1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-17 05:15:16 +00:00

z_ovl_bg_spot07_taki OK (#766)

* z_bg_spot07_taki OK

* clean up code

* implement pr suggestions

* thisx fix
This commit is contained in:
mzxrules 2021-04-11 21:33:29 -04:00 committed by GitHub
parent 7f94088a3b
commit 62df74991d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 100 additions and 454 deletions

View file

@ -15,16 +15,17 @@ void BgSpot07Taki_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgSpot07Taki_Update(Actor* thisx, GlobalContext* globalCtx);
void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx);
extern UNK_TYPE D_06000460;
extern UNK_TYPE D_06000BE0;
extern UNK_TYPE D_06001CF0;
extern UNK_TYPE D_06001F68;
extern UNK_TYPE D_06002590;
extern UNK_TYPE D_06003210;
extern UNK_TYPE D_060032D8;
extern UNK_TYPE D_060038FC;
void BgSpot07Taki_DoNothing(BgSpot07Taki* this, GlobalContext* globalCtx);
extern Gfx D_06000460[];
extern Gfx D_06000BE0[];
extern Gfx D_06001CF0[];
extern Gfx D_06001F68[];
extern CollisionHeader D_06002590;
extern Gfx D_06003210[];
extern Gfx D_060032D8[];
extern CollisionHeader D_060038FC;
/*
const ActorInit Bg_Spot07_Taki_InitVars = {
ACTOR_BG_SPOT07_TAKI,
ACTORCAT_BG,
@ -36,13 +37,92 @@ const ActorInit Bg_Spot07_Taki_InitVars = {
(ActorFunc)BgSpot07Taki_Update,
(ActorFunc)BgSpot07Taki_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot07_Taki/BgSpot07Taki_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot07_Taki/BgSpot07Taki_Destroy.s")
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot07_Taki/func_808AFD08.s")
void BgSpot07Taki_Init(Actor* thisx, GlobalContext* globalCtx) {
BgSpot07Taki* this = THIS;
s32 pad;
CollisionHeader* colHeader = NULL;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot07_Taki/BgSpot07Taki_Update.s")
DynaPolyActor_Init(&this->dyna, DPM_PLAYER);
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
if (LINK_IS_ADULT) {
if (this->dyna.actor.params == 0) {
CollisionHeader_GetVirtual(&D_06002590, &colHeader);
} else {
CollisionHeader_GetVirtual(&D_060038FC, &colHeader);
}
this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader);
}
this->actionFunc = BgSpot07Taki_DoNothing;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Spot07_Taki/BgSpot07Taki_Draw.s")
void BgSpot07Taki_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgSpot07Taki* this = THIS;
DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId);
}
void BgSpot07Taki_DoNothing(BgSpot07Taki* this, GlobalContext* globalCtx) {
}
void BgSpot07Taki_Update(Actor* thisx, GlobalContext* globalCtx) {
BgSpot07Taki* this = THIS;
this->actionFunc(this, globalCtx);
}
void BgSpot07Taki_Draw(Actor* thisx, GlobalContext* globalCtx) {
BgSpot07Taki* this = THIS;
u32 frames;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot07_taki.c", 169);
frames = globalCtx->gameplayFrames;
if (LINK_IS_ADULT) {
func_80093D18(globalCtx->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot07_taki.c", 177),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (this->dyna.actor.params == 0) {
gSPDisplayList(POLY_OPA_DISP++, D_06001CF0);
} else {
gSPDisplayList(POLY_OPA_DISP++, D_06003210);
}
}
func_80093D84(globalCtx->state.gfxCtx);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot07_taki.c", 191),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_XLU_DISP++, 0x08,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, ((frames * -1) & 0x7F), ((frames * 1) & 0x7F), 32, 32, 1,
((frames * 1) & 0x7F), ((frames * 1) & 0x7F), 32, 32));
if (LINK_IS_CHILD) {
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128);
if (this->dyna.actor.params == 0) {
gSPSegment(POLY_XLU_DISP++, 0x09,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, ((frames * -1) & 0x7F), ((frames * -3) & 0xFF), 64,
64, 1, ((frames * 1) & 0x7F), ((frames * -3) & 0xFF), 64, 64));
gSPSegment(POLY_XLU_DISP++, 0x0A,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1,
frames * 0, ((frames * 3) & 0x1FF), 32, 128));
gSPDisplayList(POLY_XLU_DISP++, D_06000460);
} else {
gSPSegment(POLY_XLU_DISP++, 0x09,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 0, ((frames * -1) & 0x7F), 32, 32, 1,
frames * 0, ((frames * -1) & 0x7F), 32, 32));
gSPSegment(POLY_XLU_DISP++, 0x0A,
Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, frames * 0, ((frames * 3) & 0x1FF), 32, 128, 1,
frames * 0, ((frames * 3) & 0x1FF), 32, 128));
gSPDisplayList(POLY_XLU_DISP++, &D_06000BE0);
}
} else if (this->dyna.actor.params == 0) {
gSPDisplayList(POLY_XLU_DISP++, D_06001F68);
} else {
gSPDisplayList(POLY_XLU_DISP++, D_060032D8);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot07_taki.c", 272);
}

View file

@ -6,9 +6,11 @@
struct BgSpot07Taki;
typedef void (*BgSpot07TakiActionFunc)(struct BgSpot07Taki*, GlobalContext*);
typedef struct BgSpot07Taki {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x1C];
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgSpot07TakiActionFunc actionFunc;
} BgSpot07Taki; // size = 0x0168
extern const ActorInit Bg_Spot07_Taki_InitVars;