1
0
mirror of https://github.com/blawar/ooot.git synced 2024-07-02 09:03:36 +00:00

Cleanups, Named functions

This commit is contained in:
Thar0 2020-03-18 18:58:55 +00:00
parent 44520cbba4
commit 50a0a5ff7f

View File

@ -14,11 +14,11 @@ static void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx);
static void DoorAna_Update(DoorAna* this, GlobalContext* globalCtx); static void DoorAna_Update(DoorAna* this, GlobalContext* globalCtx);
static void DoorAna_Draw(DoorAna* this, GlobalContext* globalCtx); static void DoorAna_Draw(DoorAna* this, GlobalContext* globalCtx);
static void func_80993EF0(DoorAna* this, ActorFunc func); static void DoorAna_SetupAction(DoorAna* this, ActorFunc func);
static void func_80993FEC(DoorAna* this, GlobalContext* globalCtx); static void DoorAna_Update_Hidden(DoorAna* this, GlobalContext* globalCtx);
static void func_80994124(DoorAna* this, GlobalContext* globalCtx); static void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx);
static void func_809942D8(DoorAna* this, GlobalContext* globalCtx); static void DoorAna_Update_Entering(DoorAna* this, GlobalContext* globalCtx);
const ActorInit Door_Ana_InitVars = const ActorInit Door_Ana_InitVars =
{ {
@ -60,7 +60,7 @@ static s16 entrances[] = {
extern Gfx* D_05001390; extern Gfx* D_05001390;
// sets current actionFunc to be ran on next update call // sets current actionFunc to be ran on next update call
static void func_80993EF0(DoorAna* this, ActorFunc func) static void DoorAna_SetupAction(DoorAna* this, ActorFunc func)
{ {
this->actionFunc = func; this->actionFunc = func;
} }
@ -86,12 +86,14 @@ static void DoorAna_Init(DoorAna* this, GlobalContext* globalCtx)
this->actor.flags |= 0x10; this->actor.flags |= 0x10;
} }
Actor_SetScale(&this->actor, 0); Actor_SetScale(&this->actor, 0);
func_80993EF0(this, (ActorFunc)&func_80993FEC); DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Hidden);
this->actor.unk_1F = 0; }
return; else
{
DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Open);
} }
func_80993EF0(this, (ActorFunc)&func_80994124);
this->actor.unk_1F = 0; this->actor.unk_1F = 0;
} }
static void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx) static void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx)
@ -104,7 +106,7 @@ static void DoorAna_Destroy(DoorAna* this, GlobalContext* globalCtx)
} }
// update routine for grottos that are currently "hidden"/unopened // update routine for grottos that are currently "hidden"/unopened
static void func_80993FEC(DoorAna* this, GlobalContext* globalCtx) static void DoorAna_Update_Hidden(DoorAna* this, GlobalContext* globalCtx)
{ {
bool openGrotto = false; bool openGrotto = false;
if ((this->actor.params & 0x200) == 0) if ((this->actor.params & 0x200) == 0)
@ -113,7 +115,7 @@ static void func_80993FEC(DoorAna* this, GlobalContext* globalCtx)
if (this->actor.waterSurfaceDist < 40000.0f && func_8006C4A4(globalCtx, 5) != 0) if (this->actor.waterSurfaceDist < 40000.0f && func_8006C4A4(globalCtx, 5) != 0)
{ {
openGrotto = true; openGrotto = true;
this->actor.flags &= -0x11; this->actor.flags &= ~0x10;
} }
} }
else else
@ -133,15 +135,15 @@ static void func_80993FEC(DoorAna* this, GlobalContext* globalCtx)
// open the grotto // open the grotto
if (openGrotto) if (openGrotto)
{ {
this->actor.params &= 0xFCFF; this->actor.params &= ~0x0300;
func_80993EF0(this, (ActorFunc)&func_80994124); DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Open);
Audio_PlaySoundGeneral(0x4802, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
} }
func_8002F5F0(&this->actor, globalCtx); func_8002F5F0(&this->actor, globalCtx);
} }
// update routine for grottos that are open // update routine for grottos that are open
static void func_80994124(DoorAna* this, GlobalContext* globalCtx) static void DoorAna_Update_Open(DoorAna* this, GlobalContext* globalCtx)
{ {
Player* player; Player* player;
s32 destinationIdx; s32 destinationIdx;
@ -162,7 +164,7 @@ static void func_80994124(DoorAna* this, GlobalContext* globalCtx)
destinationIdx = this->actor.initPosRot.rot.z + 1; destinationIdx = this->actor.initPosRot.rot.z + 1;
} }
globalCtx->nextEntranceIndex = entrances[destinationIdx]; globalCtx->nextEntranceIndex = entrances[destinationIdx];
func_80993EF0(this, (ActorFunc)&func_809942D8); DoorAna_SetupAction(this, (ActorFunc)&DoorAna_Update_Entering);
} }
else else
{ {
@ -183,7 +185,7 @@ static void func_80994124(DoorAna* this, GlobalContext* globalCtx)
} }
// update function for after the player has triggered the grotto // update function for after the player has triggered the grotto
static void func_809942D8(DoorAna* this, GlobalContext* globalCtx) static void DoorAna_Update_Entering(DoorAna* this, GlobalContext* globalCtx)
{ {
Player* player; Player* player;
@ -208,9 +210,9 @@ static void DoorAna_Draw(DoorAna* this, GlobalContext* globalCtx)
Gfx** dList = &D_05001390; // required for stack placement? Gfx** dList = &D_05001390; // required for stack placement?
Gfx* gfxArr[3]; Gfx* gfxArr[3];
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_door_ana.c", 0x1B8); func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_door_ana.c", 440);
func_80093D84(globalCtx->state.gfxCtx); func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_ana.c", 0x1BE), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_door_ana.c", 446), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyXlu.p++, dList); gSPDisplayList(gfxCtx->polyXlu.p++, dList);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_door_ana.c", 0x1C1); func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_door_ana.c", 449);
} }