X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=ent_npc.c;fp=ent_npc.c;h=8fccd29552bab08f21344dba4951cdc848a7496f;hb=f01a25e33a54c92e4d6bca0889b76f33af5e51eb;hp=d43122330120a34bbec263daed8f30d2f8ba1cf9;hpb=fbe807d19b8a626c2d75002b286dd794f893473a;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/ent_npc.c b/ent_npc.c index d431223..8fccd29 100644 --- a/ent_npc.c +++ b/ent_npc.c @@ -70,7 +70,7 @@ static struct npc *npc_resolve( u32 id ) else return NULL; } -static void npc_slowmo_call( ent_npc *npc, ent_call *call ) +static entity_call_result npc_slowmo_call( ent_npc *npc, ent_call *call ) { if( call->function == 0 ) { @@ -96,22 +96,26 @@ static void npc_slowmo_call( ent_npc *npc, ent_call *call ) if( gui_new_helper( input_button_list[k_srbind_replay_resume], &text )) vg_strcat( &text, "Resume" ); } + return k_entity_call_result_OK; } else if( call->function == -1 ) { world_entity_clear_focus(); gui_helper_clear(); + return k_entity_call_result_OK; } + else + return k_entity_call_result_unhandled; } -void ent_npc_call( world_instance *world, ent_call *call ) +entity_call_result ent_npc_call( world_instance *world, ent_call *call ) { u32 index = mdl_entity_id_id( call->id ); ent_npc *npc = mdl_arritm( &world->ent_npc, index ); if( npc->id == 2 ) { - npc_slowmo_call( npc, call ); + return npc_slowmo_call( npc, call ); } else if( npc->id == 3 ) { @@ -122,12 +126,16 @@ void ent_npc_call( world_instance *world, ent_call *call ) vg_str text; if( gui_new_helper( input_button_list[k_srbind_maccept], &text )) vg_strcat( &text, "Preview course" ); + return k_entity_call_result_OK; } else if( call->function == -1 ) { world_entity_clear_focus(); gui_helper_clear(); + return k_entity_call_result_OK; } + else + return k_entity_call_result_unhandled; } else if( npc->id == 4 ) { @@ -137,11 +145,15 @@ void ent_npc_call( world_instance *world, ent_call *call ) vg_str text; if( gui_new_helper( input_button_list[k_srbind_camera], &text )) vg_strcat( &text, "First/Thirdperson" ); + return k_entity_call_result_OK; } else if( call->function == -1 ) { gui_helper_clear(); + return k_entity_call_result_OK; } + else + return k_entity_call_result_unhandled; } else { @@ -152,17 +164,16 @@ void ent_npc_call( world_instance *world, ent_call *call ) vg_str text; if( gui_new_helper( input_button_list[k_srbind_maccept], &text )) vg_strcat( &text, "Talk to ???" ); + return k_entity_call_result_OK; } else if( call->function == -1 ) { world_entity_clear_focus(); gui_helper_clear(); + return k_entity_call_result_OK; } else - { - vg_print_backtrace(); - vg_error( "Unhandled function id: %i\n", call->function ); - } + return k_entity_call_result_unhandled; } }