Cleanup ac_ev_majin

This commit is contained in:
Cuyler36
2025-03-25 17:35:22 -04:00
parent 479ed07308
commit 998914477d
4 changed files with 141 additions and 116 deletions
+8 -5
View File
@@ -9,11 +9,15 @@
extern "C" {
#endif
typedef struct actor_ev_majin_actor_s{
typedef struct ev_majin_actor_s EV_MAJIN_ACTOR;
typedef void (*aEMJ_PROC)(EV_MAJIN_ACTOR* majin, GAME_PLAY* play);
struct ev_majin_actor_s {
NPC_ACTOR npc_class;
int unk994;
aNPC_SUB_PROC think_proc;
}EV_NPCMAJIN_ACTOR;
int action;
aEMJ_PROC act_proc;
};
extern ACTOR_PROFILE Ev_Majin_Profile;
@@ -22,4 +26,3 @@ extern ACTOR_PROFILE Ev_Majin_Profile;
#endif
#endif
-5
View File
@@ -954,11 +954,6 @@ struct npc_actor_s {
int _990;
};
typedef struct npc_destruct_table_proc {
aNPC_SUB_PROC unk0;
aNPC_SUB_PROC unk4;
} NPC_DT_PROCS;
typedef struct {
aNPC_se_data_c* lfoot_data;
aNPC_se_data_c* rfoot_data;
+62 -35
View File
@@ -1,73 +1,100 @@
#include "ac_ev_majin.h"
#include "m_common_data.h"
#include "m_name_table.h"
#include "m_demo.h"
#include "ac_groundhog_control.h"
extern void aEMJ_actor_ct(ACTOR*, GAME*);
extern void aEMJ_actor_dt(ACTOR*, GAME*);
extern void aEMJ_actor_init(ACTOR*, GAME*);
extern void aEMJ_actor_save(ACTOR*, GAME*);
enum {
aEMJ_ACT_APPEAR,
aEMJ_ACT_WAIT,
aEMJ_ACT_RETIRE,
ACTOR_PROFILE Ev_Majin_Profile = {
mAc_PROFILE_EV_MAJIN, ACTOR_PART_NPC, ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
SP_NPC_EV_MAJIN, ACTOR_OBJ_BANK_KEEP, sizeof(EV_NPCMAJIN_ACTOR),
aEMJ_actor_ct, aEMJ_actor_dt, aEMJ_actor_init,
NONE_ACTOR_PROC, aEMJ_actor_save,
aEMJ_ACT_NUM
};
extern void aEMJ_actor_move(ACTOR*, GAME*);
extern void aEMJ_actor_draw(ACTOR*, GAME*);
static void aEMJ_actor_ct(ACTOR*, GAME*);
static void aEMJ_actor_dt(ACTOR*, GAME*);
static void aEMJ_actor_init(ACTOR*, GAME*);
static void aEMJ_actor_save(ACTOR*, GAME*);
ACTOR_PROFILE Ev_Majin_Profile = {
// clang-format off
mAc_PROFILE_EV_MAJIN,
ACTOR_PART_NPC,
ACTOR_STATE_NO_DRAW_WHILE_CULLED | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
SP_NPC_EV_MAJIN,
ACTOR_OBJ_BANK_KEEP,
sizeof(EV_MAJIN_ACTOR),
aEMJ_actor_ct,
aEMJ_actor_dt,
aEMJ_actor_init,
mActor_NONE_PROC1,
aEMJ_actor_save,
// clang-format on
};
static void aEMJ_actor_move(ACTOR*, GAME*);
static void aEMJ_actor_draw(ACTOR*, GAME*);
static int aEMJ_talk_init(ACTOR*, GAME*);
static int aEMJ_talk_end_chk(ACTOR*, GAME*);
static void aEMJ_schedule_proc(NPC_ACTOR*, GAME_PLAY*, int);
void aEMJ_actor_ct(ACTOR* actor, GAME* game) {
static void aEMJ_actor_ct(ACTOR* actor, GAME* game) {
static aNPC_ct_data_c ct_data = {
&aEMJ_actor_move, &aEMJ_actor_draw, 5, mActor_NONE_PROC1, &aEMJ_talk_init, &aEMJ_talk_end_chk, 0,
// clang-format off
aEMJ_actor_move,
aEMJ_actor_draw,
aNPC_CT_SCHED_TYPE_SPECIAL,
(aNPC_TALK_REQUEST_PROC)none_proc1,
aEMJ_talk_init,
aEMJ_talk_end_chk,
0,
// clang-format on
};
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
EV_MAJIN_ACTOR* majin = (EV_MAJIN_ACTOR*)actor;
if (Common_Get(clip.npc_clip)->birth_check_proc(actor, game) == TRUE) {
if (NPC_CLIP->birth_check_proc(actor, game) == TRUE) {
majin->npc_class.schedule.schedule_proc = aEMJ_schedule_proc;
Common_Get(clip.npc_clip)->ct_proc(actor, game, &ct_data);
majin->npc_class.head.lock_flag = 1;
NPC_CLIP->ct_proc(actor, game, &ct_data);
majin->npc_class.head.lock_flag = TRUE;
majin->npc_class.talk_info.default_turn_animation = aNPC_ANIM_WAIT_R1;
majin->npc_class.talk_info.default_animation = aNPC_ANIM_WAIT_R1;
majin->npc_class.talk_info.turn = 2;
majin->npc_class.talk_info.turn = aNPC_TALK_TURN_NONE;
}
}
void aEMJ_actor_save(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->save_proc(actor, game);
static void aEMJ_actor_save(ACTOR* actor, GAME* game) {
NPC_CLIP->save_proc(actor, game);
}
void aEMJ_actor_dt(ACTOR* actor, GAME* game) {
if (Common_Get(clip.groundhog_control_clip) != NULL) {
Common_Get(clip.groundhog_control_clip)->groundhog_npc_actor = NULL;
static void aEMJ_actor_dt(ACTOR* actor, GAME* game) {
if (CLIP(groundhog_control_clip) != NULL) {
CLIP(groundhog_control_clip)->groundhog_npc_actor = NULL;
}
Common_Get(clip.npc_clip)->dt_proc(actor, game);
Common_Get(clip.effect_clip)->effect_kill_proc(eEC_EFFECT_RESET_HOLE, RSV_NO);
NPC_CLIP->dt_proc(actor, game);
eEC_CLIP->effect_kill_proc(eEC_EFFECT_RESET_HOLE, RSV_NO);
}
void aEMJ_actor_init(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->init_proc(actor, game);
static void aEMJ_actor_init(ACTOR* actor, GAME* game) {
NPC_CLIP->init_proc(actor, game);
}
void aEMJ_set_animation(ACTOR* actor, int idx) {
static void aEMJ_set_animation(EV_MAJIN_ACTOR* majin, int idx) {
static s16 animeSeqNo[] = { aNPC_ANIM_APPEAR1, aNPC_ANIM_WAIT_R1, aNPC_ANIM_GO_UG1 };
Common_Get(clip.npc_clip)->animation_init_proc(actor, animeSeqNo[idx], 0);
NPC_CLIP->animation_init_proc((ACTOR*)majin, animeSeqNo[idx], FALSE);
}
void aEMJ_actor_move(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->move_proc(actor, game);
actor->shape_info.draw_shadow = 0;
static void aEMJ_actor_move(ACTOR* actor, GAME* game) {
NPC_CLIP->move_proc(actor, game);
actor->shape_info.draw_shadow = FALSE;
}
void aEMJ_actor_draw(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->draw_proc(actor, game);
static void aEMJ_actor_draw(ACTOR* actor, GAME* game) {
NPC_CLIP->draw_proc(actor, game);
}
#include "../src/actor/npc/event/ac_ev_majin_move.c_inc"
+71 -71
View File
@@ -1,126 +1,126 @@
void aEMJ_schedule_proc(NPC_ACTOR*, GAME_PLAY*, int);
void aEMJ_setup_think_proc(NPC_ACTOR*, int);
void aEMJ_force_talk_request(NPC_ACTOR*, GAME_PLAY*);
void aEMJ_set_request_act(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
static void aEMJ_schedule_proc(NPC_ACTOR*, GAME_PLAY*, int);
static void aEMJ_setup_think_proc(EV_MAJIN_ACTOR*, int);
static void aEMJ_force_talk_request(ACTOR*, GAME*);
static void aEMJ_set_request_act(EV_MAJIN_ACTOR* majin, GAME_PLAY* play) {
majin->npc_class.request.act_priority = 4;
majin->npc_class.request.act_idx = 22;
majin->npc_class.request.act_type = 2;
majin->npc_class.request.act_idx = aNPC_ACT_SPECIAL;
majin->npc_class.request.act_type = aNPC_ACT_TYPE_SEARCH;
}
void aEMJ_act_init_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
static void aEMJ_act_init_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_MAJIN_ACTOR* majin = (EV_MAJIN_ACTOR*)actor;
majin->npc_class.action.step = 0;
}
void aEMJ_act_proc(NPC_ACTOR* actor, GAME_PLAY* play, int idx) {
static aNPC_SUB_PROC act_proc[] = { aEMJ_act_init_proc, (aNPC_SUB_PROC)mActor_NONE_PROC1,
(aNPC_SUB_PROC)mActor_NONE_PROC1 };
static void aEMJ_act_proc(NPC_ACTOR* actor, GAME_PLAY* play, int idx) {
static aNPC_SUB_PROC act_proc[] = { aEMJ_act_init_proc, (aNPC_SUB_PROC)none_proc1,
(aNPC_SUB_PROC)none_proc1, };
act_proc[idx](actor, play);
(*act_proc[idx])(actor, play);
}
void aEMJ_appear(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
static void aEMJ_appear(EV_MAJIN_ACTOR* majin, GAME_PLAY* play) {
if (majin->npc_class.draw.main_animation_state == cKF_STATE_STOPPED) {
aEMJ_setup_think_proc(actor, 1);
aEMJ_setup_think_proc(majin, aEMJ_ACT_WAIT);
}
}
void aEMJ_retire(NPC_ACTOR* actor, GAME_PLAY* play) {
if (actor->draw.main_animation_state == cKF_STATE_STOPPED) {
((NPC_ACTOR*)(actor->actor_class.parent_actor))->npc_info.animal = (Animal_c*)1;
Actor_delete(&actor->actor_class);
static void aEMJ_retire(EV_MAJIN_ACTOR* majin, GAME_PLAY* play) {
if (majin->npc_class.draw.main_animation_state == cKF_STATE_STOPPED) {
GROUNDHOG_CONTROL_ACTOR* ctrl = (GROUNDHOG_CONTROL_ACTOR*)majin->npc_class.actor_class.parent_actor;
ctrl->event_state = aGHC_EVENT_STATE_MAJIN_DONE;
Actor_delete((ACTOR*)majin);
}
}
void aEMJ_think_main_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
static void aEMJ_think_main_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_MAJIN_ACTOR* majin = (EV_MAJIN_ACTOR*)actor;
if (actor->action.idx == 0x16) {
majin->think_proc(actor, play);
if (actor->action.idx == aNPC_ACT_SPECIAL) {
(*majin->act_proc)(majin, play);
} else {
if (actor->action.step == aNPC_ACTION_END_STEP) {
aEMJ_set_request_act(actor, play);
aEMJ_set_request_act(majin, play);
}
}
}
void aEMJ_think_init_proc(ACTOR* actor, GAME* game) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
GAME_PLAY* play = (GAME_PLAY*)game;
static void aEMJ_think_init_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_MAJIN_ACTOR* majin = (EV_MAJIN_ACTOR*)actor;
majin->npc_class.action.act_proc = aEMJ_act_proc;
aEMJ_set_request_act(&majin->npc_class, play);
Common_Get(clip).effect_clip->effect_make_proc(0x5D, actor->world.position, 3, actor->shape_info.rotation.y,
&play->game, 0xFFFF, 0, 0);
aEMJ_setup_think_proc(&majin->npc_class, 0);
aEMJ_set_request_act(majin, play);
eEC_CLIP->effect_make_proc(eEC_EFFECT_RESET_HOLE, actor->actor_class.world.position, 3, actor->actor_class.shape_info.rotation.y,
&play->game, RSV_NO, 0, 0);
aEMJ_setup_think_proc(majin, aEMJ_ACT_APPEAR);
}
void aEMJ_setup_think_proc(NPC_ACTOR* actor, int idx) {
static NPC_DT_PROCS dt_tbl[] = {
{ aEMJ_appear, (aNPC_SUB_PROC)none_proc1 },
{ (aNPC_SUB_PROC)none_proc1, aEMJ_force_talk_request },
{ aEMJ_retire, (aNPC_SUB_PROC)none_proc1 },
typedef struct {
aEMJ_PROC act_proc;
aNPC_TALK_REQUEST_PROC talk_request_proc;
} aEMJ_talk_data_c;
static void aEMJ_setup_think_proc(EV_MAJIN_ACTOR* majin, int idx) {
static aEMJ_talk_data_c dt_tbl[] = {
{ aEMJ_appear, (aNPC_TALK_REQUEST_PROC)none_proc1 },
{ (aEMJ_PROC)none_proc1, aEMJ_force_talk_request },
{ aEMJ_retire, (aNPC_TALK_REQUEST_PROC)none_proc1 },
};
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
aEMJ_talk_data_c* data_p = &dt_tbl[idx];
NPC_DT_PROCS* current = &dt_tbl[idx];
majin->unk994 = idx;
majin->think_proc = current->unk0;
actor->talk_info.talk_request_proc = (mActor_proc)current->unk4;
aEMJ_set_animation(&actor->actor_class, idx);
majin->action = idx;
majin->act_proc = data_p->act_proc;
majin->npc_class.talk_info.talk_request_proc = data_p->talk_request_proc;
aEMJ_set_animation(majin, idx);
}
void aEMJ_think_proc(NPC_ACTOR* actor, GAME_PLAY* play, int idx) {
static void aEMJ_think_proc(NPC_ACTOR* actor, GAME_PLAY* play, int idx) {
static aNPC_SUB_PROC think_proc[] = {
(aNPC_SUB_PROC)(aEMJ_think_init_proc),
aEMJ_think_init_proc,
aEMJ_think_main_proc,
};
think_proc[idx](actor, play);
(*think_proc[idx])(actor, play);
}
void aEMJ_schedule_init_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
static void aEMJ_schedule_init_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_MAJIN_ACTOR* majin = (EV_MAJIN_ACTOR*)actor;
majin->npc_class.think.think_proc = aEMJ_think_proc;
majin->npc_class.condition_info.hide_request = 0;
majin->npc_class.condition_info.hide_request = FALSE;
majin->npc_class.palActorIgnoreTimer = -1;
majin->npc_class.actor_class.world.position.x += 20.0f;
majin->npc_class.actor_class.world.position.z += 20.0f;
Common_Get(clip.npc_clip)->think_proc(actor, play, 9, 0);
NPC_CLIP->think_proc(actor, play, aNPC_THINK_SPECIAL, aNPC_THINK_TYPE_INIT);
}
void aEMJ_schedule_main_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
if (Common_Get(clip.npc_clip)->think_proc(actor, play, -1, 1) == 0) {
Common_Get(clip.npc_clip)->think_proc(actor, play, -1, 2);
static void aEMJ_schedule_main_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_MAJIN_ACTOR* majin = (EV_MAJIN_ACTOR*)actor;
if (NPC_CLIP->think_proc(actor, play, -1, aNPC_THINK_TYPE_CHK_INTERRUPT) == FALSE) {
NPC_CLIP->think_proc(actor, play, -1, aNPC_THINK_TYPE_MAIN);
}
}
void aEMJ_schedule_proc(NPC_ACTOR* actor, GAME_PLAY* play, int idx) {
static void aEMJ_schedule_proc(NPC_ACTOR* actor, GAME_PLAY* play, int idx) {
static aNPC_SUB_PROC sche_proc[] = { aEMJ_schedule_init_proc, aEMJ_schedule_main_proc };
sche_proc[idx](actor, play);
(*sche_proc[idx])(actor, play);
}
void aEMJ_set_force_talk_info() {
static void aEMJ_set_force_talk_info() {
int msg_num;
switch (Common_Get(weather)) {
case mEnv_WEATHER_CLEAR:
msg_num = RANDOM(3.0f) + 0x3DAF;
msg_num = 0x3DAF + RANDOM(3);
break;
case mEnv_WEATHER_SNOW:
msg_num = RANDOM(3.0f) + 0x3DB2;
msg_num = 0x3DB2 + RANDOM(3);
break;
default:
@@ -132,25 +132,25 @@ void aEMJ_set_force_talk_info() {
mDemo_Set_msg_num(msg_num);
}
void aEMJ_force_talk_request(NPC_ACTOR* actor, GAME_PLAY* play) {
mDemo_Request(10, &actor->actor_class, aEMJ_set_force_talk_info);
static void aEMJ_force_talk_request(ACTOR* actorx, GAME* game) {
mDemo_Request(mDemo_TYPE_SPEECH, actorx, aEMJ_set_force_talk_info);
}
int aEMJ_talk_init(ACTOR* actor, GAME* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
EV_MAJIN_ACTOR* majin = (EV_MAJIN_ACTOR*)actor;
majin->npc_class.talk_info.talk_request_proc = (mActor_proc)none_proc1;
mDemo_Set_ListenAble();
return 1;
return TRUE;
}
int aEMJ_talk_end_chk(ACTOR* actor, GAME* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
int res = 0;
EV_MAJIN_ACTOR* majin = (EV_MAJIN_ACTOR*)actor;
int res = FALSE;
if (mDemo_Check(10, actor) == 0) {
aEMJ_setup_think_proc(&majin->npc_class, 2);
res = 1;
if (!mDemo_Check(mDemo_TYPE_SPEECH, actor)) {
aEMJ_setup_think_proc(majin, aEMJ_ACT_RETIRE);
res = TRUE;
}
return res;