restructure some trials, conditionalAlwaysHints and hint_list stuff

This commit is contained in:
Pepper0ni 2024-04-17 11:37:08 +01:00
parent c46efe5c0d
commit a4a832938c
24 changed files with 7779 additions and 7808 deletions

View File

@ -75,18 +75,6 @@ class CustomMessage {
*/ */
void Replace(std::string&& oldStr, std::string&& newStr); void Replace(std::string&& oldStr, std::string&& newStr);
/**
* @brief Finds an instance of oldStr in each language of the CustomMessage,
* and replaces it with the corresponding new string provided for each language.
* Typically used for dynamic variable replacement (i.e. gameplay stats, skulltula count)
*
* @param oldStr the string to be replaced
* @param newEnglish the new string for the English message
* @param newGerman the new string for the German message
* @param newFrench the new string for the French message
*/
void Replace(std::string&& oldStr, std::string&& newEnglish, std::string&& newGerman, std::string&& newFrench);
/** /**
* @brief Finds an instance of oldStr in each language of the CustomMessage, * @brief Finds an instance of oldStr in each language of the CustomMessage,
* and replaces it with the corresponding string in the provided CustomMessage. * and replaces it with the corresponding string in the provided CustomMessage.

View File

@ -9,7 +9,6 @@
#include "spoiler_log.hpp" #include "spoiler_log.hpp"
#include "starting_inventory.hpp" #include "starting_inventory.hpp"
#include "hints.hpp" #include "hints.hpp"
#include "hint_list.hpp"
#include "../entrance.h" #include "../entrance.h"
#include "shops.hpp" #include "shops.hpp"
#include "pool_functions.hpp" #include "pool_functions.hpp"

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
#pragma once
#include "hints.hpp"
#include <vector>
extern std::array<HintText, RHT_MAX> hintTable;
void HintTable_Init();
const HintText& GetHintText(const RandomizerHintTextKey hintKey);
void HintTable_Init_Item();
void HintTable_Init_Exclude_Overworld();
void HintTable_Init_Exclude_Dungeon();

View File

@ -4,7 +4,6 @@
#include "random.hpp" #include "random.hpp"
#include "spoiler_log.hpp" #include "spoiler_log.hpp"
#include "fill.hpp" #include "fill.hpp"
#include "hint_list.hpp"
#include "../trial.h" #include "../trial.h"
#include "../entrance.h" #include "../entrance.h"
#include "z64item.h" #include "z64item.h"
@ -176,14 +175,14 @@ const std::array<HintSetting, 4> hintSettingTable{{
.trialCopies = 1, .trialCopies = 1,
.junkWeight = 6, .junkWeight = 6,
.distTable = { .distTable = {
{"WotH", HINT_TYPE_WOTH, 7, 0, 1, FilterWotHLocations, 2}, {"WotH", HINT_TYPE_WOTH, 7, 0, 1, FilterWotHLocations, 2},
{"Barren", HINT_TYPE_FOOLISH, 4, 0, 1, FilterBarrenLocations, 1}, {"Barren", HINT_TYPE_FOOLISH, 4, 0, 1, FilterBarrenLocations, 1},
//("Entrance", HINT_TYPE_ENTRANCE, 6, 0, 1), //not yet implemented //("Entrance", HINT_TYPE_ENTRANCE, 6, 0, 1), //not yet implemented
{"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations}, {"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations},
{"Overworld", HINT_TYPE_ITEM, 4, 0, 1, FilterOverworldLocations}, {"Overworld", HINT_TYPE_ITEM, 4, 0, 1, FilterOverworldLocations},
{"Dungeon", HINT_TYPE_ITEM, 3, 0, 1, FilterDungeonLocations}, {"Dungeon", HINT_TYPE_ITEM, 3, 0, 1, FilterDungeonLocations},
{"Named Item", HINT_TYPE_ITEM_AREA, 10, 0, 1, FilterGoodItems}, {"Named Item", HINT_TYPE_ITEM_AREA, 10, 0, 1, FilterGoodItems},
{"Random" , HINT_TYPE_ITEM_AREA, 12, 0, 1, NoFilter} {"Random" , HINT_TYPE_ITEM_AREA, 12, 0, 1, NoFilter}
} }
}, },
// Strong hints // Strong hints
@ -192,14 +191,14 @@ const std::array<HintSetting, 4> hintSettingTable{{
.trialCopies = 1, .trialCopies = 1,
.junkWeight = 0, .junkWeight = 0,
.distTable = { .distTable = {
{"WotH", HINT_TYPE_WOTH, 12, 0, 2, FilterWotHLocations, 2}, {"WotH", HINT_TYPE_WOTH, 12, 0, 2, FilterWotHLocations, 2},
{"Barren", HINT_TYPE_FOOLISH, 12, 0, 1, FilterBarrenLocations, 1}, {"Barren", HINT_TYPE_FOOLISH, 12, 0, 1, FilterBarrenLocations, 1},
//{"Entrance", HINT_TYPE_ENTRANCE, 4, 0, 1}, //not yet implemented //{"Entrance", HINT_TYPE_ENTRANCE, 4, 0, 1}, //not yet implemented
{"Song", HINT_TYPE_ITEM, 4, 0, 1, FilterSongLocations}, {"Song", HINT_TYPE_ITEM, 4, 0, 1, FilterSongLocations},
{"Overworld", HINT_TYPE_ITEM, 6, 0, 1, FilterOverworldLocations}, {"Overworld", HINT_TYPE_ITEM, 6, 0, 1, FilterOverworldLocations},
{"Dungeon", HINT_TYPE_ITEM, 6, 0, 1, FilterDungeonLocations}, {"Dungeon", HINT_TYPE_ITEM, 6, 0, 1, FilterDungeonLocations},
{"Named Item", HINT_TYPE_ITEM_AREA, 8, 0, 1, FilterGoodItems}, {"Named Item", HINT_TYPE_ITEM_AREA, 8, 0, 1, FilterGoodItems},
{"Random" , HINT_TYPE_ITEM_AREA, 8, 0, 1, NoFilter}, {"Random" , HINT_TYPE_ITEM_AREA, 8, 0, 1, NoFilter},
}, },
}, },
// Very strong hints // Very strong hints
@ -208,17 +207,111 @@ const std::array<HintSetting, 4> hintSettingTable{{
.trialCopies = 1, .trialCopies = 1,
.junkWeight = 0, .junkWeight = 0,
.distTable = { .distTable = {
{"WotH", HINT_TYPE_WOTH, 15, 0, 2, FilterWotHLocations}, {"WotH", HINT_TYPE_WOTH, 15, 0, 2, FilterWotHLocations},
{"Barren", HINT_TYPE_FOOLISH, 15, 0, 1, FilterBarrenLocations}, {"Barren", HINT_TYPE_FOOLISH, 15, 0, 1, FilterBarrenLocations},
//{"Entrance", HINT_TYPE_ENTRANCE, 10, 0, 1}, //not yet implemented //{"Entrance", HINT_TYPE_ENTRANCE, 10, 0, 1}, //not yet implemented
{"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations}, {"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations},
{"Overworld", HINT_TYPE_ITEM, 7, 0, 1, FilterOverworldLocations}, {"Overworld", HINT_TYPE_ITEM, 7, 0, 1, FilterOverworldLocations},
{"Dungeon", HINT_TYPE_ITEM, 7, 0, 1, FilterDungeonLocations}, {"Dungeon", HINT_TYPE_ITEM, 7, 0, 1, FilterDungeonLocations},
{"Named Item", HINT_TYPE_ITEM_AREA, 5, 0, 1, FilterGoodItems}, {"Named Item", HINT_TYPE_ITEM_AREA, 5, 0, 1, FilterGoodItems},
}, },
}, },
}}; }};
uint8_t StonesRequiredBySettings() {
auto ctx = Rando::Context::GetInstance();
uint8_t stones = 0;
if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_STONES)) {
stones = ctx->GetOption(RSK_RAINBOW_BRIDGE_STONE_COUNT).Value<uint8_t>();
} else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) {
stones = ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).Value<uint8_t>() - 6;
} else if ((ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS)) && (ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON))) {
stones = ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).Value<uint8_t>() - 6;
}
if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) {
stones = std::max<uint8_t>({ stones, ctx->GetOption(RSK_LACS_STONE_COUNT).Value<uint8_t>() });
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) {
stones = std::max<uint8_t>({ stones, (uint8_t)(ctx->GetOption(RSK_LACS_REWARD_COUNT).Value<uint8_t>() - 6 )});
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS)) {
stones = std::max<uint8_t>({ stones, (uint8_t)(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).Value<uint8_t>() - 6 )});
}
return stones;
}
uint8_t MedallionsRequiredBySettings() {
auto ctx = Rando::Context::GetInstance();
uint8_t medallions = 0;
if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_MEDALLIONS)) {
medallions = ctx->GetOption(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).Value<uint8_t>();
} else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) {
medallions = ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).Value<uint8_t>() - 3;
} else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS) && ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON)) {
medallions = ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).Value<uint8_t>() - 3;
}
if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_MEDALLIONS)) {
medallions = std::max({ medallions, ctx->GetOption(RSK_LACS_MEDALLION_COUNT).Value<uint8_t>() });
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_REWARDS)) {
medallions = std::max({ medallions, (uint8_t)(ctx->GetOption(RSK_LACS_REWARD_COUNT).Value<uint8_t>() - 3 )});
} else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS) && ctx->GetOption(RSK_SHUFFLE_DUNGEON_REWARDS).Is(RO_DUNGEON_REWARDS_END_OF_DUNGEON)) {
medallions = std::max({ medallions, (uint8_t)(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).Value<uint8_t>() - 3 )});
}
return medallions;
}
uint8_t TokensRequiredBySettings() {
auto ctx = Rando::Context::GetInstance();
uint8_t tokens = 0;
if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS)) {
tokens = ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).Value<uint8_t>();
}
if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_TOKENS)) {
tokens = std::max<uint8_t>({ tokens, ctx->GetOption(RSK_LACS_TOKEN_COUNT).Value<uint8_t>() });
}
return tokens;
}
std::vector<std::pair<RandomizerCheck, std::function<bool()>>> conditionalAlwaysHints = {
std::make_pair(RC_MARKET_10_BIG_POES, []() {
auto ctx = Rando::Context::GetInstance();
return ctx->GetOption(RSK_BIG_POE_COUNT).Value<uint8_t>() >= 3 && !ctx->GetOption(RSK_BIG_POES_HINT);
}), // Remember, the option's value being 3 means 4 are required
std::make_pair(RC_DEKU_THEATER_MASK_OF_TRUTH, []() {
auto ctx = Rando::Context::GetInstance();
return !ctx->GetOption(RSK_COMPLETE_MASK_QUEST);
}),
std::make_pair(RC_SONG_FROM_OCARINA_OF_TIME, []() { return StonesRequiredBySettings() < 2; }),
std::make_pair(RC_HF_OCARINA_OF_TIME_ITEM, []() { return StonesRequiredBySettings() < 2; }),
std::make_pair(RC_SHEIK_IN_KAKARIKO, []() { return MedallionsRequiredBySettings() < 5; }),
std::make_pair(RC_DMT_TRADE_CLAIM_CHECK, []() {
auto ctx = Rando::Context::GetInstance();
return !ctx->GetOption(RSK_BIGGORON_HINT);
}),
std::make_pair(RC_KAK_30_GOLD_SKULLTULA_REWARD, []() {
auto ctx = Rando::Context::GetInstance();
return !ctx->GetOption(RSK_KAK_30_SKULLS_HINT) && TokensRequiredBySettings() < 30;
}),
std::make_pair(RC_KAK_40_GOLD_SKULLTULA_REWARD, []() {
auto ctx = Rando::Context::GetInstance();
return !ctx->GetOption(RSK_KAK_40_SKULLS_HINT) && TokensRequiredBySettings() < 40;
}),
std::make_pair(RC_KAK_50_GOLD_SKULLTULA_REWARD, []() {
auto ctx = Rando::Context::GetInstance();
return !ctx->GetOption(RSK_KAK_50_SKULLS_HINT) && TokensRequiredBySettings() < 50;
}),
std::make_pair(RC_ZR_FROGS_OCARINA_GAME, []() {
auto ctx = Rando::Context::GetInstance();
return !ctx->GetOption(RSK_FROGS_HINT);
}),
std::make_pair(RC_KF_LINKS_HOUSE_COW, []() {
auto ctx = Rando::Context::GetInstance();
return !ctx->GetOption(RSK_MALON_HINT);
}),
std::make_pair(RC_KAK_100_GOLD_SKULLTULA_REWARD, []() {
auto ctx = Rando::Context::GetInstance();
return !ctx->GetOption(RSK_KAK_100_SKULLS_HINT) && TokensRequiredBySettings() < 100;
}),
};
static std::vector<RandomizerCheck> GetEmptyGossipStones() { static std::vector<RandomizerCheck> GetEmptyGossipStones() {
auto emptyGossipStones = GetEmptyLocations(Rando::StaticData::gossipStoneLocations); auto emptyGossipStones = GetEmptyLocations(Rando::StaticData::gossipStoneLocations);
return emptyGossipStones; return emptyGossipStones;
@ -392,7 +485,7 @@ static void CreateTrialHints(uint8_t copies) {
auto requiredTrials = FilterFromPool(trials, [](TrialInfo* trial){return trial->IsRequired();}); auto requiredTrials = FilterFromPool(trials, [](TrialInfo* trial){return trial->IsRequired();});
} }
for (auto& trial : trials) {//create a hint for each hinted trial for (auto& trial : trials) {//create a hint for each hinted trial
AddGossipStoneHintCopies(copies, HINT_TYPE_TRIAL, "Trial", {}, {}, {trial->GetKey()}); AddGossipStoneHintCopies(copies, HINT_TYPE_TRIAL, "Trial", {}, {}, {trial->GetTrialKey()});
} }
} }
} }

View File

@ -69,10 +69,6 @@ struct StaticHintInfo{
std::vector<RandomizerCheck> _hintChecks = {}, bool _yourPocket = false, int _num = 0); std::vector<RandomizerCheck> _hintChecks = {}, bool _yourPocket = false, int _num = 0);
}; };
using ConditionalAlwaysHint = std::pair<RandomizerCheck, std::function<bool()>>;
extern std::vector<ConditionalAlwaysHint> conditionalAlwaysHints;
extern void CreateAllHints(); extern void CreateAllHints();
extern void CreateWarpSongTexts(); extern void CreateWarpSongTexts();
void CreateGanondorfHint(); void CreateGanondorfHint();

View File

@ -4,7 +4,6 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include "hint_list.hpp"
#include "fill.hpp" #include "fill.hpp"
#include "../randomizerTypes.h" #include "../randomizerTypes.h"
#include "../context.h" #include "../context.h"

View File

@ -1,5 +1,4 @@
#include "menu.hpp" #include "menu.hpp"
#include "hint_list.hpp"
#include "../static_data.h" #include "../static_data.h"
#include "../item_location.h" #include "../item_location.h"
#include "location_access.hpp" #include "location_access.hpp"
@ -12,7 +11,6 @@
void RandoMain::GenerateRando(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks, void RandoMain::GenerateRando(std::set<RandomizerCheck> excludedLocations, std::set<RandomizerTrick> enabledTricks,
std::string seedString) { std::string seedString) {
HintTable_Init();
// std::string settingsFileName = "./randomizer/latest_settings.json"; // std::string settingsFileName = "./randomizer/latest_settings.json";
// CVarSetString("gLoadedPreset", settingsFileName.c_str()); // CVarSetString("gLoadedPreset", settingsFileName.c_str());

View File

@ -9,7 +9,6 @@
#include "settings.h" #include "settings.h"
#include "rando_hash.h" #include "rando_hash.h"
#include "fishsanity.h" #include "fishsanity.h"
#include "static_data.h"
#include "3drando/hints.hpp" #include "3drando/hints.hpp"
#include <fstream> #include <fstream>
@ -52,6 +51,14 @@ RandomizerArea Context::GetAreaFromString(std::string str) {
return (RandomizerArea)StaticData::areaNameToEnum[str]; return (RandomizerArea)StaticData::areaNameToEnum[str];
} }
void Context::InitEarlyStaticData() {
StaticData::HintTable_Init();
StaticData::trialNameToEnum = StaticData::PopulateTranslationMap(StaticData::trialData);
StaticData::hintNameToEnum = StaticData::PopulateTranslationMap(StaticData::hintNames);
StaticData::hintTypeNameToEnum = StaticData::PopulateTranslationMap(StaticData::hintTypeNames);
StaticData::areaNameToEnum = StaticData::PopulateTranslationMap(StaticData::areaNames);
}
void Context::InitStaticData() { void Context::InitStaticData() {
StaticData::InitItemTable(); StaticData::InitItemTable();
StaticData::InitLocationTable(); StaticData::InitLocationTable();

View File

@ -36,6 +36,7 @@ class Context {
Context(); Context();
static std::shared_ptr<Context> CreateInstance(); static std::shared_ptr<Context> CreateInstance();
static std::shared_ptr<Context> GetInstance(); static std::shared_ptr<Context> GetInstance();
void InitEarlyStaticData();
void InitStaticData(); void InitStaticData();
Hint* GetHint(RandomizerHint hintKey); Hint* GetHint(RandomizerHint hintKey);
void AddHint(const RandomizerHint hintId, const Hint hint); void AddHint(const RandomizerHint hintId, const Hint hint);

View File

@ -96,7 +96,7 @@ const std::vector<std::string> Hint::GetAllMessageStrings() const {
const CustomMessage Hint::GetMessage(uint8_t id) const { const CustomMessage Hint::GetMessage(uint8_t id) const {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
if (hintType == HINT_TYPE_HINT_KEY){ if (hintType == HINT_TYPE_HINT_KEY){
return ::GetHintText(hintKeys[id]).GetMessage(); return StaticData::hintTextTable[hintKeys[id]].GetMessage();
} }
CustomMessage hintText = CustomMessage("ERROR:NO HINTTEXTKEY FOUND"); CustomMessage hintText = CustomMessage("ERROR:NO HINTTEXTKEY FOUND");
@ -108,21 +108,21 @@ const CustomMessage Hint::GetMessage(uint8_t id) const {
} }
if (id < hintKeys.size()){ if (id < hintKeys.size()){
hintText = ::GetHintText(hintKeys[id]).GetMessage(); hintText = StaticData::hintTextTable[hintKeys[id]].GetMessage();
} else if (ctx->GetOption(RSK_TOT_ALTAR_HINT) && hintType == HINT_TYPE_ALTAR_CHILD) { } else if (ctx->GetOption(RSK_TOT_ALTAR_HINT) && hintType == HINT_TYPE_ALTAR_CHILD) {
hintText = ::GetHintText(RHT_CHILD_ALTAR_STONES).GetMessage(); hintText = StaticData::hintTextTable[RHT_CHILD_ALTAR_STONES].GetMessage();
} else if (ctx->GetOption(RSK_TOT_ALTAR_HINT) && hintType == HINT_TYPE_ALTAR_ADULT) { } else if (ctx->GetOption(RSK_TOT_ALTAR_HINT) && hintType == HINT_TYPE_ALTAR_ADULT) {
hintText = ::GetHintText(RHT_ADULT_ALTAR_MEDALLIONS).GetMessage(); hintText = StaticData::hintTextTable[RHT_ADULT_ALTAR_MEDALLIONS].GetMessage();
} else if (hintType == HINT_TYPE_TRIAL) { } else if (hintType == HINT_TYPE_TRIAL) {
if (ctx->GetTrial(trials[0])->IsRequired()) { if (ctx->GetTrial(trials[0])->IsRequired()) {
hintText = ::GetHintText(RHT_TRIAL_ON).GetMessage(); hintText = StaticData::hintTextTable[RHT_TRIAL_ON].GetMessage();
} else { } else {
hintText = ::GetHintText(RHT_TRIAL_OFF).GetMessage(); hintText = StaticData::hintTextTable[RHT_TRIAL_OFF].GetMessage();
} }
} else if (hintType == HINT_TYPE_WOTH) { } else if (hintType == HINT_TYPE_WOTH) {
hintText = ::GetHintText(RHT_WAY_OF_THE_HERO).GetMessage(); hintText = StaticData::hintTextTable[RHT_WAY_OF_THE_HERO].GetMessage();
} else if (hintType == HINT_TYPE_FOOLISH) { } else if (hintType == HINT_TYPE_FOOLISH) {
hintText = ::GetHintText(RHT_FOOLISH).GetMessage(); hintText = StaticData::hintTextTable[RHT_FOOLISH].GetMessage();
} else if (hintType == HINT_TYPE_ITEM) { } else if (hintType == HINT_TYPE_ITEM) {
if (items.size() > 0) { if (items.size() > 0) {
hintText = StaticData::GetItemTable()[items[0]].GetName(); hintText = StaticData::GetItemTable()[items[0]].GetName();
@ -132,9 +132,9 @@ const CustomMessage Hint::GetMessage(uint8_t id) const {
} else if (hintType == HINT_TYPE_ITEM_AREA) { } else if (hintType == HINT_TYPE_ITEM_AREA) {
if (locations.size() > 0) { if (locations.size() > 0) {
if (Rando::StaticData::GetLocation(locations[0])->IsDungeon()) { if (Rando::StaticData::GetLocation(locations[0])->IsDungeon()) {
hintText = ::GetHintText(RHT_HOARDS).GetMessage(); hintText = StaticData::hintTextTable[RHT_HOARDS].GetMessage();
} else { } else {
hintText = ::GetHintText(RHT_CAN_BE_FOUND_AT).GetMessage(); hintText = StaticData::hintTextTable[RHT_CAN_BE_FOUND_AT].GetMessage();
} }
} else { } else {
hintText = CustomMessage("ERROR: ITEM AREA HINT WITH NO LOCATION"); //RANDOTODO get isDungeon from area? hintText = CustomMessage("ERROR: ITEM AREA HINT WITH NO LOCATION"); //RANDOTODO get isDungeon from area?
@ -166,7 +166,7 @@ const CustomMessage Hint::GetMessage(uint8_t id) const {
//If we write items and areas //If we write items and areas
for(uint8_t b = 0; b < items.size(); b++){ for(uint8_t b = 0; b < items.size(); b++){
toInsert.push_back(StaticData::GetItemTable()[items[b]].GetName()); toInsert.push_back(StaticData::GetItemTable()[items[b]].GetName());
toInsert.push_back(::GetHintText(Rando::StaticData::areaNames[areas[b]]).GetMessage()); toInsert.push_back(StaticData::hintTextTable[Rando::StaticData::areaNames[areas[b]]].GetMessage());
} }
break;} break;}
case HINT_TYPE_ALTAR_CHILD: case HINT_TYPE_ALTAR_CHILD:
@ -178,9 +178,9 @@ const CustomMessage Hint::GetMessage(uint8_t id) const {
for(uint8_t b = 0; b < areas.size(); b++){ for(uint8_t b = 0; b < areas.size(); b++){
CustomMessage areaText; CustomMessage areaText;
if ((areas[b] == RA_LINKS_POCKET || areas[b] == RA_NONE) && yourPocket){ if ((areas[b] == RA_LINKS_POCKET || areas[b] == RA_NONE) && yourPocket){
areaText = ::GetHintText(RHT_YOUR_POCKET).GetMessage(); areaText = StaticData::hintTextTable[RHT_YOUR_POCKET].GetMessage();
} else { } else {
areaText = ::GetHintText(Rando::StaticData::areaNames[areas[b]]).GetMessage(); areaText = StaticData::hintTextTable[Rando::StaticData::areaNames[areas[b]]].GetMessage();
} }
toInsert.push_back(areaText); toInsert.push_back(areaText);
} }
@ -196,14 +196,14 @@ const CustomMessage Hint::GetMessage(uint8_t id) const {
if (hintType == HINT_TYPE_ALTAR_CHILD){ if (hintType == HINT_TYPE_ALTAR_CHILD){
if (ctx->GetOption(RSK_DOOR_OF_TIME).Is(RO_DOOROFTIME_OPEN)) { if (ctx->GetOption(RSK_DOOR_OF_TIME).Is(RO_DOOROFTIME_OPEN)) {
hintText += CustomMessage(::GetHintText(RHT_CHILD_ALTAR_TEXT_END_DOTOPEN).GetMessage()); hintText += CustomMessage(StaticData::hintTextTable[RHT_CHILD_ALTAR_TEXT_END_DOTOPEN].GetMessage());
} else if (ctx->GetOption(RSK_DOOR_OF_TIME).Is(RO_DOOROFTIME_SONGONLY)) { } else if (ctx->GetOption(RSK_DOOR_OF_TIME).Is(RO_DOOROFTIME_SONGONLY)) {
hintText += CustomMessage(::GetHintText(RHT_CHILD_ALTAR_TEXT_END_DOTSONGONLY).GetMessage()); hintText += CustomMessage(StaticData::hintTextTable[RHT_CHILD_ALTAR_TEXT_END_DOTSONGONLY].GetMessage());
} else { } else {
hintText += CustomMessage(::GetHintText(RHT_CHILD_ALTAR_TEXT_END_DOTCLOSED).GetMessage()); hintText += CustomMessage(StaticData::hintTextTable[RHT_CHILD_ALTAR_TEXT_END_DOTCLOSED].GetMessage());
} }
} else if (hintType == HINT_TYPE_ALTAR_ADULT){ } else if (hintType == HINT_TYPE_ALTAR_ADULT){
hintText += GetBridgeReqsText() + GetGanonBossKeyText() + ::GetHintText(RHT_ADULT_ALTAR_TEXT_END).GetMessage(); hintText += GetBridgeReqsText() + GetGanonBossKeyText() + StaticData::hintTextTable[RHT_ADULT_ALTAR_TEXT_END].GetMessage();
} }
if (num != 0){ if (num != 0){
@ -307,7 +307,7 @@ oJson Hint::toJSON() {
if (areas.size() > 0){ if (areas.size() > 0){
std::vector<std::string> areaStrings = {}; std::vector<std::string> areaStrings = {};
for (uint c = 0; c < areas.size(); c++){ for (uint c = 0; c < areas.size(); c++){
areaStrings[c] =::GetHintText(Rando::StaticData::areaNames[areas[c]]).GetMessage().GetForCurrentLanguage(); areaStrings[c] = StaticData::hintTextTable[StaticData::areaNames[areas[c]]].GetMessage().GetForCurrentLanguage();
} }
log["areas"] = areaStrings; log["areas"] = areaStrings;
} }
@ -340,7 +340,7 @@ const CustomMessage Hint::GetItemName(uint8_t slot, bool mysterious) const {
CustomMessage itemName; CustomMessage itemName;
if (mysterious){ if (mysterious){
itemName = ::GetHintText(RHT_MYSTERIOUS_ITEM).GetMessage(); itemName = StaticData::hintTextTable[RHT_MYSTERIOUS_ITEM].GetMessage();
} else if (!ctx->GetOption(RSK_HINT_CLARITY).Is(RO_HINT_CLARITY_AMBIGUOUS) && targetRG == RG_ICE_TRAP) { //RANDOTODO store in item hint instead of item } else if (!ctx->GetOption(RSK_HINT_CLARITY).Is(RO_HINT_CLARITY_AMBIGUOUS) && targetRG == RG_ICE_TRAP) { //RANDOTODO store in item hint instead of item
targetRG = ctx->overrides[hintedCheck].LooksLike(); targetRG = ctx->overrides[hintedCheck].LooksLike();
itemName = { itemName = {
@ -411,33 +411,33 @@ CustomMessage Hint::GetBridgeReqsText() {
CustomMessage bridgeMessage; CustomMessage bridgeMessage;
if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_ALWAYS_OPEN)) { if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_ALWAYS_OPEN)) {
return ::GetHintText(RHT_BRIDGE_OPEN_HINT).GetMessage(); return StaticData::hintTextTable[RHT_BRIDGE_OPEN_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_VANILLA)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_VANILLA)) {
return ::GetHintText(RHT_BRIDGE_VANILLA_HINT).GetMessage(); return StaticData::hintTextTable[RHT_BRIDGE_VANILLA_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_STONES)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_STONES)) {
bridgeMessage = ::GetHintText(RHT_BRIDGE_VANILLA_HINT).GetMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_VANILLA_HINT].GetMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_STONE_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_STONE_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_MEDALLIONS)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_MEDALLIONS)) {
bridgeMessage = ::GetHintText(RHT_BRIDGE_MEDALLIONS_HINT).GetMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_MEDALLIONS_HINT].GetMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_MEDALLION_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEON_REWARDS)) {
bridgeMessage = ::GetHintText(RHT_BRIDGE_REWARDS_HINT).GetMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_REWARDS_HINT].GetMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_REWARD_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_DUNGEONS)) {
bridgeMessage = ::GetHintText(RHT_BRIDGE_DUNGEONS_HINT).GetMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_DUNGEONS_HINT].GetMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_DUNGEON_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_TOKENS)) {
bridgeMessage = ::GetHintText(RHT_BRIDGE_TOKENS_HINT).GetMessage(); bridgeMessage = StaticData::hintTextTable[RHT_BRIDGE_TOKENS_HINT].GetMessage();
bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).Value<uint8_t>()); bridgeMessage.InsertNumber(ctx->GetOption(RSK_RAINBOW_BRIDGE_TOKEN_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_GREG)) { else if (ctx->GetOption(RSK_RAINBOW_BRIDGE).Is(RO_BRIDGE_GREG)) {
return ::GetHintText(RHT_BRIDGE_GREG_HINT).GetMessage(); return StaticData::hintTextTable[RHT_BRIDGE_GREG_HINT].GetMessage();
} }
return bridgeMessage; return bridgeMessage;
} }
@ -447,51 +447,51 @@ CustomMessage Hint::GetGanonBossKeyText() {
CustomMessage ganonBossKeyMessage; CustomMessage ganonBossKeyMessage;
if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_STARTWITH)) { if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_STARTWITH)) {
return ::GetHintText(RHT_GANON_BK_START_WITH_HINT).GetMessage(); return StaticData::hintTextTable[RHT_GANON_BK_START_WITH_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_VANILLA)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_VANILLA)) {
return ::GetHintText(RHT_GANON_BK_VANILLA_HINT).GetMessage(); return StaticData::hintTextTable[RHT_GANON_BK_VANILLA_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_OWN_DUNGEON)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_OWN_DUNGEON)) {
return ::GetHintText(RHT_GANON_BK_OWN_DUNGEON_HINT).GetMessage(); return StaticData::hintTextTable[RHT_GANON_BK_OWN_DUNGEON_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_ANY_DUNGEON)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_ANY_DUNGEON)) {
return ::GetHintText(RHT_GANON_BK_ANY_DUNGEON_HINT).GetMessage(); return StaticData::hintTextTable[RHT_GANON_BK_ANY_DUNGEON_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_OVERWORLD)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_OVERWORLD)) {
return ::GetHintText(RHT_GANON_BK_OVERWORLD_HINT).GetMessage(); return StaticData::hintTextTable[RHT_GANON_BK_OVERWORLD_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_ANYWHERE)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_ANYWHERE)) {
return ::GetHintText(RHT_GANON_BK_ANYWHERE_HINT).GetMessage(); return StaticData::hintTextTable[RHT_GANON_BK_ANYWHERE_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_KAK_TOKENS)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_KAK_TOKENS)) {
return ::GetHintText(RHT_GANON_BK_SKULLTULA_HINT).GetMessage(); return StaticData::hintTextTable[RHT_GANON_BK_SKULLTULA_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_VANILLA)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_VANILLA)) {
return ::GetHintText(RHT_LACS_VANILLA_HINT).GetMessage(); return StaticData::hintTextTable[RHT_LACS_VANILLA_HINT].GetMessage();
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_STONES)) {
ganonBossKeyMessage = ::GetHintText(RHT_LACS_STONES_HINT).GetMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_STONES_HINT].GetMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_STONE_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_STONE_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_MEDALLIONS)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_MEDALLIONS)) {
ganonBossKeyMessage = ::GetHintText(RHT_LACS_MEDALLIONS_HINT).GetMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_MEDALLIONS_HINT].GetMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_MEDALLION_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_MEDALLION_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_REWARDS)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_REWARDS)) {
ganonBossKeyMessage = ::GetHintText(RHT_LACS_REWARDS_HINT).GetMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_REWARDS_HINT].GetMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_REWARD_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_REWARD_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_DUNGEONS)) {
ganonBossKeyMessage = ::GetHintText(RHT_LACS_DUNGEONS_HINT).GetMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_DUNGEONS_HINT].GetMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_DUNGEON_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_TOKENS)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_LACS_TOKENS)) {
ganonBossKeyMessage = ::GetHintText(RHT_LACS_TOKENS_HINT).GetMessage(); ganonBossKeyMessage = StaticData::hintTextTable[RHT_LACS_TOKENS_HINT].GetMessage();
ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_TOKEN_COUNT).Value<uint8_t>()); ganonBossKeyMessage.InsertNumber(ctx->GetOption(RSK_LACS_TOKEN_COUNT).Value<uint8_t>());
} }
else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_TRIFORCE_HUNT)) { else if (ctx->GetOption(RSK_GANONS_BOSS_KEY).Is(RO_GANON_BOSS_KEY_TRIFORCE_HUNT)) {
return ::GetHintText(RHT_GANON_BK_TRIFORCE_HINT).GetMessage(); return StaticData::hintTextTable[RHT_GANON_BK_TRIFORCE_HINT].GetMessage();
} }
return ganonBossKeyMessage; return ganonBossKeyMessage;
} }

View File

@ -378,7 +378,7 @@ RandomizerHintTextKey Item::GetHintKey() const {
} }
const HintText& Item::GetHint() const { const HintText& Item::GetHint() const {
return ::GetHintText(hintKey); return StaticData::hintTextTable[hintKey];
} }
bool Item::operator==(const Item& right) const { bool Item::operator==(const Item& right) const {

View File

@ -5,9 +5,9 @@
#include <memory> #include <memory>
#include "3drando/text.hpp" #include "3drando/text.hpp"
#include "3drando/hint_list.hpp"
#include "randomizerTypes.h" #include "randomizerTypes.h"
#include "soh/Enhancements/item-tables/ItemTableTypes.h" #include "soh/Enhancements/item-tables/ItemTableTypes.h"
#include "3drando/hints.hpp"
enum ItemType { enum ItemType {
ITEMTYPE_ITEM, ITEMTYPE_ITEM,

View File

@ -1,5 +1,5 @@
#include "location.h" #include "location.h"
#include "3drando/hint_list.hpp" #include "static_data.h"
#include <algorithm> #include <algorithm>
RandomizerCheck Rando::Location::GetRandomizerCheck() const { RandomizerCheck Rando::Location::GetRandomizerCheck() const {
@ -47,7 +47,7 @@ RandomizerHintTextKey Rando::Location::GetHintKey() const {
} }
HintText* Rando::Location::GetHint() { HintText* Rando::Location::GetHint() {
return &hintTable[hintKey]; return &StaticData::hintTextTable[hintKey];
} }
const std::string& Rando::Location::GetName() const { const std::string& Rando::Location::GetName() const {
@ -90,7 +90,7 @@ uint32_t Rando::Location::Getuint32_t() const {
} }
const HintText& Rando::Location::GetHint() const { const HintText& Rando::Location::GetHint() const {
return GetHintText(hintKey); return StaticData::hintTextTable[hintKey];
} }
RandomizerGet Rando::Location::GetVanillaItem() const { RandomizerGet Rando::Location::GetVanillaItem() const {

View File

@ -142,11 +142,7 @@ Randomizer::Randomizer() {
if (item.GetName().english.empty()) continue; if (item.GetName().english.empty()) continue;
SpoilerfileGetNameToEnum[item.GetName().english] = item.GetRandomizerGet(); SpoilerfileGetNameToEnum[item.GetName().english] = item.GetRandomizerGet();
SpoilerfileGetNameToEnum[item.GetName().french] = item.GetRandomizerGet(); SpoilerfileGetNameToEnum[item.GetName().french] = item.GetRandomizerGet();
EnumToSpoilerfileGetName[item.GetRandomizerGet()] = { EnumToSpoilerfileGetName[item.GetRandomizerGet()] = CustomMessage(item.GetName());
item.GetName().english,
item.GetName().english,
item.GetName().french,
};
} }
for (auto area : rcAreaNames) { for (auto area : rcAreaNames) {
SpoilerfileAreaNameToEnum[area.second] = area.first; SpoilerfileAreaNameToEnum[area.second] = area.first;
@ -2476,21 +2472,13 @@ CustomMessage Randomizer::GetMerchantMessage(RandomizerInf randomizerInf, u16 te
CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, textId); CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, textId);
RandomizerCheck rc = GetCheckFromRandomizerInf(randomizerInf); RandomizerCheck rc = GetCheckFromRandomizerInf(randomizerInf);
RandomizerGet shopItemGet = ctx->GetItemLocation(rc)->GetPlacedRandomizerGet(); RandomizerGet shopItemGet = ctx->GetItemLocation(rc)->GetPlacedRandomizerGet();
std::array<std::string, LANGUAGE_MAX> shopItemName; CustomMessage shopItemName;
if (mysterious) { if (mysterious) {
shopItemName = { shopItemName = Rando::StaticData::hintTextTable[RHT_MYSTERIOUS_ITEM].GetMessage();
"mysterious item",
"mysteriösen Gegenstand",
"objet mystérieux"
};
// TODO: This should eventually be replaced with a full fledged trick model & trick name system // TODO: This should eventually be replaced with a full fledged trick model & trick name system
} else if (shopItemGet == RG_ICE_TRAP) { } else if (shopItemGet == RG_ICE_TRAP) {
shopItemGet = ctx->overrides[rc].LooksLike(); shopItemGet = ctx->overrides[rc].LooksLike();
shopItemName = { shopItemName = CustomMessage(ctx->overrides[rc].GetTrickName());
std::string(ctx->overrides[rc].GetTrickName().english),
std::string(ctx->overrides[rc].GetTrickName().french),
std::string(ctx->overrides[rc].GetTrickName().english)
};
} else { } else {
shopItemName = EnumToSpoilerfileGetName[shopItemGet]; shopItemName = EnumToSpoilerfileGetName[shopItemGet];
} }
@ -2500,17 +2488,11 @@ CustomMessage Randomizer::GetMerchantMessage(RandomizerInf randomizerInf, u16 te
messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, TEXT_SCRUB_RANDOM_FREE); messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, TEXT_SCRUB_RANDOM_FREE);
} }
messageEntry.Replace("[[item]]", std::move(shopItemName[0]), std::move(shopItemName[1]), std::move(shopItemName[2])); messageEntry.Replace("[[item]]", shopItemName);
messageEntry.Replace("[[price]]", std::to_string(shopItemPrice)); messageEntry.Replace("[[price]]", std::to_string(shopItemPrice));
return messageEntry; return messageEntry;
} }
static const char* mapGetItemHints[3][2] = {
{ " It's ordinary.", " It's masterful!" },
{ "&Sieht aus wie immer.", " &Man kann darauf die Worte&%r\"Master Quest\"%w entziffern..." },
{ "&Elle vous semble %rordinaire%w.", "&Étrange... les mots %r\"Master&Quest\"%w sont gravés dessus." },
};
CustomMessage Randomizer::GetMapGetItemMessageWithHint(GetItemEntry itemEntry) { CustomMessage Randomizer::GetMapGetItemMessageWithHint(GetItemEntry itemEntry) {
CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::getItemMessageTableID, itemEntry.getItemId); CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::getItemMessageTableID, itemEntry.getItemId);
int sceneNum; int sceneNum;
@ -2553,9 +2535,9 @@ CustomMessage Randomizer::GetMapGetItemMessageWithHint(GetItemEntry itemEntry) {
) { ) {
messageEntry.Replace("[[typeHint]]", ""); messageEntry.Replace("[[typeHint]]", "");
} else if (ResourceMgr_IsSceneMasterQuest(sceneNum)) { } else if (ResourceMgr_IsSceneMasterQuest(sceneNum)) {
messageEntry.Replace("[[typeHint]]", mapGetItemHints[0][1], mapGetItemHints[1][1], mapGetItemHints[2][1]); messageEntry.Replace("[[typeHint]]", Rando::StaticData::hintTextTable[RHT_DUNGEON_MASTERFUL].GetMessage());
} else { } else {
messageEntry.Replace("[[typeHint]]", mapGetItemHints[0][0], mapGetItemHints[1][0], mapGetItemHints[2][0]); messageEntry.Replace("[[typeHint]]", Rando::StaticData::hintTextTable[RHT_DUNGEON_ORDINARY].GetMessage());
} }
return messageEntry; return messageEntry;
@ -2602,8 +2584,9 @@ void CreateRupeeMessages() {
CustomMessage Randomizer::GetRupeeMessage(u16 rupeeTextId) { CustomMessage Randomizer::GetRupeeMessage(u16 rupeeTextId) {
CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::rupeeMessageTableID, rupeeTextId); CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::rupeeMessageTableID, rupeeTextId);
messageEntry.Replace("[[rupee]]", RandomElement(englishRupeeNames), messageEntry.Replace("[[rupee]]", CustomMessage(RandomElement(englishRupeeNames),
RandomElement(germanRupeeNames), RandomElement(frenchRupeeNames)); RandomElement(germanRupeeNames),
RandomElement(frenchRupeeNames)));
return messageEntry; return messageEntry;
} }
@ -2665,9 +2648,9 @@ CustomMessage Randomizer::GetTriforcePieceMessage() {
CustomMessage messageEntry = CustomMessage messageEntry =
CustomMessageManager::Instance->RetrieveMessage(Randomizer::triforcePieceMessageTableID, messageIndex); CustomMessageManager::Instance->RetrieveMessage(Randomizer::triforcePieceMessageTableID, messageIndex);
messageEntry.Replace("[[current]]", std::to_string(current), std::to_string(current), std::to_string(current)); messageEntry.Replace("[[current]]", std::to_string(current));
messageEntry.Replace("[[remaining]]", std::to_string(remaining), std::to_string(remaining), std::to_string(remaining)); messageEntry.Replace("[[remaining]]", std::to_string(remaining));
messageEntry.Replace("[[required]]", std::to_string(required), std::to_string(required), std::to_string(required)); messageEntry.Replace("[[required]]", std::to_string(required));
return messageEntry; return messageEntry;
} }

View File

@ -40,7 +40,7 @@ class Randomizer {
static const std::string randoMiscHintsTableID; static const std::string randoMiscHintsTableID;
// Public for now to be accessed by SaveManager, will be made private again soon :tm: // Public for now to be accessed by SaveManager, will be made private again soon :tm:
std::unordered_map<RandomizerGet, std::array<std::string, 3>> EnumToSpoilerfileGetName; std::unordered_map<RandomizerGet, CustomMessage> EnumToSpoilerfileGetName;
static Sprite* GetSeedTexture(uint8_t index); static Sprite* GetSeedTexture(uint8_t index);
bool SpoilerFileExists(const char* spoilerFileName); bool SpoilerFileExists(const char* spoilerFileName);

View File

@ -3184,7 +3184,6 @@ typedef enum {
RHT_BUY_RED_POTION_50, RHT_BUY_RED_POTION_50,
RHT_TRIFORCE, RHT_TRIFORCE,
RHT_HINT, RHT_HINT,
RHT_HINT_MYSTERIOUS,
RHT_TYCOON_WALLET, RHT_TYCOON_WALLET,
RHT_CHILD_WALLET, RHT_CHILD_WALLET,
RHT_HOOKSHOT, RHT_HOOKSHOT,
@ -3229,6 +3228,8 @@ typedef enum {
RHT_BRONZE_SCALE, RHT_BRONZE_SCALE,
RHT_FISHING_POLE, RHT_FISHING_POLE,
RHT_EPONA, RHT_EPONA,
RHT_HINT_MYSTERIOUS,
RHT_MYSTERIOUS_ITEM,
// Entrances // Entrances
RHT_DESERT_COLOSSUS_TO_COLOSSUS_GROTTO, RHT_DESERT_COLOSSUS_TO_COLOSSUS_GROTTO,
RHT_GV_GROTTO_LEDGE_TO_GV_OCTOROK_GROTTO, RHT_GV_GROTTO_LEDGE_TO_GV_OCTOROK_GROTTO,
@ -3415,7 +3416,6 @@ typedef enum {
// Static Entrance Hints // Static Entrance Hints
RHT_WARP_SONG, RHT_WARP_SONG,
// Static Location Hints // Static Location Hints
RHT_MYSTERIOUS_ITEM,
RHT_MEDIGORON_HINT, RHT_MEDIGORON_HINT,
RHT_CARPET_SALESMAN_DIALOG_FIRST, RHT_CARPET_SALESMAN_DIALOG_FIRST,
RHT_CARPET_SALESMAN_DIALOG_MYSTERIOUS, RHT_CARPET_SALESMAN_DIALOG_MYSTERIOUS,
@ -3447,8 +3447,10 @@ typedef enum {
RHT_GANON_JOKE09, RHT_GANON_JOKE09,
RHT_GANON_JOKE10, RHT_GANON_JOKE10,
RHT_GANON_JOKE11, RHT_GANON_JOKE11,
// Your Pocket // Misc utilities
RHT_YOUR_POCKET, RHT_YOUR_POCKET,
RHT_DUNGEON_ORDINARY,
RHT_DUNGEON_MASTERFUL,
RHT_MAX RHT_MAX
} RandomizerHintTextKey; } RandomizerHintTextKey;

View File

@ -1,11 +1,10 @@
#include <unordered_map> #include <unordered_map>
#include "static_data.h" #include "static_data.h"
#include "../custom-message/CustomMessageManager.h"
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
namespace Rando { namespace Rando {
std::unordered_map<uint32_t, CustomMessage> hintTypeNames = { std::unordered_map<uint32_t, CustomMessage> StaticData::hintTypeNames = {
{HINT_TYPE_HINT_KEY, CustomMessage("Message")}, {HINT_TYPE_HINT_KEY, CustomMessage("Message")},
{HINT_TYPE_AREA, CustomMessage("Area")}, {HINT_TYPE_AREA, CustomMessage("Area")},
{HINT_TYPE_ITEM, CustomMessage("Item")}, {HINT_TYPE_ITEM, CustomMessage("Item")},
@ -140,7 +139,7 @@ std::unordered_map<RandomizerCheck, RandomizerHint> StaticData::gossipStoneCheck
{RC_ZR_OPEN_GROTTO_GOSSIP_STONE, RH_ZR_OPEN_GROTTO_GOSSIP_STONE} {RC_ZR_OPEN_GROTTO_GOSSIP_STONE, RH_ZR_OPEN_GROTTO_GOSSIP_STONE}
}; };
std::unordered_map<uint32_t, RandomizerHintTextKey> areaNames = { //RANDOTODO resolve None in area std::unordered_map<uint32_t, RandomizerHintTextKey> StaticData::areaNames = { //RANDOTODO resolve None in area
{RA_NONE, RHT_LINKS_POCKET}, //explicit none in area hints usually means it's a starting item, so say Link's pocket {RA_NONE, RHT_LINKS_POCKET}, //explicit none in area hints usually means it's a starting item, so say Link's pocket
{RA_LINKS_POCKET, RHT_LINKS_POCKET}, {RA_LINKS_POCKET, RHT_LINKS_POCKET},
{RA_KOKIRI_FOREST, RHT_KOKIRI_FOREST}, {RA_KOKIRI_FOREST, RHT_KOKIRI_FOREST},
@ -180,7 +179,7 @@ std::unordered_map<uint32_t, RandomizerHintTextKey> areaNames = { //RANDOTODO re
{RA_GANONS_CASTLE, RHT_GANONS_CASTLE} {RA_GANONS_CASTLE, RHT_GANONS_CASTLE}
}; };
std::unordered_map<uint32_t, RandomizerHintTextKey> trialNames = { std::unordered_map<uint32_t, RandomizerHintTextKey> StaticData::trialData = {
{TK_LIGHT_TRIAL, RHT_LIGHT_TRIAL}, {TK_LIGHT_TRIAL, RHT_LIGHT_TRIAL},
{TK_FOREST_TRIAL, RHT_FOREST_TRIAL}, {TK_FOREST_TRIAL, RHT_FOREST_TRIAL},
{TK_FIRE_TRIAL, RHT_FIRE_TRIAL}, {TK_FIRE_TRIAL, RHT_FIRE_TRIAL},
@ -189,7 +188,7 @@ std::unordered_map<uint32_t, RandomizerHintTextKey> trialNames = {
{TK_SPIRIT_TRIAL, RHT_SPIRIT_TRIAL} {TK_SPIRIT_TRIAL, RHT_SPIRIT_TRIAL}
}; };
std::unordered_map<RandomizerHint, StaticHintInfo> staticHintInfoMap = { std::unordered_map<RandomizerHint, StaticHintInfo> StaticData::staticHintInfoMap = {
//RH_GANONDORF_HINT is special cased due to being different based on master sword shuffle //RH_GANONDORF_HINT is special cased due to being different based on master sword shuffle
//Altar hints are special cased due to special hint marking rules //Altar hints are special cased due to special hint marking rules
//warp song hints are special cased due to entrences not being done properly yet //warp song hints are special cased due to entrences not being done properly yet
@ -216,7 +215,7 @@ std::unordered_map<RandomizerHint, StaticHintInfo> staticHintInfoMap = {
{RH_KAK_100_SKULLS_HINT, StaticHintInfo(HINT_TYPE_ITEM, {RHT_SKULLS_HINT}, RSK_KAK_100_SKULLS_HINT, true, {RC_KAK_100_GOLD_SKULLTULA_REWARD}, {}, {}, false, 100)} {RH_KAK_100_SKULLS_HINT, StaticHintInfo(HINT_TYPE_ITEM, {RHT_SKULLS_HINT}, RSK_KAK_100_SKULLS_HINT, true, {RC_KAK_100_GOLD_SKULLTULA_REWARD}, {}, {}, false, 100)}
}; };
std::unordered_map<std::string, uint32_t> PopulateTranslationMap(std::unordered_map<uint32_t, CustomMessage> input){ std::unordered_map<std::string, uint32_t> StaticData::PopulateTranslationMap(std::unordered_map<uint32_t, CustomMessage> input){
std::unordered_map<std::string, uint32_t> output = {}; std::unordered_map<std::string, uint32_t> output = {};
for (const auto& [key, message] : input) { for (const auto& [key, message] : input) {
std::vector<std::string> strings = message.GetAllStrings(); std::vector<std::string> strings = message.GetAllStrings();
@ -232,10 +231,11 @@ std::unordered_map<std::string, uint32_t> PopulateTranslationMap(std::unordered_
} }
return output; return output;
} }
std::unordered_map<std::string, uint32_t> PopulateTranslationMap(std::unordered_map<uint32_t, RandomizerHintTextKey> input){
std::unordered_map<std::string, uint32_t> StaticData::PopulateTranslationMap(std::unordered_map<uint32_t, RandomizerHintTextKey> input){
std::unordered_map<std::string, uint32_t> output = {}; std::unordered_map<std::string, uint32_t> output = {};
for (const auto& [key, text] : input) { for (const auto& [key, text] : input) {
std::vector<std::string> strings = ::GetHintText(text).GetClear().GetAllStrings(); std::vector<std::string> strings = hintTextTable[text].GetClear().GetAllStrings();
for (std::string string: strings){ for (std::string string: strings){
if (output.contains(string)){ if (output.contains(string)){
if (output[string] != key){ if (output[string] != key){
@ -249,12 +249,13 @@ std::unordered_map<std::string, uint32_t> PopulateTranslationMap(std::unordered_
return output; return output;
} }
std::unordered_map<std::string, uint32_t> StaticData::hintNameToEnum = PopulateTranslationMap(StaticData::hintNames); std::unordered_map<std::string, uint32_t> StaticData::hintNameToEnum = {};
std::unordered_map<std::string, uint32_t> StaticData::hintTypeNameToEnum = PopulateTranslationMap(StaticData::hintTypeNames); std::unordered_map<std::string, uint32_t> StaticData::hintTypeNameToEnum = {};
std::unordered_map<std::string, uint32_t> StaticData::areaNameToEnum = PopulateTranslationMap(StaticData::areaNames); std::unordered_map<std::string, uint32_t> StaticData::areaNameToEnum = {};
std::unordered_map<std::string, uint32_t> StaticData::trialNameToEnum = PopulateTranslationMap(StaticData::trialNames); std::unordered_map<std::string, uint32_t> StaticData::trialNameToEnum = {};
std::unordered_map<std::string, uint32_t> StaticData::locationNameToEnum = {}; //is filled in context based on location table, not touching that because of VB
std::unordered_map<u32, RandomizerHint> stoneFlagToHint{ std::unordered_map<u32, RandomizerHint> StaticData::stoneFlagToHint{
{0x0, RH_NONE}, {0x0, RH_NONE},
{0x1, RH_ZF_FAIRY_GOSSIP_STONE}, {0x1, RH_ZF_FAIRY_GOSSIP_STONE},
{0x2, RH_ZF_JABU_GOSSIP_STONE}, {0x2, RH_ZF_JABU_GOSSIP_STONE},
@ -297,4 +298,5 @@ std::unordered_map<u32, RandomizerHint> stoneFlagToHint{
{0x3C, RH_KF_STORMS_GROTTO_GOSSIP_STONE} {0x3C, RH_KF_STORMS_GROTTO_GOSSIP_STONE}
}; };
std::array<HintText, RHT_MAX> StaticData::hintTextTable = {};
} }

View File

@ -21,12 +21,18 @@ class StaticData {
public: public:
static void InitItemTable(); static void InitItemTable();
static void HintTable_Init();
static void HintTable_Init_Item();
static void HintTable_Init_Exclude_Overworld();
static void HintTable_Init_Exclude_Dungeon();
static Item& RetrieveItem(const RandomizerGet rgid); static Item& RetrieveItem(const RandomizerGet rgid);
static Item& ItemFromGIID(const int giid); static Item& ItemFromGIID(const int giid);
static std::array<Item, RG_MAX>& GetItemTable();// is there a reason this is a function and not just an exposed table? static std::array<Item, RG_MAX>& GetItemTable();// is there a reason this is a function and not just an exposed table?
static void InitLocationTable(); static void InitLocationTable();
static Location* GetLocation(RandomizerCheck locKey); static Location* GetLocation(RandomizerCheck locKey);
static std::array<Rando::Location, RC_MAX>& GetLocationTable(); static std::array<Rando::Location, RC_MAX>& GetLocationTable();
static std::unordered_map<std::string, uint32_t> PopulateTranslationMap(std::unordered_map<uint32_t, CustomMessage> input);
static std::unordered_map<std::string, uint32_t> PopulateTranslationMap(std::unordered_map<uint32_t, RandomizerHintTextKey> input);
static std::vector<RandomizerCheck> overworldLocations; static std::vector<RandomizerCheck> overworldLocations;
static std::vector<RandomizerCheck> dungeonRewardLocations; static std::vector<RandomizerCheck> dungeonRewardLocations;
static std::vector<std::vector<RandomizerCheck>> shopLocationLists; static std::vector<std::vector<RandomizerCheck>> shopLocationLists;
@ -47,10 +53,11 @@ class StaticData {
static std::unordered_map<RandomizerCheck, RandomizerHint> gossipStoneCheckToHint; static std::unordered_map<RandomizerCheck, RandomizerHint> gossipStoneCheckToHint;
static std::unordered_map<uint32_t, RandomizerHintTextKey> areaNames; static std::unordered_map<uint32_t, RandomizerHintTextKey> areaNames;
static std::unordered_map<std::string, uint32_t> areaNameToEnum; static std::unordered_map<std::string, uint32_t> areaNameToEnum;
static std::unordered_map<uint32_t, RandomizerHintTextKey> trialNames; static std::unordered_map<uint32_t, RandomizerHintTextKey> trialData;
static std::unordered_map<std::string, uint32_t> trialNameToEnum; static std::unordered_map<std::string, uint32_t> trialNameToEnum;
static std::unordered_map<RandomizerHint, StaticHintInfo> staticHintInfoMap; static std::unordered_map<RandomizerHint, StaticHintInfo> staticHintInfoMap;
static std::unordered_map<u32, RandomizerHint> stoneFlagToHint; static std::unordered_map<u32, RandomizerHint> stoneFlagToHint;
static std::array<HintText, RHT_MAX> hintTextTable;
StaticData(); StaticData();
~StaticData(); ~StaticData();

View File

@ -1,16 +1,21 @@
#include "trial.h" #include "trial.h"
#include "static_data.h"
namespace Rando { namespace Rando {
TrialInfo::TrialInfo(CustomMessage name_, TrialKey key_) : name(std::move(name_)), key(std::move(key_)) {} TrialInfo::TrialInfo(RandomizerHintTextKey nameKey_, TrialKey trialKey_) : nameKey(std::move(nameKey_)), trialKey(std::move(trialKey_)) {}
TrialInfo::TrialInfo() = default; TrialInfo::TrialInfo() = default;
TrialInfo::~TrialInfo() = default; TrialInfo::~TrialInfo() = default;
CustomMessage TrialInfo::GetName() const { CustomMessage TrialInfo::GetName() const {
return name; return StaticData::hintTextTable[nameKey].GetMessage();
} }
TrialKey TrialInfo::GetKey() const { RandomizerHintTextKey TrialInfo::GetNameKey() const {
return key; return nameKey;
}
TrialKey TrialInfo::GetTrialKey() const {
return trialKey;
} }
bool TrialInfo::IsSkipped() const { bool TrialInfo::IsSkipped() const {
@ -30,12 +35,10 @@ void TrialInfo::SetAsSkipped() {
} }
Trials::Trials() { Trials::Trials() {
mTrials[TK_LIGHT_TRIAL] = TrialInfo(GetHintText(RHT_LIGHT_TRIAL).GetMessage(), TK_LIGHT_TRIAL); mTrials = {};
mTrials[TK_FOREST_TRIAL] = TrialInfo(GetHintText(RHT_FOREST_TRIAL).GetMessage(), TK_FOREST_TRIAL); for (auto [trialKey, hintKey] : StaticData::trialData){
mTrials[TK_FIRE_TRIAL] = TrialInfo(GetHintText(RHT_FIRE_TRIAL).GetMessage(), TK_FIRE_TRIAL); mTrials[trialKey] = TrialInfo(hintKey, (TrialKey)trialKey);
mTrials[TK_WATER_TRIAL] = TrialInfo(GetHintText(RHT_WATER_TRIAL).GetMessage(), TK_WATER_TRIAL); }
mTrials[TK_SPIRIT_TRIAL] = TrialInfo(GetHintText(RHT_SPIRIT_TRIAL).GetMessage(), TK_SPIRIT_TRIAL);
mTrials[TK_SHADOW_TRIAL] = TrialInfo(GetHintText(RHT_SHADOW_TRIAL).GetMessage(), TK_SHADOW_TRIAL);
} }
Trials::~Trials() = default; Trials::~Trials() = default;
@ -81,10 +84,10 @@ void Trials::ParseJson(nlohmann::json spoilerFileJson) {
} }
} }
std::unordered_map<TrialKey, HintText> Trials::GetAllTrialHintHeys() const { std::unordered_map<uint32_t, RandomizerHintTextKey> Trials::GetAllTrialHintHeys() const {
std::unordered_map<TrialKey, HintText> output = {}; std::unordered_map<uint32_t, RandomizerHintTextKey> output = {};
for (auto trial: mTrials){ for (auto trial: mTrials){
output[trial.GetKey()] = trial.GetName(); output[(uint32_t)trial.GetTrialKey()] = trial.GetNameKey();
} }
return output; return output;
} }

View File

@ -3,25 +3,26 @@
#include "randomizerTypes.h" #include "randomizerTypes.h"
#include "../custom-message/CustomMessageManager.h" #include "../custom-message/CustomMessageManager.h"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include "3drando/hint_list.hpp" #include "static_data.h"
#include <unordered_map> #include <unordered_map>
namespace Rando { namespace Rando {
class TrialInfo { class TrialInfo {
public: public:
explicit TrialInfo(CustomMessage name_, TrialKey key_); explicit TrialInfo(RandomizerHintTextKey nameKey_, TrialKey key_);
TrialInfo(); TrialInfo();
~TrialInfo(); ~TrialInfo();
CustomMessage GetName() const; CustomMessage GetName() const;
TrialKey GetKey() const; RandomizerHintTextKey GetNameKey() const;
TrialKey GetTrialKey() const;
bool IsSkipped() const; bool IsSkipped() const;
bool IsRequired() const; bool IsRequired() const;
void SetAsRequired(); void SetAsRequired();
void SetAsSkipped(); void SetAsSkipped();
private: private:
CustomMessage name; RandomizerHintTextKey nameKey;
TrialKey key; TrialKey trialKey;
bool skipped = true; bool skipped = true;
}; };
@ -35,7 +36,7 @@ class Trials {
std::vector<TrialInfo*> GetTrialList(); std::vector<TrialInfo*> GetTrialList();
size_t GetTrialListSize() const; size_t GetTrialListSize() const;
void ParseJson(nlohmann::json spoilerFileJson); void ParseJson(nlohmann::json spoilerFileJson);
std::unordered_map<TrialKey, HintText> GetAllTrialHintHeys() const; std::unordered_map<uint32_t, RandomizerHintTextKey> GetAllTrialHintHeys() const;
private: private:
std::vector<TrialInfo> mTrials; std::vector<TrialInfo> mTrials;
}; };