From 9656a3d4a2bfaa973106bbec72a1ba48b8fc4dee Mon Sep 17 00:00:00 2001 From: HylianFreddy <82058772+HylianFreddy@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:46:35 +0100 Subject: [PATCH 1/7] Fix player draw function being overwritten by FW --- code/src/actors/player.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/code/src/actors/player.c b/code/src/actors/player.c index 92c30ea4..d937f532 100644 --- a/code/src/actors/player.c +++ b/code/src/actors/player.c @@ -106,6 +106,11 @@ void PlayerActor_rUpdate(Actor* thisx, GlobalContext* globalCtx) { Player* this = (Player*)thisx; PlayerActor_Update(thisx, globalCtx); + // Restore Randomizer draw function in case something (like Farore's Wind) overwrote it + if (thisx->draw == PlayerActor_Draw) { + thisx->draw = PlayerActor_rDraw; + } + Arrow_HandleSwap(this, globalCtx); if (this->naviActor != 0) { From 0e128b5f7c0bb56582236514621eb0d61afd1f92 Mon Sep 17 00:00:00 2001 From: HylianFreddy <82058772+HylianFreddy@users.noreply.github.com> Date: Tue, 21 Nov 2023 19:23:15 +0100 Subject: [PATCH 2/7] Don't use custom tunic on title screen Link --- code/src/actors/player.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/code/src/actors/player.c b/code/src/actors/player.c index d937f532..e0a4e4a9 100644 --- a/code/src/actors/player.c +++ b/code/src/actors/player.c @@ -27,6 +27,8 @@ #define PlayerDListGroup_EmptySheathAdult ((void*)0x53C4D8) #define PlayerDListGroup_EmptySheathChildWithHylianShield ((void*)0x53C4DC) +#define OBJECT_LINK_OPENING 0x19F + u16 healthDecrement = 0; u8 storedMask = 0; @@ -34,6 +36,12 @@ void** Player_EditAndRetrieveCMB(ZARInfo* zarInfo, u32 objModelIdx) { void** cmbMan = ZAR_GetCMBByIndex(zarInfo, objModelIdx); void* cmb = *cmbMan; + if (gActorOverlayTable[0].initInfo->objectId == OBJECT_LINK_OPENING) { + // Title Screen Link uses a different object, so don't apply the custom tunic patches + // to avoid displaying a broken tunic. + return cmbMan; + } + if (gSettingsContext.customTunicColors == ON) { if (gSaveContext.linkAge == AGE_ADULT) { CustomModel_EditLinkToCustomTunic(cmb); @@ -52,7 +60,7 @@ void** Player_EditAndRetrieveCMB(ZARInfo* zarInfo, u32 objModelIdx) { } void* Player_GetCustomTunicCMAB(ZARInfo* originalZarInfo, u32 originalIndex) { - if (gSettingsContext.customTunicColors == OFF) { + if (gSettingsContext.customTunicColors == OFF || gActorOverlayTable[0].initInfo->objectId == OBJECT_LINK_OPENING) { return ZAR_GetCMABByIndex(originalZarInfo, originalIndex); } s16 exObjectBankIdx = Object_GetIndex(&rExtendedObjectCtx, OBJECT_CUSTOM_GENERAL_ASSETS); From bd5d2857488fd17f85d394fda2ecc8e354ac317e Mon Sep 17 00:00:00 2001 From: HylianFreddy <82058772+HylianFreddy@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:52:44 +0100 Subject: [PATCH 3/7] Epona starting inventory fix --- code/src/savefile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/code/src/savefile.c b/code/src/savefile.c index 7b419b25..01c67771 100644 --- a/code/src/savefile.c +++ b/code/src/savefile.c @@ -532,6 +532,7 @@ void SaveFile_SetStartingInventory(void) { // Set Epona as freed if Skip Epona Race is enabled and Epona's Song is in the starting inventory if (gSettingsContext.skipEponaRace == SKIP && (gSaveContext.questItems >> 13) & 0x1) { EventSet(0x18); + gSaveContext.horseData.pos.y = 0xF000; // place Epona OoB, so you can't reach her without playing the song } } From 92455ec674a679325f0abb635bc8d695647f2de3 Mon Sep 17 00:00:00 2001 From: HylianFreddy <82058772+HylianFreddy@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:06:07 +0200 Subject: [PATCH 4/7] Fix ice trap on dungeon reward in water --- code/src/item_override.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/src/item_override.c b/code/src/item_override.c index 4d661250..dc7e2879 100644 --- a/code/src/item_override.c +++ b/code/src/item_override.c @@ -394,7 +394,10 @@ void ItemOverride_Update(void) { CustomModel_Update(); u8 readyStatus = ItemOverride_PlayerIsReady(); if (readyStatus) { - ItemOverride_PopIceTrap(); + if (readyStatus == READY_ON_LAND) { // Ice traps effects only work on land + ItemOverride_PopIceTrap(); + } + if (IceTrap_IsPending()) { IceTrap_Give(); } else { From 4567cf14255f7579038fc6742942de995ffa660c Mon Sep 17 00:00:00 2001 From: HylianFreddy <82058772+HylianFreddy@users.noreply.github.com> Date: Fri, 24 Nov 2023 14:16:49 +0100 Subject: [PATCH 5/7] Allow getting OVR_TEMPLE item at water surface --- code/src/item_override.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/src/item_override.c b/code/src/item_override.c index dc7e2879..f7a02902 100644 --- a/code/src/item_override.c +++ b/code/src/item_override.c @@ -341,7 +341,6 @@ static u32 ItemOverride_PlayerIsReadyInWater(void) { (PLAYER->stateFlags2 & 0x000C0000) == 0 && PLAYER->actor.draw != NULL && gGlobalContext->actorCtx.titleCtx.delayTimer == 0 && gGlobalContext->actorCtx.titleCtx.durationTimer == 0 && gGlobalContext->actorCtx.titleCtx.alpha == 0 && (PLAYER->stateFlags1 & 0x08000000) != 0 && // Player is Swimming - (PLAYER->stateFlags2 & 0x400) != 0 && // Player is underwater (PLAYER->stateFlags1 & 0x400) == 0 && // Player is not already receiving an item when surfacing gGlobalContext->sceneLoadFlag == 0 && // Another scene isn't about to be loaded rPendingOverrideQueue[0].key.type == OVR_TEMPLE // Must be an item received for completing a dungeon @@ -403,6 +402,9 @@ void ItemOverride_Update(void) { } else { ItemOverride_TryPendingItem(); if (readyStatus == READY_IN_WATER) { + // Force underwater player flag in order to play the correct get-item + // animation even if Link is at the water's surface. + PLAYER->stateFlags2 |= 0x400; SetupItemInWater(PLAYER, gGlobalContext); rDummyActor->parent = NULL; ItemOverride_PopPendingOverride(); From d5a8ecf39f68ab4106d27fd9de4fdde45c263fca Mon Sep 17 00:00:00 2001 From: HylianFreddy <82058772+HylianFreddy@users.noreply.github.com> Date: Sun, 3 Dec 2023 00:55:43 +0100 Subject: [PATCH 6/7] Additional safety check for pending overrides --- code/src/menus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/code/src/menus.c b/code/src/menus.c index 9665390b..1c2d3153 100644 --- a/code/src/menus.c +++ b/code/src/menus.c @@ -4,6 +4,7 @@ #include "savefile.h" #include "settings.h" #include "dungeon_rewards.h" +#include "item_override.h" #define gItemsMenuSpritesManager (*(MenuSpriteManager**)0x506734) #define gBowMenuSpritesManager (*(MenuSpriteManager**)0x506738) @@ -147,6 +148,7 @@ u16 GearMenu_GetRewardHint(void) { } u16 SaveMenu_IgnoreOpen(void) { - return (gSettingsContext.menuOpeningButton == 0 && rInputCtx.cur.sel) || + return ItemOverride_IsAPendingOverride() || // safety check to avoid missing pending overrides by save-warping + (gSettingsContext.menuOpeningButton == 0 && rInputCtx.cur.sel) || (gSettingsContext.menuOpeningButton == 1 && rInputCtx.cur.strt); } From f2678a30cac5173fbdf9c55bf72603ed17df7c09 Mon Sep 17 00:00:00 2001 From: HylianFreddy <82058772+HylianFreddy@users.noreply.github.com> Date: Fri, 8 Dec 2023 01:15:20 +0100 Subject: [PATCH 7/7] Fix music glitch in Desert Colossus --- code/src/savefile.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/src/savefile.c b/code/src/savefile.c index 01c67771..1b816530 100644 --- a/code/src/savefile.c +++ b/code/src/savefile.c @@ -60,7 +60,8 @@ void SaveFile_Init(u32 fileBaseIndex) { gSaveContext.eventChkInf[0x4] |= 0x8020; // Entered MS chamber, Pulled MS from pedestal gSaveContext.eventChkInf[0xC] |= 0x0020; // Sheik Spawned at MS pedestal as Adult - gSaveContext.sceneFlags[5].swch |= 0x00010000; // remove Ruto cutscene in Water Temple + gSaveContext.sceneFlags[0x05].swch |= 0x00010000; // Met Ruto in Water Temple + gSaveContext.sceneFlags[0x5C].swch |= 0x80000000; // Spoke to owl in Desert Colossus (required for music to play) gSaveContext.otherNewEventFlags |= 0x01; // Club Moblin cutscene