From 5e72c01ff4d63f60693ce7825201ac50e199e28c Mon Sep 17 00:00:00 2001 From: retro <43223593+retro-git@users.noreply.github.com> Date: Mon, 27 Dec 2021 02:29:48 +0000 Subject: [PATCH] BgInibsMovebg OK (#485) * init messy but matching and data imported * destroy matched * all matching * add param macro * use generated reloc * remove unneccessary comment * add comment * cleanup * feedback * use NULL * sort variables by address --- spec | 3 +- .../ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c | 54 ++++++++++++++++--- .../ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.h | 8 ++- undefined_syms.txt | 9 ++++ 4 files changed, 62 insertions(+), 12 deletions(-) diff --git a/spec b/spec index d51c8c74b3..c26550595b 100644 --- a/spec +++ b/spec @@ -4441,8 +4441,7 @@ beginseg name "ovl_Bg_Inibs_Movebg" compress include "build/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.o" - include "build/data/ovl_Bg_Inibs_Movebg/ovl_Bg_Inibs_Movebg.data.o" - include "build/data/ovl_Bg_Inibs_Movebg/ovl_Bg_Inibs_Movebg.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Inibs_Movebg/ovl_Bg_Inibs_Movebg_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c index 817cda67ed..c75db53063 100644 --- a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c +++ b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.c @@ -14,7 +14,6 @@ void BgInibsMovebg_Init(Actor* thisx, GlobalContext* globalCtx); void BgInibsMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgInibsMovebg_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 const ActorInit Bg_Inibs_Movebg_InitVars = { ACTOR_BG_INIBS_MOVEBG, ACTORCAT_BG, @@ -27,17 +26,56 @@ const ActorInit Bg_Inibs_Movebg_InitVars = { (ActorFunc)BgInibsMovebg_Draw, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80B96578[] = { +extern Gfx D_06001C10[]; +extern Gfx D_06001DC0[]; +extern AnimatedMaterial D_06002598; +extern Gfx D_06006140[]; +extern Gfx D_060062D8[]; +extern AnimatedMaterial D_06006858; +Gfx* D_80B96560[] = { D_060062D8, D_06001DC0 }; +Gfx* D_80B96568[] = { D_06006140, D_06001C10 }; +AnimatedMaterial* D_80B96570[] = { &D_06006858, &D_06002598 }; + +static InitChainEntry sInitChain[] = { ICHAIN_VEC3F_DIV1000(scale, 1000, ICHAIN_STOP), }; -#endif +void BgInibsMovebg_Init(Actor* thisx, GlobalContext* globalCtx) { + BgInibsMovebg* this = THIS; -extern InitChainEntry D_80B96578[]; + Actor_ProcessInitChain(&this->dyna.actor, sInitChain); + DynaPolyActor_Init(&this->dyna, 1); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Inibs_Movebg/BgInibsMovebg_Init.s") + this->unk_15C = D_80B96560[BGINIBSMOVEBG_GET_F(thisx)]; + this->unk_160 = D_80B96568[BGINIBSMOVEBG_GET_F(thisx)]; + this->unk_164 = D_80B96570[BGINIBSMOVEBG_GET_F(thisx)]; +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Inibs_Movebg/BgInibsMovebg_Destroy.s") +void BgInibsMovebg_Destroy(Actor* thisx, GlobalContext* globalCtx) { + BgInibsMovebg* this = THIS; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Inibs_Movebg/BgInibsMovebg_Draw.s") + DynaPoly_DeleteBgActor(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); +} + +void BgInibsMovebg_Draw(Actor* thisx, GlobalContext* globalCtx) { + BgInibsMovebg* this = THIS; + + AnimatedMaterial* animMat; + Gfx* dl1; + Gfx* dl2; + + animMat = this->unk_164; + if (animMat != NULL) { + AnimatedMat_Draw(globalCtx, Lib_SegmentedToVirtual(this->unk_164)); + } + + dl1 = this->unk_15C; + if (dl1 != NULL) { + func_800BDFC0(globalCtx, this->unk_15C); + } + + dl2 = this->unk_160; + if (dl2 != NULL) { + func_800BE03C(globalCtx, this->unk_160); + } +} diff --git a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.h b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.h index fea6c8a67e..92494a35f9 100644 --- a/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.h +++ b/src/overlays/actors/ovl_Bg_Inibs_Movebg/z_bg_inibs_movebg.h @@ -5,9 +5,13 @@ struct BgInibsMovebg; +#define BGINIBSMOVEBG_GET_F(thisx) ((u16)((thisx)->params) & 0xF) + typedef struct BgInibsMovebg { - /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x24]; + /* 0x000 */ DynaPolyActor dyna; + /* 0x15C */ Gfx* unk_15C; + /* 0x160 */ Gfx* unk_160; + /* 0x164 */ AnimatedMaterial* unk_164; } BgInibsMovebg; // size = 0x168 extern const ActorInit Bg_Inibs_Movebg_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index c1cd694cfa..bf888b7ac5 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -881,6 +881,15 @@ D_06013058 = 0x06013058; D_060006B0 = 0x060006B0; D_060016DC = 0x060016DC; +// ovl_Bg_Inibs_Movebg + +D_06001C10 = 0x06001C10; +D_06001DC0 = 0x06001DC0; +D_06002598 = 0x06002598; +D_06006140 = 0x06006140; +D_060062D8 = 0x060062D8; +D_06006858 = 0x06006858; + // ovl_Bg_Keikoku_Saku D_06001640 = 0x06001640;