re-add non-local gates
[carveJwlIkooP6JGAAIwe30JlM.git] / world_render.c
index 1546429235fe10b36e8643aa2132417a306dcc94..281a6e7a69cb8f75857d4ac16f49aa5a4ba8ff8a 100644 (file)
@@ -763,10 +763,6 @@ static void render_world_gates( world_instance *world, camera *cam ){
    for( u32 i=0; i<mdl_arrcount(&world->ent_gate); i++ ){
       ent_gate *gi = mdl_arritm( &world->ent_gate, i );
 
-      if( !(gi->flags & (k_ent_gate_linked|k_ent_gate_nonlocal_DELETED|
-                         k_ent_gate_locked)) )
-         continue;
-
       float dist = v3_dist2( gi->co[0], cam->transform[3] );
 
       vg_line_point( gi->co[0], 0.25f, VG__BLUE );
@@ -778,8 +774,25 @@ static void render_world_gates( world_instance *world, camera *cam ){
    }
    
    world->rendering_gate = gate;
-   if( gate )
-      render_gate( world, world, gate, cam );
+
+   if( gate ){
+      if( gate->flags & k_ent_gate_locked ){
+         world->rendering_gate = NULL;
+         return;
+      }
+
+      if( gate->flags & k_ent_gate_nonlocal ){
+         if( world_static.load_state != k_world_loader_none ){
+            world->rendering_gate = NULL;
+            return;
+         }
+
+         world_instance *dest_world = &world_static.instances[ gate->target ];
+         render_gate( world, dest_world, gate, cam );
+      }
+      else
+         render_gate( world, world, gate, cam );
+   }
 }
 
 static void world_prerender( world_instance *world ){