update helpers/location to 'frosted' ui
[carveJwlIkooP6JGAAIwe30JlM.git] / world_volumes.c
index 23b8299ccdcdfffe21ed3b1f81049212d242b150..ae507d0cffec927296435ae7f3bd0c25677de15e 100644 (file)
@@ -1,9 +1,7 @@
-#ifndef WORLD_VOLUMES_C
-#define WORLD_VOLUMES_C
-
 #include "world_volumes.h"
 
-static void world_volumes_update( world_instance *world, v3f pos ){
+void world_volumes_update( world_instance *world, v3f pos )
+{
    /* filter and check the existing ones */
    u32 j=0;
    for( u32 i=0; i<world_static.active_trigger_volume_count; i++ ){
@@ -19,16 +17,19 @@ static void world_volumes_update( world_instance *world, v3f pos ){
          world_static.active_trigger_volumes[ j ++ ] = idx;
          boxf cube = {{-1.0f,-1.0f,-1.0f},{1.0f,1.0f,1.0f}};
          vg_line_boxf_transformed( volume->to_world, cube, 0xff00ccff );
-         /* triggr on stay ..... */
       }
       else{
-         /* trigger on exit...... */
-         ent_call basecall;
-         basecall.function = k_ent_function_trigger_leave;
-         basecall.id = mdl_entity_id( k_ent_volume, idx );
-         basecall.data = NULL;
+         /* 
+          * LEGACY BEHAVIOUR: < v104 does not have leave events
+          */
+         if( world->meta.info.version >= 104 ){
+            ent_call basecall;
+            basecall.function = k_ent_function_trigger_leave;
+            basecall.id = mdl_entity_id( k_ent_volume, idx );
+            basecall.data = NULL;
 
-         entity_call( world, &basecall );
+            entity_call( world, &basecall );
+         }
       }
    }
    world_static.active_trigger_volume_count = j;
@@ -100,5 +101,3 @@ static void world_volumes_update( world_instance *world, v3f pos ){
 next_volume:;
    }
 }
-
-#endif /* WORLD_VOLUMES_H */