X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world.h;h=f065cb3ccf78abe82a48966da1c396b8d30e9408;hb=5f34184cad016aa2f8ea530b3be009703459e981;hp=7084ff17334e7b9195abfc2ff584576bccefcbc1;hpb=b4a83d4fcab39bee5a8cd6e8e6eec06314864e5b;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world.h b/world.h index 7084ff1..f065cb3 100644 --- a/world.h +++ b/world.h @@ -165,7 +165,10 @@ struct world_instance { ent_audio_clip, ent_audio, ent_volume, - ent_traffic; + ent_traffic, + ent_skateshop, + ent_marker, + ent_camera; ent_gate *rendering_gate; @@ -405,22 +408,14 @@ VG_STATIC void world_init(void) VG_MEMORY_SYSTEM ); } -typedef struct ent_call ent_call; -struct ent_call{ - ent_index ent; - u32 function; - void *data; -}; - -VG_STATIC void entity_call( world_instance *world, ent_call *call ); - VG_STATIC void ent_volume_call( world_instance *world, ent_call *call ) { - ent_volume *volume = mdl_arritm( &world->ent_volume, call->ent.index ); - if( !volume->target.type ) return; + u32 index = mdl_entity_id_id( call->id ); + ent_volume *volume = mdl_arritm( &world->ent_volume, index ); + if( !volume->target ) return; if( call->function == k_ent_function_trigger ){ - call->ent = volume->target; + call->id = volume->target; if( volume->type == k_volume_subtype_particle ){ float *co = alloca( sizeof(float)*3 ); @@ -433,14 +428,16 @@ VG_STATIC void ent_volume_call( world_instance *world, ent_call *call ) call->data = co; entity_call( world, call ); } - else + else{ entity_call( world, call ); + } } } VG_STATIC void ent_audio_call( world_instance *world, ent_call *call ) { - ent_audio *audio = mdl_arritm( &world->ent_audio, call->ent.index ); + u32 index = mdl_entity_id_id( call->id ); + ent_audio *audio = mdl_arritm( &world->ent_audio, index ); v3f sound_co; @@ -524,15 +521,6 @@ VG_STATIC void ent_audio_call( world_instance *world, ent_call *call ) } } -VG_STATIC void entity_call( world_instance *world, ent_call *call ) -{ - if( call->ent.type == k_ent_volume ){ - ent_volume_call( world, call ); - } else if( call->ent.type == k_ent_audio ){ - ent_audio_call( world, call ); - } -} - VG_STATIC void world_update( world_instance *world, v3f pos ) { world_global.sky_time += world_global.sky_rate * vg.time_delta; @@ -684,9 +672,8 @@ VG_STATIC void world_update( world_instance *world, v3f pos ) if( !world_global.in_volume ){ ent_call basecall; - basecall.ent.index = idx; - basecall.ent.type = k_ent_volume; basecall.function = k_ent_function_trigger; + basecall.id = mdl_entity_id( k_ent_volume, idx ); basecall.data = NULL; entity_call( world, &basecall ); @@ -700,9 +687,7 @@ VG_STATIC void world_update( world_instance *world, v3f pos ) for( int j=0; j