Fix: Hyrule Field bridge entrance and sun song placing link out of bounds in Entrance Rando (#2457)

* fix market night escape to work with entrance rando; adjust HF bridge spawn to not have link fall in water at night

* use scene enums for ER logic instead of magic nums

* fix sun song loading are with wrong link position with grotto shuffle on

* Update soh/soh/Enhancements/randomizer/randomizer_entrance.c
This commit is contained in:
Adam Bird 2023-02-12 23:34:16 -05:00 committed by GitHub
parent 8f9dc17752
commit 1e9f8df33b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 10 deletions

View File

@ -271,7 +271,8 @@ s16 Entrance_OverrideNextIndex(s16 nextEntranceIndex) {
// Exiting through the crawl space from Hyrule Castle courtyard is the same exit as leaving Ganon's castle // Exiting through the crawl space from Hyrule Castle courtyard is the same exit as leaving Ganon's castle
// Don't override the entrance if we came from the Castle courtyard (day and night scenes) // Don't override the entrance if we came from the Castle courtyard (day and night scenes)
if (gPlayState != NULL && (gPlayState->sceneNum == 69 || gPlayState->sceneNum == 70) && nextEntranceIndex == 0x023D) { if (gPlayState != NULL && (gPlayState->sceneNum == SCENE_HAIRAL_NIWA || gPlayState->sceneNum == SCENE_HAIRAL_NIWA_N) &&
nextEntranceIndex == 0x023D) {
return nextEntranceIndex; return nextEntranceIndex;
} }
@ -289,7 +290,7 @@ s16 Entrance_OverrideDynamicExit(s16 dynamicExitIndex) {
u32 Entrance_SceneAndSpawnAre(u8 scene, u8 spawn) { u32 Entrance_SceneAndSpawnAre(u8 scene, u8 spawn) {
s16 computedEntranceIndex; s16 computedEntranceIndex;
// Adjust the entrance to acount for the exact scene/spawn combination for child/adult and day/night // Adjust the entrance to account for the exact scene/spawn combination for child/adult and day/night
if (!IS_DAY) { if (!IS_DAY) {
if (!LINK_IS_ADULT) { if (!LINK_IS_ADULT) {
computedEntranceIndex = gSaveContext.entranceIndex + 1; computedEntranceIndex = gSaveContext.entranceIndex + 1;
@ -680,7 +681,7 @@ void Entrance_OverrideSpawnScene(s32 sceneNum, s32 spawn) {
if (Randomizer_GetSettingValue(RSK_SHUFFLE_DUNGEON_ENTRANCES) == RO_DUNGEON_ENTRANCE_SHUFFLE_ON_PLUS_GANON) { if (Randomizer_GetSettingValue(RSK_SHUFFLE_DUNGEON_ENTRANCES) == RO_DUNGEON_ENTRANCE_SHUFFLE_ON_PLUS_GANON) {
// Move Hyrule's Castle Courtyard exit spawn to be before the crates so players don't skip Talon // Move Hyrule's Castle Courtyard exit spawn to be before the crates so players don't skip Talon
if (sceneNum == 95 && spawn == 1) { if (sceneNum == SCENE_SPOT15 && spawn == 1) {
modifiedLinkActorEntry.pos.x = 0x033A; modifiedLinkActorEntry.pos.x = 0x033A;
modifiedLinkActorEntry.pos.y = 0x0623; modifiedLinkActorEntry.pos.y = 0x0623;
modifiedLinkActorEntry.pos.z = 0xFF22; modifiedLinkActorEntry.pos.z = 0xFF22;
@ -689,7 +690,7 @@ void Entrance_OverrideSpawnScene(s32 sceneNum, s32 spawn) {
// Move Ganon's Castle exit spawn to be on the small ledge near the castle and not over the void // Move Ganon's Castle exit spawn to be on the small ledge near the castle and not over the void
// to prevent Link from falling if the bridge isn't spawned // to prevent Link from falling if the bridge isn't spawned
if (sceneNum == 100 && spawn == 1) { if (sceneNum == SCENE_GANON_TOU && spawn == 1) {
modifiedLinkActorEntry.pos.x = 0xFEA8; modifiedLinkActorEntry.pos.x = 0xFEA8;
modifiedLinkActorEntry.pos.y = 0x065C; modifiedLinkActorEntry.pos.y = 0x065C;
modifiedLinkActorEntry.pos.z = 0x0290; modifiedLinkActorEntry.pos.z = 0x0290;
@ -718,6 +719,15 @@ void Entrance_OverrideSpawnScene(s32 sceneNum, s32 spawn) {
gPlayState->linkActorEntry = &modifiedLinkActorEntry; gPlayState->linkActorEntry = &modifiedLinkActorEntry;
} }
} }
if (Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_ENTRANCES) == RO_GENERIC_ON) {
// Move Hyrule Field bridge spawn for child link at night to be beyond the moat so he doesn't fall in the water
if (sceneNum == SCENE_SPOT00 && spawn == 7 && LINK_IS_CHILD && IS_NIGHT) {
modifiedLinkActorEntry.pos.x = 0x0001;
modifiedLinkActorEntry.pos.z = 0x049E;
gPlayState->linkActorEntry = &modifiedLinkActorEntry;
}
}
} }
s32 Entrance_OverrideSpawnSceneRoom(s32 sceneNum, s32 spawn, s32 roomNum) { s32 Entrance_OverrideSpawnSceneRoom(s32 sceneNum, s32 spawn, s32 roomNum) {

View File

@ -426,7 +426,8 @@ void DemoKankyo_Update(Actor* thisx, PlayState* play) {
DemoKankyo* this = (DemoKankyo*)thisx; DemoKankyo* this = (DemoKankyo*)thisx;
this->actionFunc(this, play); this->actionFunc(this, play);
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_WARP_SONGS) && // In ER, override the warp song locations. Also removes the warp song cutscene
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES) &&
thisx->params == 0x000F) { // Warp Song particles thisx->params == 0x000F) { // Warp Song particles
Entrance_SetWarpSongEntrance(); Entrance_SetWarpSongEntrance();
} }

View File

@ -350,10 +350,10 @@ void EnHeishi4_MarketSneak(EnHeishi4* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) {
switch (play->msgCtx.choiceIndex) { switch (play->msgCtx.choiceIndex) {
case 0: //yes case 0: //yes
if (gSaveContext.n64ddFlag){ if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_ENTRANCES) != RO_GENERIC_OFF){
play->nextEntranceIndex = Entrance_OverrideNextIndex(0xCD); play->nextEntranceIndex = Entrance_OverrideNextIndex(0x01FD); // Market Entrance -> HF
} else { } else {
play->nextEntranceIndex = 0xCD; play->nextEntranceIndex = 0x00CD; // HF Near bridge (OoT cutscene entrance) to not fall in the water
} }
play->sceneLoadFlag = 0x14; play->sceneLoadFlag = 0x14;
play->fadeTransition = 0x2E; play->fadeTransition = 0x2E;

View File

@ -157,8 +157,8 @@ void EnSyatekiMan_Init(Actor* thisx, PlayState* play) {
if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_INTERIOR_ENTRANCES)) { if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_SHUFFLE_INTERIOR_ENTRANCES)) {
// If child is in the adult shooting gallery or adult in the child shooting gallery, then despawn the shooting gallery man // If child is in the adult shooting gallery or adult in the child shooting gallery, then despawn the shooting gallery man
if ((LINK_IS_CHILD && Entrance_SceneAndSpawnAre(0x42, 0x00)) || //Kakariko Village -> Adult Shooting Gallery, index 003B in the entrance table if ((LINK_IS_CHILD && Entrance_SceneAndSpawnAre(SCENE_SYATEKIJYOU, 0x00)) || //Kakariko Village -> Adult Shooting Gallery, index 003B in the entrance table
(LINK_IS_ADULT && Entrance_SceneAndSpawnAre(0x42, 0x01))) { //Market -> Child Shooting Gallery, index 016D in the entrance table (LINK_IS_ADULT && Entrance_SceneAndSpawnAre(SCENE_SYATEKIJYOU, 0x01))) { //Market -> Child Shooting Gallery, index 016D in the entrance table
Actor_Kill(thisx); Actor_Kill(thisx);
return; return;
} }