Skip to content

Commit

Permalink
Fix scrubs behaving as if shuffled despite not being. (HarbourMasters…
Browse files Browse the repository at this point in the history
…#4468)

Convert shop tracking to checking for shuffled.
Change "Hide right-side shop item checks" to "Hide unshuffled shop item checks" on the check tracker.
  • Loading branch information
Malkierian authored Oct 23, 2024
1 parent 75a0979 commit 2ffd62a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 14 deletions.
4 changes: 2 additions & 2 deletions soh/soh/Enhancements/randomizer/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,10 +1181,10 @@ ScrubIdentity Randomizer::IdentifyScrub(s32 sceneNum, s32 actorParams, s32 respa
scrubIdentity.randomizerInf = rcToRandomizerInf[location->GetRandomizerCheck()];
scrubIdentity.randomizerCheck = location->GetRandomizerCheck();
scrubIdentity.getItemId = (GetItemID)Rando::StaticData::RetrieveItem(location->GetVanillaItem()).GetItemID();
scrubIdentity.isShuffled = GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) != RO_SCRUBS_OFF;
scrubIdentity.isShuffled = GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) == RO_SCRUBS_ALL;

if (location->GetRandomizerCheck() == RC_HF_DEKU_SCRUB_GROTTO || location->GetRandomizerCheck() == RC_LW_DEKU_SCRUB_GROTTO_FRONT || location->GetRandomizerCheck() == RC_LW_DEKU_SCRUB_NEAR_BRIDGE) {
scrubIdentity.isShuffled = true;
scrubIdentity.isShuffled = GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) != RO_SCRUBS_OFF;;
}

scrubIdentity.itemPrice = OTRGlobals::Instance->gRandoContext->GetItemLocation(scrubIdentity.randomizerCheck)->GetPrice();
Expand Down
30 changes: 19 additions & 11 deletions soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ bool showOverworldTokens;
bool showDungeonTokens;
bool showBeans;
bool showScrubs;
bool showMajorScrubs;
bool showMerchants;
bool showBeehives;
bool showCows;
Expand Down Expand Up @@ -73,7 +74,7 @@ bool fishsanityAgeSplit;
bool initialized;
bool doAreaScroll;
bool previousShowHidden = false;
bool hideShopRightChecks = true;
bool hideShopUnshuffledChecks = true;
bool hideTriforceCompleted = true;
bool alwaysShowGS = false;

Expand Down Expand Up @@ -1115,6 +1116,9 @@ void LoadSettings() {
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_MERCHANTS) == RO_SHUFFLE_MERCHANTS_ALL
: true;
showScrubs = IS_RANDO ?
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) == RO_SCRUBS_ALL
: false;
showMajorScrubs = IS_RANDO ?
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHUFFLE_SCRUBS) != RO_SCRUBS_OFF
: false;
showMerchants = IS_RANDO ?
Expand Down Expand Up @@ -1221,6 +1225,9 @@ void LoadSettings() {

bool IsCheckShuffled(RandomizerCheck rc) {
Rando::Location* loc = Rando::StaticData::GetLocation(rc);
if (loc->GetRCType() == RCTYPE_SHOP) {
auto identity = OTRGlobals::Instance->gRandomizer->IdentifyShopItem(loc->GetScene(), loc->GetActorParams() + 1);
}
if (IS_RANDO && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LOGIC_RULES) != RO_LOGIC_VANILLA) {
return
(loc->GetArea() != RCAREA_INVALID) && // don't show Invalid locations
Expand All @@ -1234,14 +1241,15 @@ bool IsCheckShuffled(RandomizerCheck rc) {
loc->GetQuest() == RCQUEST_MQ && OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(loc->GetScene())->IsMQ() ||
loc->GetQuest() == RCQUEST_VANILLA && OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(loc->GetScene())->IsVanilla()
) &&
(loc->GetRCType() != RCTYPE_SHOP || (showShops && loc->GetActorParams() > 0x03)) &&
(loc->GetRCType() != RCTYPE_SHOP ||
(showShops && OTRGlobals::Instance->gRandomizer->IdentifyShopItem(loc->GetScene(), loc->GetActorParams() + 1).enGirlAShopItem == 50)) &&
(rc != RC_TRIFORCE_COMPLETED || !hideTriforceCompleted) &&
(rc != RC_GIFT_FROM_SAGES || !IS_RANDO) &&
(loc->GetRCType() != RCTYPE_SCRUB ||
showScrubs ||
rc == RC_LW_DEKU_SCRUB_NEAR_BRIDGE || // The 3 scrubs that are always randomized
(showMajorScrubs && (rc == RC_LW_DEKU_SCRUB_NEAR_BRIDGE || // The 3 scrubs that are always randomized
rc == RC_HF_DEKU_SCRUB_GROTTO ||
rc == RC_LW_DEKU_SCRUB_GROTTO_FRONT
rc == RC_LW_DEKU_SCRUB_GROTTO_FRONT))
) &&
(loc->GetRCType() != RCTYPE_MERCHANT || showMerchants) &&
(loc->GetRCType() != RCTYPE_BEEHIVE || showBeehives) &&
Expand Down Expand Up @@ -1287,7 +1295,7 @@ bool IsVisibleInCheckTracker(RandomizerCheck rc) {
auto loc = Rando::StaticData::GetLocation(rc);
if (IS_RANDO) {
return IsCheckShuffled(rc) || (loc->GetRCType() == RCTYPE_SKULL_TOKEN && alwaysShowGS) ||
(loc->GetRCType() == RCTYPE_SHOP && (showShops && (!hideShopRightChecks)));
(loc->GetRCType() == RCTYPE_SHOP && (showShops && (!hideShopUnshuffledChecks)));
} else {
return loc->IsVanillaCompletion() && (!loc->IsDungeon() || (loc->IsDungeon() && loc->GetQuest() == gSaveContext.questId));
}
Expand Down Expand Up @@ -1683,14 +1691,14 @@ void CheckTrackerSettingsWindow::DrawElement() {
}
UIWidgets::EnhancementCheckbox("Vanilla/MQ Dungeon Spoilers", CVAR_TRACKER_CHECK("MQSpoilers"));
UIWidgets::Tooltip("If enabled, Vanilla/MQ dungeons will show on the tracker immediately. Otherwise, Vanilla/MQ dungeon locations must be unlocked.");
if (UIWidgets::EnhancementCheckbox("Hide right-side shop item checks", CVAR_TRACKER_CHECK("HideRightShopChecks"), false, "", UIWidgets::CheckboxGraphics::Cross, true)) {
hideShopRightChecks = !hideShopRightChecks;
RecalculateAllAreaTotals();
if (UIWidgets::EnhancementCheckbox("Hide unshuffled shop item checks", CVAR_TRACKER_CHECK("HideUnshuffledShopChecks"), false, "", UIWidgets::CheckboxGraphics::Cross, true)) {
hideShopUnshuffledChecks = !hideShopUnshuffledChecks;
UpdateFilters();
}
UIWidgets::Tooltip("If enabled, will prevent the tracker from displaying slots 1-4 in all shops.");
UIWidgets::Tooltip("If enabled, will prevent the tracker from displaying slots with non-shop-item shuffles.");
if (UIWidgets::EnhancementCheckbox("Always show gold skulltulas", CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), false, "")) {
alwaysShowGS = !alwaysShowGS;
RecalculateAllAreaTotals();
UpdateFilters();
}
UIWidgets::Tooltip("If enabled, will show GS locations in the tracker regardless of tokensanity settings.");
UIWidgets::EnhancementCheckbox("Show Logic", "gCheckTrackerOptionShowLogic");
Expand Down Expand Up @@ -1762,7 +1770,7 @@ void CheckTrackerWindow::UpdateElement() {
mystery = CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MysteriousShuffle"), 0);
showLogicTooltip = CVarGetInteger("gCheckTrackerOptionShowLogic", 0);

hideShopRightChecks = CVarGetInteger(CVAR_TRACKER_CHECK("HideRightShopChecks"), 1);
hideShopUnshuffledChecks = CVarGetInteger(CVAR_TRACKER_CHECK("HideUnshuffledShopChecks"), 1);
alwaysShowGS = CVarGetInteger(CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), 0);
}
} // namespace CheckTracker
2 changes: 1 addition & 1 deletion soh/soh/config/ConfigMigrators.h
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ namespace SOH {
{ MigrationAction::Rename, "gCheckTrackerHudEditMode", "gTrackers.CheckTracker.Draggable" },
{ MigrationAction::Rename, "gCheckTrackerKnownHide", "gTrackers.CheckTracker.Scummed.Hide" },
{ MigrationAction::Rename, "gCheckTrackerOptionAlwaysShowGSLocs", "gTrackers.CheckTracker.AlwaysShowGSLocs" },
{ MigrationAction::Rename, "gCheckTrackerOptionHideRightShopChecks", "gTrackers.CheckTracker.HideRightShopChecks" },
{ MigrationAction::Rename, "gCheckTrackerOptionHideRightShopChecks", "gTrackers.CheckTracker.HideUnshuffledShopChecks" },
{ MigrationAction::Rename, "gCheckTrackerOptionMQSpoilers", "gTrackers.CheckTracker.MQSpoilers" },
{ MigrationAction::Rename, "gCheckTrackerOptionShowHidden", "gTrackers.CheckTracker.ShowHidden" },
{ MigrationAction::Rename, "gCheckTrackerSavedExtraColor", "gTrackers.CheckTracker.Saved.ExtraColor" },
Expand Down

0 comments on commit 2ffd62a

Please sign in to comment.