workshop selecter
[carveJwlIkooP6JGAAIwe30JlM.git] / world_render.c
index 1546429235fe10b36e8643aa2132417a306dcc94..0584415a74d6a2e7f1bacba90b5eb0a366226152 100644 (file)
@@ -762,9 +762,7 @@ 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)) )
+      if( !(gi->flags & k_ent_gate_linked) )
          continue;
 
       float dist = v3_dist2( gi->co[0], cam->transform[3] );
@@ -778,8 +776,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 ){