From: hgn Date: Sun, 19 Nov 2023 08:14:09 +0000 (+0000) Subject: process triggers on leave world X-Git-Url: https://skaterift.com/git/?a=commitdiff_plain;h=7f4c71033c06954f3094c9d51219628438b80ac8;p=carveJwlIkooP6JGAAIwe30JlM.git process triggers on leave world --- diff --git a/ent_miniworld.c b/ent_miniworld.c index 54ce8ae..cd79b45 100644 --- a/ent_miniworld.c +++ b/ent_miniworld.c @@ -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, @@ -63,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 ) ){ + + } +} diff --git a/maps_src/dev_hub/main.mdl b/maps_src/dev_hub/main.mdl index deae0e2..44881ec 100644 Binary files a/maps_src/dev_hub/main.mdl and b/maps_src/dev_hub/main.mdl differ diff --git a/player.c b/player.c index 348bb74..fce9c48 100644 --- a/player.c +++ b/player.c @@ -251,7 +251,6 @@ static void player__reset(void){ world_static.focused_entity = 0; world_static.active_trigger_volume_count = 0; world_static.last_use = 0.0; - global_miniworld.active_id = 0; world_entity_unfocus(); localplayer.boundary_hash ^= NETMSG_BOUNDARY_BIT; diff --git a/skaterift.c b/skaterift.c index 8ed749c..a2b8347 100644 --- a/skaterift.c +++ b/skaterift.c @@ -337,6 +337,7 @@ static void vg_pre_update(void){ world_entity_focus_preupdate(); skaterift_replay_pre_update(); remote_sfx_pre_update(); + ent_miniworld_preupdate(); world_update( world_current_instance(), localplayer.rb.co ); audio_ambient_sprites_update( world_current_instance(), localplayer.rb.co ); diff --git a/world.c b/world.c index def59a3..ad03723 100644 --- a/world.c +++ b/world.c @@ -41,18 +41,33 @@ static void world_switch_instance( u32 index ){ return; } + world_instance *current = + &world_static.instances[ world_static.active_instance ]; + if( index != world_static.active_instance ){ - world_instance *current = - &world_static.instances[ world_static.active_instance ]; v3_copy( localplayer.rb.co, current->player_co ); v3_copy( localplayer.angles, current->player_angles ); + v3_copy( localplayer.cam.pos, current->cam_co ); current->player_angles[3] = player_get_heading_yaw(); } v3_copy( new->player_co, localplayer.rb.co ); v3_copy( new->player_angles, localplayer.angles ); + v3_copy( new->cam_co, localplayer.cam.pos ); q_axis_angle( localplayer.rb.q, (v3f){0,1,0}, new->player_angles[3] ); + /* run exit events on triggers */ + for( u32 i=0; ient_volume, idx ); + + ent_call basecall; + basecall.function = k_ent_function_trigger_leave; + basecall.id = mdl_entity_id( k_ent_volume, idx ); + basecall.data = NULL; + entity_call( current, &basecall ); + } + world_static.active_instance = index; player__reset(); diff --git a/world.h b/world.h index dde9aea..0efe185 100644 --- a/world.h +++ b/world.h @@ -64,6 +64,7 @@ struct world_instance { */ v4f player_co, player_angles; + v3f cam_co; void *heap; enum world_status{