mirror of https://github.com/zeldaret/mm.git
hgdoor documented (#1110)
* documented hgdoor * PR comments * comments from anon * Elliptics comment
This commit is contained in:
parent
d364b80da3
commit
4c0011659e
|
|
@ -16,15 +16,15 @@ void ObjHgdoor_Destroy(Actor* thisx, PlayState* play);
|
|||
void ObjHgdoor_Update(Actor* thisx, PlayState* play);
|
||||
void ObjHgdoor_Draw(Actor* thisx, PlayState* play);
|
||||
|
||||
void ObjHgdoor_SetupCheckShouldOpen(ObjHgdoor* this);
|
||||
void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, PlayState* play);
|
||||
void func_80BD42AC(ObjHgdoor* this);
|
||||
void func_80BD42C0(ObjHgdoor* this, PlayState* play);
|
||||
void func_80BD433C(ObjHgdoor* this);
|
||||
void func_80BD4358(ObjHgdoor* this, PlayState* play);
|
||||
void func_80BD4460(ObjHgdoor* this);
|
||||
void func_80BD4478(ObjHgdoor* this, PlayState* play);
|
||||
s32 func_80BD44D0(ObjHgdoor* this, PlayState* play);
|
||||
void ObjHgdoor_SetupIdle(ObjHgdoor* this);
|
||||
void ObjHgdoor_Idle(ObjHgdoor* this, PlayState* play);
|
||||
void ObjHgdoor_SetupCutscene(ObjHgdoor* this);
|
||||
void ObjHgdoor_PlayCutscene(ObjHgdoor* this, PlayState* play);
|
||||
void ObjHgdoor_SetupCsAction(ObjHgdoor* this);
|
||||
void ObjHgdoor_HandleCsAction(ObjHgdoor* this, PlayState* play);
|
||||
void ObjHgdoor_SetupStopCs(ObjHgdoor* this);
|
||||
void ObjHgdoor_StopCs(ObjHgdoor* this, PlayState* play);
|
||||
s32 ObjHgdoor_Rotate(ObjHgdoor* this, PlayState* play);
|
||||
|
||||
const ActorInit Obj_Hgdoor_InitVars = {
|
||||
ACTOR_OBJ_HGDOOR,
|
||||
|
|
@ -38,9 +38,7 @@ const ActorInit Obj_Hgdoor_InitVars = {
|
|||
(ActorFunc)ObjHgdoor_Draw,
|
||||
};
|
||||
|
||||
static s16 D_80BD4690 = 0;
|
||||
static s32 unused = 0;
|
||||
static s32 unused2 = 0;
|
||||
static s16 sOpenFlag = 0;
|
||||
|
||||
void ObjHgdoor_SetChild(ObjHgdoor* this, PlayState* play) {
|
||||
Actor* actorIterator = play->actorCtx.actorLists[ACTORCAT_PROP].first;
|
||||
|
|
@ -82,7 +80,7 @@ void ObjHgdoor_Init(Actor* thisx, PlayState* play) {
|
|||
this->rotation = 0;
|
||||
this->timer = 0;
|
||||
this->cutscene = this->dyna.actor.cutscene;
|
||||
ObjHgdoor_SetupCheckShouldOpen(this);
|
||||
ObjHgdoor_SetupIdle(this);
|
||||
}
|
||||
|
||||
void ObjHgdoor_Destroy(Actor* thisx, PlayState* play) {
|
||||
|
|
@ -91,29 +89,29 @@ void ObjHgdoor_Destroy(Actor* thisx, PlayState* play) {
|
|||
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
|
||||
}
|
||||
|
||||
void ObjHgdoor_SetupCheckShouldOpen(ObjHgdoor* this) {
|
||||
this->actionFunc = ObjHgdoor_CheckShouldOpen;
|
||||
void ObjHgdoor_SetupIdle(ObjHgdoor* this) {
|
||||
this->actionFunc = ObjHgdoor_Idle;
|
||||
}
|
||||
|
||||
void ObjHgdoor_CheckShouldOpen(ObjHgdoor* this, PlayState* play) {
|
||||
void ObjHgdoor_Idle(ObjHgdoor* this, PlayState* play) {
|
||||
if (!(gSaveContext.save.weekEventReg[75] & 0x20) && !(gSaveContext.save.weekEventReg[52] & 0x20) &&
|
||||
(this->dyna.actor.xzDistToPlayer < 100.0f) && (this->dyna.actor.playerHeightRel < 40.0f) &&
|
||||
OBJHGDOOR_IS_RIGHT_DOOR(&this->dyna.actor)) {
|
||||
ObjHgdoor_SetChild(this, play);
|
||||
ObjHgdoor_SetParent(this, play);
|
||||
func_80BD42AC(this);
|
||||
ObjHgdoor_SetupCutscene(this);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80BD42AC(ObjHgdoor* this) {
|
||||
this->actionFunc = func_80BD42C0;
|
||||
void ObjHgdoor_SetupCutscene(ObjHgdoor* this) {
|
||||
this->actionFunc = ObjHgdoor_PlayCutscene;
|
||||
}
|
||||
|
||||
void func_80BD42C0(ObjHgdoor* this, PlayState* play) {
|
||||
void ObjHgdoor_PlayCutscene(ObjHgdoor* this, PlayState* play) {
|
||||
if (ActorCutscene_GetCanPlayNext(this->cutscene)) {
|
||||
ActorCutscene_Start(this->cutscene, &this->dyna.actor);
|
||||
func_80BD433C(this);
|
||||
func_80BD433C((ObjHgdoor*)this->dyna.actor.child);
|
||||
ObjHgdoor_SetupCsAction(this);
|
||||
ObjHgdoor_SetupCsAction((ObjHgdoor*)this->dyna.actor.child);
|
||||
} else {
|
||||
if (ActorCutscene_GetCurrentIndex() == 0x7C) {
|
||||
ActorCutscene_Stop(0x7C);
|
||||
|
|
@ -122,50 +120,58 @@ void func_80BD42C0(ObjHgdoor* this, PlayState* play) {
|
|||
}
|
||||
}
|
||||
|
||||
void func_80BD433C(ObjHgdoor* this) {
|
||||
this->unk166 = 0x63;
|
||||
this->actionFunc = func_80BD4358;
|
||||
void ObjHgdoor_SetupCsAction(ObjHgdoor* this) {
|
||||
this->csAction = 0x63;
|
||||
this->actionFunc = ObjHgdoor_HandleCsAction;
|
||||
}
|
||||
|
||||
void func_80BD4358(ObjHgdoor* this, PlayState* play) {
|
||||
void ObjHgdoor_HandleCsAction(ObjHgdoor* this, PlayState* play) {
|
||||
s32 actionIndex;
|
||||
|
||||
if (Cutscene_CheckActorAction(play, 483)) {
|
||||
actionIndex = Cutscene_GetActorActionIndex(play, 483);
|
||||
if (this->unk166 != play->csCtx.actorActions[actionIndex]->action) {
|
||||
this->unk166 = play->csCtx.actorActions[actionIndex]->action;
|
||||
if (this->csAction != play->csCtx.actorActions[actionIndex]->action) {
|
||||
this->csAction = play->csCtx.actorActions[actionIndex]->action;
|
||||
switch (play->csCtx.actorActions[actionIndex]->action) {
|
||||
case 1:
|
||||
Actor_PlaySfxAtPos(&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;
|
||||
sOpenFlag = 1;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((D_80BD4690 == 1) && (func_80BD44D0(this, play))) {
|
||||
func_80BD4460(this);
|
||||
if ((sOpenFlag == 1) && ObjHgdoor_Rotate(this, play)) {
|
||||
ObjHgdoor_SetupStopCs(this);
|
||||
}
|
||||
} else {
|
||||
this->unk166 = 0x63;
|
||||
this->csAction = 0x63;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80BD4460(ObjHgdoor* this) {
|
||||
void ObjHgdoor_SetupStopCs(ObjHgdoor* this) {
|
||||
this->timer = 0;
|
||||
this->actionFunc = func_80BD4478;
|
||||
this->actionFunc = ObjHgdoor_StopCs;
|
||||
}
|
||||
|
||||
void func_80BD4478(ObjHgdoor* this, PlayState* play) {
|
||||
if (this->timer++ > 80 && !ActorCutscene_GetCanPlayNext(this->cutscene)) {
|
||||
ActorCutscene_Stop(this->cutscene);
|
||||
void ObjHgdoor_StopCs(ObjHgdoor* this, PlayState* play) {
|
||||
if (this->timer++ > 80) {
|
||||
if (!ActorCutscene_GetCanPlayNext(this->cutscene)) {
|
||||
ActorCutscene_Stop(this->cutscene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 func_80BD44D0(ObjHgdoor* this, PlayState* play) {
|
||||
/**
|
||||
* @brief Function to increment the rotation angle of the door
|
||||
*
|
||||
* @return true when door is fully open, false otherwise
|
||||
*/
|
||||
s32 ObjHgdoor_Rotate(ObjHgdoor* this, PlayState* play) {
|
||||
if (this->rotation < 0x5555) {
|
||||
this->rotation += 0x1388;
|
||||
} else {
|
||||
|
|
@ -175,7 +181,7 @@ s32 func_80BD44D0(ObjHgdoor* this, PlayState* play) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void func_80BD4500(ObjHgdoor* this) {
|
||||
void ObjHgdoor_Open(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;
|
||||
|
|
@ -188,7 +194,7 @@ void ObjHgdoor_Update(Actor* thisx, PlayState* play) {
|
|||
ObjHgdoor* this = THIS;
|
||||
|
||||
this->actionFunc(this, play);
|
||||
func_80BD4500(this);
|
||||
ObjHgdoor_Open(this);
|
||||
}
|
||||
|
||||
void ObjHgdoor_Draw(Actor* thisx, PlayState* play) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ typedef struct ObjHgdoor {
|
|||
/* 0x160 */ s16 cutscene;
|
||||
/* 0x162 */ s16 rotation;
|
||||
/* 0x164 */ s16 timer;
|
||||
/* 0x166 */ u16 unk166;
|
||||
/* 0x166 */ u16 csAction;
|
||||
} ObjHgdoor; // size = 0x168
|
||||
|
||||
extern const ActorInit Obj_Hgdoor_InitVars;
|
||||
|
|
|
|||
|
|
@ -15765,16 +15765,16 @@
|
|||
0x80BD40D0:("func_80BD40D0",),
|
||||
0x80BD4108:("ObjHgdoor_Init",),
|
||||
0x80BD41B4:("ObjHgdoor_Destroy",),
|
||||
0x80BD41E8:("ObjHgdoor_SetupCheckShouldOpen",),
|
||||
0x80BD41FC:("ObjHgdoor_CheckShouldOpen",),
|
||||
0x80BD42AC:("func_80BD42AC",),
|
||||
0x80BD42C0:("func_80BD42C0",),
|
||||
0x80BD433C:("func_80BD433C",),
|
||||
0x80BD4358:("func_80BD4358",),
|
||||
0x80BD4460:("func_80BD4460",),
|
||||
0x80BD4478:("func_80BD4478",),
|
||||
0x80BD44D0:("func_80BD44D0",),
|
||||
0x80BD4500:("func_80BD4500",),
|
||||
0x80BD41E8:("ObjHgdoor_SetupIdle",),
|
||||
0x80BD41FC:("ObjHgdoor_Idle",),
|
||||
0x80BD42AC:("ObjHgdoor_SetupCutscene",),
|
||||
0x80BD42C0:("ObjHgdoor_PlayCutscene",),
|
||||
0x80BD433C:("ObjHgdoor_SetupCsAction",),
|
||||
0x80BD4358:("ObjHgdoor_HandleCsAction",),
|
||||
0x80BD4460:("ObjHgdoor_SetupStopCs",),
|
||||
0x80BD4478:("ObjHgdoor_StopCs",),
|
||||
0x80BD44D0:("ObjHgdoor_Rotate",),
|
||||
0x80BD4500:("ObjHgdoor_Open",),
|
||||
0x80BD4540:("ObjHgdoor_Update",),
|
||||
0x80BD4570:("ObjHgdoor_Draw",),
|
||||
0x80BD4720:("func_80BD4720",),
|
||||
|
|
|
|||
Loading…
Reference in New Issue