X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_entity.c;h=7e285d44a54731ea3cd73e93885ff10ed6d70d74;hb=b270d9efa9bedb7ca0813acffc1632f84900c0de;hp=d431bedc20f88dfd0cb1043bf16143bbc21841d5;hpb=7eba38b8178c82040618a518634d8ff4813e2ff2;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_entity.c b/world_entity.c index d431bed..7e285d4 100644 --- a/world_entity.c +++ b/world_entity.c @@ -26,7 +26,7 @@ VG_STATIC void world_gen_entities_init(void){ for( u32 j=0; jent_gate); j ++ ){ ent_gate *gate = mdl_arritm( &world->ent_gate, j ); - if( gate->type == k_gate_type_teleport ){ + if( !(gate->flags & k_ent_gate_nonlocal) ) { gate_transform_update( gate ); } } @@ -415,4 +415,29 @@ VG_STATIC void entity_bh_debug( void *user, u32 item_index ){ } } +VG_STATIC void entity_bh_closest( void *user, u32 item_index, v3f point, + v3f closest ){ + world_instance *world = user; + + u32 id = world->entity_list[ item_index ], + type = mdl_entity_id_type( id ), + index = mdl_entity_id_id( id ); + + if( type == k_ent_gate ){ + ent_gate *gate = mdl_arritm( &world->ent_gate, index ); + v3_copy( gate->to_world[3], closest ); + } + else if( type == k_ent_challenge ){ + ent_challenge *challenge = mdl_arritm( &world->ent_challenge, index ); + v3_copy( challenge->transform.co, closest ); + } + else if( type == k_ent_volume ){ + ent_volume *volume = mdl_arritm( &world->ent_volume, index ); + v3_copy( volume->to_world[3], closest ); + } + else{ + vg_fatal_error( "Programming error\n" ); + } +} + #endif /* WORLD_ENTITY_C */