From 02f4785df83d2d97fff4b76cb4c4ff890cb0b7e0 Mon Sep 17 00:00:00 2001 From: Kristopher Early <1191258+MrPolymorph@users.noreply.github.com> Date: Tue, 26 Apr 2022 22:12:13 +0100 Subject: [PATCH] Bg_Open_Spot OK (#783) * Fully Matched Bg_Open_Spot * addressing review comments variable names inline with convension variable naming clarity * remove redundant return. change padding type * texScroll to texScrolls --- assets/xml/objects/object_open_obj.xml | 10 ++-- spec | 3 +- .../actors/ovl_Bg_Open_Spot/z_bg_open_spot.c | 51 ++++++++++++++----- .../actors/ovl_Bg_Open_Spot/z_bg_open_spot.h | 2 +- undefined_syms.txt | 7 ++- 5 files changed, 48 insertions(+), 25 deletions(-) diff --git a/assets/xml/objects/object_open_obj.xml b/assets/xml/objects/object_open_obj.xml index ea1664a884..74a4101bdd 100644 --- a/assets/xml/objects/object_open_obj.xml +++ b/assets/xml/objects/object_open_obj.xml @@ -4,11 +4,11 @@ - - - - - + + + + + diff --git a/spec b/spec index c99293c3b2..57a0441240 100644 --- a/spec +++ b/spec @@ -3439,8 +3439,7 @@ beginseg name "ovl_Bg_Open_Spot" compress include "build/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.o" - include "build/data/ovl_Bg_Open_Spot/ovl_Bg_Open_Spot.data.o" - include "build/data/ovl_Bg_Open_Spot/ovl_Bg_Open_Spot.reloc.o" + include "build/src/overlays/actors/ovl_Bg_Open_Spot/ovl_Bg_Open_Spot_reloc.o" endseg beginseg diff --git a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c index b776253e60..48d2cd4f25 100644 --- a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c +++ b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.c @@ -1,10 +1,11 @@ /* * File: z_bg_open_spot.c * Overlay: ovl_Bg_Open_Spot - * Description: Star Light Rays in Intro Scene + * Description: Spotlights that shine on the Skull Kid when he turns Link + * into a Deku Scrub. */ - #include "z_bg_open_spot.h" +#include "objects/object_open_obj/object_open_obj.h" #define FLAGS (ACTOR_FLAG_10) @@ -13,8 +14,8 @@ void BgOpenSpot_Init(Actor* thisx, GlobalContext* globalCtx); void BgOpenSpot_Destroy(Actor* thisx, GlobalContext* globalCtx); void BgOpenSpot_Update(Actor* thisx, GlobalContext* globalCtx); +void BgOpenSpot_Draw(Actor* thisx, GlobalContext* globalCtx); -#if 0 const ActorInit Bg_Open_Spot_InitVars = { ACTOR_BG_OPEN_SPOT, ACTORCAT_PROP, @@ -27,25 +28,49 @@ const ActorInit Bg_Open_Spot_InitVars = { (ActorFunc)NULL, }; -// static InitChainEntry sInitChain[] = { -static InitChainEntry D_80ACB3B0[] = { +static InitChainEntry sInitChain[] = { ICHAIN_F32(uncullZoneForward, 4000, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneScale, 560, ICHAIN_CONTINUE), ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_CONTINUE), ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP), }; -#endif +void BgOpenSpot_Init(Actor* thisx, GlobalContext* globalCtx) { + BgOpenSpot* this = THIS; -extern InitChainEntry D_80ACB3B0[]; + Actor_ProcessInitChain(&this->actor, sInitChain); + this->texScrolls = Lib_SegmentedToVirtual(gSpotlightTexAnim); +} -extern UNK_TYPE D_06001A60; -extern UNK_TYPE D_06002CE0; +void BgOpenSpot_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Open_Spot/BgOpenSpot_Init.s") +void BgOpenSpot_Update(Actor* thisx, GlobalContext* globalCtx) { + BgOpenSpot* this = THIS; + u32 action; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Open_Spot/BgOpenSpot_Destroy.s") + if (Cutscene_CheckActorAction(globalCtx, 0x7D)) { + action = globalCtx->csCtx.actorActions[Cutscene_GetActorActionIndex(globalCtx, 0x7D)]->action; + if (action == 1) { + this->actor.draw = NULL; + } else if (action == 2) { + this->actor.draw = BgOpenSpot_Draw; + } + } +} -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Open_Spot/BgOpenSpot_Update.s") +void BgOpenSpot_Draw(Actor* thisx, GlobalContext* globalCtx) { + s32 pad; + BgOpenSpot* this = (BgOpenSpot*)thisx; -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Open_Spot/func_80ACB2B0.s") + AnimatedMat_Draw(globalCtx, this->texScrolls); + OPEN_DISPS(globalCtx->state.gfxCtx); + + func_8012C2DC(globalCtx->state.gfxCtx); + gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gDPSetColorDither(POLY_XLU_DISP++, G_CD_BAYER); + gSPDisplayList(POLY_XLU_DISP++, gSpotlightLeftDL); + gSPDisplayList(POLY_XLU_DISP++, gSpotlightRightDL); + + CLOSE_DISPS(globalCtx->state.gfxCtx); +} diff --git a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.h b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.h index cf4fa2f8da..3a2b92125c 100644 --- a/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.h +++ b/src/overlays/actors/ovl_Bg_Open_Spot/z_bg_open_spot.h @@ -7,7 +7,7 @@ struct BgOpenSpot; typedef struct BgOpenSpot { /* 0x000 */ Actor actor; - /* 0x144 */ char unk_144[0x4]; + /* 0x144 */ AnimatedMaterial* texScrolls; } BgOpenSpot; // size = 0x148 extern const ActorInit Bg_Open_Spot_InitVars; diff --git a/undefined_syms.txt b/undefined_syms.txt index eca7f59677..1ef7e69420 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -679,11 +679,10 @@ D_06000098 = 0x06000098; D_060003E8 = 0x060003E8; D_06001640 = 0x06001640; -// ovl_Bg_Open_Spot -D_06001A60 = 0x06001A60; -D_06001B40 = 0x06001B40; -D_06002CE0 = 0x06002CE0; +// ovl_Bg_Sinkai_Kabe + +D_06000048 = 0x06000048; // ovl_Bg_Spout_Fire