From c7de50a58471898c88fc0200b18ce9503acbe8b0 Mon Sep 17 00:00:00 2001 From: Cuyler36 Date: Fri, 13 Jun 2025 22:36:55 -0400 Subject: [PATCH] ac_havest_npc[0/1]: cleanup --- src/actor/npc/ac_harvest_npc0.c | 11 ++++++++++- src/actor/npc/ac_harvest_npc0.c_inc | 24 ++++++++++++------------ src/actor/npc/ac_harvest_npc1.c | 9 ++++++++- src/actor/npc/ac_harvest_npc1.c_inc | 14 +++++++------- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/src/actor/npc/ac_harvest_npc0.c b/src/actor/npc/ac_harvest_npc0.c index f16c2fd6..b8ae5476 100644 --- a/src/actor/npc/ac_harvest_npc0.c +++ b/src/actor/npc/ac_harvest_npc0.c @@ -21,6 +21,15 @@ typedef struct npc_harvest_npc0_actor_s { u8 _9A8; } NPC_HARVEST_NPC0_ACTOR; +enum { + aHT0_ACT_WAIT, + aHT0_ACT_MERRY, + aHT0_ACT_DRINK, + aHT0_ACT_TO_DEFAULT, + + aHT0_ACT_NUM +}; + static void aHT0_actor_ct(ACTOR* actorx, GAME* game); static void aHT0_actor_dt(ACTOR* actorx, GAME* game); static void aHT0_actor_init(ACTOR* actorx, GAME* game); @@ -95,7 +104,7 @@ static void aHT0_actor_init(ACTOR* actorx, GAME* game) { } static void aHT0_set_animation(ACTOR* actorx, int index) { - static int animeSeqNo[] = { 72, 74, 73, 1 }; + static int animeSeqNo[] = { aNPC_ANIM_SITDOWN_WAIT1, aNPC_ANIM_SITDOWN_CLAP1, aNPC_ANIM_SITDOWN_DRINK1, aNPC_ANIM_WALK1 }; NPC_CLIP->animation_init_proc(actorx, animeSeqNo[index], FALSE); } diff --git a/src/actor/npc/ac_harvest_npc0.c_inc b/src/actor/npc/ac_harvest_npc0.c_inc index 046763d6..1bb65f08 100644 --- a/src/actor/npc/ac_harvest_npc0.c_inc +++ b/src/actor/npc/ac_harvest_npc0.c_inc @@ -64,7 +64,7 @@ static void aHT0_setupAction(NPC_ACTOR* actorx, int index) { actor->actor.draw.loop_flag = anm_loop_base[index] + RANDOM(anm_loop_rnd[index]); aHT0_set_animation(&actorx->actor_class, index); if (index == 1) { - static u8 clap_se_no[] = { 0x2f, 0x31, 0x32, 0x33 }; + static u8 clap_se_no[] = { NA_SE_2F, NA_SE_31, NA_SE_32, NA_SE_33 }; actor->_9A8 = clap_se_no[RANDOM(ARRAY_COUNT(clap_se_no))]; } } @@ -74,7 +74,7 @@ static void aHT0_act_chg_data_proc(NPC_HARVEST_NPC0_ACTOR* actor, GAME_PLAY* pla } static void aHT0_act_init_proc(NPC_HARVEST_NPC0_ACTOR* actor, GAME_PLAY* play) { - aHT0_setupAction(&actor->actor, 3); + aHT0_setupAction(&actor->actor, aHT0_ACT_TO_DEFAULT); } static void aHT0_act_main_proc(NPC_HARVEST_NPC0_ACTOR* actor, GAME_PLAY* play) { @@ -88,10 +88,10 @@ static void aHT0_act_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int index) { } static void aHT0_think_main_proc(NPC_HARVEST_NPC0_ACTOR* actor, GAME_PLAY* play) { - if (actor->actor.action.step == (u8)-1) { + if (actor->actor.action.step == aNPC_ACTION_END_STEP) { switch (actor->actor.action.idx) { - case 22: { - static int action[] = { 0, 1, 2, 3 }; + case aNPC_ACT_SPECIAL: { + static int action[] = { aHT0_ACT_WAIT, aHT0_ACT_MERRY, aHT0_ACT_DRINK, aHT0_ACT_TO_DEFAULT }; if (actor->_998 != -1) { aHT0_setupAction(&actor->actor, action[actor->_998]); actor->_998 = -1; @@ -106,7 +106,7 @@ static void aHT0_think_main_proc(NPC_HARVEST_NPC0_ACTOR* actor, GAME_PLAY* play) aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV | aNPC_COND_DEMO_SKIP_MOVE_Y; actor->actor.collision.check_kind = aNPC_BG_CHECK_TYPE_ONLY_GROUND; } break; - case 8: { + case aNPC_ACT_TALK: { actor->actor.movement.mv_angl = aHT0_GetDefaultAngle(actor); aHT0_set_request_act(&actor->actor); actor->actor.condition_info.demo_flg = aNPC_COND_DEMO_SKIP_HEAD_LOOKAT | @@ -135,10 +135,10 @@ static void aHT0_schedule_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { NPC_HARVEST_NPC0_ACTOR* actor = (NPC_HARVEST_NPC0_ACTOR*)actorx; int id = actor->actor.actor_class.npc_id - SP_NPC_EV_HARVEST_0; actor->actor.think.think_proc = aHT0_think_proc; - actor->actor.condition_info.hide_request = 0; + actor->actor.condition_info.hide_request = FALSE; actor->actor.palActorIgnoreTimer = -1; - actor->actor.talk_info.turn = 1; - actor->actor.talk_info.default_animation = 72; + actor->actor.talk_info.turn = aNPC_TALK_TURN_HEAD; + actor->actor.talk_info.default_animation = aNPC_ANIM_SITDOWN_WAIT1; actor->_9A4 = id; actor->actor.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_RANGE_CHECK | @@ -148,7 +148,7 @@ static void aHT0_schedule_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { actor->_998 = -1; actor->actor.movement.mv_angl = actor->actor.actor_class.world.angle.y = actor->actor.actor_class.shape_info.rotation.y = aHT0_GetDefaultAngle(actor); - NPC_CLIP->think_proc(actorx, play, 9, 0); + NPC_CLIP->think_proc(actorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT); } static void aHT0_schedule_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { @@ -181,7 +181,7 @@ static void aHT0_set_talk_info(ACTOR* actorx) { } static void aHT0_talk_request(ACTOR* actorx, GAME* game) { - mDemo_Request(7, actorx, aHT0_set_talk_info); + mDemo_Request(mDemo_TYPE_TALK, actorx, aHT0_set_talk_info); } static BOOL aHT0_talk_init(ACTOR* actorx, GAME* game) { @@ -192,7 +192,7 @@ static BOOL aHT0_talk_init(ACTOR* actorx, GAME* game) { static BOOL aHT0_talk_end_chk(ACTOR* actorx, GAME* game) { NPC_HARVEST_NPC0_ACTOR* actor = (NPC_HARVEST_NPC0_ACTOR*)actorx; BOOL ret = FALSE; - if (mDemo_Check(7, actorx) == FALSE) { + if (!mDemo_Check(mDemo_TYPE_TALK, actorx)) { actor->_99C = 1; ret = TRUE; } diff --git a/src/actor/npc/ac_harvest_npc1.c b/src/actor/npc/ac_harvest_npc1.c index a0a18d6d..d592f3ed 100644 --- a/src/actor/npc/ac_harvest_npc1.c +++ b/src/actor/npc/ac_harvest_npc1.c @@ -18,6 +18,13 @@ typedef struct npc_harvest_npc1_actor_s { aHT1_PROC _99C; } NPC_HARVEST_NPC1_ACTOR; +enum { + aHT1_ACT_WAIT, + aHT1_ACT_TO_DEFAULT, + + aHT1_ACT_NUM +}; + static void aHT1_actor_ct(ACTOR* actorx, GAME* game); static void aHT1_actor_dt(ACTOR* actorx, GAME* game); static void aHT1_actor_init(ACTOR* actorx, GAME* game); @@ -78,7 +85,7 @@ static void aHT1_actor_init(ACTOR* actorx, GAME* game) { } static void aHT1_set_animation(ACTOR* actorx, int index) { - static int animeSeqNo[] = { 5, 1 }; + static int animeSeqNo[] = { aNPC_ANIM_WAIT1, aNPC_ANIM_WALK1 }; NPC_CLIP->animation_init_proc(actorx, animeSeqNo[index], FALSE); } diff --git a/src/actor/npc/ac_harvest_npc1.c_inc b/src/actor/npc/ac_harvest_npc1.c_inc index d3b8d880..d3362f4d 100644 --- a/src/actor/npc/ac_harvest_npc1.c_inc +++ b/src/actor/npc/ac_harvest_npc1.c_inc @@ -38,7 +38,7 @@ static void aHT1_act_chg_data_proc(NPC_HARVEST_NPC1_ACTOR* actor, GAME_PLAY* pla } static void aHT1_act_init_proc(NPC_HARVEST_NPC1_ACTOR* actor, GAME_PLAY* play) { - aHT1_setupAction(&actor->actor, 1); + aHT1_setupAction(&actor->actor, aHT1_ACT_TO_DEFAULT); } static void aHT1_act_main_proc(NPC_HARVEST_NPC1_ACTOR* actor, GAME_PLAY* play) { @@ -52,9 +52,9 @@ static void aHT1_act_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int index) { } static void aHT1_think_main_proc(NPC_HARVEST_NPC1_ACTOR* actor, GAME_PLAY* play) { - if (actor->actor.action.step == (u8)-1) { + if (actor->actor.action.step == aNPC_ACTION_END_STEP) { switch (actor->actor.action.idx) { - case 22: { + case aNPC_ACT_SPECIAL: { if (actor->_998 != -1) { aHT1_setupAction(&actor->actor, actor->_998); actor->_998 = -1; @@ -63,7 +63,7 @@ static void aHT1_think_main_proc(NPC_HARVEST_NPC1_ACTOR* actor, GAME_PLAY* play) aNPC_COND_DEMO_SKIP_MOVE_RANGE_CHECK | aNPC_COND_DEMO_SKIP_MOVE_CIRCLE_REV; actor->actor.collision.check_kind = aNPC_BG_CHECK_TYPE_ONLY_GROUND; } break; - case 8: { + case aNPC_ACT_TALK: { actor->actor.movement.mv_angl = aHT1_GetDefaultAngle(actor); aHT1_set_request_act(&actor->actor); actor->actor.condition_info.demo_flg = @@ -98,7 +98,7 @@ static void aHT1_schedule_init_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { actor->actor.actor_class.shape_info.rotation.y = aHT1_GetDefaultAngle(); actor->actor.actor_class.world.angle.y = aHT1_GetDefaultAngle(); actor->actor.movement.mv_angl = aHT1_GetDefaultAngle(); - NPC_CLIP->think_proc(actorx, play, 9, 0); + NPC_CLIP->think_proc(actorx, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT); } static void aHT1_schedule_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play) { @@ -120,7 +120,7 @@ static void aHT1_set_talk_info(ACTOR* actorx) { } static void aHT1_talk_request(ACTOR* actorx, GAME* game) { - mDemo_Request(7, actorx, aHT1_set_talk_info); + mDemo_Request(mDemo_TYPE_TALK, actorx, aHT1_set_talk_info); } static BOOL aHT1_talk_init(ACTOR* actorx, GAME* game) { @@ -131,7 +131,7 @@ static BOOL aHT1_talk_init(ACTOR* actorx, GAME* game) { static BOOL aHT1_talk_end_chk(ACTOR* actorx, GAME* game) { NPC_HARVEST_NPC1_ACTOR* actor = (NPC_HARVEST_NPC1_ACTOR*)actorx; BOOL ret = FALSE; - if (mDemo_Check(7, actorx) == FALSE) { + if (!mDemo_Check(mDemo_TYPE_TALK, actorx)) { ret = TRUE; } return ret;