ovl_En_Test2 Decompiled (#968)

* all functions matching

* all functions matching

* data problem

* ovl_En_Test2 Decompiled

* format + fix constants

* final details

* pr review

* pr review

* pr review
This commit is contained in:
Alejandro Asenjo 2022-08-07 19:52:01 -03:00 committed by GitHub
parent d88aa7ebbe
commit a6bec3ecc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 121 additions and 21 deletions

View File

@ -6,37 +6,37 @@
<Texture Name="object_hakugin_obj_Tex_000330" OutName="tex_000330" Format="ci4" Width="64" Height="64" Offset="0x330" />
<DList Name="object_hakugin_obj_DL_000D30" Offset="0xD30" />
<DList Name="object_hakugin_obj_DL_000D38" Offset="0xD38" />
<!-- <Blob Name="object_hakugin_obj_Blob_000E40" Size="0x10" Offset="0xE40" /> -->
<TextureAnimation Name="object_hakugin_obj_Matanimheader_000E48" Offset="0xE48" />
<Texture Name="object_hakugin_obj_TLUT_000E50" OutName="tlut_000E50" Format="rgba16" Width="4" Height="4" Offset="0xE50" />
<Texture Name="object_hakugin_obj_Tex_000E70" OutName="tex_000E70" Format="ci4" Width="64" Height="64" Offset="0xE70" />
<DList Name="object_hakugin_obj_DL_0016D0" Offset="0x16D0" />
<DList Name="object_hakugin_obj_DL_0016D8" Offset="0x16D8" />
<!-- <Blob Name="object_hakugin_obj_Blob_0017A0" Size="0x10" Offset="0x17A0" /> -->
<TextureAnimation Name="object_hakugin_obj_Matanimheader_0017A8" Offset="0x17A8" />
<Texture Name="object_hakugin_obj_TLUT_0017B0" OutName="tlut_0017B0" Format="rgba16" Width="4" Height="4" Offset="0x17B0" />
<Texture Name="object_hakugin_obj_Tex_0017D0" OutName="tex_0017D0" Format="ci4" Width="64" Height="64" Offset="0x17D0" />
<DList Name="object_hakugin_obj_DL_002010" Offset="0x2010" />
<DList Name="object_hakugin_obj_DL_002018" Offset="0x2018" />
<!-- <Blob Name="object_hakugin_obj_Blob_0020D8" Size="0x18" Offset="0x20D8" /> -->
<TextureAnimation Name="object_hakugin_obj_Matanimheader_0020E8" Offset="0x20E8" />
<Texture Name="object_hakugin_obj_TLUT_0020F0" OutName="tlut_0020F0" Format="rgba16" Width="4" Height="4" Offset="0x20F0" />
<Texture Name="object_hakugin_obj_Tex_002110" OutName="tex_002110" Format="ci4" Width="64" Height="64" Offset="0x2110" />
<DList Name="object_hakugin_obj_DL_002970" Offset="0x2970" />
<DList Name="object_hakugin_obj_DL_002978" Offset="0x2978" />
<!-- <Blob Name="object_hakugin_obj_Blob_002A48" Size="0x18" Offset="0x2A48" /> -->
<TextureAnimation Name="object_hakugin_obj_Matanimheader_002A58" Offset="0x2A58" />
<DList Name="object_hakugin_obj_DL_0035A0" Offset="0x35A0" />
<DList Name="object_hakugin_obj_DL_0035A8" Offset="0x35A8" />
<!-- <Blob Name="object_hakugin_obj_Blob_003878" Size="0x18" Offset="0x3878" /> -->
<TextureAnimation Name="object_hakugin_obj_Matanimheader_003888" Offset="0x3888" />
<Texture Name="object_hakugin_obj_TLUT_003890" OutName="tlut_003890" Format="rgba16" Width="4" Height="4" Offset="0x3890" />
<Texture Name="object_hakugin_obj_TLUT_0038B0" OutName="tlut_0038B0" Format="rgba16" Width="4" Height="4" Offset="0x38B0" />
<Texture Name="object_hakugin_obj_Tex_0038D0" OutName="tex_0038D0" Format="ci4" Width="64" Height="64" Offset="0x38D0" />
<Texture Name="object_hakugin_obj_Tex_0040D0" OutName="tex_0040D0" Format="ci4" Width="64" Height="64" Offset="0x40D0" />
<DList Name="object_hakugin_obj_DL_004920" Offset="0x4920" />
<DList Name="object_hakugin_obj_DL_004928" Offset="0x4928" />
<!-- <Blob Name="object_hakugin_obj_Blob_0049F0" Size="0x10" Offset="0x49F0" /> -->
<TextureAnimation Name="object_hakugin_obj_Matanimheader_0049F8" Offset="0x49F8" />
<Texture Name="object_hakugin_obj_TLUT_004A00" OutName="tlut_004A00" Format="rgba16" Width="4" Height="4" Offset="0x4A00" />
<Texture Name="object_hakugin_obj_Tex_004A20" OutName="tex_004A20" Format="ci4" Width="64" Height="64" Offset="0x4A20" />
<DList Name="object_hakugin_obj_DL_005260" Offset="0x5260" />
<DList Name="object_hakugin_obj_DL_005268" Offset="0x5268" />
<!-- <Blob Name="object_hakugin_obj_Blob_005328" Size="0x18" Offset="0x5328" /> -->
<TextureAnimation Name="object_hakugin_obj_Matanimheader_005338" Offset="0x5338" />
<Texture Name="object_hakugin_obj_TLUT_005340" OutName="tlut_005340" Format="rgba16" Width="4" Height="4" Offset="0x5340" />
<Texture Name="object_hakugin_obj_Tex_005360" OutName="tex_005360" Format="ci4" Width="64" Height="64" Offset="0x5360" />
<DList Name="object_hakugin_obj_DL_006120" Offset="0x6120" />

3
spec
View File

@ -2721,8 +2721,7 @@ beginseg
name "ovl_En_Test2"
compress
include "build/src/overlays/actors/ovl_En_Test2/z_en_test2.o"
include "build/data/ovl_En_Test2/ovl_En_Test2.data.o"
include "build/data/ovl_En_Test2/ovl_En_Test2.reloc.o"
include "build/src/overlays/actors/ovl_En_Test2/ovl_En_Test2_reloc.o"
endseg
beginseg

View File

@ -5,6 +5,12 @@
*/
#include "z_en_test2.h"
#include "objects/object_dekucity_ana_obj/object_dekucity_ana_obj.h"
#include "objects/object_sichitai_obj/object_sichitai_obj.h"
#include "objects/object_yukimura_obj/object_yukimura_obj.h"
#include "objects/object_hakugin_obj/object_hakugin_obj.h"
#include "objects/object_meganeana_obj/object_meganeana_obj.h"
#include "objects/object_haka_obj/object_haka_obj.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_80)
@ -12,8 +18,15 @@
void EnTest2_Init(Actor* thisx, PlayState* play);
void EnTest2_Update(Actor* thisx, PlayState* play);
void EnTest2_UpdateForLens(Actor* thisx, PlayState* play);
void EnTest2_Draw(Actor* thisx, PlayState* play);
typedef struct EnTest2ModelInfo {
/* 0x0 */ Gfx* dList1;
/* 0x4 */ Gfx* dList2;
/* 0x8 */ AnimatedMaterial* animMat;
} EnTest2ModelInfo; // size = 0xC
#if 0
const ActorInit En_Test2_InitVars = {
ACTOR_EN_TEST2,
ACTORCAT_BG,
@ -26,22 +39,105 @@ const ActorInit En_Test2_InitVars = {
(ActorFunc)NULL,
};
// static InitChainEntry sInitChain[] = {
static InitChainEntry D_80A3E74C[] = {
static EnTest2ModelInfo sModelInfo[] = {
{ object_dekucity_ana_obj_DL_000040, NULL, NULL },
{ object_sichitai_obj_DL_001820, NULL, NULL },
{ object_yukimura_obj_DL_0008C0, NULL, NULL },
{ object_hakugin_obj_DL_0016D8, NULL, object_hakugin_obj_Matanimheader_0017A8 },
{ object_hakugin_obj_DL_002018, NULL, object_hakugin_obj_Matanimheader_0020E8 },
{ object_hakugin_obj_DL_005268, NULL, object_hakugin_obj_Matanimheader_005338 },
{ object_meganeana_obj_DL_000110, object_meganeana_obj_DL_000080, NULL },
{ object_haka_obj_DL_000F70, NULL, NULL },
{ object_haka_obj_DL_001200, NULL, NULL },
{ object_hakugin_obj_DL_004928, NULL, object_hakugin_obj_Matanimheader_0049F8 },
{ object_hakugin_obj_DL_002978, NULL, object_hakugin_obj_Matanimheader_002A58 },
{ object_hakugin_obj_DL_000D38, NULL, object_hakugin_obj_Matanimheader_000E48 },
{ object_hakugin_obj_DL_0035A8, NULL, object_hakugin_obj_Matanimheader_003888 },
};
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F(scale, 1, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 8000, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 800, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 2500, ICHAIN_STOP),
};
#endif
static s16 sObjectIds[] = {
OBJECT_DEKUCITY_ANA_OBJ, OBJECT_SICHITAI_OBJ, OBJECT_YUKIMURA_OBJ, OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ,
OBJECT_HAKUGIN_OBJ, OBJECT_MEGANEANA_OBJ, OBJECT_HAKA_OBJ, OBJECT_HAKA_OBJ, OBJECT_HAKUGIN_OBJ,
OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ, OBJECT_HAKUGIN_OBJ,
};
extern InitChainEntry D_80A3E74C[];
void EnTest2_Init(Actor* thisx, PlayState* play) {
EnTest2* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/EnTest2_Init.s")
Actor_ProcessInitChain(&this->actor, sInitChain);
if ((this->actor.params == EN_TEST2_PARAMS_B) || (this->actor.params == EN_TEST2_PARAMS_C)) {
this->actor.flags |= ACTOR_FLAG_20;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/EnTest2_Update.s")
void EnTest2_Update(Actor* thisx, PlayState* play) {
s32 pad;
s32 objectIndex;
EnTest2ModelInfo* modelInfo;
EnTest2* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/func_80A3E4EC.s")
objectIndex = Object_GetIndex(&play->objectCtx, sObjectIds[this->actor.params]);
if (objectIndex < 0) {
Actor_MarkForDeath(&this->actor);
return;
}
if (Object_IsLoaded(&play->objectCtx, objectIndex)) {
modelInfo = &sModelInfo[this->actor.params];
this->actor.objBankIndex = objectIndex;
this->actor.draw = EnTest2_Draw;
if (modelInfo->animMat != NULL) {
Actor_SetObjectDependency(play, &this->actor);
this->animMat = Lib_SegmentedToVirtual(modelInfo->animMat);
}
if (play->roomCtx.currRoom.unk5) {
this->actor.update = EnTest2_UpdateForLens;
} else {
this->actor.update = Actor_Noop;
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Test2/func_80A3E524.s")
void EnTest2_UpdateForLens(Actor* thisx, PlayState* play) {
EnTest2* this = THIS;
if (play->actorCtx.unk4 == 100) {
this->actor.flags |= ACTOR_FLAG_80;
} else {
this->actor.flags &= ~ACTOR_FLAG_80;
}
}
void EnTest2_Draw(Actor* thisx, PlayState* play) {
s32 pad;
EnTest2* this = THIS;
Gfx* dList = sModelInfo[this->actor.params].dList2;
if (this->animMat != NULL) {
AnimatedMat_Draw(play, this->animMat);
}
if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_80)) {
OPEN_DISPS(play->state.gfxCtx);
func_8012C2DC(play->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (dList != NULL) {
gSPDisplayList(POLY_XLU_DISP++, dList);
}
gSPDisplayList(POLY_XLU_DISP++, sModelInfo[this->actor.params].dList1);
CLOSE_DISPS(play->state.gfxCtx);
} else {
if (dList != NULL) {
Gfx_DrawDListXlu(play, dList);
}
Gfx_DrawDListOpa(play, sModelInfo[this->actor.params].dList1);
}
}

View File

@ -7,9 +7,14 @@ struct EnTest2;
typedef struct EnTest2 {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x4];
/* 0x144 */ AnimatedMaterial* animMat;
} EnTest2; // size = 0x148
typedef enum {
/* 0xB */ EN_TEST2_PARAMS_B = 0xB,
/* 0xC */ EN_TEST2_PARAMS_C
} EnTest2_Params;
extern const ActorInit En_Test2_InitVars;
#endif // Z_EN_TEST2_H

View File

@ -10347,8 +10347,8 @@
0x80A3E248:("ObjSmork_Draw",),
0x80A3E390:("EnTest2_Init",),
0x80A3E3E4:("EnTest2_Update",),
0x80A3E4EC:("func_80A3E4EC",),
0x80A3E524:("func_80A3E524",),
0x80A3E4EC:("EnTest2_UpdateForLens",),
0x80A3E524:("EnTest2_Draw",),
0x80A3E7E0:("func_80A3E7E0",),
0x80A3E80C:("func_80A3E80C",),
0x80A3E870:("func_80A3E870",),