ovl_Bg_Tobira01 OK and documented (#1247)

* Decompiled source of tobira01

* Documented and formatted in prep for merge request

* Added spacing, renamed unused back to what it was, added definitions, changed 1.6666 to division

* Ran weekeventreg script, added additional spaces throughout the file, removed the macros for 0 and 60, updated some missed this casts, renamed spot11 out names

* Converted gSaveContext calls over to CLEAR_WEEKEVENTREG calls from review feedback

* Reformatted some files

* More review feedback

* Removed _tex
This commit is contained in:
Thomas 2023-05-28 12:19:53 -06:00 committed by GitHub
parent 7a5cbf2e20
commit 20f7e2199a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 26 deletions

View File

@ -1,13 +1,13 @@
<Root>
<File Name="object_spot11_obj" Segment="6">
<DList Name="object_spot11_obj_DL_000080" Offset="0x80" />
<DList Name="object_spot11_obj_DL_000088" Offset="0x88" />
<Texture Name="object_spot11_obj_Tex_000120" OutName="tex_000120" Format="rgba16" Width="32" Height="64" Offset="0x120" />
<Collision Name="object_spot11_obj_Colheader_0011C0" Offset="0x11C0" />
<DList Name="object_spot11_obj_DL_0013F0" Offset="0x13F0" />
<Texture Name="object_spot11_obj_TLUT_001560" OutName="tlut_001560" Format="rgba16" Width="16" Height="16" Offset="0x1560" />
<Texture Name="object_spot11_obj_Tex_001760" OutName="tex_001760" Format="ci8" Width="32" Height="32" Offset="0x1760" />
<Texture Name="object_spot11_obj_Tex_001B60" OutName="tex_001B60" Format="ci8" Width="32" Height="16" Offset="0x1B60" />
<Collision Name="object_spot11_obj_Colheader_001EB8" Offset="0x1EB8" />
<DList Name="gSpot11EmptyDL" Offset="0x80" />
<DList Name="gGoronDoorDL" Offset="0x88" />
<Texture Name="gGoronDoorTex" OutName="goron_door" Format="rgba16" Width="32" Height="64" Offset="0x120" />
<Collision Name="gGoronDoorCol" Offset="0x11C0" />
<DList Name="gWoodStepDL" Offset="0x13F0" />
<Texture Name="gWoodTLUT" OutName="wood_tlut" Format="rgba16" Width="16" Height="16" Offset="0x1560" />
<Texture Name="gWoodStepTopTex" OutName="wood_step_top" Format="ci8" Width="32" Height="32" Offset="0x1760" />
<Texture Name="gWoodStepSideTex" OutName="wood_step_side" Format="ci8" Width="32" Height="16" Offset="0x1B60" />
<Collision Name="gWoodStepCol" Offset="0x1EB8" />
</File>
</Root>

3
spec
View File

@ -3589,8 +3589,7 @@ beginseg
name "ovl_Bg_Tobira01"
compress
include "build/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.o"
include "build/data/ovl_Bg_Tobira01/ovl_Bg_Tobira01.data.o"
include "build/data/ovl_Bg_Tobira01/ovl_Bg_Tobira01.reloc.o"
include "build/src/overlays/actors/ovl_Bg_Tobira01/ovl_Bg_Tobira01_reloc.o"
endseg
beginseg

View File

@ -84,8 +84,7 @@ BgBreakwallStruct D_808B8140[] = {
func_808B77D0, NULL },
{ OBJECT_IKNINSIDE_OBJ, NULL, object_ikninside_obj_DL_00AEC0, object_ikninside_obj_Matanimheader_00BCB8, NULL,
func_808B751C, func_808B7A10, func_808B7D34 },
{ OBJECT_SPOT11_OBJ, object_spot11_obj_DL_0013F0, NULL, NULL, &object_spot11_obj_Colheader_001EB8, func_808B736C,
func_808B77D0, NULL },
{ OBJECT_SPOT11_OBJ, gWoodStepDL, NULL, NULL, &gWoodStepCol, func_808B736C, func_808B77D0, NULL },
};
static InitChainEntry sInitChain[] = {

View File

@ -16,7 +16,6 @@ void BgTobira01_Destroy(Actor* thisx, PlayState* play);
void BgTobira01_Update(Actor* thisx, PlayState* play);
void BgTobira01_Draw(Actor* thisx, PlayState* play);
/*
const ActorInit Bg_Tobira01_InitVars = {
ACTOR_BG_TOBIRA01,
ACTORCAT_PROP,
@ -28,14 +27,80 @@ const ActorInit Bg_Tobira01_InitVars = {
(ActorFunc)BgTobira01_Update,
(ActorFunc)BgTobira01_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/func_80B12430.s")
void BgTobira01_Action(BgTobira01* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 csId = this->dyna.actor.csId;
s16 prevPosYTick;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Init.s")
if (this->cutsceneRequested) {
if (CutsceneManager_GetCurrentCsId() == CS_ID_GLOBAL_TALK) {
CutsceneManager_Stop(CS_ID_GLOBAL_TALK);
} else if (CutsceneManager_IsNext(csId)) {
CutsceneManager_StartWithPlayerCs(csId, &this->dyna.actor);
SET_WEEKEVENTREG(WEEKEVENTREG_88_40);
this->cutsceneRequested = false;
} else {
CutsceneManager_Queue(csId);
}
} else if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40) && (this->posYTick == 0) &&
(play->actorCtx.playerImpact.timer != 0) &&
(play->actorCtx.playerImpact.type == PLAYER_IMPACT_GORON_GROUND_POUND) &&
(SurfaceType_GetSceneExitIndex(&play->colCtx, player->actor.floorPoly, player->actor.floorBgId) == 6)) {
this->cutsceneRequested = true;
this->unk16C = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Destroy.s")
prevPosYTick = this->posYTick;
if (CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40)) {
this->posYTick++;
} else {
this->posYTick--;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Update.s")
this->posYTick = CLAMP(this->posYTick, 0, 60);
if (prevPosYTick != this->posYTick) {
Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_STONEDOOR_OPEN_S - SFX_FLAG);
this->dyna.actor.world.pos.y = this->posY = (this->posYTick * (5.0f / 3.0f)) + this->dyna.actor.home.pos.y;
this->timer = 180;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Tobira01/BgTobira01_Draw.s")
if (!(player->stateFlags1 & PLAYER_STATE1_40) && CHECK_WEEKEVENTREG(WEEKEVENTREG_88_40) &&
(DECR(this->timer) == 0)) {
CLEAR_WEEKEVENTREG(WEEKEVENTREG_88_40);
}
}
void BgTobira01_Init(Actor* thisx, PlayState* play) {
BgTobira01* this = THIS;
DynaPolyActor_Init(&this->dyna, DYNA_TRANSFORM_POS);
DynaPolyActor_LoadMesh(play, &this->dyna, &gGoronDoorCol);
CLEAR_WEEKEVENTREG(WEEKEVENTREG_88_40);
Actor_SetScale(&this->dyna.actor, 1.0f);
this->timer = gSaveContext.save.isNight;
this->posYTick = 0;
this->actionFunc = BgTobira01_Action;
}
void BgTobira01_Destroy(Actor* thisx, PlayState* play) {
BgTobira01* this = THIS;
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
}
void BgTobira01_Update(Actor* thisx, PlayState* play) {
BgTobira01* this = THIS;
this->actionFunc(this, play);
}
void BgTobira01_Draw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
func_8012C28C(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_OPA_DISP++, gGoronDoorDL);
CLOSE_DISPS(play->state.gfxCtx);
}

View File

@ -5,9 +5,16 @@
struct BgTobira01;
typedef void (*BgTobira01ActionFunc)(struct BgTobira01*, PlayState*);
typedef struct BgTobira01 {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x2C];
/* 0x000 */ DynaPolyActor dyna;
/* 0x15C */ BgTobira01ActionFunc actionFunc;
/* 0x160 */ s16 posYTick;
/* 0x162 */ s16 timer;
/* 0x164 */ f32 posY;
/* 0x168 */ s32 cutsceneRequested;
/* 0x16C */ s32 unk16C;
} BgTobira01; // size = 0x170
#endif // Z_BG_TOBIRA01_H

View File

@ -586,10 +586,6 @@ D_060005F8 = 0x060005F8;
D_06000A20 = 0x06000A20;
D_06000040 = 0x06000040;
/* ovl_Bg_Tobira01 */
D_060011C0 = 0x060011C0;
D_06000088 = 0x06000088;
// ovl_Boss_01
D_06000C44 = 0x06000C44;