From 6acabae38f9445b199979861bcadf432d37522a7 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sat, 17 May 2025 02:11:04 -0400 Subject: [PATCH 01/12] Prevent another use of gSaveContext during Seed Generation (#5458) * Prevent BeanPlanted using gSaveContext for seed gen * address malk's comment about extern --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> --- soh/soh/Enhancements/randomizer/location_access.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index 6cf2aa2ab..ade8cbf72 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -12,7 +12,6 @@ #include extern "C" { -extern SaveContext gSaveContext; extern PlayState* gPlayState; } @@ -275,7 +274,7 @@ bool BeanPlanted(const RandomizerRegion region) { if (gPlayState != nullptr && gPlayState->sceneNum == sceneID) { swch = gPlayState->actorCtx.flags.swch; } else if (sceneID != SCENE_ID_MAX) { - swch = gSaveContext.sceneFlags[sceneID].swch; + swch = Rando::Context::GetInstance()->GetLogic()->GetSaveContext()->sceneFlags[sceneID].swch; } else { swch = 0; } From 9cb65308584bb863d00c016d77210057905ea47a Mon Sep 17 00:00:00 2001 From: xxAtrain223 Date: Sat, 17 May 2025 19:29:53 -0500 Subject: [PATCH 02/12] Fix Enable Available Checks from title screen. (#5502) --- soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 6c670e447..5346a31ef 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -2114,7 +2114,10 @@ void CheckTrackerSettingsWindow::DrawElement() { "with your current progress.") .Color(THEME_COLOR))) { enableAvailableChecks = CVarGetInteger(CVAR_TRACKER_CHECK("EnableAvailableChecks"), 0); - RecalculateAvailableChecks(); + + if (GameInteractor::IsSaveLoaded(true)) { + RecalculateAvailableChecks(); + } } ImGui::EndDisabled(); From 66351fa4e4b23711bc80fd9fe3e00c2a05fbdb11 Mon Sep 17 00:00:00 2001 From: xxAtrain223 Date: Sat, 17 May 2025 19:30:01 -0500 Subject: [PATCH 03/12] Remove freestanding key from Bottom of the Well Perimeter. (#5496) --- .../randomizer/location_access/dungeons/bottom_of_the_well.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp index 44c3fa817..8a8393ba1 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp @@ -25,7 +25,6 @@ void RegionTable_Init_BottomOfTheWell() { }, { //Locations LOCATION(RC_BOTTOM_OF_THE_WELL_FRONT_CENTER_BOMBABLE_CHEST, logic->HasExplosives()), - LOCATION(RC_BOTTOM_OF_THE_WELL_FREESTANDING_KEY, (logic->HasItem(RG_BRONZE_SCALE) || logic->LoweredWaterInsideBotw) && logic->CanUse(RG_STICKS) || logic->CanUse(RG_DINS_FIRE)), LOCATION(RC_BOTTOM_OF_THE_WELL_UNDERWATER_FRONT_CHEST, logic->LoweredWaterInsideBotw), LOCATION(RC_BOTTOM_OF_THE_WELL_UNDERWATER_LEFT_CHEST, logic->LoweredWaterInsideBotw), LOCATION(RC_BOTTOM_OF_THE_WELL_NEAR_ENTRANCE_POT_1, logic->CanBreakPots()), From b30fff5d57500c65e8fe246fabb49c2303e74a60 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Sat, 17 May 2025 20:56:57 -0400 Subject: [PATCH 04/12] Skip Forest Temple Basement Pillars Cutscene (#5473) * vb forest pillar cs skip * change to one point cutscene skip * rm whitespace --- .../vanilla-behavior/GIVanillaBehavior.h | 8 ++++++++ soh/soh/Enhancements/timesaver_hook_handlers.cpp | 5 +++++ .../ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c | 13 ++++++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 0c11e3c93..223001711 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -474,6 +474,14 @@ typedef enum { // - `*BgHeavyBlock` VB_FREEZE_LINK_FOR_BLOCK_THROW, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - None + VB_FREEZE_LINK_FOR_FOREST_PILLARS, + // #### `result` // ```c // true diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 13c14b0a6..9f488efce 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -375,6 +375,11 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li } break; } + case VB_FREEZE_LINK_FOR_FOREST_PILLARS: + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO)) { + *should = false; + } + break; case VB_SHOW_TITLE_CARD: if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), IS_RANDO)) { *should = false; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index 04aff53be..692497415 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -6,6 +6,7 @@ #include "z_bg_mori_kaitenkabe.h" #include "objects/object_mori_objects/object_mori_objects.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS 0 @@ -97,7 +98,9 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { if ((this->timer > (28 - CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 4)) && !Player_InCsMode(play)) { BgMoriKaitenkabe_SetupRotate(this); - Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, 8); + if (GameInteractor_Should(VB_FREEZE_LINK_FOR_FOREST_PILLARS, true)) { + Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, 8); + } Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); push.x = Math_SinS(this->dyna.unk_158); push.y = 0.0f; @@ -131,7 +134,9 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { Math_StepToF(&this->rotSpeed, 0.6f, 0.02f); if (Math_StepToF(&this->rotYdeg, this->rotDirection * 45.0f, this->rotSpeed)) { BgMoriKaitenkabe_SetupWait(this); - Player_SetCsActionWithHaltedActors(play, thisx, 7); + if (GameInteractor_Should(VB_FREEZE_LINK_FOR_FOREST_PILLARS, true)) { + Player_SetCsActionWithHaltedActors(play, thisx, 7); + } if (this->rotDirection > 0.0f) { thisx->home.rot.y += 0x2000; } else { @@ -148,7 +153,9 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } - Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); + if (GameInteractor_Should(VB_FREEZE_LINK_FOR_FOREST_PILLARS, true)) { + Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); + } } void BgMoriKaitenkabe_Update(Actor* thisx, PlayState* play) { From e0d5fbec42d270a17e0b14c4a1d836136c6fe66e Mon Sep 17 00:00:00 2001 From: xxAtrain223 Date: Sat, 17 May 2025 20:05:20 -0500 Subject: [PATCH 05/12] Available Checks Prices (#5446) * Improved the item location price availability. * Moved the available checks price logic into location_access.cpp. * Fixed typo and clarified check status identified. --- .../Enhancements/randomizer/3drando/fill.cpp | 2 +- .../Enhancements/randomizer/3drando/fill.hpp | 2 +- .../randomizer/location_access.cpp | 66 +++++++++++++++++-- .../Enhancements/randomizer/location_access.h | 3 +- .../randomizer/randomizer_check_tracker.cpp | 11 +--- 5 files changed, 67 insertions(+), 17 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 8885117c3..94b495639 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -421,7 +421,7 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals Rando::ItemLocation* location = ctx->GetItemLocation(loc); RandomizerGet locItem = location->GetPlacedRandomizerGet(); - if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAvailableChecks)) { + if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion)) { if (gals.calculatingAvailableChecks) { gals.accessibleLocations.push_back(loc); StopPerformanceTimer(PT_LOCATION_LOGIC); diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.hpp b/soh/soh/Enhancements/randomizer/3drando/fill.hpp index bb013cc13..a9b864ce2 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.hpp @@ -70,4 +70,4 @@ void GeneratePlaythrough(); bool CheckBeatable(RandomizerGet ignore=RG_NONE); -void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess); \ No newline at end of file +void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess); diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index ade8cbf72..e9da7568e 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -10,7 +10,9 @@ #include "soh/Enhancements/debugger/performanceTimer.h" #include +#include +#include "3drando/shops.hpp" extern "C" { extern PlayState* gPlayState; } @@ -31,7 +33,7 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const { return GetConditionsMet(); } -bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const { +bool LocationAccess::ConditionsMet(Region* parentRegion) const { // WARNING enterance validation can run this after resetting the access for sphere 0 validation // When refactoring ToD access, either fix the above or do not assume that we // have any access at all just because this is being run @@ -44,17 +46,71 @@ bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailab conditionsMet = true; } - return conditionsMet && - (calculatingAvailableChecks || CanBuy()); // TODO: run CanBuy when price is known due to settings + return conditionsMet && CanBuy(); +} + +static uint16_t GetMinimumPrice(const Rando::Location* loc) { + extern PriceSettingsStruct shopsanityPrices; + extern PriceSettingsStruct scrubPrices; + extern PriceSettingsStruct merchantPrices; + PriceSettingsStruct priceSettings = loc->GetRCType() == RCTYPE_SHOP ? shopsanityPrices + : loc->GetRCType() == RCTYPE_SCRUB ? scrubPrices + : merchantPrices; + + auto ctx = Rando::Context::GetInstance(); + switch (ctx->GetOption(priceSettings.main).Get()) { + case RO_PRICE_VANILLA: + return loc->GetVanillaPrice(); + case RO_PRICE_CHEAP_BALANCED: + return 0; + case RO_PRICE_BALANCED: + return 0; + case RO_PRICE_FIXED: + return ctx->GetOption(priceSettings.fixedPrice).Get() * 5; + case RO_PRICE_RANGE: { + uint16_t range1 = ctx->GetOption(priceSettings.range1).Get() * 5; + uint16_t range2 = ctx->GetOption(priceSettings.range1).Get() * 5; + return range1 < range2 ? range1 : range2; + } + case RO_PRICE_SET_BY_WALLET: { + if (ctx->GetOption(priceSettings.noWallet).Get()) { + return 0; + } else if (ctx->GetOption(priceSettings.childWallet).Get()) { + return 1; + } else if (ctx->GetOption(priceSettings.adultWallet).Get()) { + return 100; + } else if (ctx->GetOption(priceSettings.giantWallet).Get()) { + return 201; + } else { + return 501; + } + } + default: + return 0; + } } bool LocationAccess::CanBuy() const { - return CanBuyAnother(location); + const auto& loc = Rando::StaticData::GetLocation(location); + const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location); + + if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) { + // Checks should only be identified while playing + if (itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) { + return CanBuyAnother(GetMinimumPrice(loc)); + } else { + return CanBuyAnother(itemLoc->GetPrice()); + } + } + + return true; } bool CanBuyAnother(RandomizerCheck rc) { - uint16_t price = ctx->GetItemLocation(rc)->GetPrice(); + return CanBuyAnother(ctx->GetItemLocation(rc)->GetPrice()); +} +bool CanBuyAnother(uint16_t price) { if (price > 500) { return logic->HasItem(RG_TYCOON_WALLET); } else if (price > 200) { diff --git a/soh/soh/Enhancements/randomizer/location_access.h b/soh/soh/Enhancements/randomizer/location_access.h index 828c31a08..8d6815089 100644 --- a/soh/soh/Enhancements/randomizer/location_access.h +++ b/soh/soh/Enhancements/randomizer/location_access.h @@ -84,7 +84,7 @@ class LocationAccess { bool CheckConditionAtAgeTime(bool& age, bool& time) const; - bool ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const; + bool ConditionsMet(Region* parentRegion) const; RandomizerCheck GetLocation() const { return location; @@ -103,6 +103,7 @@ class LocationAccess { bool CanBuy() const; }; +bool CanBuyAnother(uint16_t price); bool CanBuyAnother(RandomizerCheck rc); namespace Rando { diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 5346a31ef..8648c9826 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -1967,7 +1967,7 @@ void RecalculateAvailableChecks() { StartPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS); std::vector targetLocations; - targetLocations.reserve(RR_MAX); + targetLocations.reserve(RC_MAX); for (auto& location : Rando::StaticData::GetLocationTable()) { RandomizerCheck rc = location.GetRandomizerCheck(); Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); @@ -1979,15 +1979,8 @@ void RecalculateAvailableChecks() { std::vector availableChecks = ReachabilitySearch(targetLocations, RG_NONE, true); for (auto& rc : availableChecks) { - const auto& location = Rando::StaticData::GetLocation(rc); const auto& itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); - if (location->GetRCType() == RCTYPE_SHOP && itemLocation->GetCheckStatus() == RCSHOW_IDENTIFIED) { - if (CanBuyAnother(rc)) { - itemLocation->SetAvailable(true); - } - } else { - itemLocation->SetAvailable(true); - } + itemLocation->SetAvailable(true); } totalChecksAvailable = 0; From 8e349429245aee3590b801ed04027cdb46695c28 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Sun, 18 May 2025 02:06:24 +0100 Subject: [PATCH 06/12] Toggle the vanilla flags instead of the rando flags when removing one time scrubs (#5504) --- soh/soh/Enhancements/randomizer/savefile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/savefile.cpp b/soh/soh/Enhancements/randomizer/savefile.cpp index cb8c7eaef..1bed22a71 100644 --- a/soh/soh/Enhancements/randomizer/savefile.cpp +++ b/soh/soh/Enhancements/randomizer/savefile.cpp @@ -269,9 +269,9 @@ extern "C" void Randomizer_InitSaveFile() { // Remove One Time Scrubs with Scrubsanity off if (Randomizer_GetSettingValue(RSK_SHUFFLE_SCRUBS) == RO_SCRUBS_OFF) { - Flags_SetRandomizerInf(RAND_INF_SCRUBS_PURCHASED_LW_DEKU_SCRUB_NEAR_BRIDGE); - Flags_SetRandomizerInf(RAND_INF_SCRUBS_PURCHASED_LW_DEKU_SCRUB_GROTTO_FRONT); - Flags_SetRandomizerInf(RAND_INF_SCRUBS_PURCHASED_HF_DEKU_SCRUB_GROTTO); + Flags_SetItemGetInf(ITEMGETINF_DEKU_SCRUB_HEART_PIECE); + Flags_SetInfTable(INFTABLE_BOUGHT_STICK_UPGRADE); + Flags_SetInfTable(INFTABLE_BOUGHT_NUT_UPGRADE); } int startingAge = OTRGlobals::Instance->gRandoContext->GetOption(RSK_SELECTED_STARTING_AGE).Get(); From ecad59e31fe134dea65f8da7b160b17692276011 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Sat, 17 May 2025 18:52:45 -0700 Subject: [PATCH 07/12] Add tooltip to Generate Seed button when disabled indicating the need to be on File Select. (#5509) --- soh/soh/Enhancements/randomizer/randomizer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index d3e2c83b5..18a23df53 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3724,13 +3724,15 @@ void RandomizerSettingsWindow::DrawElement() { } UIWidgets::Spacer(0); - ImGui::BeginDisabled((gSaveContext.gameMode != GAMEMODE_FILE_SELECT) || GameInteractor::IsSaveLoaded()); - if (UIWidgets::Button("Generate Randomizer", - UIWidgets::ButtonOptions().Size(ImVec2(250.f, 0.f)).Color(THEME_COLOR))) { + UIWidgets::ButtonOptions options = UIWidgets::ButtonOptions().Size(ImVec2(250.f, 0.f)).Color(THEME_COLOR); + options.Disabled((gSaveContext.gameMode != GAMEMODE_FILE_SELECT) || GameInteractor::IsSaveLoaded()); + if (options.disabled) { + options.DisabledTooltip("Must be on File Select to generate a randomizer seed."); + } + if (UIWidgets::Button("Generate Randomizer", options)) { ctx->SetSpoilerLoaded(false); GenerateRandomizer(CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0) ? seedString : ""); } - ImGui::EndDisabled(); ImGui::SameLine(); if (!CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) { From 53566c9a73a3f176824547af2f940085e5f425ae Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sun, 18 May 2025 16:25:24 -0400 Subject: [PATCH 08/12] fix incorrect `__VA_ARGS__` use in `lusprintf` version of `osSyncPrintf` (#5510) --- soh/include/functions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/include/functions.h b/soh/include/functions.h index 86e3bf77f..f29153a9c 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -15,7 +15,7 @@ extern "C" #include #if defined(INCLUDE_GAME_PRINTF) && defined(_DEBUG) -#define osSyncPrintf(fmt, ...) lusprintf(__FILE__, __LINE__, 0, fmt, __VA_ARGS__) +#define osSyncPrintf(fmt, ...) lusprintf(__FILE__, __LINE__, 0, fmt, ##__VA_ARGS__) #else #define osSyncPrintf(fmt, ...) osSyncPrintfUnused(fmt, ##__VA_ARGS__) #endif From f16e34e8b8f538725229c2d4ff9018e50596d7de Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Sun, 18 May 2025 22:25:18 +0100 Subject: [PATCH 09/12] fix and rename IsKeysanity to IsFireLoopLocked (#5515) * c * fix and rename IsKeysanity * add comment --- .../randomizer/location_access/dungeons/fire_temple.cpp | 4 ++-- soh/soh/Enhancements/randomizer/logic.cpp | 9 +++++---- soh/soh/Enhancements/randomizer/logic.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp index 8888cdac9..70cf890b0 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp @@ -20,7 +20,7 @@ void RegionTable_Init_FireTemple() { //Exits Entrance(RR_FIRE_TEMPLE_ENTRYWAY, []{return true;}), Entrance(RR_FIRE_TEMPLE_NEAR_BOSS_ROOM, []{return logic->FireTimer() >= 24;}), - Entrance(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return Here(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->CanUse(RG_MEGATON_HAMMER);}) && (logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsKeysanity);}), + Entrance(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return Here(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->CanUse(RG_MEGATON_HAMMER);}) && (logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsFireLoopLocked);}), Entrance(RR_FIRE_TEMPLE_LOOP_EXIT, []{return true;}), Entrance(RR_FIRE_TEMPLE_BIG_LAVA_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 2) && logic->FireTimer() >= 24;}), }); @@ -43,7 +43,7 @@ void RegionTable_Init_FireTemple() { areaTable[RR_FIRE_TEMPLE_LOOP_ENEMIES] = Region("Fire Temple Loop Enemies", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, {}, { //Exits - Entrance(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsKeysanity;}), + Entrance(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsFireLoopLocked;}), Entrance(RR_FIRE_TEMPLE_LOOP_TILES, []{return Here(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return logic->CanKillEnemy(RE_TORCH_SLUG) && logic->CanKillEnemy(RE_FIRE_KEESE);});}), }); diff --git a/soh/soh/Enhancements/randomizer/logic.cpp b/soh/soh/Enhancements/randomizer/logic.cpp index 252806473..7f4b7e102 100644 --- a/soh/soh/Enhancements/randomizer/logic.cpp +++ b/soh/soh/Enhancements/randomizer/logic.cpp @@ -1389,6 +1389,7 @@ bool Logic::SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless static_cast(GlitchDifficulty::INTERMEDIATE) || GetDifficultyValueFromString(GlitchHover) >= static_cast(GlitchDifficulty::INTERMEDIATE))) { return FireTempleKeys >= requiredAmountGlitched; }*/ + // If the Fire Temple loop lock is removed, Small key Count is set to 1 before starting return GetSmallKeyCount(SCENE_FIRE_TEMPLE) >= requiredAmountGlitchless; case RR_WATER_TEMPLE: @@ -2336,9 +2337,9 @@ void Logic::Reset() { StartPerformanceTimer(PT_LOGIC_RESET); memset(inLogic, false, sizeof(inLogic)); // Settings-dependent variables - IsKeysanity = ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) || - ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) || - ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE); + IsFireLoopLocked = ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) || + ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_OVERWORLD) || + ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANY_DUNGEON); // AmmoCanDrop = /*AmmoDrops.IsNot(AMMODROPS_NONE)*/ false; TODO: AmmoDrop setting @@ -2400,7 +2401,7 @@ void Logic::Reset() { // If not keysanity, start with 1 logical key to account for automatically unlocking the basement door in vanilla // FiT - if (!IsKeysanity && ctx->GetDungeon(Rando::FIRE_TEMPLE)->IsVanilla()) { + if (!IsFireLoopLocked && ctx->GetDungeon(Rando::FIRE_TEMPLE)->IsVanilla()) { SetSmallKeyCount(SCENE_FIRE_TEMPLE, 1); } diff --git a/soh/soh/Enhancements/randomizer/logic.h b/soh/soh/Enhancements/randomizer/logic.h index 4f966f5de..77c49d25f 100644 --- a/soh/soh/Enhancements/randomizer/logic.h +++ b/soh/soh/Enhancements/randomizer/logic.h @@ -59,7 +59,7 @@ class Logic { bool LightTrialClear = false; // Logical keysanity - bool IsKeysanity = false; + bool IsFireLoopLocked = false; // Bottle Count uint8_t Bottles = 0; From f0e40fd1dc09b894c0ee6956ca2e4fc369436e85 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sun, 18 May 2025 17:26:10 -0400 Subject: [PATCH 10/12] fix incorrect token count in messages when tokensanity is off (#5503) * fix incorrect token count in messages when tokensanity is off * Update OTRGlobals.cpp --- soh/soh/OTRGlobals.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 72030657e..dcabfca70 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -2437,15 +2437,15 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { // animation until the text box auto-dismisses. // RANDOTODO: Implement a way to determine if an item came from a skulltula and // inject the auto-dismiss control code if it did. - if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && - !(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF)) { + bool gsTokensShuffled = Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF; + if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && !(IS_RANDO && gsTokensShuffled)) { textId = TEXT_GS_NO_FREEZE; } else { textId = TEXT_GS_FREEZE; } // In vanilla, GS token count is incremented prior to the text box displaying // In rando we need to bump the token count by one to show the correct count - s16 gsCount = gSaveContext.inventory.gsTokens + (IS_RANDO ? 1 : 0); + s16 gsCount = gSaveContext.inventory.gsTokens + ((IS_RANDO && gsTokensShuffled) ? 1 : 0); messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, textId, MF_FORMATTED); messageEntry.Replace("[[gsCount]]", std::to_string(gsCount)); } else if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && From 4334a132e31ef12a1cccf2c77e7006ed9c54c88d Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Sun, 18 May 2025 22:28:55 +0100 Subject: [PATCH 11/12] fix the wrong codepath being used in CanBuy when generating seeds (#5514) --- soh/soh/Enhancements/randomizer/3drando/fill.cpp | 2 +- soh/soh/Enhancements/randomizer/location_access.cpp | 8 ++++---- soh/soh/Enhancements/randomizer/location_access.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 94b495639..8885117c3 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -421,7 +421,7 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals Rando::ItemLocation* location = ctx->GetItemLocation(loc); RandomizerGet locItem = location->GetPlacedRandomizerGet(); - if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion)) { + if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAvailableChecks)) { if (gals.calculatingAvailableChecks) { gals.accessibleLocations.push_back(loc); StopPerformanceTimer(PT_LOCATION_LOGIC); diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index e9da7568e..cdd684f04 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -33,7 +33,7 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const { return GetConditionsMet(); } -bool LocationAccess::ConditionsMet(Region* parentRegion) const { +bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const { // WARNING enterance validation can run this after resetting the access for sphere 0 validation // When refactoring ToD access, either fix the above or do not assume that we // have any access at all just because this is being run @@ -46,7 +46,7 @@ bool LocationAccess::ConditionsMet(Region* parentRegion) const { conditionsMet = true; } - return conditionsMet && CanBuy(); + return conditionsMet && CanBuy(calculatingAvailableChecks); } static uint16_t GetMinimumPrice(const Rando::Location* loc) { @@ -90,13 +90,13 @@ static uint16_t GetMinimumPrice(const Rando::Location* loc) { } } -bool LocationAccess::CanBuy() const { +bool LocationAccess::CanBuy(bool calculatingAvailableChecks) const { const auto& loc = Rando::StaticData::GetLocation(location); const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location); if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) { // Checks should only be identified while playing - if (itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) { + if (calculatingAvailableChecks && itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) { return CanBuyAnother(GetMinimumPrice(loc)); } else { return CanBuyAnother(itemLoc->GetPrice()); diff --git a/soh/soh/Enhancements/randomizer/location_access.h b/soh/soh/Enhancements/randomizer/location_access.h index 8d6815089..9c8df0e9b 100644 --- a/soh/soh/Enhancements/randomizer/location_access.h +++ b/soh/soh/Enhancements/randomizer/location_access.h @@ -84,7 +84,7 @@ class LocationAccess { bool CheckConditionAtAgeTime(bool& age, bool& time) const; - bool ConditionsMet(Region* parentRegion) const; + bool ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const; RandomizerCheck GetLocation() const { return location; @@ -100,7 +100,7 @@ class LocationAccess { std::string condition_str; // Makes sure shop locations are buyable - bool CanBuy() const; + bool CanBuy(bool calculatingAvailableChecks) const; }; bool CanBuyAnother(uint16_t price); From 081f82875a8afbacc77d2baa1230040dc785266c Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Mon, 19 May 2025 00:24:57 -0400 Subject: [PATCH 12/12] fix link voice missing when hanging off ledges (#5506) * fix link voice missing when hanging off ledges * remove unused bitrate var * hardcoded but justified * format --- soh/soh/stubs.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/soh/soh/stubs.c b/soh/soh/stubs.c index 56013e56f..118b36e72 100644 --- a/soh/soh/stubs.c +++ b/soh/soh/stubs.c @@ -145,7 +145,47 @@ void Audio_osWritebackDCache(void* mem, s32 size) { } s32 osAiSetFrequency(u32 freq) { - return 1; + // this is based off the math from the original method + /* + + s32 osAiSetFrequency(u32 frequency) { + u8 bitrate; + f32 dacRateF = ((f32)osViClock / frequency) + 0.5f; + u32 dacRate = dacRateF; + + if (dacRate < 132) { + return -1; + } + + bitrate = (dacRate / 66); + if (bitrate > 16) { + bitrate = 16; + } + + HW_REG(AI_DACRATE_REG, u32) = dacRate - 1; + HW_REG(AI_BITRATE_REG, u32) = bitrate - 1; + return osViClock / (s32)dacRate; + } + + */ + + // bitrate is unused + + // osViClock comes from + // #define VI_NTSC_CLOCK 48681812 /* Hz = 48.681812 MHz */ + // s32 osViClock = VI_NTSC_CLOCK; + + // frequency was originally 32000 + + // given all of that, dacRate is + // (u32)(((f32)48681812 / 32000) + 0.5f) + // which evaluates to 1521 (which is > 132) + + // this leaves us with a final calculation of + // 48681812 / 1521 + // which evaluates to 32006 + + return 32006; } void osInvalDCache(void* vaddr, s32 nbytes) {