ac_npc_mask_cat cleanup

This commit is contained in:
Cuyler36
2025-05-12 10:14:03 -04:00
parent 0937843b6f
commit 230a8fcf52
2 changed files with 57 additions and 53 deletions
+29 -26
View File
@@ -34,8 +34,8 @@ static void aNMC_actor_dt(ACTOR* actorx, GAME* game);
static void aNMC_actor_init(ACTOR* actorx, GAME* game);
static void aNMC_actor_save(ACTOR* actorx, GAME* game);
// clang-format off
ACTOR_PROFILE Npc_Mask_Cat_Profile = {
// clang-format off
mAc_PROFILE_NPC_MASK_CAT,
ACTOR_PART_NPC,
ACTOR_STATE_NONE,
@@ -47,46 +47,49 @@ ACTOR_PROFILE Npc_Mask_Cat_Profile = {
aNMC_actor_init,
mActor_NONE_PROC1,
aNMC_actor_save,
// clang-format on
};
// clang-format on
static void aNMC_actor_ct(ACTOR* actorx, GAME* game) {
static aNPC_ct_data_c ct_data = {
&aNMC_actor_move,
&aNMC_actor_draw,
3,
&aNMC_talk_request,
&aNMC_talk_init,
&aNMC_talk_end_chk,
0,
};
if (CLIP(npc_clip)->birth_check_proc(actorx, game) == TRUE) {
if (Common_Get(spnpc_first_talk_flags) & (1 << aNPC_SPNPC_BIT_MASK_CAT)) {
Actor_delete(actorx);
actorx->sv_proc = NULL;
actorx->dt_proc = NULL;
mNpc_RenewalSetNpc(actorx);
} else {
CLIP(npc_clip)->ct_proc(actorx, game, &ct_data);
// clang-format off
static aNPC_ct_data_c ct_data = {
&aNMC_actor_move,
&aNMC_actor_draw,
aNPC_CT_SCHED_TYPE_WANDER,
&aNMC_talk_request,
&aNMC_talk_init,
&aNMC_talk_end_chk,
0,
};
// clang-format on
if (NPC_CLIP->birth_check_proc(actorx, game) == TRUE) {
if (Common_Get(spnpc_first_talk_flags) & (1 << aNPC_SPNPC_BIT_MASK_CAT)) {
Actor_delete(actorx);
actorx->sv_proc = NULL;
actorx->dt_proc = NULL;
mNpc_RenewalSetNpc(actorx);
} else {
NPC_CLIP->ct_proc(actorx, game, &ct_data);
}
}
}
}
static void aNMC_actor_save(ACTOR* actorx, GAME* game) {
CLIP(npc_clip)->save_proc(actorx, game);
NPC_CLIP->save_proc(actorx, game);
}
static void aNMC_actor_dt(ACTOR* actorx, GAME* game) {
CLIP(npc_clip)->dt_proc(actorx, game);
mEv_actor_dying_message(0x73, actorx);
NPC_CLIP->dt_proc(actorx, game);
mEv_actor_dying_message(mEv_EVENT_MASK_NPC, actorx);
}
static void aNMC_actor_init(ACTOR* actorx, GAME* game) {
CLIP(npc_clip)->init_proc(actorx, game);
NPC_CLIP->init_proc(actorx, game);
}
static void aNMC_actor_draw(ACTOR* actorx, GAME* game) {
CLIP(npc_clip)->draw_proc(actorx, game);
NPC_CLIP->draw_proc(actorx, game);
}
#include "../src/actor/npc/ac_npc_mask_cat_move.c_inc"
#include "../src/actor/npc/ac_npc_mask_cat_move.c_inc"
+28 -27
View File
@@ -1,44 +1,45 @@
static void aNMC_set_painter_name_str() {
mMsg_Window_c* msg_p = mMsg_Get_base_window_p();
mMsg_Set_free_str(msg_p, 0, Save_Get(mask_cat).design.creator_pid.player_name, 8);
mMsg_SET_FREE_STR(mMsg_FREE_STR0, Save_Get(mask_cat).design.creator_pid.player_name,
sizeof(Save_Get(mask_cat).design.creator_pid.player_name));
}
static void aNMC_set_talk_info() {
u32 msg_num;
s32 mask_cat_talk_idx = Save_Get(mask_cat).talk_idx;
if ((Common_Get(spnpc_first_talk_flags) & (1 << aNPC_SPNPC_BIT_MASK_CAT))) {
if (mask_cat_talk_idx <= 0) {
mask_cat_talk_idx = 1;
static void aNMC_set_talk_info(ACTOR* actorx) {
int msg_num;
int mask_cat_talk_idx = Save_Get(mask_cat).talk_idx;
if ((Common_Get(spnpc_first_talk_flags) & (1 << aNPC_SPNPC_BIT_MASK_CAT))) {
if (mask_cat_talk_idx <= 0) {
mask_cat_talk_idx = 1;
}
msg_num = 0x31E5 + 4 * (mask_cat_talk_idx - 1) + RANDOM(3);
} else {
Save_Get(mask_cat).talk_idx++;
msg_num = mask_cat_talk_idx * 4 + 0x31E4;
}
msg_num = 0x31E5 + 4 * (mask_cat_talk_idx - 1) + RANDOM(3);
} else {
++Save_Get(mask_cat).talk_idx;
msg_num = mask_cat_talk_idx * 4 + 0x31E4;
}
mDemo_Set_msg_num(msg_num);
aNMC_set_painter_name_str();
mDemo_Set_msg_num(msg_num);
aNMC_set_painter_name_str();
}
static void aNMC_talk_request(ACTOR* actorx, GAME* game) {
mDemo_Request(mDemo_TYPE_TALK, actorx, aNMC_set_talk_info);
mDemo_Request(mDemo_TYPE_TALK, actorx, aNMC_set_talk_info);
}
static int aNMC_talk_init(ACTOR* actorx, GAME* game) {
Common_Get(spnpc_first_talk_flags) |= (1 << aNPC_SPNPC_BIT_MASK_CAT);
mDemo_Set_ListenAble();
return 1;
Common_Get(spnpc_first_talk_flags) |= (1 << aNPC_SPNPC_BIT_MASK_CAT);
mDemo_Set_ListenAble();
return TRUE;
}
static int aNMC_talk_end_chk(ACTOR* actorx, GAME* game) {
s32 retValue = 0;
int ret = FALSE;
if (mDemo_Check(mDemo_TYPE_TALK, actorx) == 0)
{
retValue = 1;
}
return retValue;
if (!mDemo_Check(mDemo_TYPE_TALK, actorx)) {
ret = TRUE;
}
return ret;
}
static void aNMC_actor_move(ACTOR* actorx, GAME* game) {
CLIP(npc_clip)->move_proc(actorx, game);
}
NPC_CLIP->move_proc(actorx, game);
}