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: 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 --- .../actors/ovl_Bg_Open_Spot/z_bg_open_spot.c | 51 ++++++++++++++++------ .../actors/ovl_Bg_Open_Spot/z_bg_open_spot.h | 2 +- 2 files changed, 39 insertions(+), 14 deletions(-) (limited to 'src') 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 b776253e6..48d2cd4f2 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; + + Actor_ProcessInitChain(&this->actor, sInitChain); + this->texScrolls = Lib_SegmentedToVirtual(gSpotlightTexAnim); +} + +void BgOpenSpot_Destroy(Actor* thisx, GlobalContext* globalCtx) { +} -extern InitChainEntry D_80ACB3B0[]; +void BgOpenSpot_Update(Actor* thisx, GlobalContext* globalCtx) { + BgOpenSpot* this = THIS; + u32 action; -extern UNK_TYPE D_06001A60; -extern UNK_TYPE D_06002CE0; + 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_Init.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/BgOpenSpot_Destroy.s") + AnimatedMat_Draw(globalCtx, this->texScrolls); + OPEN_DISPS(globalCtx->state.gfxCtx); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Open_Spot/BgOpenSpot_Update.s") + 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); -#pragma GLOBAL_ASM("asm/non_matchings/overlays/ovl_Bg_Open_Spot/func_80ACB2B0.s") + 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 cf4fa2f8d..3a2b92125 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; -- cgit v1.2.3