mirror of https://github.com/zeldaret/mm.git
obj_hgdoor OK and partially documented (#190)
* obj_hgdoor OK and partially documented * Made unused variables static and ran formatter * Made all suggested changes * Made all suggested changes
This commit is contained in:
parent
c00b385586
commit
c3feee1775
|
@ -8104,9 +8104,9 @@ SECTIONS
|
|||
ovl_Obj_Hgdoor : AT(RomLocation)
|
||||
{
|
||||
build/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.o(.text)
|
||||
build/asm/overlays/ovl_Obj_Hgdoor_data.o(.data)
|
||||
build/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.o(.data)
|
||||
build/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor.o(.rodata)
|
||||
build/asm/overlays/ovl_Obj_Hgdoor_rodata.o(.rodata)
|
||||
build/src/overlays/actors/ovl_Obj_Hgdoor/z_obj_hgdoor_overlay.o(.ovl)
|
||||
}
|
||||
SegmentEnd = .;
|
||||
SegmentSize = SegmentEnd - SegmentStart;
|
||||
|
|
|
@ -272,6 +272,14 @@ D_06000908 = 0x06000908;
|
|||
D_06000F28 = 0x06000F28;
|
||||
D_06000CE8 = 0x06000CE8;
|
||||
|
||||
/* z_obj_hgdoor */
|
||||
D_06001D10 = 0x06001D10;
|
||||
D_060018C0 = 0x060018C0;
|
||||
D_06001AB0 = 0x06001AB0;
|
||||
D_06001BA8 = 0x06001BA8;
|
||||
D_06001670 = 0x06001670;
|
||||
D_06001768 = 0x06001768;
|
||||
|
||||
/* obj_funen */
|
||||
D_060000D0 = 0x060000D0;
|
||||
|
||||
|
|
|
@ -36,11 +36,11 @@ const ActorInit Bg_Iknin_Susceil_InitVars = {
|
|||
(ActorFunc)BgIkninSusceil_Draw,
|
||||
};
|
||||
|
||||
s32 unused = 0;
|
||||
f32 D_80C0B0E4 = 960.0f;
|
||||
Vec2f D_80C0B0E8 = { -320.0f, 0.0f };
|
||||
s8 D_80C0B0F0[] = { 0x00, 0x00, 0x07, 0x0A, 0x0A, 0x0B, 0x0B, 0x00 };
|
||||
s8 D_80C0B0F8[] = { 0x01, 0x02, 0x00, 0x01, 0x02, 0x01, 0x02, 0x00 };
|
||||
static s32 unused = 0;
|
||||
static f32 D_80C0B0E4 = 960.0f;
|
||||
static Vec2f D_80C0B0E8 = { -320.0f, 0.0f };
|
||||
static s8 D_80C0B0F0[] = { 0x00, 0x00, 0x07, 0x0A, 0x0A, 0x0B, 0x0B, 0x00 };
|
||||
static s8 D_80C0B0F8[] = { 0x01, 0x02, 0x00, 0x01, 0x02, 0x01, 0x02, 0x00 };
|
||||
|
||||
static InitChainEntry sInitChain[] = {
|
||||
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
|
||||
|
|
|
@ -9,7 +9,23 @@ void ObjHgdoor_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void ObjHgdoor_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void ObjHgdoor_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
/*
|
||||
void ObjHgdoor_SetupCheckShouldOpen(ObjHgdoor* this);
|
||||
void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, GlobalContext* globalCtx);
|
||||
void func_80BD42AC(ObjHgdoor* this);
|
||||
void func_80BD42C0(ObjHgdoor* this, GlobalContext* globalCtx);
|
||||
void func_80BD433C(ObjHgdoor* this);
|
||||
void func_80BD4358(ObjHgdoor* this, GlobalContext* globalCtx);
|
||||
void func_80BD4460(ObjHgdoor* this);
|
||||
void func_80BD4478(ObjHgdoor* this, GlobalContext* globalCtx);
|
||||
s32 func_80BD44D0(ObjHgdoor* this, GlobalContext* globalCtx);
|
||||
|
||||
extern CollisionHeader D_06001D10;
|
||||
extern CollisionHeader D_060018C0;
|
||||
extern Gfx D_06001AB0[];
|
||||
extern Gfx D_06001BA8[];
|
||||
extern Gfx D_06001670[];
|
||||
extern Gfx D_06001768[];
|
||||
|
||||
const ActorInit Obj_Hgdoor_InitVars = {
|
||||
ACTOR_OBJ_HGDOOR,
|
||||
ACTORCAT_PROP,
|
||||
|
@ -21,36 +37,172 @@ const ActorInit Obj_Hgdoor_InitVars = {
|
|||
(ActorFunc)ObjHgdoor_Update,
|
||||
(ActorFunc)ObjHgdoor_Draw,
|
||||
};
|
||||
*/
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD4090.asm")
|
||||
static s16 D_80BD4690 = 0;
|
||||
static s32 unused = 0;
|
||||
static s32 unused2 = 0;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD40D0.asm")
|
||||
void ObjHgdoor_SetChild(ObjHgdoor* this, GlobalContext* globalCtx) {
|
||||
Actor* actorIterator = globalCtx->actorCtx.actorList[ACTORCAT_PROP].first;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/ObjHgdoor_Init.asm")
|
||||
while (actorIterator) {
|
||||
if ((actorIterator->id == ACTOR_OBJ_HGDOOR) && (&this->dyna.actor != actorIterator)) {
|
||||
this->dyna.actor.child = actorIterator;
|
||||
break;
|
||||
}
|
||||
actorIterator = actorIterator->next;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/ObjHgdoor_Destroy.asm")
|
||||
void ObjHgdoor_SetParent(ObjHgdoor* this, GlobalContext* globalCtx) {
|
||||
Actor* actorIterator = globalCtx->actorCtx.actorList[ACTORCAT_PROP].first;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD41E8.asm")
|
||||
while (actorIterator) {
|
||||
if (actorIterator->id == ACTOR_EN_HG) {
|
||||
this->dyna.actor.parent = actorIterator;
|
||||
break;
|
||||
}
|
||||
actorIterator = actorIterator->next;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD41FC.asm")
|
||||
void ObjHgdoor_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjHgdoor* this = THIS;
|
||||
s32 pad;
|
||||
CollisionHeader* header = NULL;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD42AC.asm")
|
||||
Actor_SetScale(&this->dyna.actor, 0.1f);
|
||||
BcCheck3_BgActorInit(&this->dyna, 1);
|
||||
if (OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) {
|
||||
BgCheck_RelocateMeshHeader(&D_06001D10, &header);
|
||||
} else {
|
||||
BgCheck_RelocateMeshHeader(&D_060018C0, &header);
|
||||
}
|
||||
this->dyna.bgId = BgCheck_AddActorMesh(globalCtx, &globalCtx->colCtx.dyna, &this->dyna, header);
|
||||
this->rotation = 0;
|
||||
this->timer = 0;
|
||||
this->cutscene = this->dyna.actor.cutscene;
|
||||
ObjHgdoor_SetupCheckShouldOpen(this);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD42C0.asm")
|
||||
void ObjHgdoor_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjHgdoor* this = THIS;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD433C.asm")
|
||||
BgCheck_RemoveActorMesh(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD4358.asm")
|
||||
void ObjHgdoor_SetupCheckShouldOpen(ObjHgdoor* this) {
|
||||
this->actionFunc = ObjHgdoor_CheckShouldOpen;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD4460.asm")
|
||||
void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, GlobalContext* globalCtx) {
|
||||
if (!(gSaveContext.weekEventReg[75] & 0x20) && !(gSaveContext.weekEventReg[52] & 0x20) &&
|
||||
(this->dyna.actor.xzDistToPlayer < 100.0f) && (this->dyna.actor.yDistToPlayer < 40.0f) &&
|
||||
OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) {
|
||||
ObjHgdoor_SetChild(this, globalCtx);
|
||||
ObjHgdoor_SetParent(this, globalCtx);
|
||||
func_80BD42AC(this);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD4478.asm")
|
||||
void func_80BD42AC(ObjHgdoor* this) {
|
||||
this->actionFunc = func_80BD42C0;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD44D0.asm")
|
||||
void func_80BD42C0(ObjHgdoor* this, GlobalContext* globalCtx) {
|
||||
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
|
||||
ActorCutscene_Start(this->cutscene, &this->dyna.actor);
|
||||
func_80BD433C(this);
|
||||
func_80BD433C((ObjHgdoor*)this->dyna.actor.child);
|
||||
} else {
|
||||
if (ActorCutscene_GetCurrentIndex() == 0x7C) {
|
||||
ActorCutscene_Stop(0x7C);
|
||||
}
|
||||
ActorCutscene_SetIntentToPlay(this->cutscene);
|
||||
}
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/func_80BD4500.asm")
|
||||
void func_80BD433C(ObjHgdoor* this) {
|
||||
this->unk166 = 0x63;
|
||||
this->actionFunc = func_80BD4358;
|
||||
}
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/ObjHgdoor_Update.asm")
|
||||
void func_80BD4358(ObjHgdoor* this, GlobalContext* globalCtx) {
|
||||
u32 actionIndex;
|
||||
|
||||
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_Obj_Hgdoor_0x80BD4090/ObjHgdoor_Draw.asm")
|
||||
if (func_800EE29C(globalCtx, 0x1E3)) {
|
||||
actionIndex = func_800EE200(globalCtx, 0x1E3);
|
||||
if (this->unk166 != globalCtx->csCtx.actorActions[actionIndex]->unk0) {
|
||||
this->unk166 = globalCtx->csCtx.actorActions[actionIndex]->unk0;
|
||||
switch (globalCtx->csCtx.actorActions[actionIndex]->unk0) {
|
||||
case 1:
|
||||
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_WOOD_DOOR_OPEN_SPEEDY);
|
||||
if ((this->dyna.actor.parent != NULL) && (this->dyna.actor.parent->id == ACTOR_EN_HG)) {
|
||||
this->dyna.actor.parent->colChkInfo.health = 1;
|
||||
}
|
||||
D_80BD4690 = 1;
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((D_80BD4690 == 1) && (func_80BD44D0(this, globalCtx))) {
|
||||
func_80BD4460(this);
|
||||
}
|
||||
} else {
|
||||
this->unk166 = 0x63;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80BD4460(ObjHgdoor* this) {
|
||||
this->timer = 0;
|
||||
this->actionFunc = func_80BD4478;
|
||||
}
|
||||
|
||||
void func_80BD4478(ObjHgdoor* this, GlobalContext* globalCtx) {
|
||||
if (this->timer++ > 80 && !ActorCutscene_GetCanPlayNext(this->cutscene)) {
|
||||
ActorCutscene_Stop(this->cutscene);
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_80BD44D0(ObjHgdoor* this, GlobalContext* globalCtx) {
|
||||
if (this->rotation < 0x5555) {
|
||||
this->rotation += 0x1388;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void func_80BD4500(ObjHgdoor* this) {
|
||||
this->dyna.actor.shape.rot.y = this->dyna.actor.home.rot.y;
|
||||
if (OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) {
|
||||
this->dyna.actor.shape.rot.y += this->rotation;
|
||||
} else {
|
||||
this->dyna.actor.shape.rot.y -= this->rotation;
|
||||
}
|
||||
}
|
||||
|
||||
void ObjHgdoor_Update(Actor* thisx, GlobalContext* globalCtx) {
|
||||
ObjHgdoor* this = THIS;
|
||||
|
||||
this->actionFunc(this, globalCtx);
|
||||
func_80BD4500(this);
|
||||
}
|
||||
|
||||
void ObjHgdoor_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx);
|
||||
func_8012C28C(globalCtx->state.gfxCtx);
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
if (OBJHGDOOR_IS_RIGHT_DOOR(thisx)) {
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06001AB0);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06001BA8);
|
||||
} else {
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06001670);
|
||||
gSPDisplayList(POLY_OPA_DISP++, D_06001768);
|
||||
}
|
||||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,18 @@
|
|||
|
||||
struct ObjHgdoor;
|
||||
|
||||
typedef void (*ObjHgdoorActionFunc)(struct ObjHgdoor*, GlobalContext*);
|
||||
|
||||
#define OBJHGDOOR_IS_RIGHT_DOOR(thisx) \
|
||||
((thisx)->params & 0x8000) // door on the right when looking at the cabinet
|
||||
|
||||
typedef struct ObjHgdoor {
|
||||
/* 0x000 */ Actor actor;
|
||||
/* 0x144 */ char unk_144[0x24];
|
||||
/* 0x000 */ DynaPolyActor dyna;
|
||||
/* 0x15C */ ObjHgdoorActionFunc actionFunc;
|
||||
/* 0x160 */ s16 cutscene;
|
||||
/* 0x162 */ s16 rotation;
|
||||
/* 0x164 */ s16 timer;
|
||||
/* 0x166 */ u16 unk166;
|
||||
} ObjHgdoor; // size = 0x168
|
||||
|
||||
extern const ActorInit Obj_Hgdoor_InitVars;
|
||||
|
|
|
@ -15774,12 +15774,12 @@
|
|||
0x80BD3AA8:("func_80BD3AA8",),
|
||||
0x80BD3AF8:("func_80BD3AF8",),
|
||||
0x80BD3CAC:("EnAh_Draw",),
|
||||
0x80BD4090:("func_80BD4090",),
|
||||
0x80BD4090:("ObjHgdoor_SetChild",),
|
||||
0x80BD40D0:("func_80BD40D0",),
|
||||
0x80BD4108:("ObjHgdoor_Init",),
|
||||
0x80BD41B4:("ObjHgdoor_Destroy",),
|
||||
0x80BD41E8:("func_80BD41E8",),
|
||||
0x80BD41FC:("func_80BD41FC",),
|
||||
0x80BD41E8:("ObjHgdoor_SetupCheckShouldOpen",),
|
||||
0x80BD41FC:("ObjHgdoor_CheckShouldOpen",),
|
||||
0x80BD42AC:("func_80BD42AC",),
|
||||
0x80BD42C0:("func_80BD42C0",),
|
||||
0x80BD433C:("func_80BD433C",),
|
||||
|
|
Loading…
Reference in New Issue