diff --git a/configure.py b/configure.py index 6569014e..ae8e8414 100644 --- a/configure.py +++ b/configure.py @@ -1149,7 +1149,7 @@ config.libs = [ Object(Matching, "actor/npc/ac_taisou_npc0.c"), Object(Matching, "actor/npc/ac_tamaire_npc0.c"), Object(Matching, "actor/npc/ac_tamaire_npc1.c"), - Object(NonMatching, "actor/npc/ac_tokyoso_npc0.c"), + Object(Matching, "actor/npc/ac_tokyoso_npc0.c"), Object(Matching, "actor/npc/ac_tokyoso_npc1.c"), Object(Matching, "actor/npc/ac_tukimi_npc0.c"), Object(Matching, "actor/npc/ac_tukimi_npc1.c"), diff --git a/include/ac_tokyoso_npc0.h b/include/ac_tokyoso_npc0.h index 03c208e4..119bf0b2 100644 --- a/include/ac_tokyoso_npc0.h +++ b/include/ac_tokyoso_npc0.h @@ -3,11 +3,30 @@ #include "types.h" #include "m_actor.h" +#include "ac_npc.h" #ifdef __cplusplus extern "C" { #endif +typedef struct tokyoso_npc0_actor_s TOKYOSO_NPC0_ACTOR; + +typedef void (*aTKN0_THINK_PROC)(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play); +typedef void (*aTKN0_TALK_PROC)(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play); + +struct tokyoso_npc0_actor_s { + NPC_ACTOR npc_class; + aTKN0_THINK_PROC think_proc; + aTKN0_TALK_PROC talk_proc; + int base_msg; + s16 timer; + s16 think_idx; + s16 next_think_idx; + s16 move_think_idx; + s16 talk_idx; + u8 change_flag; +}; + extern ACTOR_PROFILE Tokyoso_Npc0_Profile; #ifdef __cplusplus @@ -15,4 +34,3 @@ extern ACTOR_PROFILE Tokyoso_Npc0_Profile; #endif #endif - diff --git a/include/audio_defs.h b/include/audio_defs.h index 544af565..66ecf4b1 100644 --- a/include/audio_defs.h +++ b/include/audio_defs.h @@ -174,6 +174,7 @@ typedef enum audio_sound_effects { NA_SE_EAT = 0x113, NA_SE_114 = 0x114, NA_SE_SEMI_ESCAPE = 0x115, + NA_SE_116 = 0x116, NA_SE_11A = 0x11A, NA_SE_11B = 0x11B, @@ -215,6 +216,8 @@ typedef enum audio_sound_effects { NA_SE_ARAIIKI_GIRL = 0x15A, NA_SE_AMI_HIT_WATER = 0x15C, + NA_SE_15D = 0x15D, + NA_SE_15E = 0x15E, NA_SE_ZASSOU_NUKU = 0x15F, NA_SE_HACHI_SASARERU, diff --git a/src/actor/npc/ac_tokyoso_npc0.c b/src/actor/npc/ac_tokyoso_npc0.c new file mode 100644 index 00000000..c95e5c86 --- /dev/null +++ b/src/actor/npc/ac_tokyoso_npc0.c @@ -0,0 +1,193 @@ +#include "ac_tokyoso_npc0.h" + +#include "ac_tokyoso_control.h" +#include "m_common_data.h" +#include "m_player_lib.h" +#include "m_font.h" +#include "m_msg.h" +#include "m_soncho.h" +#include "libultra/libultra.h" + +// TODO: coordinate enum types with ac_tokyoso_control + +// enum { +// aTKN0_THINK_BIRTH, +// aTKN0_THINK_KYORO_MAE, +// aTKN0_THINK_KYORO, +// aTKN0_THINK_WALK_TURN, +// aTKN0_THINK_WALK, +// aTKN0_THINK_HIROU_MAE, +// aTKN0_THINK_HIROU, +// aTKN0_THINK_HIROU_SP, +// aTKN0_THINK_HIROU_END, +// aTKN0_THINK_NAGERU, +// aTKN0_THINK_NAGERU_END, + +// aTKN0_THINK_NUM +// }; + +// enum { +// aTKN0_THINK_PROC_NONE, +// aTKN0_THINK_PROC_TIMER_NEXT, +// aTKN0_THINK_PROC_BIRTH, +// aTKN0_THINK_PROC_TURN_NEXT, +// aTKN0_THINK_PROC_WALK, +// aTKN0_THINK_PROC_HIROU, +// aTKN0_THINK_PROC_HIROU_SP, +// aTKN0_THINK_PROC_ANIME_NEXT, +// aTKN0_THINK_PROC_NAGERU, +// aTKN0_THINK_PROC_NAGERU_END, + +// aTKN0_THINK_PROC_NUM +// }; + +// enum { +// aTKN0_THINK_INIT_PROC_NONE, +// aTKN0_THINK_INIT_PROC_NORMAL_WAIT, +// aTKN0_THINK_INIT_PROC_MOVE, +// aTKN0_THINK_INIT_PROC_KYORO_MAE, +// aTKN0_THINK_INIT_PROC_KYORO, +// aTKN0_THINK_INIT_PROC_WALK_TURN, +// aTKN0_THINK_INIT_PROC_HIROU_MAE, +// aTKN0_THINK_INIT_PROC_HIROU, +// aTKN0_THINK_INIT_PROC_HIROU_SP, +// aTKN0_THINK_INIT_PROC_HIROU_END, +// aTKN0_THINK_INIT_PROC_NAGERU, +// aTKN0_THINK_INIT_PROC_NAGERU_END, + +// aTKN0_THINK_INIT_PROC_NUM +// }; + +static void aTKN0_actor_ct(ACTOR* actorx, GAME* game); +static void aTKN0_actor_dt(ACTOR* actorx, GAME* game); +static void aTKN0_actor_move(ACTOR* actorx, GAME* game); +static void aTKN0_actor_draw(ACTOR* actorx, GAME* game); +static void aTKN0_actor_save(ACTOR* actorx, GAME* game); +static void aTKN0_actor_init(ACTOR* actorx, GAME* game); + +// clang-format off +ACTOR_PROFILE Tokyoso_Npc0_Profile = { + mAc_PROFILE_TOKYOSO_NPC0, + ACTOR_PART_NPC, + ACTOR_STATE_NONE, + SP_NPC_EV_TOKYOSO_0, + ACTOR_OBJ_BANK_KEEP, + sizeof(TOKYOSO_NPC0_ACTOR), + aTKN0_actor_ct, + aTKN0_actor_dt, + aTKN0_actor_init, + mActor_NONE_PROC1, + aTKN0_actor_save, +}; +// clang-format on + +static void aTKN0_talk_request(ACTOR* actorx, GAME* game); +static int aTKN0_talk_init(ACTOR* actorx, GAME* game); +static int aTKN0_talk_end_chk(ACTOR* actorx, GAME* game); + +static void aTKN0_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type); +static void aTKN0_setup_think_proc(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play, s16 think_idx); + +static void aTKN0_actor_ct(ACTOR* actorx, GAME* game) { + static aNPC_ct_data_c ct_data = { + aTKN0_actor_move, + aTKN0_actor_draw, + aNPC_CT_SCHED_TYPE_SPECIAL, + (aNPC_TALK_REQUEST_PROC)none_proc1, + aTKN0_talk_init, + aTKN0_talk_end_chk, + 0, + }; + TOKYOSO_NPC0_ACTOR* actor = (TOKYOSO_NPC0_ACTOR*)actorx; + + if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) { + static int base_msg_table[] = { 0x19DD, 0x19ED, 0x19CD, 0x19FD, 0x1A0D, 0x1A1D }; + + actor->npc_class.schedule.schedule_proc = aTKN0_schedule_proc; + NPC_CLIP->ct_proc(actorx, game, &ct_data); + + actor->npc_class.palActorIgnoreTimer = -1; + actor->base_msg = base_msg_table[mNpc_GetNpcLooks(actorx)]; + actor->change_flag = FALSE; + actorx->cull_radius = 800.0f; + + { + aEv_tokyoso_c* tokyoso = (aEv_tokyoso_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, 8); + + if (tokyoso != NULL && tokyoso->_00 == 3) { + tokyoso->_00 = 0; + tokyoso->flags = 0; + } + } + + actor->npc_class.head.lock_flag = TRUE; + actor->npc_class.collision.check_kind = mCoBG_CHECK_TYPE_NORMAL; + actorx->world.position.y = mCoBG_GetBgY_OnlyCenter_FromWpos2(actorx->world.position, 0.0f); + actorx->position_speed.y = 0.0f; + actorx->gravity = 0.0f; + actorx->max_velocity_y = 0.0f; + } +} + +static void aTKN0_actor_save(ACTOR* actorx, GAME* game) { + mNpc_RenewalSetNpc(actorx); +} + +static void aTKN0_actor_dt(ACTOR* actorx, GAME* game) { + aEv_tokyoso_c* tokyoso = (aEv_tokyoso_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, 8); + + if (tokyoso != NULL) { + tokyoso->flags = aTKC_FLAG_DELETE_NPC0; + tokyoso->_00 = 3; + } + + NPC_CLIP->dt_proc(actorx, game); +} + +static void aTKN0_actor_init(ACTOR* actorx, GAME* game) { + NPC_CLIP->init_proc(actorx, game); +} + +static int aTKN0_set_request_act(TOKYOSO_NPC0_ACTOR* actor, u8 prio, u8 idx, u8 type, u16 obj, s16 move_x, s16 move_z) { + int res = FALSE; + + if (prio >= actor->npc_class.request.act_priority) { + u16 args[6]; + + bzero(args, sizeof(args)); + args[0] = obj; + args[2] = move_x; + args[3] = move_z; + actor->npc_class.request.act_priority = prio; + actor->npc_class.request.act_idx = idx; + actor->npc_class.request.act_type = type; + mem_copy((u8*)actor->npc_class.request.act_args, (u8*)args, sizeof(args)); + res = TRUE; + } + + return res; +} + +static void aTKN0_make_pistoru(ACTOR* actorx, GAME* game) { + TOKYOSO_NPC0_ACTOR* actor = (TOKYOSO_NPC0_ACTOR*)actorx; + + if (actor->npc_class.right_hand.item_actor_p == NULL) { + ACTOR* pistol = CLIP(tools_clip)->aTOL_birth_proc(TOOL_PISTOL, aTOL_ACTION_S_TAKEOUT, actorx, game, -1, NULL); + + if (pistol != NULL) { + actor->npc_class.right_hand.item_actor_p = pistol; + } + } +} + +static void aTKN0_actor_move(ACTOR* actorx, GAME* game) { + aTKN0_make_pistoru(actorx, game); + NPC_CLIP->move_proc(actorx, game); +} + +#include "../src/actor/npc/ac_tokyoso_npc0_talk.c_inc" +#include "../src/actor/npc/ac_tokyoso_npc0_schedule.c_inc" + +static void aTKN0_actor_draw(ACTOR* actorx, GAME* game) { + NPC_CLIP->draw_proc(actorx, game); +} diff --git a/src/actor/npc/ac_tokyoso_npc0_schedule.c_inc b/src/actor/npc/ac_tokyoso_npc0_schedule.c_inc new file mode 100644 index 00000000..3d4c3547 --- /dev/null +++ b/src/actor/npc/ac_tokyoso_npc0_schedule.c_inc @@ -0,0 +1,235 @@ +static void aTKN0_turn_next(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + if (actor->npc_class.action.idx == aNPC_ACT_TURN) { + aTKN0_setup_think_proc(actor, play, (s16)++actor->think_idx); + } +} + +static void aTKN0_birth(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + aEv_tokyoso_c* tokyoso = (aEv_tokyoso_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, 8); + + if (tokyoso != NULL && tokyoso->_00 == 1) { + tokyoso->_00 = 2; + aTKN0_setup_think_proc(actor, play, 2); + } +} + +static void aTKN0_wait(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + aEv_tokyoso_c* tokyoso = (aEv_tokyoso_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, 8); + + if (tokyoso->flags & aTKC_FLAG_READY_SHOOTER) { + aTKN0_setup_think_proc(actor, play, (s16)++actor->think_idx); + } +} + +static void aTKN0_anime_next(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + if (cKF_FrameControl_stop_proc(&actor->npc_class.draw.main_animation.keyframe.frame_control) == TRUE) { + aTKN0_setup_think_proc(actor, play, (s16)++actor->think_idx); + } +} + +static void aTKN0_timer_next(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + if (actor->timer > 0) { + actor->timer--; + } else { + aTKN0_setup_think_proc(actor, play, (s16)++actor->think_idx); + } +} + +static void aTKN0_lathe(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + aEv_tokyoso_c* tokyoso = (aEv_tokyoso_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, 8); + + actor->npc_class.condition_info.demo_flg |= aNPC_COND_DEMO_SKIP_FOOTSTEPS; + if ((tokyoso->flags & aTKC_GOAL_MASK) != 0 || (tokyoso->flags & aTKC_FLAG_READY_SHOOTER) != 0) { + aTKN0_setup_think_proc(actor, play, 2); + actor->npc_class.condition_info.demo_flg &= ~aNPC_COND_DEMO_SKIP_FOOTSTEPS; + } else { + aTKN0_set_request_act(actor, 4, aNPC_ACT_TURN2, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, tokyoso->pos_0A[0][0], tokyoso->pos_0A[0][1]); + } +} + +static void aTKN0_think_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { + TOKYOSO_NPC0_ACTOR* actor = (TOKYOSO_NPC0_ACTOR*)nactorx; + ACTOR* actorx = (ACTOR*)nactorx; + + if (mDemo_Check(mDemo_TYPE_TALK, actorx) == TRUE) { + return; + } + + if (actor->npc_class.action.step == aNPC_ACTION_END_STEP) { + actor->npc_class.condition_info.demo_flg = aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y; + } + + if (actor->npc_class.action.step == aNPC_ACTION_END_STEP || actor->npc_class.action.idx == aNPC_ACT_WAIT) { + actor->think_proc(actor, play); + } +} + +static void aTKN0_think_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { + TOKYOSO_NPC0_ACTOR* actor = (TOKYOSO_NPC0_ACTOR*)nactorx; + + nactorx->actor_class.status_data.weight = MASSTYPE_HEAVY; + nactorx->condition_info.hide_request = FALSE; + aTKN0_setup_think_proc(actor, play, 0); + nactorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y; +} + +static void aTKN0_normal_wait_init(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + aTKN0_set_request_act(actor, 4, aNPC_ACT_WAIT, aNPC_ACT_TYPE_DEFAULT, aNPC_ACT_OBJ_DEFAULT, 0, 0); +} + +static void aTKN0_turn_f_init(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + ACTOR* actorx = (ACTOR*)actor; + + aTKN0_set_request_act(actor, 4, aNPC_ACT_TURN, aNPC_ACT_TYPE_TO_POINT, aNPC_ACT_OBJ_DEFAULT, actorx->world.position.x, actorx->world.position.z + 10.0f); +} + +static void aTKN0_ready_init(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + aEv_tokyoso_c* tokyoso = (aEv_tokyoso_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, 8); + + tokyoso->flags &= ~aTKC_FLAG_READY_SHOOTER; +} + +static void aTKN0_set_init(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + NPC_CLIP->animation_init_proc((ACTOR*)actor, aNPC_ANIM_TAMAKOME1, FALSE); + actor->npc_class.draw.main_animation.keyframe.frame_control.mode = cKF_FRAMECONTROL_STOP; +} + +static void aTKN0_set_af_init(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + ACTOR* actorx = (ACTOR*)actor; + + switch (mNpc_GetNpcSoundSpec(actorx)) { + case 3: + sAdo_OngenTrgStart(NA_SE_15D, &actorx->world.position); + break; + case 4: + sAdo_OngenTrgStart(NA_SE_15E, &actorx->world.position); + break; + default: + sAdo_OngenTrgStart(NA_SE_116, &actorx->world.position); + break; + + } + + actor->timer = 115; + NPC_CLIP->animation_init_proc(actorx, aNPC_ANIM_YOUI1, FALSE); +} + +static void aTKN0_start_init(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + ACTOR* actorx = (ACTOR*)actor; + xyz_t pos; + aEv_tokyoso_c* tokyoso = (aEv_tokyoso_c*)mEv_get_save_area(mEv_EVENT_SPORTS_FAIR_FOOT_RACE, 8); + + tokyoso->flags &= ~aTKC_FLAG_READY_SHOOTER; + NPC_CLIP->animation_init_proc(actorx, aNPC_ANIM_DON1, FALSE); + actor->npc_class.draw.main_animation.keyframe.frame_control.mode = cKF_FRAMECONTROL_STOP; + + pos.x = actor->npc_class.right_hand.pos.x; + pos.y = actor->npc_class.right_hand.pos.y + 10.0f; + pos.z = actor->npc_class.right_hand.pos.z; + + eEC_CLIP->effect_make_proc(eEC_EFFECT_DUST, pos, 1, actorx->shape_info.rotation.y, (GAME*)play, actorx->npc_id, 0, 3); + sAdo_OngenTrgStart(MONO(NA_SE_53), &actorx->world.position); +} + +static void aTKN0_lathe_init(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play) { + actor->npc_class.action.idx = aNPC_ACT_RUN; + aTKN0_normal_wait_init(actor, play); +} + + +enum { + aTKN0_TALK_REQUEST_NONE, + aTKN0_TALK_REQUEST_NORM, + + aTKN0_TALK_REQUEST_NUM +}; + +typedef struct { + u8 think_proc_idx; + u8 think_init_idx; + u8 talk_request_idx; + u8 talk_idx; + u8 think_idx_after_talk; +} aTKN0_think_data_c; + +// TODO: enums for these +static aTKN0_think_data_c dt_tbl[] = { + {0x02, 0x01, 0x00, 0x00, 0x00}, + {0x01, 0x02, 0x00, 0x00, 0x01}, + {0x03, 0x01, 0x01, 0x00, 0x01}, + {0x03, 0x03, 0x00, 0x00, 0x03}, + {0x04, 0x04, 0x00, 0x00, 0x04}, + {0x05, 0x05, 0x00, 0x00, 0x05}, + {0x04, 0x06, 0x00, 0x00, 0x06}, + {0x06, 0x07, 0x01, 0x01, 0x07}, +}; + +static aTKN0_THINK_PROC proc_table[] = { + (aTKN0_THINK_PROC)none_proc1, + aTKN0_turn_next, + aTKN0_birth, + aTKN0_wait, + aTKN0_anime_next, + aTKN0_timer_next, + aTKN0_lathe, +}; + +typedef void (*aTKN0_THINK_INIT_PROC)(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play); + +static aTKN0_THINK_INIT_PROC init_table[] = { + (aTKN0_THINK_INIT_PROC)none_proc1, + aTKN0_normal_wait_init, + aTKN0_turn_f_init, + aTKN0_ready_init, + aTKN0_set_init, + aTKN0_set_af_init, + aTKN0_start_init, + aTKN0_lathe_init, +}; + +static void aTKN0_setup_think_proc(TOKYOSO_NPC0_ACTOR* actor, GAME_PLAY* play, s16 think_idx) { + static aNPC_TALK_REQUEST_PROC talk_request_table[] = { (aNPC_TALK_REQUEST_PROC)none_proc1, aTKN0_norm_talk_request, (aNPC_TALK_REQUEST_PROC)none_proc1 }; + aTKN0_think_data_c* dt; + + dt = &dt_tbl[think_idx]; + actor->think_idx = think_idx; + actor->think_proc = proc_table[dt->think_proc_idx]; + actor->npc_class.talk_info.talk_request_proc = talk_request_table[dt->talk_request_idx]; + actor->talk_idx = dt->talk_idx; + actor->next_think_idx = dt->think_idx_after_talk; + (*init_table[dt->think_init_idx])(actor, play); + actor->change_flag = TRUE; +} + +static void aTKN0_think_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) { + switch (type) { + case aNPC_THINK_PROC_INIT: + aTKN0_think_init_proc(nactorx, play); + break; + case aNPC_THINK_PROC_MAIN: + aTKN0_think_main_proc(nactorx, play); + break; + } +} + +static void aTKN0_schedule_init_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { + nactorx->think.think_proc = aTKN0_think_proc; + NPC_CLIP->think_proc(nactorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT); +} + +static void aTKN0_schedule_main_proc(NPC_ACTOR* nactorx, GAME_PLAY* play) { + if (!NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT)) { + NPC_CLIP->think_proc(nactorx, play, -1, aNPC_THINK_TYPE_MAIN); + } +} + +static void aTKN0_schedule_proc(NPC_ACTOR* nactorx, GAME_PLAY* play, int type) { + switch (type) { + case aNPC_SCHEDULE_PROC_INIT: + aTKN0_schedule_init_proc(nactorx, play); + break; + case aNPC_SCHEDULE_PROC_MAIN: + aTKN0_schedule_main_proc(nactorx, play); + break; + } +} diff --git a/src/actor/npc/ac_tokyoso_npc0_talk.c_inc b/src/actor/npc/ac_tokyoso_npc0_talk.c_inc new file mode 100644 index 00000000..c39e3c40 --- /dev/null +++ b/src/actor/npc/ac_tokyoso_npc0_talk.c_inc @@ -0,0 +1,59 @@ +enum { + aTKN0_TALK_END_WAIT, + + aTKN0_TALK_NUM +}; + +typedef struct { + int msg_no; + u8 turn; + u8 camera; + aTKN0_TALK_PROC talk_proc; +} aTKN0_talk_data_c; + +static void aTKN0_set_norm_talk_info(ACTOR* actorx) { + static aTKN0_talk_data_c dt_tbl[] = { + {0x0000, TRUE, CAMERA2_PROCESS_TALK, (aTKN0_TALK_PROC)none_proc1}, + {0x0000, TRUE, CAMERA2_PROCESS_TALK, (aTKN0_TALK_PROC)none_proc1}, + }; + TOKYOSO_NPC0_ACTOR* actor = (TOKYOSO_NPC0_ACTOR*)actorx; + aTKN0_talk_data_c* data_p = &dt_tbl[actor->talk_idx]; + + mDemo_Set_msg_num(actor->base_msg + data_p->msg_no + RANDOM(2)); + mDemo_Set_talk_turn(data_p->turn); + mDemo_Set_camera(data_p->camera); + actor->talk_proc = data_p->talk_proc; +} + +static void aTKN0_norm_talk_request(ACTOR* actorx, GAME* game) { + TOKYOSO_NPC0_ACTOR* actor = (TOKYOSO_NPC0_ACTOR*)actorx; + + if (!actor->change_flag) { + mDemo_Request(mDemo_TYPE_TALK, actorx, aTKN0_set_norm_talk_info); + } else { + actor->change_flag = FALSE; + } +} + +static int aTKN0_talk_init(ACTOR* actorx, GAME* game) { + TOKYOSO_NPC0_ACTOR* actor = (TOKYOSO_NPC0_ACTOR*)actorx; + + actor->npc_class.talk_info.talk_request_proc = (aNPC_TALK_REQUEST_PROC)none_proc1; + mDemo_Set_ListenAble(); + mDemo_Start(actorx); + return TRUE; +} + +static int aTKN0_talk_end_chk(ACTOR* actorx, GAME* game) { + TOKYOSO_NPC0_ACTOR* actor = (TOKYOSO_NPC0_ACTOR*)actorx; + GAME_PLAY* play = (GAME_PLAY*)game; + int ret = FALSE; + + actor->talk_proc(actor, play); + if (mDemo_CAN_ACTOR_TALK(actorx)) { + aTKN0_setup_think_proc(actor, play, actor->next_think_idx); + ret = TRUE; + } + + return ret; +}