Skip to content

Commit

Permalink
RepeatableItemsOnTokens And No Logic (#117)
Browse files Browse the repository at this point in the history
- Adjusts Fill algorithm to account for No Logic (removes need for separate NoLogicFill which will fix oddities where settings may not carry over properly)
- Adjust Tingle Shop text... again
- Rename "Version" to "Game Version" in Game Settings Menu for clarity on which version it's referencing
- Adjusts all vanilla Gold Skulltula Token locations to be non-repeatable locations
- Added "Repeat Items on Tokens" toggle inside of Item Pool Settings menu which allows repeatable items (items potentially needed more than once in a play through such as Title Deeds or Anju & Kafei quest items) to be placed inside spider houses in vanilla gold skulltula token locations
- Update Z3DR
  • Loading branch information
Tacoman369 authored Nov 19, 2024
1 parent c056f62 commit 241af15
Show file tree
Hide file tree
Showing 13 changed files with 156 additions and 115 deletions.
2 changes: 1 addition & 1 deletion Z3DR
10 changes: 10 additions & 0 deletions source/fill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ static bool UpdateToDAccess(Entrance* entrance) {
return ageTimePropigated;
}*/
std::vector<LocationKey> GetEmptyLocations(std::vector<LocationKey> allowedLocations) {
return FilterFromPool(allowedLocations,
[](const LocationKey loc) { return Location(loc)->GetPlacedItemKey() == NONE; });
}

std::vector<LocationKey> GetAllEmptyLocations() {
return FilterFromPool(allLocations, [](const LocationKey loc) { return Location(loc)->GetPlacedItemKey() == NONE;});
Expand Down Expand Up @@ -391,6 +395,12 @@ static void AssumedFill(const std::vector<ItemKey>& items, const std::vector<Loc
return;
}

//If No Logic fast fill everything
if (Settings::Logic.Is(LogicSetting::LOGIC_NONE)) {
FastFill(items, GetEmptyLocations(allowedLocations), true);
return;
}

//keep retrying to place everything until it works or takes too long
int retries = 10;
bool unsuccessfulPlacement = false;
Expand Down
92 changes: 47 additions & 45 deletions source/hints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,53 @@ static std::vector<LocationKey> CalculateBarrenRegions() {
return finalBarrenLocations;
}

void CreateTingleHintText() {
// Create custom messages for Tingle items if we shuffled.
if (Settings::ShuffleTingleMaps.Is(true)) {
// Logic: Get item names from location.
// Create custom message for each tingle location (6)
std::string clockTownMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_CT)->GetPlacedItemKey()).GetName().GetEnglish();
std::string woodfallMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_WF)->GetPlacedItemKey()).GetName().GetEnglish();
std::string snowHeadMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_SH)->GetPlacedItemKey()).GetName().GetEnglish();
std::string romaniMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_RR)->GetPlacedItemKey()).GetName().GetEnglish();
std::string greatBayMap = ItemTable(Location(TINGLE_GBC_GB)->GetPlacedItemKey()).GetName().GetEnglish();
std::string stoneTowerMap = ItemTable(Location(TINGLE_GBC_ST)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D11, 0xFFFF, 0x3FF0A005, 0xFF1001,
clockTownMap.insert(0, "#").append("# #5 Rupees#&").append(woodfallMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
clockTownMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_CT)->GetPlacedItemKey()).GetName().GetEnglish();
woodfallMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_WF)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D12, 0xFFFF, 0x3FF0A014, 0xFF1001,
woodfallMap.insert(0, "#").append("# #20 Rupees#&").append(snowHeadMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
woodfallMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_WF)->GetPlacedItemKey()).GetName().GetEnglish();
snowHeadMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_SH)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D13, 0xFFFF, 0x3FF0A014, 0xFF1001,
snowHeadMap.insert(0, "#").append("# #20 Rupees#&").append(romaniMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
snowHeadMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_SH)->GetPlacedItemKey()).GetName().GetEnglish();
romaniMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_RR)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D14, 0xFFFF, 0x3FF0A014, 0xFF1001,
romaniMap.insert(0, "#").append("# #20 Rupees#&").append(greatBayMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
romaniMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_RR)->GetPlacedItemKey()).GetName().GetEnglish();
greatBayMap = ItemTable(Location(TINGLE_GBC_GB)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D15, 0xFFFF, 0x3FF0A014, 0xFF1001,
greatBayMap.insert(0, "#").append("# #20 Rupees#&").append(stoneTowerMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
greatBayMap = ItemTable(Location(TINGLE_GBC_GB)->GetPlacedItemKey()).GetName().GetEnglish();
stoneTowerMap = ItemTable(Location(TINGLE_GBC_ST)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D16, 0xFFFF, 0x3FF0A014, 0xFF1001,
stoneTowerMap.insert(0, "#").append("# #20 Rupees#&").append(clockTownMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
}
}
//Find the location which has the given itemKey and create the generic altar text for the reward
/*
static Text BuildDungeonRewardText(ItemID itemID, const ItemKey itemKey) {
Expand Down Expand Up @@ -552,49 +598,5 @@ void CreateAllHints() {
//being reachable.
GetAccessibleLocations({});

// Create custom messages for Tingle items if we shuffled.
if (Settings::ShuffleTingleMaps.Is(true)) {
// Logic: Get item names from location.
// Create custom message for each tingle location (6)
std::string clockTownMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_CT)->GetPlacedItemKey()).GetName().GetEnglish();
std::string woodfallMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_WF)->GetPlacedItemKey()).GetName().GetEnglish();
std::string snowHeadMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_SH)->GetPlacedItemKey()).GetName().GetEnglish();
std::string romaniMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_RR)->GetPlacedItemKey()).GetName().GetEnglish();
std::string greatBayMap = ItemTable(Location(TINGLE_GBC_GB)->GetPlacedItemKey()).GetName().GetEnglish();
std::string stoneTowerMap = ItemTable(Location(TINGLE_GBC_ST)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D11, 0xFFFF, 0x3FF0A005, 0xFF1001,
clockTownMap.insert(0, "#").append("# #5 Rupees#&").append(woodfallMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
clockTownMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_CT)->GetPlacedItemKey()).GetName().GetEnglish();
woodfallMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_WF)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D12, 0xFFFF, 0x3FF0A014, 0xFF1001,
woodfallMap.insert(0, "#").append("# #20 Rupees#&").append(snowHeadMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
woodfallMap = ItemTable(Location(TINGLE_N_CLOCK_TOWN_WF)->GetPlacedItemKey()).GetName().GetEnglish();
snowHeadMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_SH)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D13, 0xFFFF, 0x3FF0A014, 0xFF1001,
snowHeadMap.insert(0, "#").append("# #20 Rupees#&").append(romaniMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
snowHeadMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_SH)->GetPlacedItemKey()).GetName().GetEnglish();
romaniMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_RR)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D14, 0xFFFF, 0x3FF0A014, 0xFF1001,
romaniMap.insert(0, "#").append("# #20 Rupees#&").append(greatBayMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
romaniMap = ItemTable(Location(TINGLE_TWIN_ISLANDS_RR)->GetPlacedItemKey()).GetName().GetEnglish();
greatBayMap = ItemTable(Location(TINGLE_GBC_GB)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D15, 0xFFFF, 0x3FF0A014, 0xFF1001,
greatBayMap.insert(0, "#").append("# #20 Rupees#&").append(stoneTowerMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
greatBayMap = ItemTable(Location(TINGLE_GBC_GB)->GetPlacedItemKey()).GetName().GetEnglish();
stoneTowerMap = ItemTable(Location(TINGLE_GBC_ST)->GetPlacedItemKey()).GetName().GetEnglish();

CustomMessages::CreateMessage(0x1D16, 0xFFFF, 0x3FF0A014, 0xFF1001,
stoneTowerMap.insert(0, "#").append("# #20 Rupees#&").append(clockTownMap.insert(0, "#").c_str()).append("# #40 Rupees#").append("&#No thanks#").c_str(),
{QM_GREEN, QM_RED, QM_GREEN, QM_RED, QM_GREEN}, {}, {}, 0x0, false, false);
}

}
1 change: 1 addition & 0 deletions source/include/hints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,4 @@ class HintText {
};

extern void CreateAllHints();
extern void CreateTingleHintText();
4 changes: 4 additions & 0 deletions source/include/item_location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ class ItemLocation {
bool IsRepeatable() const {
return repeatable;
}

void SetRepeatable(bool repeatable_) {
repeatable = repeatable_;
}

bool IsAddedToPool() const {
return addedToPool;
Expand Down
3 changes: 2 additions & 1 deletion source/include/setting_descriptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,5 @@ extern string_view EURegionDesc;
extern string_view VersionDesc;
extern string_view LanguageDesc;
extern string_view fastMaskDesc;
extern string_view disableBotebookAnimation;
extern string_view disableBotebookAnimation;
extern string_view repeatItemsOnTokensDesc;
2 changes: 2 additions & 0 deletions source/include/settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ namespace Settings {
extern std::vector<Option*> gameOptions;
extern Menu gameSettings;

extern Option RepeatableItemsOnTokens;

}


2 changes: 1 addition & 1 deletion source/include/version.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#define RANDOMIZER_VERSION "v1.4.1"
#define RANDOMIZER_VERSION "v1.4.2"
#define COMMIT_NUMBER "develop"
Loading

0 comments on commit 241af15

Please sign in to comment.