diff --git a/include/ac_tukimi_npc1.h b/include/ac_tukimi_npc1.h index f5376c31..fd4993c0 100644 --- a/include/ac_tukimi_npc1.h +++ b/include/ac_tukimi_npc1.h @@ -15,7 +15,7 @@ extern ACTOR_PROFILE Tukimi_Npc1_Profile; /* sizeof(tukimi_npc1_s) == 0x998 */ struct tukimi_npc1_s { /* 0x000 */ NPC_ACTOR npc_class; - /* 0x994 */ int npcIdx; + /* 0x994 */ int event_idx; }; #ifdef __cplusplus @@ -23,4 +23,3 @@ struct tukimi_npc1_s { #endif #endif - diff --git a/src/actor/npc/ac_npc_guide2_move.c_inc b/src/actor/npc/ac_npc_guide2_move.c_inc index 375ece6a..afdfab7b 100644 --- a/src/actor/npc/ac_npc_guide2_move.c_inc +++ b/src/actor/npc/ac_npc_guide2_move.c_inc @@ -115,7 +115,7 @@ static void aNG2_set_camera_eyes(NPC_GUIDE2_ACTOR* guide2) { guide2->npc_class.request.head_pos.y = guide2->npc_class.actor_class.eye.position.y; guide2->npc_class.request.head_pos.z = 400.0f; guide2->npc_class.request.head_priority = 3; - guide2->npc_class.request.head_type = 2; + guide2->npc_class.request.head_type = aNPC_HEAD_TARGET_POS; } } diff --git a/src/actor/npc/ac_npc_guide_move.c_inc b/src/actor/npc/ac_npc_guide_move.c_inc index 78f02071..d3e18bfc 100644 --- a/src/actor/npc/ac_npc_guide_move.c_inc +++ b/src/actor/npc/ac_npc_guide_move.c_inc @@ -115,7 +115,7 @@ static void aNGD_set_camera_eyes(NPC_GUIDE_ACTOR* guide) { guide->npc_class.request.head_pos.y = guide->npc_class.actor_class.eye.position.y; guide->npc_class.request.head_pos.z = 400.0f; guide->npc_class.request.head_priority = 3; - guide->npc_class.request.head_type = 2; + guide->npc_class.request.head_type = aNPC_HEAD_TARGET_POS; } } diff --git a/src/actor/npc/ac_npc_mask_cat2_move.c_inc b/src/actor/npc/ac_npc_mask_cat2_move.c_inc index fd0fdc12..81c5aaf8 100644 --- a/src/actor/npc/ac_npc_mask_cat2_move.c_inc +++ b/src/actor/npc/ac_npc_mask_cat2_move.c_inc @@ -154,7 +154,7 @@ static void aNM2_set_camera_eyes(NPC_MASK_CAT2_ACTOR* actorx) { actorx->npc_class.request.head_pos.y = actorx->npc_class.actor_class.eye.position.y; actorx->npc_class.request.head_pos.z = 400.0f; actorx->npc_class.request.head_priority = 3; - actorx->npc_class.request.head_type = 2; + actorx->npc_class.request.head_type = aNPC_HEAD_TARGET_POS; } static void aNM2_set_walk_spd(NPC_MASK_CAT2_ACTOR* actorx) { diff --git a/src/actor/npc/ac_tukimi_npc0.c b/src/actor/npc/ac_tukimi_npc0.c index 6f93a22a..3740fe55 100644 --- a/src/actor/npc/ac_tukimi_npc0.c +++ b/src/actor/npc/ac_tukimi_npc0.c @@ -1,37 +1,7 @@ #include "ac_tukimi_npc0.h" -#include "ac_npc.h" -#include "ac_npc_h.h" -#include "ac_quest_manager.h" -#include "audio.h" -#include "dolphin/os/OSRtc.h" -#include "game.h" -#include "libc64/qrand.h" -#include "libultra/libultra.h" -#include "m_actor.h" -#include "m_actor_type.h" -#include "m_bgm.h" -#include "m_card.h" -#include "m_choice.h" #include "m_common_data.h" -#include "m_config.h" -#include "m_demo.h" -#include "m_event.h" -#include "m_field_info.h" -#include "m_land.h" -#include "m_lib.h" #include "m_msg.h" -#include "m_npc.h" -#include "m_play.h" -#include "m_play_h.h" -#include "m_player_lib.h" -#include "m_private.h" -#include "m_quest.h" -#include "m_soncho.h" -#include "m_submenu.h" -#include "m_vibctl.h" -#include "sys_math.h" -#include "types.h" static void aTM0_actor_ct(ACTOR* actorx, GAME* game); static void aTM0_actor_save(ACTOR* actorx, GAME* game); @@ -51,13 +21,12 @@ static void aTM0_think_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play); static void aTM0_think_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int think_idx); static void aTM0_schedule_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play); static void aTM0_schedule_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play); -static void aTM0_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_proc_idx); +static void aTM0_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_proc_idx); static void aTM0_set_talk_info(ACTOR* actorx); static void aTM0_talk_request(ACTOR* actorx, GAME* game); static int aTM0_talk_init(ACTOR* actorx, GAME* game); static int aTM0_talk_end_chk(ACTOR* actorx, GAME* game); - // clang-format off ACTOR_PROFILE Tukimi_Npc0_Profile = { mAc_PROFILE_TUKIMI_NPC0, @@ -90,7 +59,7 @@ static void aTM0_actor_ct(ACTOR* actorx, GAME* game) { TUKIMI_NPC0_ACTOR* tukimi_npc0_actor = (TUKIMI_NPC0_ACTOR*)actorx; if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) { tukimi_npc0_actor->npc_class.schedule.schedule_proc = aTM0_schedule_proc; - NPC_CLIP->ct_proc(actorx, game, &ct_data); + NPC_CLIP->ct_proc(actorx, game, &ct_data); } } diff --git a/src/actor/npc/ac_tukimi_npc0_talk.c_inc b/src/actor/npc/ac_tukimi_npc0_talk.c_inc index dfd51fdd..01a4c415 100644 --- a/src/actor/npc/ac_tukimi_npc0_talk.c_inc +++ b/src/actor/npc/ac_tukimi_npc0_talk.c_inc @@ -30,7 +30,9 @@ static void aTM0_think_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { actorx->action.step = 0; aTM0_set_animation(&actorx->actor_class, &play->game); } - actorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK; + actorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | + aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | + aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK; aTM0_set_request_act(actorx); } } @@ -54,18 +56,20 @@ static void aTM0_think_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int think_idx) { static void aTM0_schedule_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { int puleIdx; s16 ang; - static s16 def_angle[] = {0xA000, 0x2000, 0x6000, 0xE000, 0xE000, 0x2000, 0xA000, 0}; - static f32 def_posX[] = {1.0f, 39.0f, 39.0f, 1.0f, 1.0f, 39.0f, 1.0f}; - static f32 def_posZ[] = {1.0f, 39.0f, 1.0f, 39.0f, 39.0f, 39.0f, 1.0f}; + static s16 def_angle[] = { 0xA000, 0x2000, 0x6000, 0xE000, 0xE000, 0x2000, 0xA000, 0 }; + static f32 def_posX[] = { 1.0f, 39.0f, 39.0f, 1.0f, 1.0f, 39.0f, 1.0f }; + static f32 def_posZ[] = { 1.0f, 39.0f, 1.0f, 39.0f, 39.0f, 39.0f, 1.0f }; actorx->think.think_proc = &aTM0_think_proc; - actorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK; + actorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | + aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | + aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK; actorx->collision.check_kind = aNPC_BG_CHECK_TYPE_ONLY_GROUND; actorx->condition_info.hide_request = FALSE; actorx->palActorIgnoreTimer = -1; actorx->talk_info.turn = aNPC_TALK_TURN_HEAD; actorx->talk_info.default_animation = aNPC_ANIM_SANBASI1; actorx->actor_class.status_data.weight = MASSTYPE_HEAVY; - + puleIdx = mFI_GetPuleIdx(); ang = def_angle[puleIdx]; actorx->actor_class.shape_info.rotation.y = ang; @@ -74,14 +78,14 @@ static void aTM0_schedule_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { actorx->actor_class.world.position.x += def_posX[puleIdx]; actorx->actor_class.world.position.z += def_posZ[puleIdx]; - NPC_CLIP->think_proc(actorx, play, 9, FALSE); + NPC_CLIP->think_proc(actorx, play, aNPC_THINK_SPECIAL, FALSE); } static void aTM0_schedule_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { s16 yRot; f32 trigVal; - if (NPC_CLIP->think_proc(actorx, play, -1, 1) == FALSE) { - NPC_CLIP->think_proc(actorx, play, -1, 2); + if (NPC_CLIP->think_proc(actorx, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT) == FALSE) { + NPC_CLIP->think_proc(actorx, play, -1, aNPC_THINK_TYPE_MAIN); } if (actorx->action.idx == aNPC_ACT_SPECIAL) { yRot = actorx->actor_class.shape_info.rotation.y; @@ -89,11 +93,11 @@ static void aTM0_schedule_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { actorx->request.head_pos.y = actorx->actor_class.eye.position.y - 30.0f; actorx->request.head_pos.z = actorx->actor_class.eye.position.z + cos_s(yRot) * 40.0f; actorx->request.head_priority = 3; - actorx->request.head_type = 2; + actorx->request.head_type = aNPC_HEAD_TARGET_POS; } } -static void aTM0_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_proc_idx) { +static void aTM0_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_proc_idx) { // clang-format off static aNPC_SUB_PROC sche_proc[] = { &aTM0_schedule_init_proc, @@ -104,8 +108,8 @@ static void aTM0_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_pro } static void aTM0_set_talk_info(ACTOR* actorx) { - static int msg_base[mNpc_LOOKS_NUM] = {0x1EB0, 0x1EBF, 0x1EA1, 0x1ECE, 0x1EDD, 0x1EEC}; - static int msg_base2[mNpc_LOOKS_NUM] = {0x3F46, 0x3F55, 0x3F37, 0x3F64, 0x3F73, 0x3F82}; + static int msg_base[mNpc_LOOKS_NUM] = { 0x1EB0, 0x1EBF, 0x1EA1, 0x1ECE, 0x1EDD, 0x1EEC }; + static int msg_base2[mNpc_LOOKS_NUM] = { 0x3F46, 0x3F55, 0x3F37, 0x3F64, 0x3F73, 0x3F82 }; mMsg_Window_c* msg_p = mMsg_Get_base_window_p(); u8 worldName[LAND_NAME_SIZE]; mNpc_EventNpc_c* eventNpc; @@ -115,11 +119,11 @@ static void aTM0_set_talk_info(ACTOR* actorx) { int i; looks = mNpc_GetNpcLooks(actorx); msg = msg_base; - + for (i = 0; i < mNpc_EVENT_NPC_NUM; i++) { eventNpc = mNpc_GetSameEventNpc(i + SP_NPC_EV_TUKIMI_0); if (eventNpc != NULL) { - actorRet = Actor_info_fgName_search(&((GAME_PLAY*)gamePT)->actor_info,eventNpc->event_id, ACTOR_PART_NPC); + actorRet = Actor_info_fgName_search(&((GAME_PLAY*)gamePT)->actor_info, eventNpc->event_id, ACTOR_PART_NPC); mNpc_GetNpcWorldName(worldName, actorRet); mMsg_Set_free_str(msg_p, i + mMsg_FREE_STR1, worldName, LAND_NAME_SIZE); } @@ -142,8 +146,8 @@ static int aTM0_talk_init(ACTOR* actorx, GAME* game) { static int aTM0_talk_end_chk(ACTOR* actorx, GAME* game) { BOOL res = FALSE; int demoCheck = mDemo_Check(mDemo_TYPE_TALK, actorx); - if (demoCheck == FALSE){ + if (demoCheck == FALSE) { res = TRUE; } return res; -} \ No newline at end of file +} diff --git a/src/actor/npc/ac_tukimi_npc1.c b/src/actor/npc/ac_tukimi_npc1.c index 861ef385..1755f014 100644 --- a/src/actor/npc/ac_tukimi_npc1.c +++ b/src/actor/npc/ac_tukimi_npc1.c @@ -1,37 +1,7 @@ #include "ac_tukimi_npc1.h" -#include "ac_npc.h" -#include "ac_npc_h.h" -#include "ac_quest_manager.h" -#include "audio.h" -#include "dolphin/os/OSRtc.h" -#include "game.h" -#include "libc64/qrand.h" -#include "libultra/libultra.h" -#include "m_actor.h" -#include "m_actor_type.h" -#include "m_bgm.h" -#include "m_card.h" -#include "m_choice.h" #include "m_common_data.h" -#include "m_config.h" -#include "m_demo.h" -#include "m_event.h" -#include "m_field_info.h" -#include "m_land.h" -#include "m_lib.h" #include "m_msg.h" -#include "m_npc.h" -#include "m_play.h" -#include "m_play_h.h" -#include "m_player_lib.h" -#include "m_private.h" -#include "m_quest.h" -#include "m_soncho.h" -#include "m_submenu.h" -#include "m_vibctl.h" -#include "sys_math.h" -#include "types.h" static void aTM1_actor_ct(ACTOR* actorx, GAME* game); static void aTM1_actor_save(ACTOR* actorx, GAME* game); @@ -51,14 +21,13 @@ static void aTM1_think_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play); static void aTM1_think_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int think_idx); static void aTM1_schedule_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play); static void aTM1_schedule_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play); -static void aTM1_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_proc_idx); +static void aTM1_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_proc_idx); static void aTM1_set_talk_info(ACTOR* actorx); static void aTM1_set_talk_info2(ACTOR* actorx); static void aTM1_talk_request(ACTOR* actorx, GAME* game); static int aTM1_talk_init(ACTOR* actorx, GAME* game); static int aTM1_talk_end_chk(ACTOR* actorx, GAME* game); - // clang-format off ACTOR_PROFILE Tukimi_Npc1_Profile = { mAc_PROFILE_TUKIMI_NPC1, @@ -91,7 +60,7 @@ static void aTM1_actor_ct(ACTOR* actorx, GAME* game) { TUKIMI_NPC1_ACTOR* tukimi_npc0_actor = (TUKIMI_NPC1_ACTOR*)actorx; if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) { tukimi_npc0_actor->npc_class.schedule.schedule_proc = aTM1_schedule_proc; - NPC_CLIP->ct_proc(actorx, game, &ct_data); + NPC_CLIP->ct_proc(actorx, game, &ct_data); } } diff --git a/src/actor/npc/ac_tukimi_npc1_talk.c_inc b/src/actor/npc/ac_tukimi_npc1_talk.c_inc index 7e734cb3..226b2d02 100644 --- a/src/actor/npc/ac_tukimi_npc1_talk.c_inc +++ b/src/actor/npc/ac_tukimi_npc1_talk.c_inc @@ -9,9 +9,17 @@ static void aTM1_act_chg_data_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { } static void aTM1_act_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { - int unk = ((TUKIMI_NPC1_ACTOR*)actorx)->npcIdx == 4; + TUKIMI_NPC1_ACTOR* tukimi_actor = (TUKIMI_NPC1_ACTOR*)actorx; + int anim_idx; + + if (tukimi_actor->event_idx == 4) { + anim_idx = 1; + } else { + anim_idx = 0; + } + actorx->action.step = 0; - aTM1_set_animation(&actorx->actor_class, unk); + aTM1_set_animation(&actorx->actor_class, anim_idx); } static void aTM1_act_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int act_idx) { @@ -26,14 +34,23 @@ static void aTM1_act_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int act_idx) { } void aTM1_think_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { - int npc_idx; + TUKIMI_NPC1_ACTOR* tukimi_actor = (TUKIMI_NPC1_ACTOR*)actorx; + int anim_idx; + if (actorx->action.step == aNPC_ACTION_END_STEP) { if (actorx->action.idx == aNPC_ACT_SPECIAL) { - npc_idx = ((TUKIMI_NPC1_ACTOR*)actorx)->npcIdx==4; + if (tukimi_actor->event_idx == 4) { + anim_idx = 1; + } else { + anim_idx = 0; + } + actorx->action.step = 0; - aTM1_set_animation(&actorx->actor_class, npc_idx); + aTM1_set_animation((ACTOR*)actorx, anim_idx); } - actorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK; + actorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | + aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | + aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK; aTM1_set_request_act(actorx); } } @@ -57,11 +74,20 @@ static void aTM1_think_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int think_idx) { static void aTM1_schedule_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { TUKIMI_NPC1_ACTOR* tukimi_actor = (TUKIMI_NPC1_ACTOR*)actorx; int puleIdx; - int npcIdx; + int event_idx; s16 ang; - static s16 def_angle[][7] = {0xC000, 0x4000, 0xA000, 0x8000, 0xE000, 0xC000, 0x2000, 0x2000, 0xA000, 0xE000, 0x2000, 0xE000, 0xE000, 0xC000, 0x2000, 0xA000, 0xE000, 0x2000, 0xE000, 0xE000, 0xC000, 0xE000, 0xE000, 0, 0, 0x2000, 0x6000, 0xE000, 0, 0, 0, 0, 0, 0, 0}; + + static s16 def_angle[][7] = { + {0xC000, 0x4000, 0xA000, 0x8000, 0xE000, 0xC000, 0x2000}, + {0x2000, 0xA000, 0xE000, 0x2000, 0xE000, 0xE000, 0xC000}, + {0x2000, 0xA000, 0xE000, 0x2000, 0xE000, 0xE000, 0xC000}, + {0xE000, 0xE000, 0x0000, 0x0000, 0x2000, 0x6000, 0xE000}, + {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000}, + }; actorx->think.think_proc = &aTM1_think_proc; - actorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK; + actorx->condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | aNPC_COND_DEMO_SKIP_FORWARD_CHECK | + aNPC_COND_DEMO_SKIP_BGCHECK | aNPC_COND_DEMO_SKIP_MOVE_Y | + aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK; actorx->collision.check_kind = aNPC_BG_CHECK_TYPE_NONE; actorx->condition_info.hide_request = FALSE; actorx->palActorIgnoreTimer = -1; @@ -75,34 +101,37 @@ static void aTM1_schedule_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { } actorx->actor_class.status_data.weight = MASSTYPE_HEAVY; - + puleIdx = mFI_GetPuleIdx(); - npcIdx = actorx->actor_class.npc_id - SP_NPC_EV_TUKIMI_0; - ang = def_angle[npcIdx][puleIdx]; + event_idx = actorx->actor_class.npc_id - SP_NPC_EV_TUKIMI_0; + ang = def_angle[event_idx][puleIdx]; actorx->actor_class.shape_info.rotation.y = ang; actorx->actor_class.world.angle.y = ang; actorx->movement.mv_angl = ang; - - tukimi_actor->npcIdx = npcIdx; - NPC_CLIP->think_proc(actorx, play, 9, FALSE); + + tukimi_actor->event_idx = event_idx; + NPC_CLIP->think_proc(actorx, play, aNPC_THINK_SPECIAL, FALSE); } static void aTM1_schedule_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { + TUKIMI_NPC1_ACTOR* tukimi_actor = (TUKIMI_NPC1_ACTOR*)actorx; s16 yRot; - if (NPC_CLIP->think_proc(actorx, play, -1, 1) == FALSE) { - NPC_CLIP->think_proc(actorx, play, -1, 2); + + if (NPC_CLIP->think_proc(actorx, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT) == FALSE) { + NPC_CLIP->think_proc(actorx, play, -1, aNPC_THINK_TYPE_MAIN); } - if ((((TUKIMI_NPC1_ACTOR*)actorx)->npcIdx != 4) && (actorx->action.idx == aNPC_ACT_SPECIAL)) { + + if ((tukimi_actor->event_idx != 4) && (actorx->action.idx == aNPC_ACT_SPECIAL)) { yRot = actorx->actor_class.shape_info.rotation.y; actorx->request.head_pos.x = actorx->actor_class.eye.position.x + sin_s(yRot) * 40.0f; actorx->request.head_pos.y = actorx->actor_class.eye.position.y + 30.0f; actorx->request.head_pos.z = actorx->actor_class.eye.position.z + cos_s(yRot) * 40.0f; actorx->request.head_priority = 3; - actorx->request.head_type = 2; + actorx->request.head_type = aNPC_HEAD_TARGET_POS; } } -static void aTM1_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_proc_idx) { +static void aTM1_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_proc_idx) { // clang-format off static aNPC_SUB_PROC sche_proc[] = { &aTM1_schedule_init_proc, @@ -113,25 +142,27 @@ static void aTM1_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int sche_pro } static void aTM1_set_talk_info(ACTOR* actorx) { - static int msg_base[mNpc_LOOKS_NUM] = {0x1EB0, 0x1EBF, 0x1EA1, 0x1ECE, 0x1EDD, 0x1EEC}; - static int msg_base2[mNpc_LOOKS_NUM] = {0x3F46, 0x3F55, 0x3F37, 0x3F64, 0x3F73, 0x3F82}; - + static int msg_base[mNpc_LOOKS_NUM] = { 0x1EB0, 0x1EBF, 0x1EA1, 0x1ECE, 0x1EDD, 0x1EEC }; + static int msg_base2[mNpc_LOOKS_NUM] = { 0x3F46, 0x3F55, 0x3F37, 0x3F64, 0x3F73, 0x3F82 }; + + TUKIMI_NPC1_ACTOR* tukimi_actor = (TUKIMI_NPC1_ACTOR*)actorx; mMsg_Window_c* msg_p = mMsg_Get_base_window_p(); u8 worldName[LAND_NAME_SIZE]; mNpc_EventNpc_c* eventNpc; ACTOR* actorRet; - int npcIdx; + int event_idx; int* msg; int looks; int i; + looks = mNpc_GetNpcLooks(actorx); - npcIdx = ((TUKIMI_NPC1_ACTOR*)actorx)->npcIdx; + event_idx = tukimi_actor->event_idx; msg = msg_base; - + for (i = 0; i < mNpc_EVENT_NPC_NUM; i++) { eventNpc = mNpc_GetSameEventNpc(i + SP_NPC_EV_TUKIMI_0); if (eventNpc != NULL) { - actorRet = Actor_info_fgName_search(&((GAME_PLAY*)gamePT)->actor_info,eventNpc->event_id, ACTOR_PART_NPC); + actorRet = Actor_info_fgName_search(&((GAME_PLAY*)gamePT)->actor_info, eventNpc->event_id, ACTOR_PART_NPC); mNpc_GetNpcWorldName(worldName, actorRet); mMsg_Set_free_str(msg_p, i + mMsg_FREE_STR1, worldName, LAND_NAME_SIZE); } @@ -139,12 +170,12 @@ static void aTM1_set_talk_info(ACTOR* actorx) { if (mEv_check_status(mEv_EVENT_METEOR_SHOWER, mEv_STATUS_ACTIVE) == TRUE) { msg = msg_base2; } - mDemo_Set_msg_num(msg[looks] + RANDOM(3) + npcIdx * 3); + mDemo_Set_msg_num(msg[looks] + RANDOM(3) + event_idx * 3); } static void aTM1_set_talk_info2(ACTOR* actorx) { - static int msg_base[mNpc_LOOKS_NUM] = {0x1EBC, 0x1ECB, 0x1EAD, 0x1EDA, 0x1EE9, 0x1EF8}; - static int msg_base2[mNpc_LOOKS_NUM] = {0x3F52, 0x3F61, 0x3F43, 0x3F70, 0x3F7F, 0x3F8E}; + static int msg_base[mNpc_LOOKS_NUM] = { 0x1EBC, 0x1ECB, 0x1EAD, 0x1EDA, 0x1EE9, 0x1EF8 }; + static int msg_base2[mNpc_LOOKS_NUM] = { 0x3F52, 0x3F61, 0x3F43, 0x3F70, 0x3F7F, 0x3F8E }; u8 worldName[LAND_NAME_SIZE]; mNpc_EventNpc_c* eventNpc; ACTOR* actorRet; @@ -153,7 +184,7 @@ static void aTM1_set_talk_info2(ACTOR* actorx) { int i; looks = mNpc_GetNpcLooks(actorx); msg = msg_base; - + if (mEv_check_status(mEv_EVENT_METEOR_SHOWER, mEv_STATUS_ACTIVE) == TRUE) { msg = msg_base2; } @@ -161,9 +192,15 @@ static void aTM1_set_talk_info2(ACTOR* actorx) { } static void aTM1_talk_request(ACTOR* actorx, GAME* game) { - mDemo_REQUEST_PROC funcPtr = (actorx->npc_id == SP_NPC_EV_TUKIMI_4) ? aTM1_set_talk_info2 : aTM1_set_talk_info; + mDemo_REQUEST_PROC req_proc; - mDemo_Request(mDemo_TYPE_TALK, actorx, funcPtr); + if (actorx->npc_id == SP_NPC_EV_TUKIMI_4) { + req_proc = aTM1_set_talk_info2; + } else { + req_proc = aTM1_set_talk_info; + } + + mDemo_Request(mDemo_TYPE_TALK, actorx, req_proc); } static int aTM1_talk_init(ACTOR* actorx, GAME* game) { @@ -173,9 +210,9 @@ static int aTM1_talk_init(ACTOR* actorx, GAME* game) { static int aTM1_talk_end_chk(ACTOR* actorx, GAME* game) { BOOL res = FALSE; - int demoCheck = mDemo_Check(mDemo_TYPE_TALK, actorx); - if (demoCheck == FALSE){ + + if (!mDemo_Check(mDemo_TYPE_TALK, actorx)) { res = TRUE; } return res; -} \ No newline at end of file +}