mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-19 05:22:32 -04:00
ovl_En_Sekihi Decompiled and Documented (#907)
* progress * All functions matching * ovl_En_Sekihi Decompiled and Documented * pr review * pr review * params enum * corrections and renaming * pr review * Update src/overlays/actors/ovl_En_Sekihi/z_en_sekihi.c Co-authored-by: Derek Hensley <hensley.derek58@gmail.com> Co-authored-by: Derek Hensley <hensley.derek58@gmail.com>
This commit is contained in:
@@ -5,6 +5,11 @@
|
||||
*/
|
||||
|
||||
#include "z_en_sekihi.h"
|
||||
#include "objects/object_sekihil/object_sekihil.h"
|
||||
#include "objects/object_sekihig/object_sekihig.h"
|
||||
#include "objects/object_sekihin/object_sekihin.h"
|
||||
#include "objects/object_sekihiz/object_sekihiz.h"
|
||||
#include "objects/object_zog/object_zog.h"
|
||||
|
||||
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8 | ACTOR_FLAG_10)
|
||||
|
||||
@@ -13,13 +18,12 @@
|
||||
void EnSekihi_Init(Actor* thisx, PlayState* play);
|
||||
void EnSekihi_Destroy(Actor* thisx, PlayState* play);
|
||||
void EnSekihi_Update(Actor* thisx, PlayState* play);
|
||||
void EnSekihi_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void func_80A44DE8(EnSekihi* this, PlayState* play);
|
||||
void func_80A44F40(EnSekihi* this, PlayState* play);
|
||||
void func_80A450B0(EnSekihi* this, PlayState* play);
|
||||
void func_80A45130(EnSekihi* this, PlayState* play);
|
||||
void EnSekihi_DoNothing(EnSekihi* this, PlayState* play);
|
||||
|
||||
#if 0
|
||||
const ActorInit En_Sekihi_InitVars = {
|
||||
ACTOR_EN_SEKIHI,
|
||||
ACTORCAT_PROP,
|
||||
@@ -32,20 +36,150 @@ const ActorInit En_Sekihi_InitVars = {
|
||||
(ActorFunc)NULL,
|
||||
};
|
||||
|
||||
#endif
|
||||
static s16 sObjectIds[] = { OBJECT_SEKIHIL, OBJECT_SEKIHIG, OBJECT_SEKIHIN, OBJECT_SEKIHIZ, OBJECT_ZOG };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/EnSekihi_Init.s")
|
||||
static Gfx* sOpaDLists[] = {
|
||||
gGraveTriforceSymbolDL, gGraveGoronSymbolDL, gGraveKokiriSymbolDL, gTombSongOfSoaringDL, gMikauGraveDL,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/EnSekihi_Destroy.s")
|
||||
static Gfx* sXluDLists[] = {
|
||||
gSunSongTriforceSymbolDL, gSunSongGoronSymbolDL, gSunSongKokiriSymbolDL, gSekihizEmptyDL, gMikauGraveDirtDL,
|
||||
};
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A44DE8.s")
|
||||
static u16 sTextIds[] = { 0, 0, 0, 0, 0x1018 };
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A44F40.s")
|
||||
void EnSekihi_Init(Actor* thisx, PlayState* play) {
|
||||
EnSekihi* this = THIS;
|
||||
s32 params = ENSIKIHI_GET_TYPE(thisx);
|
||||
s32 objectIndex;
|
||||
s32 pad;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A450B0.s")
|
||||
if ((params < SEKIHI_TYPE_0 || params >= SEKIHI_TYPE_MAX) || sOpaDLists[params] == NULL) {
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
} else {
|
||||
if ((params == SEKIHI_TYPE_4) && (((gSaveContext.save.skullTokenCount & 0xFFFF)) >= 30)) {
|
||||
gSaveContext.save.weekEventReg[13] |= 0x20;
|
||||
}
|
||||
objectIndex = Object_GetIndex(&play->objectCtx, sObjectIds[params]);
|
||||
if (objectIndex >= 0) {
|
||||
this->objectIndex = objectIndex;
|
||||
}
|
||||
this->actionFunc = func_80A44DE8;
|
||||
this->opaDList = sOpaDLists[params];
|
||||
this->xluDList = sXluDLists[params];
|
||||
this->dyna.actor.textId = sTextIds[params];
|
||||
this->dyna.actor.focus.pos.y = this->dyna.actor.world.pos.y + 60.0f;
|
||||
Actor_SetScale(&this->dyna.actor, 0.1f);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A45130.s")
|
||||
void EnSekihi_Destroy(Actor* thisx, PlayState* play) {
|
||||
EnSekihi* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/EnSekihi_Update.s")
|
||||
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_En_Sekihi/func_80A45164.s")
|
||||
void func_80A44DE8(EnSekihi* this, PlayState* play) {
|
||||
CollisionHeader* colHeader = NULL;
|
||||
s32 params;
|
||||
CollisionHeader* colHeaders[] = {
|
||||
&gSekihilCol, &gSekihigCol, &gSekihinCol, &gSekihizCol, &gObjectZogCol,
|
||||
};
|
||||
|
||||
params = ENSIKIHI_GET_TYPE(&this->dyna.actor);
|
||||
if (Object_IsLoaded(&play->objectCtx, this->objectIndex)) {
|
||||
this->dyna.actor.objBankIndex = this->objectIndex;
|
||||
this->dyna.actor.draw = EnSekihi_Draw;
|
||||
if (params == SEKIHI_TYPE_4) {
|
||||
this->actionFunc = func_80A450B0;
|
||||
} else {
|
||||
this->actionFunc = EnSekihi_DoNothing;
|
||||
}
|
||||
|
||||
Actor_SetObjectDependency(play, &this->dyna.actor);
|
||||
DynaPolyActor_Init(&this->dyna, 0);
|
||||
if (colHeaders[params] != NULL) {
|
||||
CollisionHeader_GetVirtual(colHeaders[params], &colHeader);
|
||||
}
|
||||
|
||||
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
|
||||
if ((params == SEKIHI_TYPE_4) && (INV_CONTENT(ITEM_MASK_ZORA) != ITEM_MASK_ZORA)) {
|
||||
Actor_MarkForDeath(&this->dyna.actor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A44F40(EnSekihi* this, PlayState* play) {
|
||||
switch (Message_GetState(&play->msgCtx)) {
|
||||
case 4:
|
||||
if (Message_ShouldAdvance(play) && (play->msgCtx.currentTextId == 0x1019)) {
|
||||
switch (play->msgCtx.choiceIndex) {
|
||||
case 0:
|
||||
func_8019F208();
|
||||
func_80151938(play, 0x101A);
|
||||
break;
|
||||
case 1:
|
||||
func_8019F208();
|
||||
func_80151938(play, 0x101B);
|
||||
break;
|
||||
case 2:
|
||||
func_8019F230();
|
||||
func_801477B4(play);
|
||||
this->actionFunc = func_80A450B0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (Message_ShouldAdvance(play)) {
|
||||
switch (play->msgCtx.currentTextId) {
|
||||
case 0x1018:
|
||||
func_80151938(play, play->msgCtx.currentTextId + 1);
|
||||
break;
|
||||
case 0x101A:
|
||||
case 0x101B:
|
||||
func_801477B4(play);
|
||||
this->actionFunc = func_80A450B0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A450B0(EnSekihi* this, PlayState* play) {
|
||||
if (Actor_ProcessTalkRequest(&this->dyna.actor, &play->state)) {
|
||||
this->actionFunc = func_80A44F40;
|
||||
} else if ((this->dyna.actor.xzDistToPlayer < 100.0f) && (Player_IsFacingActor(&this->dyna.actor, 0x2600, play))) {
|
||||
func_800B8614(&this->dyna.actor, play, 120.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void EnSekihi_DoNothing(EnSekihi* this, PlayState* play) {
|
||||
}
|
||||
|
||||
void EnSekihi_Update(Actor* thisx, PlayState* play) {
|
||||
EnSekihi* this = THIS;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
}
|
||||
|
||||
void EnSekihi_Draw(Actor* thisx, PlayState* play) {
|
||||
EnSekihi* this = THIS;
|
||||
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
if (this->xluDList != NULL) {
|
||||
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
func_8012C2DC(play->state.gfxCtx);
|
||||
gSPDisplayList(POLY_XLU_DISP++, this->xluDList);
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
func_8012C28C(play->state.gfxCtx);
|
||||
gSPDisplayList(POLY_OPA_DISP++, this->opaDList);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -3,16 +3,29 @@
|
||||
|
||||
#include "global.h"
|
||||
|
||||
#define ENSIKIHI_GET_TYPE(thisx) ((thisx)->params & 0xF)
|
||||
|
||||
struct EnSekihi;
|
||||
|
||||
typedef void (*EnSekihiActionFunc)(struct EnSekihi*, PlayState*);
|
||||
|
||||
typedef struct EnSekihi {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x24];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ Gfx* opaDList;
|
||||
/* 0x160 */ Gfx* xluDList;
|
||||
/* 0x164 */ s8 objectIndex;
|
||||
/* 0x168 */ EnSekihiActionFunc actionFunc;
|
||||
} EnSekihi; // size = 0x16C
|
||||
|
||||
typedef enum SekihiType {
|
||||
/* 0x0 */ SEKIHI_TYPE_0,
|
||||
/* 0x1 */ SEKIHI_TYPE_1,
|
||||
/* 0x2 */ SEKIHI_TYPE_2,
|
||||
/* 0x3 */ SEKIHI_TYPE_3,
|
||||
/* 0x4 */ SEKIHI_TYPE_4,
|
||||
/* 0x5 */ SEKIHI_TYPE_MAX
|
||||
} SekihiType;
|
||||
|
||||
extern const ActorInit En_Sekihi_InitVars;
|
||||
|
||||
#endif // Z_EN_SEKIHI_H
|
||||
|
||||
Reference in New Issue
Block a user