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 )
{
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 )
{
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 )
{
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
{
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;
}
}
-void ent_npc_preupdate( ent_npc *ent, int active )
+void ent_npc_preupdate( ent_focus_context *ctx )
{
- world_instance *world = world_current_instance();
+ world_instance *world = ctx->world;
+ ent_npc *ent = mdl_arritm( &world->ent_npc, ctx->index );
- if( !active )
+ if( !ctx->active )
{
if( button_down(k_srbind_maccept) )
{