mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Merge pull request #207 from Cuyler36/ac_ev_castaway
Implement & link ac_ev_castaway
This commit is contained in:
@@ -549,6 +549,10 @@ ac_aprilfool_control.c:
|
||||
ac_groundhog_control.c:
|
||||
.text: [0x805155C8, 0x80515C48]
|
||||
.data: [0x8069FD88, 0x8069FDD0]
|
||||
ac_ev_castaway.c:
|
||||
.text: [0x8051CAC4, 0x8051CDCC]
|
||||
.rodata: [0x806491B0, 0x806491B8]
|
||||
.data: [0x806A03A0, 0x806A03F8]
|
||||
ac_ev_dokutu.c:
|
||||
.text: [0x8051DFF4, 0x8051E228]
|
||||
.data: [0x806A05C8, 0x806A0608]
|
||||
|
||||
@@ -3,11 +3,19 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "m_actor.h"
|
||||
#include "ac_npc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ev_castaway_s EV_CASTAWAY_ACTOR;
|
||||
|
||||
struct ev_castaway_s {
|
||||
NPC_ACTOR npc_class;
|
||||
s16 bobbing_cycle;
|
||||
};
|
||||
|
||||
extern ACTOR_PROFILE Ev_Castaway_Profile;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
+4
-3
@@ -16,6 +16,7 @@ extern "C" {
|
||||
#define aNPC_SPNPC_BIT_CURATOR 0
|
||||
#define aNPC_SPNPC_BIT_GOHOME_NPC 1
|
||||
#define aNPC_SPNPC_BIT_MASK_CAT 2
|
||||
#define aNPC_SPNPC_BIT_CASTAWAY 4
|
||||
#define aNPC_SPNPC_BIT_EV_SONCHO 5
|
||||
|
||||
#define aNPC_SPNPC_BIT_GET(field, bit) (((field) >> (bit)) & 1)
|
||||
@@ -141,7 +142,7 @@ typedef struct npc_draw_info_s {
|
||||
/* 0x000 */ u8 _000[0x20 - 0];
|
||||
/* 0x020 */ f32 _20;
|
||||
/* 0x024 */ f32 _24;
|
||||
/* 0x024 */ u8 _028[0x534 - 0x028];
|
||||
/* 0x028 */ u8 _028[0x534 - 0x028];
|
||||
/* 0x538 */ u8 _534;
|
||||
/* 0x538 */ u8 _535;
|
||||
/* 0x538 */ u8 _536;
|
||||
@@ -149,13 +150,13 @@ typedef struct npc_draw_info_s {
|
||||
/* 0x538 */ u8 _538;
|
||||
/* 0x538 */ u8 _539;
|
||||
/* 0x540 */ u8 _53A[0x580 - 0x53A];
|
||||
/* 0x580 */ int _580;
|
||||
/* 0x580 */ int animation_id;
|
||||
/* 0x584 */ int texture_bank_idx;
|
||||
/* 0x588 */ u8 _588[0x5BD - 0x588];
|
||||
/* 0x5BD */ u8 _5BD;
|
||||
/* 0x5BE */ u8 _5BE;
|
||||
/* 0x5BE */ u8 _5BF[0x630 - 0x5BF];
|
||||
} aNPC_draw_info_c;
|
||||
} aNPC_draw_info_c;
|
||||
|
||||
|
||||
typedef void (*aNPC_THINK_PROC)(NPC_ACTOR*, GAME_PLAY*, int);
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#include "ac_ev_castaway.h"
|
||||
|
||||
#include "m_common_data.h"
|
||||
|
||||
static void aECST_actor_ct(ACTOR* actorx, GAME* game);
|
||||
static void aECST_actor_dt(ACTOR* actorx, GAME* game);
|
||||
static void aECST_actor_init(ACTOR* actorx, GAME* game);
|
||||
static void aECST_actor_move(ACTOR* actorx, GAME* game);
|
||||
static void aECST_actor_draw(ACTOR* actorx, GAME* game);
|
||||
static void aECST_actor_save(ACTOR* actorx, GAME* game);
|
||||
|
||||
ACTOR_PROFILE Ev_Castaway_Profile = {
|
||||
mAc_PROFILE_EV_CASTAWAY,
|
||||
ACTOR_PART_NPC,
|
||||
ACTOR_STATE_CAN_MOVE_IN_DEMO_SCENES | ACTOR_STATE_NO_MOVE_WHILE_CULLED,
|
||||
EMPTY_NO,
|
||||
ACTOR_OBJ_BANK_KEEP,
|
||||
sizeof(EV_CASTAWAY_ACTOR),
|
||||
&aECST_actor_ct,
|
||||
&aECST_actor_dt,
|
||||
&aECST_actor_init,
|
||||
mActor_NONE_PROC1,
|
||||
&aECST_actor_save
|
||||
};
|
||||
|
||||
static void aECST_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int type);
|
||||
|
||||
static void aECST_actor_ct(ACTOR* actorx, GAME* game) {
|
||||
static aNPC_ct_data_c ct_data = {
|
||||
&aECST_actor_move,
|
||||
&aECST_actor_draw,
|
||||
5,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
0
|
||||
};
|
||||
|
||||
static xyz_t def_pos = { 3580.0f, 0.0f, 4670.0f }; // 'G-5' @ 9-4
|
||||
|
||||
EV_CASTAWAY_ACTOR* castaway = (EV_CASTAWAY_ACTOR*)actorx;
|
||||
|
||||
if ((*Common_Get(clip).npc_clip->birth_check_proc)(actorx, game) == TRUE) {
|
||||
castaway->npc_class.schedule.schedule_proc = &aECST_schedule_proc;
|
||||
(*Common_Get(clip).npc_clip->ct_proc)(actorx, game, &ct_data);
|
||||
castaway->npc_class.condition_info.demo_flg = ~aNPC_COND_DEMO_SKIP_MOVE_Y; // is this a mistake?
|
||||
castaway->npc_class.condition_info.hide_request = FALSE;
|
||||
castaway->npc_class.palActorIgnoreTimer = -1;
|
||||
aNPC_SPNPC_BIT_SET(Common_Get(spnpc_first_talk_flags), aNPC_SPNPC_BIT_CASTAWAY);
|
||||
actorx->status_data.weight = 254;
|
||||
actorx->gravity = 0.0f;
|
||||
actorx->max_velocity_y = 0.0f;
|
||||
actorx->shape_info.rotation.y = DEG2SHORT_ANGLE(68.027344f); // 0x3060
|
||||
actorx->world.angle.y = DEG2SHORT_ANGLE(68.027344f); // 0x3060
|
||||
castaway->npc_class.movement.mv_angl = DEG2SHORT_ANGLE(68.027344f); // 0x3060
|
||||
actorx->world.position = def_pos;
|
||||
actorx->home.position = def_pos;
|
||||
}
|
||||
}
|
||||
|
||||
static void aECST_actor_save(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->save_proc)(actorx, game);
|
||||
}
|
||||
|
||||
static void aECST_actor_dt(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->dt_proc)(actorx, game);
|
||||
}
|
||||
|
||||
static void aECST_actor_init(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->init_proc)(actorx, game);
|
||||
}
|
||||
|
||||
static void aECST_schedule_main_proc(NPC_ACTOR* actorx, GAME_PLAY* play) {
|
||||
if (actorx->draw.animation_id != 116) {
|
||||
(*Common_Get(clip).npc_clip->animation_init_proc)((ACTOR*)actorx, 116, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static void aECST_schedule_proc(NPC_ACTOR* actorx, GAME_PLAY* play, int type) {
|
||||
static aNPC_SUB_PROC sched_proc[2] = {
|
||||
(aNPC_SUB_PROC)&none_proc1,
|
||||
aECST_schedule_main_proc
|
||||
};
|
||||
|
||||
(*sched_proc[type])(actorx, play);
|
||||
}
|
||||
|
||||
static void aECST_actor_move(ACTOR* actorx, GAME* game) {
|
||||
EV_CASTAWAY_ACTOR* castaway = (EV_CASTAWAY_ACTOR*)actorx;
|
||||
s16 cycle = castaway->bobbing_cycle;
|
||||
|
||||
cycle += 512;
|
||||
actorx->position_speed.y = (actorx->home.position.y + 4.0f + sin_s(cycle) * 4.0f) - actorx->world.position.y;
|
||||
castaway->bobbing_cycle = cycle;
|
||||
(*Common_Get(clip).npc_clip->move_proc)(actorx, game);
|
||||
}
|
||||
|
||||
static void aECST_actor_draw(ACTOR* actorx, GAME* game) {
|
||||
(*Common_Get(clip).npc_clip->draw_proc)(actorx, game);
|
||||
}
|
||||
+1
-1
@@ -108,7 +108,7 @@ void aNRTC_actor_move(ACTOR* actor, GAME* game){
|
||||
GAME_PLAY* play = (GAME_PLAY*)game;
|
||||
|
||||
|
||||
if(rtc->npc_class.draw._580 == 0x76){
|
||||
if(rtc->npc_class.draw.animation_id == 0x76){
|
||||
sAdos_GetStaffRollInfo(&info);
|
||||
if(info.unk0 != 4){
|
||||
val = 0.0f;
|
||||
|
||||
@@ -326,10 +326,10 @@ int aNRTC_talk_end_chk(ACTOR* actor,GAME* game){
|
||||
}
|
||||
if (mDemo_Get_OrderValue(4, 0) == 0) {
|
||||
if (unk9AC >= 0x258) {
|
||||
if ( rtc->npc_class.draw._580 != 0x76) {
|
||||
if ( rtc->npc_class.draw.animation_id != 0x76) {
|
||||
mDemo_Set_OrderValue(4, 0, 0xFF);
|
||||
}
|
||||
} else if (rtc->npc_class.draw._580 == 0x76) {
|
||||
} else if (rtc->npc_class.draw.animation_id == 0x76) {
|
||||
mDemo_Set_OrderValue(4, 0, 0xFD);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user