process triggers on leave world
[carveJwlIkooP6JGAAIwe30JlM.git] / ent_miniworld.c
index bc59d470f6c17e2aeb6ee8f169c76a4f4839c661..cd79b4552626ca5dda89aac1bbcd0b7d1ef63419 100644 (file)
@@ -1,6 +1,7 @@
 #include "entity.h"
 #include "ent_miniworld.h"
 #include "world_render.h"
+#include "input.h"
 
 static void ent_miniworld_call( world_instance *world, ent_call *call ){
    ent_miniworld *miniworld = mdl_arritm( &world->ent_miniworld, 
@@ -14,6 +15,19 @@ static void ent_miniworld_call( world_instance *world, ent_call *call ){
 
       global_miniworld.active_id = call->id;
    }
+   else if( call->function == 1 ){
+
+      if( global_miniworld.active_id == call->id )
+         global_miniworld.active_id = 0;
+      else 
+         vg_warn( "bad call\n" );
+
+      if( miniworld->proxy ){
+         ent_prop *prop = mdl_arritm( &world->ent_prop, 
+                                      mdl_entity_id_id(miniworld->proxy) );
+         prop->flags &= ~0x1;
+      }
+   }
 }
 
 static void ent_miniworld_render( world_instance *host_world ){
@@ -25,7 +39,20 @@ static void ent_miniworld_render( world_instance *host_world ){
    ent_miniworld *miniworld = mdl_arritm( &host_world->ent_miniworld, 
                                           mdl_entity_id_id(entity_id) );
 
+   int rendering = 1;
    if( miniworld->purpose == k_world_purpose_invalid )
+      rendering = 0;
+
+   if( miniworld->proxy ){
+      ent_prop *prop = mdl_arritm( &host_world->ent_prop, 
+                                   mdl_entity_id_id(miniworld->proxy) );
+      if( !rendering )
+         prop->flags &= ~0x1;
+      else
+         prop->flags |= 0x1;
+   }
+
+   if( !rendering )
       return;
 
    world_instance *dest_world = &world_static.instances[miniworld->purpose];
@@ -37,3 +64,12 @@ static void ent_miniworld_render( world_instance *host_world ){
 
    //render_world_routes( , &skaterift.cam, 1 );
 }
+
+static void ent_miniworld_preupdate(void){
+   if( !global_miniworld.active_id )
+      return;
+
+   if( button_down( k_srbind_use ) ){
+      
+   }
+}