Entrance Rando Fixes

This commit is contained in:
jdflyer
2026-08-17 20:05:39 -07:00
parent 7129605035
commit de7f09a6a4
4 changed files with 25 additions and 8 deletions
@@ -2122,7 +2122,7 @@
Connection: Sacred Grove Lower -> Lost Woods Lower Battle Arena
Alias: Sacred Grove -> Lost Woods Lower Battle Arena
Stage: 54
Room: 1
Room: 3
Spawn: 1
Spawn Type: "50"
Parameters: "F01F"
@@ -2157,7 +2157,7 @@
Spawn: 0
Spawn Type: "00"
Parameters: "F012"
State: 2
State: -1
Return:
Connection: Sacred Grove Past -> Sacred Grove Upper
Alias: Sacred Grove Past -> Sacred Grove
@@ -2166,7 +2166,7 @@
Spawn: 5
Spawn Type: "10"
Parameters: "F032"
State: 2
State: -1
- Type: Overworld
Forward:
+2 -1
View File
@@ -658,7 +658,8 @@ HookAction hookPreSetNextStage(ModContext*, void* args, void*, void*) {
mods::arg_ref<char const*>(args, 0),
mods::arg_ref<s8>(args, 2),
mods::arg_ref<s16>(args, 1),
mods::arg_ref<s8>(args, 3)
mods::arg_ref<s8>(args, 3),
mods::arg_ref<u32>(args, 5)
);
return HOOK_CONTINUE;
}
+19 -3
View File
@@ -861,7 +861,7 @@ int randomizer_getItemAtLocation(const std::string& locationName) {
return randomizer_GetContext().mItemLocations[nameLookupOverride(locationName)].itemId;
}
void randomizer_checkAndOverrideEntranceData(const char*& stageName, s8& roomNo, s16& pointNo, s8& mapLayer) {
void randomizer_checkAndOverrideEntranceData(const char*& stageName, s8& roomNo, s16& pointNo, s8& mapLayer, u32& lastMode) {
RandomizerContext::EntranceOverride override = {
.stageId = static_cast<u8>(getStageID(stageName)), .roomNo = roomNo, .mapLayer = mapLayer, .pointNo = static_cast<s16>(pointNo)};
@@ -871,12 +871,28 @@ void randomizer_checkAndOverrideEntranceData(const char*& stageName, s8& roomNo,
// }
// mods::log::info("Original Stage:{}, {}, {}, {}",stageName,roomNo,pointNo,mapLayer);
if (randomizer_GetContext().mEntranceOverrides.contains(override)) {
auto& newOverride = randomizer_GetContext().mEntranceOverrides[override];
auto it = randomizer_GetContext().mEntranceOverrides.find(override);
if (it == randomizer_GetContext().mEntranceOverrides.end()) {
// If the specific layer specified isn't found, search the overrides again for layer -1
// This is used to resolve issues where a transition (like the door to the past) requests
// A specific layer to load
override.mapLayer = -1;
it = randomizer_GetContext().mEntranceOverrides.find(override);
}
if (it != randomizer_GetContext().mEntranceOverrides.end()) {
const auto& newOverride = it->second;
stageName = allStages[newOverride.stageId];
pointNo = newOverride.pointNo;
roomNo = newOverride.roomNo;
mapLayer = newOverride.mapLayer;
// Override the lastSceneMode if we are coming from a wolf dig hole
if ((lastMode&0xF) == 9) {
lastMode = (lastMode&0xFFFFFFF0);
}
// mods::log::info("New Stage:{}, {}, {}, {}",stageName,roomNo,pointNo,mapLayer);
}
}
+1 -1
View File
@@ -229,7 +229,7 @@ int randomizer_getItemAtLocation(const std::string& locationName);
* @brief Overrides the given entrance paramaters if an override exists for them
*/
void randomizer_checkAndOverrideEntranceData(
const char*& i_Name, s8& i_RoomNo, s16& i_Point, s8& i_Layer);
const char*& i_Name, s8& i_RoomNo, s16& i_Point, s8& i_Layer, u32& lastMode);
/*
* @brief Puts the associated flag into the randomizer state's temporary flag
* variable. This allows the tracker/Archipelago to know a location has been checked