En_Hidden_Nuts (#705)

* En_Hidden_Nuts

* PR
This commit is contained in:
Maide
2022-03-26 02:04:42 +00:00
committed by GitHub
parent 69c0e15a45
commit 2746266881
4 changed files with 400 additions and 35 deletions
+1 -2
View File
@@ -4769,8 +4769,7 @@ beginseg
name "ovl_En_Hidden_Nuts"
compress
include "build/src/overlays/actors/ovl_En_Hidden_Nuts/z_en_hidden_nuts.o"
include "build/data/ovl_En_Hidden_Nuts/ovl_En_Hidden_Nuts.data.o"
include "build/data/ovl_En_Hidden_Nuts/ovl_En_Hidden_Nuts.reloc.o"
include "build/src/overlays/actors/ovl_En_Hidden_Nuts/ovl_En_Hidden_Nuts_reloc.o"
endseg
beginseg
@@ -5,6 +5,7 @@
*/
#include "z_en_hidden_nuts.h"
#include "objects/object_hintnuts/object_hintnuts.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_2000000)
@@ -15,15 +16,20 @@ void EnHiddenNuts_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnHiddenNuts_Update(Actor* thisx, GlobalContext* globalCtx);
void EnHiddenNuts_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_80BDB268(EnHiddenNuts* this);
void func_80BDB2B8(EnHiddenNuts* this, GlobalContext* globalCtx);
void func_80BDB580(EnHiddenNuts* this);
void func_80BDB59C(EnHiddenNuts* this, GlobalContext* globalCtx);
void func_80BDB788(EnHiddenNuts* this);
void func_80BDB7E8(EnHiddenNuts* this, GlobalContext* globalCtx);
void func_80BDB8F4(EnHiddenNuts* this, GlobalContext* globalCtx);
void func_80BDB930(EnHiddenNuts* this);
void func_80BDB978(EnHiddenNuts* this, GlobalContext* globalCtx);
void func_80BDBA28(EnHiddenNuts* this, GlobalContext* globalCtx);
void func_80BDBB48(EnHiddenNuts* this, GlobalContext* globalCtx);
void func_80BDBE70(EnHiddenNuts* this, GlobalContext* globalCtx);
void func_80BDBED4(EnHiddenNuts* this, GlobalContext* globalCtx);
#if 0
const ActorInit En_Hidden_Nuts_InitVars = {
ACTOR_EN_HIDDEN_NUTS,
ACTORCAT_PROP,
@@ -36,51 +42,397 @@ const ActorInit En_Hidden_Nuts_InitVars = {
(ActorFunc)EnHiddenNuts_Draw,
};
// static ColliderCylinderInit sCylinderInit = {
static ColliderCylinderInit D_80BDC0D0 = {
{ COLTYPE_NONE, AT_NONE, AC_NONE, OC1_ON | OC1_TYPE_PLAYER, OC2_TYPE_1, COLSHAPE_CYLINDER, },
{ ELEMTYPE_UNK0, { 0xF7CFFFFF, 0x00, 0x00 }, { 0xF7CFFFFF, 0x00, 0x00 }, TOUCH_NONE | TOUCH_SFX_NORMAL, BUMP_NONE, OCELEM_ON, },
static ColliderCylinderInit sCylinderInit = {
{
COLTYPE_NONE,
AT_NONE,
AC_NONE,
OC1_ON | OC1_TYPE_PLAYER,
OC2_TYPE_1,
COLSHAPE_CYLINDER,
},
{
ELEMTYPE_UNK0,
{ 0xF7CFFFFF, 0x00, 0x00 },
{ 0xF7CFFFFF, 0x00, 0x00 },
TOUCH_NONE | TOUCH_SFX_NORMAL,
BUMP_NONE,
OCELEM_ON,
},
{ 30, 20, 0, { 0, 0, 0 } },
};
#endif
static AnimationHeader* D_80BDC0FC[] = {
&object_hintnuts_Anim_000168, &object_hintnuts_Anim_0024CC, &object_hintnuts_Anim_0026C4,
&object_hintnuts_Anim_002894, &object_hintnuts_Anim_002B90, &object_hintnuts_Anim_002F7C,
&object_hintnuts_Anim_003128, &object_hintnuts_Anim_0029BC, &object_hintnuts_Anim_0024CC,
};
extern ColliderCylinderInit D_80BDC0D0;
u8 D_80BDC120[] = {
ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE,
ANIMMODE_LOOP, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP,
};
extern UNK_TYPE D_060024CC;
void EnHiddenNuts_Init(Actor* thisx, GlobalContext* globalCtx) {
EnHiddenNuts* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/EnHiddenNuts_Init.s")
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f);
SkelAnime_Init(globalCtx, &this->skelAnime, &object_hintnuts_Skel_0023B8.sh, &object_hintnuts_Anim_0024CC,
this->jointTable, this->morphTable, 10);
Actor_SetScale(&this->actor, 0.01f);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/EnHiddenNuts_Destroy.s")
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->actor.targetMode = 0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB1B4.s")
Collider_InitAndSetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB268.s")
this->unk_21E = ENHIDDENNUTS_GET_F80(&this->actor);
this->switchFlag = ENHIDDENNUTS_GET_SWITCHFLAG(&this->actor);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB2B8.s")
if (this->switchFlag == 0x7F) {
this->switchFlag = -1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB580.s")
if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) {
Actor_MarkForDeath(&this->actor);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB59C.s")
if (this->unk_21E == 0x1F) {
Actor_MarkForDeath(&this->actor);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB788.s")
this->path = func_8013D648(globalCtx, this->unk_21E, 0x3F);
this->unk_226 = this->actor.cutscene;
func_801A5080(2);
func_80BDB268(this);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB7E8.s")
void EnHiddenNuts_Destroy(Actor* thisx, GlobalContext* globalCtx) {
EnHiddenNuts* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB8F4.s")
Collider_DestroyCylinder(globalCtx, &this->collider);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB930.s")
void func_80BDB1B4(EnHiddenNuts* this, s32 arg1) {
f32 sp34;
f32 sp30;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDB978.s")
this->unk_220 = arg1;
sp34 = 0.0f;
sp30 = -4.0f;
this->unk_22C = Animation_GetLastFrame(D_80BDC0FC[arg1]);
if (this->unk_220 == 1) {
sp34 = this->unk_22C;
sp30 = 0.0f;
}
Animation_Change(&this->skelAnime, D_80BDC0FC[this->unk_220], 1.0f, sp34, this->unk_22C, D_80BDC120[this->unk_220],
sp30);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDBA28.s")
void func_80BDB268(EnHiddenNuts* this) {
this->actor.textId = 0x234;
this->unk_228 = 1600.0f;
this->actor.shape.yOffset = 1600.0f;
func_80BDB1B4(this, 1);
this->unk_21A = 0;
this->actionFunc = func_80BDB2B8;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDBB48.s")
void func_80BDB2B8(EnHiddenNuts* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
s32 i;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDBE70.s")
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/func_80BDBED4.s")
if (player->stateFlags2 & 0x8000000) {
if (this->unk_20A == 0) {
play_sound(NA_SE_SY_TRE_BOX_APPEAR);
this->unk_20A = 1;
}
} else {
this->unk_20A = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/EnHiddenNuts_Update.s")
if (Actor_ProcessTalkRequest(&this->actor, &globalCtx->state) != 0) {
func_80BDB580(this);
return;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Hidden_Nuts/EnHiddenNuts_Draw.s")
if (this->unk_218 == 0) {
Vec3f sp94 = { 0.0f, 0.0f, 0.0f };
Vec3f sp88 = { 0.0f, 0.0f, 0.0f };
Color_RGBA8 sp84 = { 255, 255, 255, 255 };
Color_RGBA8 sp80 = { 150, 150, 150, 0 };
Vec3f sp74;
for (i = 0; i < 3; i++) {
sp94.y = Rand_ZeroFloat(1.0f) + 1.0f;
Math_Vec3f_Copy(&sp74, &this->actor.world.pos);
sp74.x += randPlusMinusPoint5Scaled(15.0f);
sp74.z += randPlusMinusPoint5Scaled(15.0f);
EffectSsDtBubble_SpawnCustomColor(globalCtx, &sp74, &sp94, &sp88, &sp84, &sp80, Rand_S16Offset(120, 90), 30,
1);
}
this->unk_218 = 30;
}
if (!(this->actor.xzDistToPlayer > 120.0f)) {
if ((globalCtx->msgCtx.ocarinaMode == 3) && (globalCtx->msgCtx.unk1202E == 0)) {
globalCtx->msgCtx.ocarinaMode = 4;
func_80BDB788(this);
} else if (func_801A5100() == 2) {
func_80BDB788(this);
} else {
func_800B8614(&this->actor, globalCtx, BREG(13) + 100.0f);
}
}
}
void func_80BDB580(EnHiddenNuts* this) {
this->unk_21A = 1;
this->actionFunc = func_80BDB59C;
}
void func_80BDB59C(EnHiddenNuts* this, GlobalContext* globalCtx) {
s32 i;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NEMURI_SLEEP - SFX_FLAG);
if (this->unk_218 == 0) {
Vec3f sp98 = { 0.0f, 0.0f, 0.0f };
Vec3f sp8C = { 0.0f, 0.0f, 0.0f };
Color_RGBA8 sp88 = { 255, 255, 255, 255 };
Color_RGBA8 sp84 = { 150, 150, 150, 0 };
Vec3f sp78;
for (i = 0; i < 3; i++) {
sp98.y = Rand_ZeroFloat(1.0f) + 1.0f;
Math_Vec3f_Copy(&sp78, &this->actor.world.pos);
sp78.x += randPlusMinusPoint5Scaled(15.0f);
sp78.z += randPlusMinusPoint5Scaled(15.0f);
EffectSsDtBubble_SpawnCustomColor(globalCtx, &sp78, &sp98, &sp8C, &sp88, &sp84, Rand_S16Offset(120, 90), 30,
1);
}
this->unk_218 = 30;
}
if ((Message_GetState(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) {
func_801477B4(globalCtx);
func_80BDB268(this);
}
}
void func_80BDB788(EnHiddenNuts* this) {
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_8000000;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP);
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DEAD);
this->unk_21A = 2;
this->actionFunc = func_80BDB7E8;
}
void func_80BDB7E8(EnHiddenNuts* this, GlobalContext* globalCtx) {
Vec3f sp3C;
if (ActorCutscene_GetCurrentIndex() == 0x7C) {
ActorCutscene_Stop(0x7C);
ActorCutscene_SetIntentToPlay(this->unk_226);
return;
}
if (!ActorCutscene_GetCanPlayNext(this->unk_226)) {
ActorCutscene_SetIntentToPlay(this->unk_226);
return;
}
ActorCutscene_StartAndSetUnkLinkFields(this->unk_226, &this->actor);
this->unk_228 = -1200.0f;
Math_Vec3f_Copy(&sp3C, &this->actor.world.pos);
sp3C.y = this->actor.floorHeight + 30.0f;
EffectSsHahen_SpawnBurst(globalCtx, &sp3C, 4.0f, 0, 10, 3, 15, -1, 10, NULL);
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP);
func_80BDB1B4(this, 7);
this->actionFunc = func_80BDB8F4;
}
void func_80BDB8F4(EnHiddenNuts* this, GlobalContext* globalCtx) {
f32 curFrame = this->skelAnime.curFrame;
if (this->unk_22C <= curFrame) {
func_80BDB930(this);
}
}
void func_80BDB930(EnHiddenNuts* this) {
func_80BDB1B4(this, 3);
this->unk_21A = 3;
this->unk_228 = 500.0f;
this->actionFunc = func_80BDB978;
}
void func_80BDB978(EnHiddenNuts* this, GlobalContext* globalCtx) {
f32 curFrame = this->skelAnime.curFrame;
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 8.0f) ||
Animation_OnFrame(&this->skelAnime, 18.0f)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUT_FAINT);
}
if (this->unk_22C <= curFrame) {
this->unk_224++;
if (this->unk_224 >= 2) {
func_80BDBA28(this, globalCtx);
}
}
}
void func_80BDBA28(EnHiddenNuts* this, GlobalContext* globalCtx) {
Vec3f sp44;
func_80BDB1B4(this, 2);
this->unk_228 = 0.0f;
Math_Vec3f_Copy(&sp44, &this->actor.world.pos);
sp44.y = this->actor.floorHeight + 30.0f;
EffectSsHahen_SpawnBurst(globalCtx, &sp44, 4.0f, 0, 10, 3, 15, -1, 10, NULL);
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_UP);
this->unk_208 = 1;
if ((this->path != NULL) && !func_8013D68C(this->path, this->unk_208, &this->unk_20C)) {
Actor_MarkForDeath(&this->actor);
}
this->actor.speedXZ = 2.0f;
this->actor.gravity = -2.0f;
this->actor.velocity.y = 4.0f;
this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_20C);
this->unk_21A = 4;
this->actionFunc = func_80BDBB48;
}
void func_80BDBB48(EnHiddenNuts* this, GlobalContext* globalCtx) {
s32 pad[3];
f32 sp58 = this->skelAnime.curFrame;
WaterBox* sp54;
f32 sp50;
s16 sp4E = 0;
Vec3f sp40;
if (WaterBox_GetSurface1(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, &sp50,
&sp54) &&
(this->actor.world.pos.y < sp50)) {
this->actor.velocity.y = 0.0f;
Math_Vec3f_Copy(&sp40, &this->actor.world.pos);
sp40.y = sp50;
this->actor.gravity = 0.0f;
if ((globalCtx->gameplayFrames % 8) == 0) {
EffectSsGRipple_Spawn(globalCtx, &sp40, 650, 3150, 0);
}
if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) ||
Animation_OnFrame(&this->skelAnime, 10.0f)) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_WALK_WATER);
sp4E = 1;
}
}
if ((sp4E != 0) && (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 5.0f) ||
Animation_OnFrame(&this->skelAnime, 10.0f))) {
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_WALK);
}
Math_SmoothStepToS(&this->actor.world.rot.y, Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_20C), 1, 0x1388, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 1, 0x3E8, 0);
if (this->unk_220 == 2) {
if (this->unk_22C <= sp58) {
this->actor.speedXZ = 0.0f;
this->actor.velocity.y = 0.0f;
func_80BDB1B4(this, 6);
}
} else {
Math_ApproachF(&this->actor.world.pos.x, this->unk_20C.x, 0.5f,
fabsf(Math_SinS(this->actor.world.rot.y) * (BREG(33) + 8.0f)));
Math_ApproachF(&this->actor.world.pos.z, this->unk_20C.z, 0.5f,
fabsf(Math_CosS(this->actor.world.rot.y) * (BREG(33) + 8.0f)));
if ((sqrtf(SQ(this->actor.world.pos.x - this->unk_20C.x) + SQ(this->actor.world.pos.z - this->unk_20C.z)) <
4.0f) &&
(this->path != NULL)) {
this->unk_208++;
if (this->unk_208 >= this->path->count) {
func_80BDBE70(this, globalCtx);
} else if ((this->path != NULL) && !func_8013D68C(this->path, this->unk_208, &this->unk_20C)) {
Actor_MarkForDeath(&this->actor);
}
}
}
}
void func_80BDBE70(EnHiddenNuts* this, GlobalContext* globalCtx) {
if (this->switchFlag >= 0) {
Flags_SetSwitch(globalCtx, this->switchFlag);
}
func_80BDB1B4(this, 8);
this->unk_21A = 5;
this->actionFunc = func_80BDBED4;
}
void func_80BDBED4(EnHiddenNuts* this, GlobalContext* globalCtx) {
f32 curFrame = this->skelAnime.curFrame;
Vec3f sp38;
if (this->unk_22C <= curFrame) {
Math_Vec3f_Copy(&sp38, &this->actor.world.pos);
sp38.y = this->actor.floorHeight;
Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_NUTS_DOWN);
EffectSsHahen_SpawnBurst(globalCtx, &sp38, 4.0f, 0, 10, 3, 15, -1, 10, NULL);
Actor_MarkForDeath(&this->actor);
}
}
void EnHiddenNuts_Update(Actor* thisx, GlobalContext* globalCtx) {
s32 pad;
EnHiddenNuts* this = THIS;
if (this->unk_218 != 0) {
this->unk_218--;
}
Actor_SetFocus(&this->actor, 20.0f);
SkelAnime_Update(&this->skelAnime);
this->actionFunc(this, globalCtx);
Math_ApproachF(&this->actor.shape.yOffset, this->unk_228, 0.5f, 200.0f);
if (this->unk_21A >= 4) {
Actor_MoveWithGravity(&this->actor);
Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 40.0f, 0x1D);
}
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
void EnHiddenNuts_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnHiddenNuts* this = THIS;
func_8012C28C(globalCtx->state.gfxCtx);
SkelAnime_DrawOpa(globalCtx, this->skelAnime.skeleton, this->skelAnime.jointTable, NULL, NULL, &this->actor);
}
@@ -7,11 +7,30 @@ struct EnHiddenNuts;
typedef void (*EnHiddenNutsActionFunc)(struct EnHiddenNuts*, GlobalContext*);
#define ENHIDDENNUTS_GET_SWITCHFLAG(thisx) ((thisx)->params & 0x7F)
#define ENHIDDENNUTS_GET_F80(thisx) (((thisx)->params >> 7) & 0x1F)
typedef struct EnHiddenNuts {
/* 0x0000 */ Actor actor;
/* 0x0144 */ char unk_144[0xBC];
/* 0x0144 */ SkelAnime skelAnime;
/* 0x0188 */ Vec3s jointTable[10];
/* 0x01C4 */ Vec3s morphTable[10];
/* 0x0200 */ EnHiddenNutsActionFunc actionFunc;
/* 0x0204 */ char unk_204[0x7C];
/* 0x0204 */ Path* path;
/* 0x0208 */ s16 unk_208;
/* 0x020A */ u8 unk_20A;
/* 0x020C */ Vec3f unk_20C;
/* 0x0218 */ s16 unk_218;
/* 0x021A */ s16 unk_21A;
/* 0x021C */ s16 switchFlag;
/* 0x021E */ s16 unk_21E;
/* 0x0220 */ s32 unk_220;
/* 0x0224 */ s16 unk_224;
/* 0x0226 */ s16 unk_226;
/* 0x0228 */ f32 unk_228;
/* 0x022C */ f32 unk_22C;
/* 0x0230 */ UNK_TYPE1 unk230[4];
/* 0x0234 */ ColliderCylinder collider;
} EnHiddenNuts; // size = 0x280
extern const ActorInit En_Hidden_Nuts_InitVars;
-5
View File
@@ -1314,11 +1314,6 @@ D_0600B644 = 0x0600B644;
D_0600F248 = 0x0600F248;
D_06012A58 = 0x06012A58;
// ovl_En_Hidden_Nuts
D_060023B8 = 0x060023B8;
D_060024CC = 0x060024CC;
// ovl_En_Horse
D_06008C68 = 0x06008C68;