Hookify more Entrance Rando handling (#4500)

* Hookify more entrance rando handling

* fix bad enums
This commit is contained in:
Archez
2024-10-31 00:27:20 -04:00
committed by GitHub
parent 6e024ed15d
commit 98fa5663b4
15 changed files with 92 additions and 85 deletions

View File

@@ -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);
}
}
}

View File

@@ -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 <overlays/actors/ovl_En_Niw/z_en_niw.h>
#include <overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h>
#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) {

View File

@@ -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 <string.h>
#include <assert.h>
@@ -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;

View File

@@ -4,7 +4,6 @@
#include <string.h>
#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();
}

View File

@@ -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,

View File

@@ -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;

View File

@@ -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;