link enginner and majin

This commit is contained in:
Prakxo
2024-01-05 15:20:07 +01:00
parent f2637656ee
commit ca63c36bb4
8 changed files with 346 additions and 2 deletions
+87
View File
@@ -0,0 +1,87 @@
#include "ac_ev_majin.h"
#include "m_common_data.h"
#include "m_name_table.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*);
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,
};
extern void aEMJ_actor_move(ACTOR*, GAME*);
extern 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 aNPC_ct_data_c ct_data = {
&aEMJ_actor_move,
&aEMJ_actor_draw,
5,
mActor_NONE_PROC1,
&aEMJ_talk_init,
&aEMJ_talk_end_chk,
0,
};
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
if(Common_Get(clip.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;
majin->npc_class.talk_info.default_turn_animation = 0x4E;
majin->npc_class.talk_info.default_animation = 0x4E;
majin->npc_class.talk_info.turn = 2;
}
}
void aEMJ_actor_save(ACTOR* actor, GAME* game) {
Common_Get(clip.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;
}
Common_Get(clip.npc_clip)->dt_proc(actor,game);
Common_Get(clip.effect_clip)->effect_kill_proc(0x5D, 0xFFFF);
}
void aEMJ_actor_init(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->init_proc(actor,game);
}
void aEMJ_set_animation(ACTOR* actor, int idx){
static s16 animeSeqNo[] = {79,78,80};
Common_Get(clip.npc_clip)->animation_init_proc(actor,animeSeqNo[idx],0);
}
void aEMJ_actor_move(ACTOR* actor, GAME* game){
Common_Get(clip.npc_clip)->move_proc(actor,game);
actor->shape_info.draw_shadow = 0;
}
void aEMJ_actor_draw(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->draw_proc(actor,game);
}
#include "../src/ac_ev_majin_move.c_inc"
+157
View File
@@ -0,0 +1,157 @@
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;
majin->npc_class.request.act_priority = 4;
majin->npc_class.request.act_idx = 22;
majin->npc_class.request.act_type = 2;
}
void aEMJ_act_init_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_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};
act_proc[idx](actor, play);
}
void aEMJ_appear(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
if (majin->npc_class.draw._04 == 1) {
aEMJ_setup_think_proc(actor, 1);
}
}
void aEMJ_retire(NPC_ACTOR* actor, GAME_PLAY* play) {
if (actor->draw._04 == 1) {
((NPC_ACTOR*)(actor->actor_class.parent_actor))->npc_info.animal = (Animal_c*)1;
Actor_delete(&actor->actor_class);
}
}
void aEMJ_think_main_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
if (actor->action.idx == 0x16) {
majin->think_proc(actor, play);
} else {
if (actor->action.step == aNPC_ACTION_END_STEP) {
aEMJ_set_request_act(actor, play);
}
}
}
void aEMJ_think_init_proc(ACTOR* actor, GAME* game) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
GAME_PLAY* play = (GAME_PLAY*)game;
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);
}
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},
};
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
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);
}
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_main_proc,
};
think_proc[idx](actor, play);
}
void aEMJ_schedule_init_proc(NPC_ACTOR* actor, GAME_PLAY* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
majin->npc_class.think.think_proc = aEMJ_think_proc;
majin->npc_class.condition_info.hide_request = 0;
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);
}
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);
}
}
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);
}
void aEMJ_set_force_talk_info() {
int msg_num;
switch (Common_Get(weather)) {
case mEnv_WEATHER_CLEAR:
msg_num = RANDOM(3.0f) + 0x3DAF;
break;
case mEnv_WEATHER_SNOW:
msg_num = RANDOM(3.0f) + 0x3DB2;
break;
default:
case mEnv_WEATHER_RAIN:
msg_num = 0x3DAF;
break;
}
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);
}
int aEMJ_talk_init(ACTOR* actor, GAME* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
majin->npc_class.talk_info.talk_request_proc = (mActor_proc)none_proc1;
mDemo_Set_ListenAble();
return 1;
}
int aEMJ_talk_end_chk(ACTOR* actor, GAME* play) {
EV_NPCMAJIN_ACTOR* majin = (EV_NPCMAJIN_ACTOR*)actor;
int res = 0;
if (mDemo_Check(10, actor) == 0) {
aEMJ_setup_think_proc(&majin->npc_class, 2);
res = 1;
}
return res;
}
+72
View File
@@ -0,0 +1,72 @@
#include "ac_npc_engineer.h"
#include "m_name_table.h"
#include "m_common_data.h"
extern void aNEG_actor_ct(ACTOR* actor, GAME* game);
extern void aNEG_actor_dt(ACTOR* actor, GAME* game);
extern void aNEG_actor_init(ACTOR* actor, GAME* game);
extern void aNEG_actor_save(ACTOR* actor, GAME* game);
ACTOR_PROFILE Npc_Engineer_Profile = {
mAc_PROFILE_NPC_ENGINEER,
ACTOR_PART_NPC,
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
EMPTY_NO,
ACTOR_OBJ_BANK_KEEP,
sizeof(NPCENGINEER_ACTOR),
aNEG_actor_ct,
aNEG_actor_dt,
aNEG_actor_init,
mActor_NONE_PROC1,
aNEG_actor_save,
};
void aNEG_actor_move(ACTOR*, GAME*);
void aNEG_actor_draw(ACTOR*, GAME*);
void aNEG_actor_ct(ACTOR* actor, GAME* game){
static aNPC_ct_data_c ct_data = {
&aNEG_actor_move,
&aNEG_actor_draw,
5,
NULL,
NULL,
NULL,
0,
};
NPCENGINEER_ACTOR* engineer = (NPCENGINEER_ACTOR*)actor;
if(Common_Get(clip.npc_clip)->birth_check_proc(actor,game) == TRUE){
engineer->npc_class.schedule.schedule_proc = (aNPC_SCHEDULE_PROC)mActor_NONE_PROC1;
Common_Get(clip.npc_clip)->ct_proc(actor,game,&ct_data);
engineer->npc_class.condition_info.demo_flg = -1;
engineer->npc_class.condition_info.hide_request = 0;
engineer->npc_class.palActorIgnoreTimer = -1;
engineer->npc_class.actor_class.status_data.weight = MASSTYPE_HEAVY;
engineer->npc_class.actor_class.shape_info.rotation.y = 0x4000;
engineer->npc_class.actor_class.world.angle.y = 0x4000;
engineer->npc_class.movement.mv_angl = 0x4000;
engineer->npc_class.request.act_priority = 4;
engineer->npc_class.request.act_idx = 0;
engineer->npc_class.request.act_type = 0;
}
}
void aNEG_actor_save(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->save_proc(actor,game);
}
void aNEG_actor_dt(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->dt_proc(actor,game);
}
void aNEG_actor_init(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->init_proc(actor,game);
}
void aNEG_actor_move(ACTOR* actor, GAME* game){
Common_Get(clip.npc_clip)->move_proc(actor,game);
}
void aNEG_actor_draw(ACTOR* actor, GAME* game) {
Common_Get(clip.npc_clip)->draw_proc(actor,game);
}