From f4e4545180c7fb643f8a2012a36c6346c495f510 Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Thu, 23 Nov 2023 09:07:30 -0500 Subject: Re-implement King Dodongo's Lava texture effects (#3434) * fix alt backgrounds not always loading * include gfx lookup with the original unload * Add hook for alt toggle * handle cpu modified texture for kd lava * malloc array instead of illegal initialize --- soh/src/code/z_room.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'soh/src/code') diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index ccbc93d0d..772978f09 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -277,6 +277,11 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h bg->b.imagePal = 0; bg->b.imageFlip = CVarGetInteger("gMirroredWorld", 0) ? G_BG_FLAG_FLIPS : 0; + // When an alt resource exists for the background, we need to unload the original asset + // to clear the cache so the alt asset will be loaded instead + // OTRTODO: If Alt loading over original cache is fixed, this line can most likely be removed + ResourceMgr_UnloadOriginalWhenAltExists((char*) source); + if (ResourceMgr_ResourceIsBackground((char*) source)) { char* blob = (char*) ResourceGetDataByName((char *) source); swapAndConvertJPEG(blob); -- cgit v1.2.3 From f2df029efa9c46d4169dd1b1fc10ad887ddebe65 Mon Sep 17 00:00:00 2001 From: Adam Bird Date: Fri, 24 Nov 2023 09:38:45 -0500 Subject: fix: skybox crash for mask shop (#3427) --- soh/src/code/z_vr_box.c | 7 ++++++- soh/src/code/z_vr_box_draw.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_vr_box.c b/soh/src/code/z_vr_box.c index b77c3d869..ff2622187 100644 --- a/soh/src/code/z_vr_box.c +++ b/soh/src/code/z_vr_box.c @@ -417,7 +417,12 @@ void func_800AEFC8(SkyboxContext* skyboxCtx, s16 skyboxId) { s32 j; s32 phi_s3 = 0; - if (skyboxId == SKYBOX_BAZAAR || (skyboxId > SKYBOX_HOUSE_KAKARIKO && skyboxId <= SKYBOX_BOMBCHU_SHOP)) { + //! @bug All shops only provide 2 faces for their sky box. Mask shop is missing from the condition + // meaning that the Mask shop will calculate 4 faces + // This effect is not noticed as the faces are behind the camera, but will cause a crash in SoH. + // SOH General: We have added the Mask shop to this check so only the 2 expected faces are calculated. + if (skyboxId == SKYBOX_BAZAAR || skyboxId == SKYBOX_HAPPY_MASK_SHOP || + (skyboxId >= SKYBOX_KOKIRI_SHOP && skyboxId <= SKYBOX_BOMBCHU_SHOP)) { for (j = 0, i = 0; i < 2; i++, j += 2) { phi_s3 = func_800ADBB0(skyboxCtx, skyboxCtx->roomVtx, phi_s3, D_8012AEBC[i].unk_0, D_8012AEBC[i].unk_4, D_8012AEBC[i].unk_8, D_8012AEBC[i].unk_C, D_8012AEBC[i].unk_10, i, j); diff --git a/soh/src/code/z_vr_box_draw.c b/soh/src/code/z_vr_box_draw.c index 8eb97573e..5b4867121 100644 --- a/soh/src/code/z_vr_box_draw.c +++ b/soh/src/code/z_vr_box_draw.c @@ -59,8 +59,14 @@ void SkyboxDraw_Draw(SkyboxContext* skyboxCtx, GraphicsContext* gfxCtx, s16 skyb gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[2]); gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[3]); - if (skyboxId != SKYBOX_BAZAAR) { - if (skyboxId <= SKYBOX_HOUSE_KAKARIKO || skyboxId > SKYBOX_BOMBCHU_SHOP) { + //! @bug All shops only provide 2 faces for their sky box. Mask shop is missing from the condition + // meaning that the Mask shop will render the previously loaded sky box values, or uninitialized data. + // This effect is not noticed as the faces are behind the camera, but will cause a crash in SoH. + // SOH General: We have added the Mask shop to this check so only the 2 expected faces are rendered. + if (skyboxId != SKYBOX_BAZAAR && skyboxId != SKYBOX_HAPPY_MASK_SHOP) { + if (skyboxId < SKYBOX_KOKIRI_SHOP || skyboxId > SKYBOX_BOMBCHU_SHOP) { + // Skip remaining faces for most shop skyboxes + gDPPipeSync(POLY_OPA_DISP++); gDPLoadTLUT_pal256(POLY_OPA_DISP++, skyboxCtx->palettes[2]); gSPDisplayList(POLY_OPA_DISP++, skyboxCtx->dListBuf[4]); -- cgit v1.2.3 From 95f27ace2e918a5512f4d2621a8dad3200042e7c Mon Sep 17 00:00:00 2001 From: inspectredc <78732756+inspectredc@users.noreply.github.com> Date: Fri, 24 Nov 2023 14:40:42 +0000 Subject: Fix kokiri sword unequipping when using switch age cheat/enhancements (#3415) * test fix for ks unequip * remove unnecessary brackets --- soh/src/code/z_parameter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index bbaa8d90b..20debfd79 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1526,13 +1526,13 @@ void Inventory_SwapAgeEquipment(void) { } else { // When becoming child, set swordless flag if player doesn't have kokiri sword // Only in rando to keep swordless link bugs in vanilla - if (IS_RANDO && (EQUIP_INV_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4) & gSaveContext.inventory.equipment) == 0) { + if (IS_RANDO && CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0) { Flags_SetInfTable(INFTABLE_SWORDLESS); } // When using enhancements, set swordless flag if player doesn't have kokiri sword or hasn't equipped a sword yet. // Then set the child equips button items to item none to ensure kokiri sword is not equipped - if ((CVarGetInteger("gSwitchAge", 0) || CVarGetInteger("gSwitchTimeline", 0)) && ((EQUIP_INV_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4) & gSaveContext.inventory.equipment) == 0 || Flags_GetInfTable(INFTABLE_SWORDLESS))) { + if ((CVarGetInteger("gSwitchAge", 0) || CVarGetInteger("gSwitchTimeline", 0)) && (CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0 || Flags_GetInfTable(INFTABLE_SWORDLESS))) { Flags_SetInfTable(INFTABLE_SWORDLESS); gSaveContext.childEquips.buttonItems[0] = ITEM_NONE; } @@ -1568,7 +1568,7 @@ void Inventory_SwapAgeEquipment(void) { gSaveContext.equips.equipment = gSaveContext.childEquips.equipment; gSaveContext.equips.equipment &= (u16) ~(0xF << (EQUIP_TYPE_SWORD * 4)); // Equips kokiri sword in the inventory screen only if kokiri sword exists in inventory and a sword has been equipped already - if (!((EQUIP_INV_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4) & gSaveContext.inventory.equipment) == 0) && !Flags_GetInfTable(INFTABLE_SWORDLESS)) { + if (!(CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0) && !Flags_GetInfTable(INFTABLE_SWORDLESS)) { gSaveContext.equips.equipment |= EQUIP_VALUE_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4); } } else if (gSaveContext.childEquips.buttonItems[0] != ITEM_NONE) { @@ -1598,7 +1598,7 @@ void Inventory_SwapAgeEquipment(void) { (only kokiri tunic/boots equipped, no sword, no C-button items, no D-Pad items). When becoming child, set swordless flag if player doesn't have kokiri sword Only in rando to keep swordless link bugs in vanilla*/ - if (EQUIP_INV_SWORD_KOKIRI << (EQUIP_TYPE_SWORD * 4) & gSaveContext.inventory.equipment == 0) { + if (CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0) { Flags_SetInfTable(INFTABLE_SWORDLESS); } -- cgit v1.2.3 From c4f34624bad0dc4aa823bda9ba6691eab6e43209 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Tue, 28 Nov 2023 19:25:48 -0700 Subject: Flag tracker (#3447) * Hook into flagset hooks for processing check tracking. Has some manual workarounds (some breaks still need to be found). Remove areaChecks and looping functionality as redundant. * Additional vanilla handling. * Fix tracker not showing MQ checks in MQ non-rando. Fix tracker marking non-MQ variants of dungeon checks (e.g. map chest, etc) when collecting in MQ. * Set all areas to spoiled if not rando. * Revert attempt to spoil in randomizer based on MQ dungeon count as I don't know how that works at the moment. * Restore and update spoiling based on MQ dungeon settings (none, selection, or count of 12). Fix Anju As Adult check. * Remove Anchor-specific code :baguette: * Use `ClearAreaTotals()` in `Teardown()` instead of the duplicate code there. * Update to `ClearAreaChecksAndTotals()` with `vec.clear()` added. * Fix type spoiling again. Now spoils on 0 MQ dungeons, not rando, if the option is enabled in check tracker settings, selection, or set number of 12. Fix vanilla checks being marked collected in MQ dungeons. * Fix 100 GS check. * ACTUALLY fix 100 GS: change flag type to `RandomizerInf()` in `item_location.cpp`, add RC to RandoInf for it to the table. Also don't send GI for flag if father, falsely triggers ZR frogs minigame. * Fix gravedigging tour tracking. * Fix membership card check tracking. Change scene and flag values to any existing enums. Clarifying formatting for the checking loop vOrMQ conditions. * Fix Gravedigging Tour tracking. Simplify Always Win Gravedigging Tour and Fix Gravedigging Tour Glitch applications. Modified all necessary paths to use vanilla GDT PoH collection flag instead of randomizer variant. * Fix Kak Potion Shop being "seen" when entering as child. --- soh/src/code/z_message_PAL.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'soh/src/code') diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index da0f5f55f..7bb3803fc 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -3384,7 +3384,7 @@ void Message_Update(PlayState* play) { } sLastPlayedSong = 0xFF; osSyncPrintf("OCARINA_MODE=%d chk_ocarina_no=%d\n", play->msgCtx.ocarinaMode, msgCtx->unk_E3F2); - CheckTracker_OnMessageClose(); + // TODO: OnMessageClose hook break; case MSGMODE_PAUSED: break; -- cgit v1.2.3