1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-16 12:54:40 +00:00

Ovl_Bg_Spot01_Idomizu OK (#303)

* Init OK (with weird goto)

* func_808ABB84 matching

* BgSpot01Idomizu_Destroy matching

* Run ./format.sh

* BgSpot01Idomizu_Update matching

* Remove Init's goto

* BgSpot01Idomizu_Draw matching

* Delete BgSpot01Idomizu asm files

* Variable naming and cleanup

* Update spec

* Delete unused ASM

* Address review feedback

* Fix fake match in Draw caused by not doing dispRefs[4]
This commit is contained in:
Tom Overton 2020-08-13 21:17:25 -07:00 committed by GitHub
parent fb548ac9e4
commit d3b88e1b1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 62 additions and 253 deletions

View file

@ -17,7 +17,6 @@ void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx);
/*
const ActorInit Bg_Spot01_Idomizu_InitVars = {
ACTOR_BG_SPOT01_IDOMIZU,
ACTORTYPE_BG,
@ -29,13 +28,64 @@ const ActorInit Bg_Spot01_Idomizu_InitVars = {
(ActorFunc)BgSpot01Idomizu_Update,
(ActorFunc)BgSpot01Idomizu_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Destroy.s")
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/func_808ABB84.s")
extern Gfx D_060007D0[];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Update.s")
void BgSpot01Idomizu_Init(Actor* thisx, GlobalContext* globalCtx) {
BgSpot01Idomizu* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot01_Idomizu/BgSpot01Idomizu_Draw.s")
Actor_ProcessInitChain(&this->actor, sInitChain);
if (gSaveContext.eventChkInf[6] & 0x80 || LINK_AGE_IN_YEARS == YEARS_ADULT) {
this->waterHeight = -550.0f;
} else {
this->waterHeight = 52.0f;
}
this->actionFunc = func_808ABB84;
this->actor.posRot.pos.y = this->waterHeight;
}
void BgSpot01Idomizu_Destroy(Actor* thisx, GlobalContext* globalCtx) {
}
void func_808ABB84(BgSpot01Idomizu* this, GlobalContext* globalCtx) {
if (gSaveContext.eventChkInf[6] & 0x80) {
this->waterHeight = -550.0f;
}
globalCtx->colCtx.stat.colHeader->waterBoxes[0].unk_02 = this->actor.posRot.pos.y;
if (this->waterHeight < this->actor.posRot.pos.y) {
Audio_PlaySoundGeneral(NA_SE_EV_WATER_LEVEL_DOWN - SFX_FLAG, &D_801333D4, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
}
Math_SmoothScaleMaxF(&this->actor.posRot.pos.y, this->waterHeight, 1.0f, 2.0f);
}
void BgSpot01Idomizu_Update(Actor* thisx, GlobalContext* globalCtx) {
BgSpot01Idomizu* this = THIS;
this->actionFunc(this, globalCtx);
}
void BgSpot01Idomizu_Draw(Actor* thisx, GlobalContext* globalCtx) {
u32 frames;
GraphicsContext* gfxCtx;
Gfx* dispRefs[4];
gfxCtx = globalCtx->state.gfxCtx;
Graph_OpenDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 228);
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(gfxCtx->polyXlu.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 232),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
frames = globalCtx->state.frames;
gSPSegment(gfxCtx->polyXlu.p++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 127 - frames % 128, frames & 0x7F, 32, 32, 1,
frames % 128, frames & 0x7F, 32, 32));
gSPDisplayList(gfxCtx->polyXlu.p++, D_060007D0);
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_bg_spot01_idomizu.c", 244);
}

View file

@ -11,7 +11,7 @@ typedef void (*BgSpot01IdomizuActionFunc)(struct BgSpot01Idomizu*, GlobalContext
typedef struct BgSpot01Idomizu {
/* 0x0000 */ Actor actor;
/* 0x014C */ BgSpot01IdomizuActionFunc actionFunc;
/* 0x0150 */ f32 unk_150;
/* 0x0150 */ f32 waterHeight;
/* 0x0154 */ char unk_154[0x4];
} BgSpot01Idomizu; // size = 0x0158