ovl_En_Fall2 OK (#916)

* `ovl_En_Fall2` decompiled

* Suggested changes

* Minor suggestions

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>

* Don't commit directly from github

* Define vertices in xml, add macro

Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
Lucas 2022-07-11 22:44:19 -04:00 committed by GitHub
parent 6616f542f1
commit 2995d72965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 151 additions and 24 deletions

View File

@ -11,7 +11,11 @@
<Texture Name="gOpenMouthMoonFarSideTex" OutName="open_mouth_moon_far_side" Format="ci4" Width="64" Height="64" Offset="0x3CE8" />
<Texture Name="gOpenMouthMoonFaceTex" OutName="open_mouth_moon_face" Format="ci4" Width="64" Height="64" Offset="0x44E8" />
<Texture Name="gOpenMouthMoonTeethTex" OutName="open_mouth_moon_teeth" Format="rgba16" Width="64" Height="32" Offset="0x4CE8" />
<!-- <Blob Name="object_fall2_Blob_005CE8" Size="0x228" Offset="0x5CE8" /> -->
<!-- <Blob Name="object_fall2_Blob_005CE8" Size="0x20C" Offset="0x5CE8" /> -->
<Blob Name="object_fall2_Blob_005EF4" Size="0x1C" Offset="0x5EF4" />
<Array Name="object_fall2_Vtx_005F10" Count="239" Offset="0x5F10">
<Vtx />
</Array>
<DList Name="object_fall2_DL_006E00" Offset="0x6E00" />
<DList Name="object_fall2_DL_006EF0" Offset="0x6EF0" />
<DList Name="object_fall2_DL_006FF8" Offset="0x6FF8" />
@ -25,5 +29,6 @@
<Texture Name="object_fall2_Tex_007838" OutName="tex_007838" Format="i4" Width="64" Height="64" Offset="0x7838" />
<Texture Name="object_fall2_Tex_008038" OutName="tex_008038" Format="i4" Width="64" Height="64" Offset="0x8038" />
<TextureAnimation Name="object_fall2_Matanimheader_008840" Offset="0x8840" />
<Blob Name="object_fall2_Blob_008898" Size="0x8" Offset="0x8898" />
</File>
</Root>

View File

@ -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);

3
spec
View File

@ -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

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;