Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RepeatableItemsOnTokens And No Logic #117

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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