X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=ent_route.c;h=f5b51c5ec2ce520c74860ee04897d88ca214ef89;hb=304647a7672165dd35ffe54884ed9aedcc9bf363;hp=8f95a26d292ce22c76c528e1819d8394f6cb7408;hpb=5f6a4f9df6c8accc89f1920bfe9ace3cbac4c4b6;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/ent_route.c b/ent_route.c index 8f95a26..f5b51c5 100644 --- a/ent_route.c +++ b/ent_route.c @@ -4,14 +4,17 @@ struct global_ent_route global_ent_route; -void ent_route_call( world_instance *world, ent_call *call ) +entity_call_result ent_route_call( world_instance *world, ent_call *call ) { u32 index = mdl_entity_id_id( call->id ); ent_route *route = mdl_arritm( &world->ent_route, index ); - if( call->function == 0 ){ /* view() */ - if( localplayer.subsystem == k_player_subsystem_walk ){ - world_entity_focus( call->id ); + if( call->function == 0 ) + { /* view() */ + if( localplayer.subsystem == k_player_subsystem_walk ) + { + world_entity_set_focus( call->id ); + world_entity_focus_modal(); gui_helper_clear(); vg_str text; @@ -27,20 +30,21 @@ void ent_route_call( world_instance *world, ent_call *call ) if( gui_new_helper( input_button_list[k_srbind_mback], &text ) ) vg_strcat( &text, "exit" ); } + + return k_entity_call_result_OK; } - else { - /* TODO: Comrpession */ - vg_print_backtrace(); - vg_error( "Unhandled function id: %u\n", call->function ); - } + + return k_entity_call_result_unhandled; } -/* TODO: these should recieve the world instance */ -void ent_route_preupdate( ent_route *route, int active ) +void ent_route_preupdate( ent_focus_context *ctx ) { - if( !active ) return; + if( !ctx->active ) + return; + + world_instance *world = ctx->world; + ent_route *route = mdl_arritm( &world->ent_route, ctx->index ); - world_instance *world = world_current_instance(); u32 cam_id = 0; if( __builtin_expect( world->meta.info.version >= 103, 1 ) ) @@ -61,8 +65,10 @@ void ent_route_preupdate( ent_route *route, int active ) global_ent_route.helper_alltime->greyed =!world_sfd.view_weekly; global_ent_route.helper_weekly->greyed = world_sfd.view_weekly; - if( button_down( k_srbind_mback ) ){ - world_entity_unfocus(); + if( button_down( k_srbind_mback ) ) + { + world_entity_exit_modal(); + world_entity_clear_focus(); gui_helper_clear(); return; }