From d1ac7eb80d540be5086b7c1d1cddb02481554b12 Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Mon, 24 Jan 2022 18:42:36 -0500 Subject: [PATCH] Document the lens system (#1079) * merge master * A little bit * start docs on lens * Delete Jenkinsfile * Make sense of the numbers in `Actor_DrawLensOfTruthMask` f3dzex commands * More comments on `Actor_DrawLens` f3dzex usage * remove padding * renames * Simplify gfx comments * Add some line breaks * Remove undef Co-authored-by: Dragorn421 Co-authored-by: Louis --- include/functions.h | 2 +- include/z64.h | 3 +- src/code/z_actor.c | 57 ++++++++++++++----- src/code/z_parameter.c | 10 ++-- .../ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c | 2 +- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 2 +- .../ovl_Bg_Haka_Megane/z_bg_haka_megane.c | 2 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 2 +- .../z_bg_menkuri_nisekabe.c | 2 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 2 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 2 +- .../actors/ovl_En_Po_Desert/z_en_po_desert.c | 4 +- src/overlays/actors/ovl_En_Test/z_en_test.c | 4 +- .../ovl_Item_Etcetera/z_item_etcetera.c | 2 +- .../actors/ovl_player_actor/z_player.c | 14 ++--- 15 files changed, 68 insertions(+), 42 deletions(-) diff --git a/include/functions.h b/include/functions.h index fa43066593..5dcf327879 100644 --- a/include/functions.h +++ b/include/functions.h @@ -453,7 +453,7 @@ void func_8002F948(Actor* actor, u16 sfxId); void func_8002F974(Actor* actor, u16 sfxId); void func_8002F994(Actor* actor, s32 arg1); s32 func_8002F9EC(GlobalContext* globalCtx, Actor* actor, CollisionPoly* poly, s32 bgId, Vec3f* pos); -void func_800304B0(GlobalContext* globalCtx); +void Actor_DisableLens(GlobalContext* globalCtx); void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry* actorEntry); void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx); s32 func_800314D4(GlobalContext* globalCtx, Actor* actorB, Vec3f* arg2, f32 arg3); diff --git a/include/z64.h b/include/z64.h index 567d6684f8..9483483f98 100644 --- a/include/z64.h +++ b/include/z64.h @@ -242,10 +242,9 @@ typedef struct { /* 0x0000 */ u8 freezeFlashTimer; /* 0x0001 */ char unk_01[0x01]; /* 0x0002 */ u8 unk_02; - /* 0x0003 */ u8 unk_03; + /* 0x0003 */ u8 lensActive; /* 0x0004 */ char unk_04[0x04]; /* 0x0008 */ u8 total; // total number of actors loaded - /* 0x0009 */ char unk_09[0x03]; /* 0x000C */ ActorListEntry actorLists[ACTORCAT_MAX]; /* 0x006C */ TargetContext targetCtx; struct { diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 235702d206..39db8cafa3 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1944,9 +1944,9 @@ void func_80030488(GlobalContext* globalCtx) { LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, D_8015BC10); } -void func_800304B0(GlobalContext* globalCtx) { - if (globalCtx->actorCtx.unk_03 != 0) { - globalCtx->actorCtx.unk_03 = 0; +void Actor_DisableLens(GlobalContext* globalCtx) { + if (globalCtx->actorCtx.lensActive) { + globalCtx->actorCtx.lensActive = false; func_800876C8(globalCtx); } } @@ -2245,20 +2245,32 @@ void func_80030ED8(Actor* actor) { } } -void func_80030FA8(GraphicsContext* gfxCtx) { +#define LENS_MASK_WIDTH 64 +#define LENS_MASK_HEIGHT 64 +// 26 and 6 are for padding between the mask texture and the screen borders +#define LENS_MASK_OFFSET_S ((SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) - 26) +#define LENS_MASK_OFFSET_T ((SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) - 6) + +void Actor_DrawLensOverlay(GraphicsContext* gfxCtx) { OPEN_DISPS(gfxCtx, "../z_actor.c", 6161); - gDPLoadTextureBlock(POLY_XLU_DISP++, gLensOfTruthMaskTex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, - G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD); + gDPLoadTextureBlock(POLY_XLU_DISP++, gLensOfTruthMaskTex, G_IM_FMT_I, G_IM_SIZ_8b, LENS_MASK_WIDTH, + LENS_MASK_HEIGHT, 0, G_TX_MIRROR | G_TX_CLAMP, G_TX_MIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, + G_TX_NOLOD); - gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, 384, 224, 892, 732); - gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, 1280, 960, G_TX_RENDERTILE, 2240, 1600, 576, 597); + gDPSetTileSize(POLY_XLU_DISP++, G_TX_RENDERTILE, (SCREEN_WIDTH / 2 - LENS_MASK_WIDTH) << 2, + (SCREEN_HEIGHT / 2 - LENS_MASK_HEIGHT) << 2, (SCREEN_WIDTH / 2 + LENS_MASK_WIDTH - 1) << 2, + (SCREEN_HEIGHT / 2 + LENS_MASK_HEIGHT - 1) << 2); + gSPTextureRectangle(POLY_XLU_DISP++, 0, 0, SCREEN_WIDTH << 2, SCREEN_HEIGHT << 2, G_TX_RENDERTILE, + LENS_MASK_OFFSET_S << 5, LENS_MASK_OFFSET_T << 5, + (1 << 10) * (SCREEN_WIDTH - 2 * LENS_MASK_OFFSET_S) / SCREEN_WIDTH, + (1 << 10) * (SCREEN_HEIGHT - 2 * LENS_MASK_OFFSET_T) / SCREEN_HEIGHT); gDPPipeSync(POLY_XLU_DISP++); CLOSE_DISPS(gfxCtx, "../z_actor.c", 6183); } -void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** invisibleActors) { +void Actor_DrawLensActors(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** invisibleActors) { Actor** invisibleActor; GraphicsContext* gfxCtx; s32 i; @@ -2272,27 +2284,40 @@ void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** inv gDPPipeSync(POLY_XLU_DISP++); if (globalCtx->roomCtx.curRoom.showInvisActors == 0) { + // Update both the color frame buffer and the z-buffer gDPSetOtherMode(POLY_XLU_DISP++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | G_RM_CLD_SURF | G_RM_CLD_SURF2); + gDPSetCombineMode(POLY_XLU_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 0, 255); + + // the z-buffer will later only allow drawing inside the lens circle } else { + // Update the z-buffer but not the color frame buffer gDPSetOtherMode(POLY_XLU_DISP++, G_AD_DISABLE | G_CD_MAGICSQ | G_CK_NONE | G_TC_FILT | G_TF_BILERP | G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_THRESHOLD | G_ZS_PRIM | Z_UPD | IM_RD | CVG_DST_SAVE | ZMODE_OPA | FORCE_BL | GBL_c1(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA) | GBL_c2(G_BL_CLR_BL, G_BL_0, G_BL_CLR_MEM, G_BL_1MA)); + + // inverts the mask image, which initially is 0 inner and 74 outer, + // by setting the combiner to draw 74 - image instead of the image gDPSetCombineLERP(POLY_XLU_DISP++, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0, PRIMITIVE, TEXEL0, PRIM_LOD_FRAC, 0); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0xFF, 74, 74, 74, 74); + + // the z-buffer will later only allow drawing outside the lens circle } + // Together with the depth source set above, this sets the depth to the closest. + // For a pixel with such a depth value, the z-buffer will reject drawing to that pixel. gDPSetPrimDepth(POLY_XLU_DISP++, 0, 0); - func_80030FA8(gfxCtx); + // The z-buffer will be updated where the mask is not fully transparent. + Actor_DrawLensOverlay(gfxCtx); // "Magic lens invisible Actor display START" gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 START", numInvisibleActors); @@ -2308,6 +2333,8 @@ void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** inv gDPNoOpString(POLY_OPA_DISP++, "魔法のメガネ 見えないActor表示 END", numInvisibleActors); if (globalCtx->roomCtx.curRoom.showInvisActors != 0) { + // Draw the lens overlay to the color frame buffer + gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 0); // "Blue spectacles (exterior)" gDPPipeSync(POLY_XLU_DISP++); @@ -2319,7 +2346,7 @@ void func_8003115C(GlobalContext* globalCtx, s32 numInvisibleActors, Actor** inv gDPSetCombineMode(POLY_XLU_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 0, 0, 255); - func_80030FA8(gfxCtx); + Actor_DrawLensOverlay(gfxCtx); gDPNoOpString(POLY_OPA_DISP++, "青い眼鏡(外側)", 1); // "Blue spectacles (exterior)" } @@ -2398,7 +2425,7 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { if ((HREG(64) != 1) || ((HREG(65) != -1) && (HREG(65) != HREG(66))) || (HREG(71) == 0)) { if ((actor->init == NULL) && (actor->draw != NULL) && (actor->flags & (ACTOR_FLAG_5 | ACTOR_FLAG_6))) { if ((actor->flags & ACTOR_FLAG_7) && - ((globalCtx->roomCtx.curRoom.showInvisActors == 0) || (globalCtx->actorCtx.unk_03 != 0) || + ((globalCtx->roomCtx.curRoom.showInvisActors == 0) || globalCtx->actorCtx.lensActive || (actor->room != globalCtx->roomCtx.curRoom.num))) { ASSERT(invisibleActorCounter < INVISIBLE_ACTOR_MAX, "invisible_actor_counter < INVISIBLE_ACTOR_MAX", "../z_actor.c", 6464); @@ -2426,10 +2453,10 @@ void func_800315AC(GlobalContext* globalCtx, ActorContext* actorCtx) { } if ((HREG(64) != 1) || (HREG(72) != 0)) { - if (globalCtx->actorCtx.unk_03 != 0) { - func_8003115C(globalCtx, invisibleActorCounter, invisibleActors); + if (globalCtx->actorCtx.lensActive) { + Actor_DrawLensActors(globalCtx, invisibleActorCounter, invisibleActors); if ((globalCtx->csCtx.state != CS_STATE_IDLE) || Player_InCsMode(globalCtx)) { - func_800304B0(globalCtx); + Actor_DisableLens(globalCtx); } } } diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index b3de2f7634..c4f70d8818 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2272,7 +2272,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 2: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.unk_03 = 0; + globalCtx->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 1; @@ -2284,7 +2284,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 1: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.unk_03 = 0; + globalCtx->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 6; @@ -2312,7 +2312,7 @@ s32 func_80087708(GlobalContext* globalCtx, s16 arg1, s16 arg2) { case 4: if ((gSaveContext.unk_13F0 == 0) || (gSaveContext.unk_13F0 == 7)) { if (gSaveContext.unk_13F0 == 7) { - globalCtx->actorCtx.unk_03 = 0; + globalCtx->actorCtx.lensActive = false; } gSaveContext.unk_13F8 = gSaveContext.magic - arg1; gSaveContext.unk_13F0 = 4; @@ -2459,8 +2459,8 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { ((gSaveContext.equips.buttonItems[1] != ITEM_LENS) && (gSaveContext.equips.buttonItems[2] != ITEM_LENS) && (gSaveContext.equips.buttonItems[3] != ITEM_LENS)) || - (globalCtx->actorCtx.unk_03 == 0)) { - globalCtx->actorCtx.unk_03 = 0; + !globalCtx->actorCtx.lensActive) { + globalCtx->actorCtx.lensActive = false; Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); gSaveContext.unk_13F0 = 0; diff --git a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c index b8da9e6ada..5385e46995 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Nisekabe/z_bg_gnd_nisekabe.c @@ -39,7 +39,7 @@ void BgGndNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgGndNisekabe_Update(Actor* thisx, GlobalContext* globalCtx) { BgGndNisekabe* this = (BgGndNisekabe*)thisx; - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_7; } else { this->actor.flags &= ~ACTOR_FLAG_7; diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index 0f1751a973..39f32b1f61 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -291,7 +291,7 @@ void BgHakaGate_FalseSkull(BgHakaGate* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->switchFlag)) { Math_StepToS(&this->vFlameScale, 350, 20); } - if (globalCtx->actorCtx.unk_03) { + if (globalCtx->actorCtx.lensActive) { this->dyna.actor.flags |= ACTOR_FLAG_7; } else { this->dyna.actor.flags &= ~ACTOR_FLAG_7; diff --git a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c index d2019a724b..bb3b62429b 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c +++ b/src/overlays/actors/ovl_Bg_Haka_Megane/z_bg_haka_megane.c @@ -108,7 +108,7 @@ void func_8087DB24(BgHakaMegane* this, GlobalContext* globalCtx) { void func_8087DBF0(BgHakaMegane* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { thisx->flags |= ACTOR_FLAG_7; func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); } else { diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index d946b3cbb5..959b490945 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -259,7 +259,7 @@ void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) { &scytheVertices[2]); } - if ((this->unk_151 == 0) || (globalCtx->actorCtx.unk_03 != 0)) { + if ((this->unk_151 == 0) || globalCtx->actorCtx.lensActive) { scytheVertices[0].x = this->actor.world.pos.x + blureEffectVertices1[this->actor.params].z * actorRotYSin + blureEffectVertices1[this->actor.params].x * actorRotYCos; scytheVertices[0].y = this->actor.world.pos.y + blureEffectVertices1[this->actor.params].y; diff --git a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c index 4eced10bcd..00162c5d02 100644 --- a/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c +++ b/src/overlays/actors/ovl_Bg_Menkuri_Nisekabe/z_bg_menkuri_nisekabe.c @@ -40,7 +40,7 @@ void BgMenkuriNisekabe_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgMenkuriNisekabe_Update(Actor* thisx, GlobalContext* globalCtx) { BgMenkuriNisekabe* this = (BgMenkuriNisekabe*)thisx; - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_7; } else { this->actor.flags &= ~ACTOR_FLAG_7; diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 2dc10d7311..67f4bc25b7 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -2636,7 +2636,7 @@ void BossSst_UpdateHead(Actor* thisx, GlobalContext* globalCtx) { BossSst_HeadCollisionCheck(this, globalCtx); this->actionFunc(this, globalCtx); if (this->vVanish) { - if ((globalCtx->actorCtx.unk_03 == 0) || (thisx->colorFilterTimer != 0)) { + if (!globalCtx->actorCtx.lensActive || (thisx->colorFilterTimer != 0)) { this->actor.flags &= ~ACTOR_FLAG_7; } else { this->actor.flags |= ACTOR_FLAG_7; diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 4c463bad59..05b653a25d 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -722,7 +722,7 @@ s32 EnFirefly_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dL void* thisx, Gfx** gfx) { EnFirefly* this = (EnFirefly*)thisx; - if ((this->actor.draw == EnFirefly_DrawInvisible) && (globalCtx->actorCtx.unk_03 == 0)) { + if ((this->actor.draw == EnFirefly_DrawInvisible) && !globalCtx->actorCtx.lensActive) { *dList = NULL; } else if (limbIndex == 1) { pos->y += 2300.0f; diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c index 27b519a000..ba8b0de846 100644 --- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c +++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c @@ -132,7 +132,7 @@ void EnPoDesert_UpdateSpeedModifier(EnPoDesert* this) { void EnPoDesert_WaitForPlayer(EnPoDesert* this, GlobalContext* globalCtx) { func_8002F974(&this->actor, NA_SE_EN_PO_FLY - SFX_FLAG); - if (this->actor.xzDistToPlayer < 200.0f && (this->currentPathPoint != 2 || globalCtx->actorCtx.unk_03)) { + if (this->actor.xzDistToPlayer < 200.0f && (this->currentPathPoint != 2 || globalCtx->actorCtx.lensActive)) { if (this->currentPathPoint == 2) { if (Gameplay_InCsMode(globalCtx)) { this->actor.shape.rot.y += 0x800; @@ -197,7 +197,7 @@ void EnPoDesert_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_SetFocus(&this->actor, 42.0f); Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); - if (globalCtx->actorCtx.unk_03) { + if (globalCtx->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_7; this->actor.shape.shadowDraw = ActorShadow_DrawCircle; } else { diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index bcca638a05..9e1104c12d 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -1803,7 +1803,7 @@ void EnTest_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.params == STALFOS_TYPE_INVISIBLE) { - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_7; this->actor.shape.shadowDraw = ActorShadow_DrawFeet; } else { @@ -1876,7 +1876,7 @@ void EnTest_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, V Matrix_MultVec3f(&D_80864670, &sp64); if ((this->swordState >= 1) && - ((this->actor.params != STALFOS_TYPE_INVISIBLE) || (globalCtx->actorCtx.unk_03 != 0))) { + ((this->actor.params != STALFOS_TYPE_INVISIBLE) || globalCtx->actorCtx.lensActive)) { EffectBlure_AddVertex(Effect_GetByIndex(this->effectIndex), &sp70, &sp64); } else if (this->swordState >= 0) { EffectBlure_AddSpace(Effect_GetByIndex(this->effectIndex)); diff --git a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c index dace98579a..cdf7e8678d 100644 --- a/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c +++ b/src/overlays/actors/ovl_Item_Etcetera/z_item_etcetera.c @@ -201,7 +201,7 @@ void ItemEtcetera_Update(Actor* thisx, GlobalContext* globalCtx) { void ItemEtcetera_DrawThroughLens(Actor* thisx, GlobalContext* globalCtx) { ItemEtcetera* this = (ItemEtcetera*)thisx; - if (globalCtx->actorCtx.unk_03 != 0) { + if (globalCtx->actorCtx.lensActive) { func_8002EBCC(&this->actor, globalCtx, 0); func_8002ED80(&this->actor, globalCtx, 0); GetItem_Draw(globalCtx, this->giDrawId); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 1f8b465d25..a78c260294 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2722,12 +2722,12 @@ void func_80835F44(GlobalContext* globalCtx, Player* this, s32 item) { if (actionParam == PLAYER_AP_LENS) { if (func_80087708(globalCtx, 0, 3)) { - if (globalCtx->actorCtx.unk_03 != 0) { - func_800304B0(globalCtx); + if (globalCtx->actorCtx.lensActive) { + Actor_DisableLens(globalCtx); } else { - globalCtx->actorCtx.unk_03 = 1; + globalCtx->actorCtx.lensActive = true; } - func_80078884((globalCtx->actorCtx.unk_03 != 0) ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); + func_80078884((globalCtx->actorCtx.lensActive) ? NA_SE_SY_GLASSMODE_ON : NA_SE_SY_GLASSMODE_OFF); } else { func_80078884(NA_SE_SY_ERROR); } @@ -4175,7 +4175,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { .sides[(doorDirection > 0) ? 0 : 1] .effects; - func_800304B0(globalCtx); + Actor_DisableLens(globalCtx); } } else { // This actor can be either EnDoor or DoorKiller. @@ -4228,7 +4228,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { if (this->doorType != PLAYER_DOORTYPE_FAKE) { this->stateFlags1 |= PLAYER_STATE1_29; - func_800304B0(globalCtx); + Actor_DisableLens(globalCtx); if (((doorActor->params >> 7) & 7) == 3) { sp4C.x = doorActor->world.pos.x - (sp6C * sp74); @@ -5806,7 +5806,7 @@ s32 func_8083E0FC(Player* this, GlobalContext* globalCtx) { func_80832F54(globalCtx, this, 0x9B); this->actor.parent = this->rideActor; func_80832224(this); - func_800304B0(globalCtx); + Actor_DisableLens(globalCtx); return 1; }