diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 5beb802ba..7d2c7ebd1 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -16,6 +16,8 @@ extern "C" { #include "functions.h" #include "variables.h" #include "soh/Enhancements/randomizer/adult_trade_shuffle.h" +#include "soh/Enhancements/randomizer/randomizer_entrance.h" +#include "soh/Enhancements/randomizer/randomizer_grotto.h" #include "src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h" #include "src/overlays/actors/ovl_En_Si/z_en_si.h" #include "src/overlays/actors/ovl_En_Cow/z_en_cow.h" @@ -55,6 +57,7 @@ extern PlayState* gPlayState; extern void func_8084DFAC(PlayState* play, Player* player); extern void Player_SetupActionPreserveAnimMovement(PlayState* play, Player* player, PlayerActionFunc actionFunc, s32 flags); extern s32 Player_SetupWaitForPutAway(PlayState* play, Player* player, AfterPutAwayFunc func); +extern void Play_InitEnvironment(PlayState * play, s16 skyboxId); } #define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetSelectedOptionIndex() @@ -1460,7 +1463,25 @@ void RandomizerOnSceneInitHandler(int16_t sceneNum) { } if (RAND_GET_OPTION(RSK_SHUFFLE_ENTRANCES)) { + // In ER, override roomNum to load based on scene and spawn during scene init + if (gSaveContext.respawnFlag <= 0) { + s8 origRoom = gPlayState->roomCtx.curRoom.num; + s8 replacedRoom = Entrance_OverrideSpawnSceneRoom(gPlayState->sceneNum, gPlayState->curSpawn, origRoom); + + if (origRoom != replacedRoom) { + // Reset room ctx back to prev room and then load the new room + gPlayState->roomCtx.status = 0; + gPlayState->roomCtx.curRoom = gPlayState->roomCtx.prevRoom; + func_8009728C(gPlayState, &gPlayState->roomCtx, replacedRoom); + } + } + + // Handle updated link spawn positions + Entrance_OverrideSpawnScene(sceneNum, gPlayState->curSpawn); + Entrance_OverrideWeatherState(); + // Need to reinitialize the environment after replacing the weather mode + Play_InitEnvironment(gPlayState, gPlayState->skyboxId); } // LACs & Prelude checks @@ -1833,6 +1854,11 @@ void RandomizerOnActorInitHandler(void* actorRef) { Actor_Kill(actor); return; } + + // In ER, once Link has spawned we know the scene has loaded, so we can sanitize the last known entrance type + if (actor->id == ACTOR_PLAYER && RAND_GET_OPTION(RSK_SHUFFLE_ENTRANCES)) { + Grotto_SanitizeEntranceType(); + } } void RandomizerOnGameFrameUpdateHandler() { @@ -2041,6 +2067,37 @@ void RandomizerOnSceneSpawnActorsHandler() { } } +void RandomizerOnPlayDestroyHandler() { + // In ER, remove link from epona when entering somewhere that doesn't support epona + if (RAND_GET_OPTION(RSK_SHUFFLE_OVERWORLD_ENTRANCES)) { + Entrance_HandleEponaState(); + } +} + +void RandomizerOnExitGameHandler(int32_t fileNum) { + // When going from a rando save to a vanilla save within the same game instance + // we need to reset the entrance table back to its vanilla state + Entrance_ResetEntranceTable(); +} + +void RandomizerOnKaleidoscopeUpdateHandler(int16_t inDungeonScene) { + static uint16_t prevKaleidoState = 0; + + // In ER, handle overriding the game over respawn entrance and dealing with death warp to from grottos + if (RAND_GET_OPTION(RSK_SHUFFLE_ENTRANCES)) { + if (prevKaleidoState == 0x10 && gPlayState->pauseCtx.state == 0x11 && gPlayState->pauseCtx.promptChoice == 0) { + // Needs to be called before Play_TriggerRespawn when transitioning from state 0x10 to 0x11 + Entrance_SetGameOverEntrance(); + } + if (prevKaleidoState == 0x11 && gPlayState->pauseCtx.state == 0 && gPlayState->pauseCtx.promptChoice == 0) { + // Needs to be called after Play_TriggerRespawn when transitioning from state 0x11 to 0 + Grotto_ForceGrottoReturn(); + } + } + + prevKaleidoState = gPlayState->pauseCtx.state; +} + void RandomizerRegisterHooks() { static uint32_t onFlagSetHook = 0; static uint32_t onSceneFlagSetHook = 0; @@ -2054,6 +2111,9 @@ void RandomizerRegisterHooks() { static uint32_t onPlayerUpdateHook = 0; static uint32_t onGameFrameUpdateHook = 0; static uint32_t onSceneSpawnActorsHook = 0; + static uint32_t onPlayDestroyHook = 0; + static uint32_t onExitGameHook = 0; + static uint32_t onKaleidoUpdateHook = 0; static uint32_t fishsanityOnActorInitHook = 0; static uint32_t fishsanityOnFlagSetHook = 0; @@ -2078,6 +2138,9 @@ void RandomizerRegisterHooks() { GameInteractor::Instance->UnregisterGameHook(onPlayerUpdateHook); GameInteractor::Instance->UnregisterGameHook(onGameFrameUpdateHook); GameInteractor::Instance->UnregisterGameHook(onSceneSpawnActorsHook); + GameInteractor::Instance->UnregisterGameHook(onPlayDestroyHook); + GameInteractor::Instance->UnregisterGameHook(onExitGameHook); + GameInteractor::Instance->UnregisterGameHook(onKaleidoUpdateHook); GameInteractor::Instance->UnregisterGameHook(fishsanityOnActorInitHook); GameInteractor::Instance->UnregisterGameHook(fishsanityOnFlagSetHook); @@ -2097,6 +2160,9 @@ void RandomizerRegisterHooks() { onPlayerUpdateHook = 0; onGameFrameUpdateHook = 0; onSceneSpawnActorsHook = 0; + onPlayDestroyHook = 0; + onExitGameHook = 0; + onKaleidoUpdateHook = 0; fishsanityOnActorInitHook = 0; fishsanityOnFlagSetHook = 0; @@ -2126,6 +2192,9 @@ void RandomizerRegisterHooks() { onPlayerUpdateHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnPlayerUpdateHandler); onGameFrameUpdateHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnGameFrameUpdateHandler); onSceneSpawnActorsHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnSceneSpawnActorsHandler); + onPlayDestroyHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnPlayDestroyHandler); + onPlayDestroyHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnExitGameHandler); + onKaleidoUpdateHook = GameInteractor::Instance->RegisterGameHook(RandomizerOnKaleidoscopeUpdateHandler); if (RAND_GET_OPTION(RSK_FISHSANITY) != RO_FISHSANITY_OFF) { OTRGlobals::Instance->gRandoContext->GetFishsanity()->InitializeFromSave(); diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index ae298139e..0d5e6d2ed 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -105,7 +105,7 @@ std::map DungeonRCAreasBySceneID = { std::vector spoilingEntrances = { ENTR_DEKU_TREE_ENTRANCE, ENTR_DODONGOS_CAVERN_BOSS_DOOR, - ENTR_JABU_JABU_BOSS_DOOR, + ENTR_JABU_JABU_ENTRANCE, ENTR_JABU_JABU_BOSS_DOOR, ENTR_FOREST_TEMPLE_ENTRANCE, ENTR_FIRE_TEMPLE_ENTRANCE, diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance.c b/soh/soh/Enhancements/randomizer/randomizer_entrance.c index c8ac6fd83..e441f3aa5 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance.c +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance.c @@ -57,15 +57,15 @@ typedef struct { } DungeonEntranceInfo; static DungeonEntranceInfo dungeons[] = { - //entryway exit, boss, reverse, bluewarp, dungeon scene, boss scene - { ENTR_DEKU_TREE_ENTRANCE, ENTR_KOKIRI_FOREST_OUTSIDE_DEKU_TREE, ENTR_DEKU_TREE_BOSS_ENTRANCE, ENTR_DEKU_TREE_BOSS_DOOR, ENTR_KOKIRI_FOREST_DEKU_TREE_BLUE_WARP, SCENE_DEKU_TREE, SCENE_DEKU_TREE_BOSS }, - { ENTR_DODONGOS_CAVERN_ENTRANCE, ENTR_DEATH_MOUNTAIN_TRAIL_OUTSIDE_DODONGOS_CAVERN, ENTR_DODONGOS_CAVERN_BOSS_ENTRANCE, ENTR_DODONGOS_CAVERN_BOSS_DOOR, ENTR_DEATH_MOUNTAIN_TRAIL_DODONGO_BLUE_WARP, SCENE_DODONGOS_CAVERN, SCENE_DODONGOS_CAVERN_BOSS }, - { ENTR_JABU_JABU_BOSS_DOOR, ENTR_ZORAS_FOUNTAIN_OUTSIDE_JABU_JABU, ENTR_JABU_JABU_BOSS_ENTRANCE, ENTR_JABU_JABU_BOSS_DOOR, ENTR_ZORAS_FOUNTAIN_JABU_JABU_BLUE_WARP, SCENE_JABU_JABU, SCENE_JABU_JABU_BOSS }, - { ENTR_FOREST_TEMPLE_ENTRANCE, ENTR_SACRED_FOREST_MEADOW_OUTSIDE_TEMPLE, ENTR_FOREST_TEMPLE_BOSS_ENTRANCE, ENTR_FOREST_TEMPLE_BOSS_DOOR, ENTR_SACRED_FOREST_MEADOW_FOREST_TEMPLE_BLUE_WARP, SCENE_FOREST_TEMPLE, SCENE_FOREST_TEMPLE_BOSS }, - { ENTR_FIRE_TEMPLE_ENTRANCE, ENTR_DEATH_MOUNTAIN_CRATER_OUTSIDE_TEMPLE, ENTR_FIRE_TEMPLE_BOSS_ENTRANCE, ENTR_FIRE_TEMPLE_BOSS_DOOR, ENTR_DEATH_MOUNTAIN_CRATER_FIRE_TEMPLE_BLUE_WARP, SCENE_FIRE_TEMPLE, SCENE_FIRE_TEMPLE_BOSS }, - { ENTR_WATER_TEMPLE_ENTRANCE, ENTR_LAKE_HYLIA_OUTSIDE_TEMPLE, ENTR_WATER_TEMPLE_BOSS_ENTRANCE, ENTR_WATER_TEMPLE_BOSS_DOOR, ENTR_LAKE_HYLIA_WATER_TEMPLE_BLUE_WARP, SCENE_WATER_TEMPLE, SCENE_WATER_TEMPLE_BOSS }, - { ENTR_SPIRIT_TEMPLE_ENTRANCE, ENTR_DESERT_COLOSSUS_OUTSIDE_TEMPLE, ENTR_SPIRIT_TEMPLE_BOSS_ENTRANCE, ENTR_SPIRIT_TEMPLE_BOSS_DOOR, ENTR_DESERT_COLOSSUS_SPIRIT_TEMPLE_BLUE_WARP, SCENE_SPIRIT_TEMPLE, SCENE_SPIRIT_TEMPLE_BOSS }, - { ENTR_SHADOW_TEMPLE_ENTRANCE, ENTR_GRAVEYARD_OUTSIDE_TEMPLE, ENTR_SHADOW_TEMPLE_BOSS_ENTRANCE, ENTR_SHADOW_TEMPLE_BOSS_DOOR, ENTR_GRAVEYARD_SHADOW_TEMPLE_BLUE_WARP, SCENE_SHADOW_TEMPLE, SCENE_SHADOW_TEMPLE_BOSS }, + //entryway exit, boss, reverse, bluewarp, dungeon scene, boss scene + { ENTR_DEKU_TREE_ENTRANCE, ENTR_KOKIRI_FOREST_OUTSIDE_DEKU_TREE, ENTR_DEKU_TREE_BOSS_ENTRANCE, ENTR_DEKU_TREE_BOSS_DOOR, ENTR_KOKIRI_FOREST_DEKU_TREE_BLUE_WARP, SCENE_DEKU_TREE, SCENE_DEKU_TREE_BOSS }, + { ENTR_DODONGOS_CAVERN_ENTRANCE, ENTR_DEATH_MOUNTAIN_TRAIL_OUTSIDE_DODONGOS_CAVERN, ENTR_DODONGOS_CAVERN_BOSS_ENTRANCE, ENTR_DODONGOS_CAVERN_BOSS_DOOR, ENTR_DEATH_MOUNTAIN_TRAIL_DODONGO_BLUE_WARP, SCENE_DODONGOS_CAVERN, SCENE_DODONGOS_CAVERN_BOSS }, + { ENTR_JABU_JABU_ENTRANCE, ENTR_ZORAS_FOUNTAIN_OUTSIDE_JABU_JABU, ENTR_JABU_JABU_BOSS_ENTRANCE, ENTR_JABU_JABU_BOSS_DOOR, ENTR_ZORAS_FOUNTAIN_JABU_JABU_BLUE_WARP, SCENE_JABU_JABU, SCENE_JABU_JABU_BOSS }, + { ENTR_FOREST_TEMPLE_ENTRANCE, ENTR_SACRED_FOREST_MEADOW_OUTSIDE_TEMPLE, ENTR_FOREST_TEMPLE_BOSS_ENTRANCE, ENTR_FOREST_TEMPLE_BOSS_DOOR, ENTR_SACRED_FOREST_MEADOW_FOREST_TEMPLE_BLUE_WARP, SCENE_FOREST_TEMPLE, SCENE_FOREST_TEMPLE_BOSS }, + { ENTR_FIRE_TEMPLE_ENTRANCE, ENTR_DEATH_MOUNTAIN_CRATER_OUTSIDE_TEMPLE, ENTR_FIRE_TEMPLE_BOSS_ENTRANCE, ENTR_FIRE_TEMPLE_BOSS_DOOR, ENTR_DEATH_MOUNTAIN_CRATER_FIRE_TEMPLE_BLUE_WARP, SCENE_FIRE_TEMPLE, SCENE_FIRE_TEMPLE_BOSS }, + { ENTR_WATER_TEMPLE_ENTRANCE, ENTR_LAKE_HYLIA_OUTSIDE_TEMPLE, ENTR_WATER_TEMPLE_BOSS_ENTRANCE, ENTR_WATER_TEMPLE_BOSS_DOOR, ENTR_LAKE_HYLIA_WATER_TEMPLE_BLUE_WARP, SCENE_WATER_TEMPLE, SCENE_WATER_TEMPLE_BOSS }, + { ENTR_SPIRIT_TEMPLE_ENTRANCE, ENTR_DESERT_COLOSSUS_OUTSIDE_TEMPLE, ENTR_SPIRIT_TEMPLE_BOSS_ENTRANCE, ENTR_SPIRIT_TEMPLE_BOSS_DOOR, ENTR_DESERT_COLOSSUS_SPIRIT_TEMPLE_BLUE_WARP, SCENE_SPIRIT_TEMPLE, SCENE_SPIRIT_TEMPLE_BOSS }, + { ENTR_SHADOW_TEMPLE_ENTRANCE, ENTR_GRAVEYARD_OUTSIDE_TEMPLE, ENTR_SHADOW_TEMPLE_BOSS_ENTRANCE, ENTR_SHADOW_TEMPLE_BOSS_DOOR, ENTR_GRAVEYARD_SHADOW_TEMPLE_BLUE_WARP, SCENE_SHADOW_TEMPLE, SCENE_SHADOW_TEMPLE_BOSS }, }; static s8 hasCopiedEntranceTable = 0; @@ -334,7 +334,7 @@ void Entrance_SetGameOverEntrance(void) { gSaveContext.entranceIndex = ENTR_DODONGOS_CAVERN_ENTRANCE; return; case ENTR_JABU_JABU_BOSS_ENTRANCE : //Jabu Jabus Belly Boss Room - gSaveContext.entranceIndex = ENTR_JABU_JABU_BOSS_DOOR; + gSaveContext.entranceIndex = ENTR_JABU_JABU_ENTRANCE; return; case ENTR_FOREST_TEMPLE_BOSS_ENTRANCE : //Forest Temple Boss Room gSaveContext.entranceIndex = ENTR_FOREST_TEMPLE_ENTRANCE; @@ -375,7 +375,7 @@ void Entrance_SetSavewarpEntrance(void) { } else if (scene == SCENE_DODONGOS_CAVERN || scene == SCENE_DODONGOS_CAVERN_BOSS) { gSaveContext.entranceIndex = ENTR_DODONGOS_CAVERN_ENTRANCE; } else if (scene == SCENE_JABU_JABU || scene == SCENE_JABU_JABU_BOSS) { - gSaveContext.entranceIndex = ENTR_JABU_JABU_BOSS_DOOR; + gSaveContext.entranceIndex = ENTR_JABU_JABU_ENTRANCE; } else if (scene == SCENE_FOREST_TEMPLE || scene == SCENE_FOREST_TEMPLE_BOSS) { //Forest Temple Boss Room gSaveContext.entranceIndex = ENTR_FOREST_TEMPLE_ENTRANCE; } else if (scene == SCENE_FIRE_TEMPLE || scene == SCENE_FIRE_TEMPLE_BOSS) { //Fire Temple Boss Room @@ -481,18 +481,6 @@ void Entrance_OverrideBlueWarp(void) { } } -void Entrance_OverrideCutsceneEntrance(u16 cutsceneCmd) { - switch (cutsceneCmd) { - case 24: // Dropping a fish for Jabu Jabu - gPlayState->nextEntranceIndex = Entrance_OverrideNextIndex(ENTR_JABU_JABU_BOSS_DOOR); - gPlayState->transitionTrigger = TRANS_TRIGGER_START; - gPlayState->transitionType = TRANS_TYPE_FADE_BLACK; - // In case Jabu's mouth leads to a grotto return - Grotto_ForceGrottoReturnOnSpecialEntrance(); - break; - } -} - void Entrance_EnableFW(void) { Player* player = GET_PLAYER(gPlayState); // Leave restriction in Tower Collapse Interior, Castle Collapse, Treasure Box Shop, Tower Collapse Exterior, diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance.h b/soh/soh/Enhancements/randomizer/randomizer_entrance.h index 286ef3b6f..d2c8c79cb 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance.h +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance.h @@ -45,7 +45,6 @@ void Entrance_SetGameOverEntrance(void); void Entrance_SetSavewarpEntrance(void); void Entrance_SetWarpSongEntrance(void); void Entrance_OverrideBlueWarp(void); -void Entrance_OverrideCutsceneEntrance(uint16_t cutsceneCmd); void Entrance_HandleEponaState(void); void Entrance_OverrideWeatherState(void); void Entrance_OverrideGeurdoGuardCapture(void); diff --git a/soh/soh/Enhancements/randomizer/randomizer_grotto.h b/soh/soh/Enhancements/randomizer/randomizer_grotto.h index 938c4c6d6..b2b7f3fd1 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_grotto.h +++ b/soh/soh/Enhancements/randomizer/randomizer_grotto.h @@ -2,6 +2,7 @@ #define _RANDO_GROTTO_H_ #include "z64math.h" +#include "z64actor.h" #define NUM_GROTTOS GROTTO_OFFSET_MAX #define NOT_GROTTO 0 @@ -26,6 +27,7 @@ void Grotto_SetExitOverride(s16 originalIndex, s16 overrideIndex); void Grotto_SetLoadOverride(s16 originalIndex, s16 overrideIndex); s16 Grotto_GetEntranceValueHandlingGrottoRando(s16 nextEntranceIndex); s16 Grotto_OverrideSpecialEntrance(s16 nextEntranceIndex); +void Grotto_OverrideActorEntrance(Actor* thisx); void Grotto_ForceGrottoReturnOnSpecialEntrance(void); void Grotto_ForceGrottoReturn(void); void Grotto_ForceRegularVoidOut(void); diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 987dbf9d3..3bd83cd93 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -2860,14 +2860,6 @@ extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) { Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text); } -extern "C" void Entrance_ClearEntranceTrackingData(void) { - ClearEntranceTrackingData(); -} - -extern "C" void Entrance_InitEntranceTrackingData(void) { - InitEntranceTrackingData(); -} - extern "C" void EntranceTracker_SetCurrentGrottoID(s16 entranceIndex) { SetCurrentGrottoIDForTracker(entranceIndex); } diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 1ed0ab808..86e411ba9 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -210,8 +210,6 @@ void Overlay_DisplayText(float duration, const char* text); void Overlay_DisplayText_Seconds(int seconds, const char* text); GetItemEntry ItemTable_Retrieve(int16_t getItemID); GetItemEntry ItemTable_RetrieveEntry(s16 modIndex, s16 getItemID); -void Entrance_ClearEntranceTrackingData(void); -void Entrance_InitEntranceTrackingData(void); void EntranceTracker_SetCurrentGrottoID(s16 entranceIndex); void EntranceTracker_SetLastEntranceOverride(s16 entranceIndex); void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement); diff --git a/soh/soh/z_play_otr.cpp b/soh/soh/z_play_otr.cpp index 47e4279b2..729e3badb 100644 --- a/soh/soh/z_play_otr.cpp +++ b/soh/soh/z_play_otr.cpp @@ -58,6 +58,9 @@ extern "C" void OTRPlay_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn) { auto roomSize = func_80096FE8(play, &play->roomCtx); osSyncPrintf("ROOM SIZE=%fK\n", roomSize / 1024.0f); + + GameInteractor::Instance->ExecuteHooks(play->sceneNum); + SPDLOG_INFO("Scene Init - sceneNum: {0:#x}, entranceIndex: {1:#x}", play->sceneNum, gSaveContext.entranceIndex); } void OTRPlay_InitScene(PlayState* play, s32 spawn) { @@ -83,9 +86,6 @@ void OTRPlay_InitScene(PlayState* play, s32 spawn) { .get()); auto data2 = ResourceMgr_LoadVtxByCRC(0x68d4ea06044e228f);*/ - - GameInteractor::Instance->ExecuteHooks(play->sceneNum); - SPDLOG_INFO("Scene Init - sceneNum: {0:#x}, entranceIndex: {1:#x}", play->sceneNum, gSaveContext.entranceIndex); volatile int a = 0; } diff --git a/soh/src/code/z_demo.c b/soh/src/code/z_demo.c index a6cae15e3..5d44a14af 100644 --- a/soh/src/code/z_demo.c +++ b/soh/src/code/z_demo.c @@ -738,7 +738,11 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB play->transitionType = TRANS_TYPE_FADE_WHITE; break; case 24: - play->nextEntranceIndex = ENTR_JABU_JABU_ENTRANCE; + if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { + play->nextEntranceIndex = Entrance_OverrideNextIndex(ENTR_JABU_JABU_ENTRANCE); + } else { + play->nextEntranceIndex = ENTR_JABU_JABU_ENTRANCE; + } play->transitionTrigger = TRANS_TRIGGER_START; play->transitionType = TRANS_TYPE_FADE_BLACK; break; @@ -1304,10 +1308,6 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB play->transitionType = TRANS_TYPE_FADE_WHITE; break; } - - if (shouldSkipCommand && IS_RANDO) { - Entrance_OverrideCutsceneEntrance(cmd->base); - } } } diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index af53219e8..ae6d987a9 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -7,7 +7,6 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/debugconsole.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" -#include "soh/Enhancements/randomizer/randomizer_entrance.h" #include #include #include "soh/Enhancements/enhancementTypes.h" @@ -182,11 +181,6 @@ void Play_Destroy(GameState* thisx) { play->gameplayFrames = 0; } - // In ER, remove link from epona when entering somewhere that doesn't support epona - if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_ENTRANCES)) { - Entrance_HandleEponaState(); - } - play->state.gfxCtx->callback = NULL; play->state.gfxCtx->callbackParam = 0; SREG(91) = 0; @@ -1867,10 +1861,6 @@ void Play_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn) { } OTRPlay_SpawnScene(play, sceneNum, spawn); - - if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { - Entrance_OverrideSpawnScene(sceneNum, spawn); - } } void func_800C016C(PlayState* play, Vec3f* src, Vec3f* dest) { diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index 2db187375..1478d50f8 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -4,7 +4,6 @@ #include "global.h" #include "vt.h" -#include "soh/Enhancements/randomizer/randomizer_entrance.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include #include @@ -578,13 +577,6 @@ u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) { frontRoom = gSaveContext.respawnFlag > 0 ? ((void)0, gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex) : play->setupEntranceList[play->curSpawn].room; - - // In ER, override roomNum to load based on scene and spawn during scene init - if (IS_RANDO && gSaveContext.respawnFlag <= 0 && - Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { - frontRoom = Entrance_OverrideSpawnSceneRoom(play->sceneNum, play->curSpawn, frontRoom); - } - func_8009728C(play, roomCtx, frontRoom); return maxRoomSize; diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index 28e81e4db..388d59ec9 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -4,7 +4,6 @@ #include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" -#include "soh/Enhancements/randomizer/randomizer_entrance.h" #include "soh/Enhancements/randomizer/savefile.h" #define NUM_DUNGEONS 8 @@ -100,7 +99,7 @@ void Sram_OpenSave() { gSaveContext.entranceIndex = ENTR_DODONGOS_CAVERN_ENTRANCE; break; case SCENE_JABU_JABU_BOSS: - gSaveContext.entranceIndex = ENTR_JABU_JABU_BOSS_DOOR; + gSaveContext.entranceIndex = ENTR_JABU_JABU_ENTRANCE; break; case SCENE_FOREST_TEMPLE_BOSS: gSaveContext.entranceIndex = ENTR_FOREST_TEMPLE_ENTRANCE; @@ -266,8 +265,4 @@ void Sram_InitSram(GameState* gameState) { Save_Init(); func_800F6700(gSaveContext.audioSetting); - - // When going from a rando save to a vanilla save within the same game instance - // we need to reset the entrance table back to its vanilla state - Entrance_ResetEntranceTable(); } diff --git a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index feda50c76..ef2134f6e 100644 --- a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -20,8 +20,6 @@ void DoorAna_WaitClosed(DoorAna* this, PlayState* play); void DoorAna_WaitOpen(DoorAna* this, PlayState* play); void DoorAna_GrabPlayer(DoorAna* this, PlayState* play); -void Grotto_OverrideActorEntrance(Actor* thisx); - const ActorInit Door_Ana_InitVars = { ACTOR_DOOR_ANA, ACTORCAT_ITEMACTION, diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index f4f343c9f..4d4e9480d 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -10772,11 +10772,6 @@ void Player_Init(Actor* thisx, PlayState* play2) { s32 respawnFlag; s32 respawnMode; - // In ER, once Link has spawned we know the scene has loaded, so we can sanitize the last known entrance type - if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { - Grotto_SanitizeEntranceType(); - } - play->shootingGalleryStatus = play->bombchuBowlingStatus = 0; play->playerInit = Player_InitCommon; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 741eb45e7..46555fa0e 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -16,8 +16,6 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" -#include "soh/Enhancements/randomizer/randomizer_entrance.h" -#include "soh/Enhancements/randomizer/randomizer_grotto.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/Enhancements/kaleido.h" @@ -4473,11 +4471,6 @@ void KaleidoScope_Update(PlayState* play) gSaveContext.entranceIndex = ENTR_GANONS_TOWER_0; break; } - - // In ER, handle overriding the game over respawn entrance - if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { - Entrance_SetGameOverEntrance(); - } } else { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } @@ -4499,10 +4492,6 @@ void KaleidoScope_Update(PlayState* play) if (pauseCtx->promptChoice == 0 && GameInteractor_Should(VB_BE_ABLE_TO_SAVE, true)) { Play_TriggerRespawn(play); gSaveContext.respawnFlag = -2; - // In ER, handle death warp to last entrance from grottos - if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { - Grotto_ForceGrottoReturn(); - } // Reset frame counter to prevent autosave on respawn play->gameplayFrames = 0; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK;