From 8926d8f78451fe84c5cc50b38e015b279579511a Mon Sep 17 00:00:00 2001 From: Archez Date: Fri, 22 Nov 2024 18:23:15 -0500 Subject: [PATCH] Fix array out of bounds in entrance init (#4566) --- soh/soh/Enhancements/randomizer/randomizer_entrance.c | 4 ++-- soh/soh/Enhancements/randomizer/randomizer_grotto.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance.c b/soh/soh/Enhancements/randomizer/randomizer_entrance.c index aa839cc3e..8f4a1668c 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance.c +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance.c @@ -161,7 +161,7 @@ void Entrance_Init(void) { } // Initialize all boss room save/death warps with their vanilla dungeon entryway - for (s16 i = 1; i < SHUFFLEABLE_BOSS_COUNT; i++) { + for (s16 i = 0; i < SHUFFLEABLE_BOSS_COUNT; i++) { bossSceneSaveDeathWarps[i] = dungeons[i].entryway; } @@ -185,7 +185,7 @@ void Entrance_Init(void) { // Search for boss room overrides and look for the matching save/death warp value to use // If the boss room is in a dungeon, use the dungeons entryway as the save warp // Otherwise use the "exit" value for the entrance that lead to the boss room - for (int j = 0; j <= SHUFFLEABLE_BOSS_COUNT; j++) { + for (int j = 0; j < SHUFFLEABLE_BOSS_COUNT; j++) { if (overrideIndex == dungeons[j].bossDoor) { bossScene = dungeons[j].bossScene; } diff --git a/soh/soh/Enhancements/randomizer/randomizer_grotto.c b/soh/soh/Enhancements/randomizer/randomizer_grotto.c index 180f4ca84..f9471a2ba 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_grotto.c +++ b/soh/soh/Enhancements/randomizer/randomizer_grotto.c @@ -273,7 +273,7 @@ void Grotto_OverrideActorEntrance(Actor* thisx) { void Grotto_ForceGrottoReturnOnSpecialEntrance(void) { if (lastEntranceType == GROTTO_RETURN && (Randomizer_GetSettingValue(RSK_SHUFFLE_GROTTO_ENTRANCES) || Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_SPAWNS) || Randomizer_GetSettingValue(RSK_SHUFFLE_WARP_SONGS))) { gSaveContext.respawnFlag = 2; - gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = 0x4FF; + gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = 0x04FF; gSaveContext.respawn[RESPAWN_MODE_RETURN].pos = grottoReturnTable[grottoId].pos; // Clear current temp flags gSaveContext.respawn[RESPAWN_MODE_RETURN].tempSwchFlags = 0; @@ -308,7 +308,7 @@ void Grotto_ForceRegularVoidOut(void) { // so that Sun's Song and Game Over will behave correctly void Grotto_SetupReturnInfoOnFWReturn(void) { if (Randomizer_GetSettingValue(RSK_SHUFFLE_GROTTO_ENTRANCES) || Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_SPAWNS) || Randomizer_GetSettingValue(RSK_SHUFFLE_WARP_SONGS) && - gSaveContext.fw.playerParams == 0x4FF) { + gSaveContext.fw.playerParams == 0x04FF) { gSaveContext.respawn[RESPAWN_MODE_RETURN] = gSaveContext.respawn[RESPAWN_MODE_TOP]; gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams = 0x0DFF; lastEntranceType = GROTTO_RETURN;