diff --git a/assets/xml/objects/object_fall2.xml b/assets/xml/objects/object_fall2.xml index 4e58e9fd3e..25439a50ad 100644 --- a/assets/xml/objects/object_fall2.xml +++ b/assets/xml/objects/object_fall2.xml @@ -11,7 +11,11 @@ - + + + + + @@ -25,5 +29,6 @@ + diff --git a/include/functions.h b/include/functions.h index 6cd05f12d5..e437b1eca7 100644 --- a/include/functions.h +++ b/include/functions.h @@ -3001,7 +3001,7 @@ void func_80183070(void); // void func_801832B0(void); // void func_8018332C(void); // void func_8018340C(void); -void func_80183430(SkeletonInfo* skeletonInfo, void* arg1, void* arg2, Vec3s* arg3, s16* arg4, UnkKeyframeCallback* callbacks); +void func_80183430(SkeletonInfo* skeletonInfo, void* arg1, void* arg2, Vec3s* arg3, Vec3s* arg4, UnkKeyframeCallback* callbacks); void func_8018349C(UNK_PTR arg0); void func_801834A8(SkeletonInfo* skeletonInfo, void* arg1); // void func_80183510(void); diff --git a/spec b/spec index ea17431258..f0b3153b75 100644 --- a/spec +++ b/spec @@ -5071,8 +5071,7 @@ beginseg name "ovl_En_Fall2" compress include "build/src/overlays/actors/ovl_En_Fall2/z_en_fall2.o" - include "build/data/ovl_En_Fall2/ovl_En_Fall2.data.o" - include "build/data/ovl_En_Fall2/ovl_En_Fall2.reloc.o" + include "build/src/overlays/actors/ovl_En_Fall2/ovl_En_Fall2_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h index b9625d75e8..b5c90371cd 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h @@ -24,7 +24,7 @@ typedef struct DemoSyoten { /* 0x0000 */ Actor actor; /* 0x0144 */ SkeletonInfo unk_144; /* 0x0174 */ Vec3s unk_174[51]; - /* 0x02A6 */ s16 unk_2A6[153]; + /* 0x02A6 */ Vec3s unk_2A6[51]; /* 0x03D8 */ f32 unk_3D8; /* 0x03DC */ Gfx* unk_3DC; /* 0x03E0 */ AnimatedMaterial* unk_3E0; diff --git a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c index dac233f969..58ab4e5916 100644 --- a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c +++ b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.c @@ -15,7 +15,12 @@ void EnFall2_Destroy(Actor* thisx, PlayState* play); void EnFall2_Update(Actor* thisx, PlayState* play); void EnFall2_Draw(Actor* thisx, PlayState* play); -#if 0 +void func_80C1B724(f32 arg0); +void EnFall2_DoNothing(EnFall2* this, PlayState* play); +void func_80C1B9D4(EnFall2* this, PlayState* play); +void func_80C1B8F0(EnFall2* this); +void func_80C1B9D4(EnFall2* this, PlayState* play); + const ActorInit En_Fall2_InitVars = { ACTOR_EN_FALL2, ACTORCAT_ITEMACTION, @@ -28,26 +33,137 @@ const ActorInit En_Fall2_InitVars = { (ActorFunc)EnFall2_Draw, }; -#endif +void EnFall2_Init(Actor* thisx, PlayState* play) { + EnFall2* this = THIS; -extern UNK_TYPE D_06005EF4; -extern UNK_TYPE D_06005F10; -extern UNK_TYPE D_06008840; + Actor_SetScale(&this->actor, 1.0f); + this->actionFunc = EnFall2_DoNothing; + func_80183430(&this->skeletonInfo, object_fall2_Blob_008898, object_fall2_Blob_005EF4, this->unk174, this->unk228, + NULL); + func_801835EC(&this->skeletonInfo, object_fall2_Blob_005EF4); + this->unk2DC = Lib_SegmentedToVirtual(object_fall2_Matanimheader_008840); + Actor_SetScale(&this->actor, 0.02f); + this->actionFunc = func_80C1B9D4; + this->csActionIndex = 0x231; + this->alphaLevel = 0.0f; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fall2/EnFall2_Init.s") +void EnFall2_Destroy(Actor* thisx, PlayState* play) { + EnFall2* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fall2/EnFall2_Destroy.s") + func_8018349C(&this->skeletonInfo); +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fall2/func_80C1B724.s") +u8 sAlphaTableIndices[] = { + 0, 2, 0, 0, 4, 0, 4, 4, 2, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 2, 0, 4, 2, 2, 0, 4, 4, 4, 4, 0, 2, 2, 4, 0, 2, + 0, 4, 4, 2, 0, 2, 4, 4, 4, 2, 0, 4, 4, 4, 2, 2, 0, 4, 4, 2, 4, 0, 2, 0, 0, 2, 4, 4, 2, 0, 2, 4, 4, 4, 2, + 0, 4, 4, 4, 4, 4, 2, 2, 0, 2, 4, 0, 2, 0, 0, 2, 4, 4, 2, 0, 2, 4, 4, 4, 2, 0, 0, 2, 2, 4, 4, 4, 4, 4, 4, + 2, 0, 2, 0, 0, 2, 4, 4, 2, 0, 2, 4, 4, 4, 2, 0, 2, 0, 5, 2, 5, 5, 5, 5, 0, 2, 5, 0, 2, 0, 2, 5, 5, 2, 0, + 2, 5, 5, 5, 2, 0, 3, 3, 3, 2, 2, 0, 0, 3, 3, 0, 2, 2, 3, 0, 2, 3, 3, 2, 0, 2, 3, 3, 3, 2, 0, 2, 2, 2, 2, + 0, 2, 2, 2, 2, 2, 0, 0, 2, 0, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fall2/func_80C1B8A4.s") +void func_80C1B724(f32 arg0) { + Vtx* vertex = Lib_SegmentedToVirtual(object_fall2_Vtx_005F10); + u8 perVertexAlphaTable[6]; + s32 i; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fall2/func_80C1B8B4.s") + if (arg0 > 1.0f) { + arg0 = 1.0f; + } + if (arg0 < 0.0f) { + arg0 = 0.0f; + } + perVertexAlphaTable[0] = 0; + perVertexAlphaTable[1] = (s8)(54.0f * arg0); + perVertexAlphaTable[2] = (s8)(104.0f * arg0); + perVertexAlphaTable[3] = (s8)(155.0f * arg0); + perVertexAlphaTable[4] = (s8)(255.0f * arg0); + perVertexAlphaTable[5] = (s8)(205.0f * arg0); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fall2/func_80C1B8F0.s") + for (i = 0; i < ARRAY_COUNT(sAlphaTableIndices); i++, vertex++) { + vertex->v.cn[3] = perVertexAlphaTable[sAlphaTableIndices[i]]; + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fall2/func_80C1B9D4.s") +void EnFall2_DoNothing(EnFall2* this, PlayState* play) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fall2/EnFall2_Update.s") +void func_80C1B8B4(EnFall2* this) { + this->actor.draw = EnFall2_Draw; + if (this->csActorAction == 1) { + Actor_SetScale(&this->actor, 0.02f); + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Fall2/EnFall2_Draw.s") +void func_80C1B8F0(EnFall2* this) { + switch (this->csActorAction) { + case 1: + if (this->alphaLevel < 1.0f) { + this->alphaLevel += 1.0f / 30.0f; + } else { + this->alphaLevel = 1.0f; + } + break; + case 2: + if (this->alphaLevel > 0.0f) { + this->alphaLevel -= 0.1f; + if (this->alphaLevel < 0.0f) { + this->alphaLevel = 0.0f; + } + } + if (this->actor.scale.x > 0.0f) { + this->actor.scale.x -= 20.0f * 0.0001f; + if (this->actor.scale.x < 0.0f) { + this->actor.scale.x = 0.0f; + } + this->actor.scale.z = this->actor.scale.x; + } + } +} + +void func_80C1B9D4(EnFall2* this, PlayState* play) { + func_80183DE0(&this->skeletonInfo); + if (Cutscene_CheckActorAction(play, this->csActionIndex)) { + Cutscene_ActorTranslateAndYaw(&this->actor, play, Cutscene_GetActorActionIndex(play, this->csActionIndex)); + if (this->csActorAction != + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionIndex)]->action) { + this->csActorAction = + play->csCtx.actorActions[Cutscene_GetActorActionIndex(play, this->csActionIndex)]->action; + func_80C1B8B4(this); + } + func_80C1B8F0(this); + if (this->alphaLevel > 0.0f) { + func_800B9010(&this->actor, NA_SE_EV_MOON_LIGHT_PILLAR - SFX_FLAG); + } + } else { + this->actor.draw = NULL; + } + func_80C1B724(this->alphaLevel); +} + +void EnFall2_Update(Actor* thisx, PlayState* play) { + EnFall2* this = THIS; + + this->actionFunc(this, play); +} + +void EnFall2_Draw(Actor* thisx, PlayState* play) { + s32 pad; + EnFall2* this = THIS; + Mtx* mtx; + + if (!(this->alphaLevel <= 0.0f)) { + func_8012C2DC(play->state.gfxCtx); + AnimatedMat_DrawXlu(play, Lib_SegmentedToVirtual(object_fall2_Matanimheader_008840)); + + mtx = GRAPH_ALLOC(play->state.gfxCtx, ALIGN16(this->skeletonInfo.unk_18->unk_1 * sizeof(Mtx))); + + if (mtx != NULL) { + func_8012C2DC(play->state.gfxCtx); + Matrix_RotateYS((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000), MTXMODE_APPLY); + func_8018450C(play, &this->skeletonInfo, mtx, NULL, NULL, &this->actor); + } + } +} diff --git a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h index 5c489bd7cf..5ac33b27de 100644 --- a/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h +++ b/src/overlays/actors/ovl_En_Fall2/z_en_fall2.h @@ -2,15 +2,22 @@ #define Z_EN_FALL2_H #include "global.h" +#include "assets/objects/object_fall2/object_fall2.h" struct EnFall2; typedef void (*EnFall2ActionFunc)(struct EnFall2*, PlayState*); typedef struct EnFall2 { - /* 0x0000 */ Actor actor; - /* 0x0144 */ char unk_144[0x1A4]; - /* 0x02E8 */ EnFall2ActionFunc actionFunc; + /* 0x000 */ Actor actor; + /* 0x144 */ SkeletonInfo skeletonInfo; + /* 0x174 */ Vec3s unk174[30]; + /* 0x228 */ Vec3s unk228[30]; + /* 0x2DC */ AnimatedMaterial* unk2DC; + /* 0x2E0 */ f32 alphaLevel; + /* 0x2E4 */ s16 csActorAction; + /* 0x2E6 */ u16 csActionIndex; + /* 0x2E8 */ EnFall2ActionFunc actionFunc; } EnFall2; // size = 0x2EC extern const ActorInit En_Fall2_InitVars; diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.h b/src/overlays/actors/ovl_En_Test/z_en_test.h index bcb0c4a1e4..e01c44c6ab 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.h +++ b/src/overlays/actors/ovl_En_Test/z_en_test.h @@ -21,7 +21,7 @@ typedef struct EnTest { /* 0x144 */ SkeletonInfo skeletonInfo; /* 0x174 */ s32 unk_174; /* 0x178 */ Vec3s unk_178[12]; - /* 0x1C0 */ s16 unk_1C0[36]; + /* 0x1C0 */ Vec3s unk_1C0[12]; /* 0x208 */ u8 unk_208; /* 0x209 */ u8 unk_209; /* 0x20A */ u8 unk_20A; diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.h b/src/overlays/actors/ovl_En_Test7/z_en_test7.h index ed12ab059f..e35c252290 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.h +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.h @@ -47,7 +47,7 @@ typedef struct EnTest7 { /* 0x015C */ EnTest7Struct2 unk_15C[100]; /* 0x18CC */ SkeletonInfo unk_18CC; /* 0x18FC */ Vec3s unk_18FC[114]; - /* 0x1BA8 */ s16 unk_1BA8[342]; + /* 0x1BA8 */ Vec3s unk_1BA8[114]; /* 0x1E54 */ s32 unk_1E54; /* 0x1E58 */ EnTest7UnkFunc unk_1E58; /* 0x1E5C */ EnTest7ActionFunc actionFunc;