Skip to content
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
3 changes: 2 additions & 1 deletion asm/patch_diffs/flexible_hint_locations_diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Data:
0x21E6900: [0x38, 0x60, 0x00, 0x00]
0x21E6924: [0x38, 0x60, 0x00, 0x00]
0x21E6950: [0x38, 0x60, 0x00, 0x00]
0x24734F4: [0x41, 0x82, 0x0C, 0xEC]
0x2473540: [0x48, 0x00, 0x0B, 0xEC]
0x2474194: [0x3B, 0xC0, 0x0D, 0x77]
0x2481050: [0x48, 0x47, 0x8D, 0xB8]
0x28F9E04: [0x00, 0x00, 0x0D, 0x73, 0x81, 0x9F, 0x06, 0x48, 0x2C, 0x0C, 0x0D, 0x73,
0x41, 0x80, 0x00, 0x28, 0x3D, 0x60, 0x02, 0x90, 0x81, 0x6B, 0x9E, 0x04, 0x7C,
Expand Down
9 changes: 6 additions & 3 deletions asm/patches/flexible_hint_locations.asm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ continue_check_other_messages:
; - Defeating the Mighty Darknuts in the Master Sword Chamber ("So, despite our efforts, the princess")
; - Being in Hyrule before any of the other 3 have triggered ("I am concerned about Princess Zelda")
; These don't make as much sense in the randomizer, and cause issues if KoRL hints are enabled
; Skip checking for them and just show the randomizer's text instead
.org 0x024734F4 ; In daShip_c::setInitMessage
beq 0x024741E0 ; Show message 3443 (0xD73)
; Skip checking for all of them except the Hyrule one incase KoRL sword hints in Hyrule are enabled
.org 0x02473540 ; In daShip_c::setInitMessage
b 0x0247412C ; begin checking for "Hyrule" stage

.org 0x02474194
li r30, 0xD77 ; Change Hyrule stage message id to this index for Korl Hyrule Hints
2 changes: 2 additions & 0 deletions gui/desktop/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ void MainWindow::apply_config_settings()
APPLY_CHECKBOX_SETTING(config, ui, ho_ho_hints);
APPLY_CHECKBOX_SETTING(config, ui, ho_ho_triforce_hints);
APPLY_CHECKBOX_SETTING(config, ui, korl_hints);
APPLY_CHECKBOX_SETTING(config, ui, korl_sword_hints);
APPLY_CHECKBOX_SETTING(config, ui, kreeb_bow_hints);
APPLY_CHECKBOX_SETTING(config, ui, use_always_hints);
APPLY_CHECKBOX_SETTING(config, ui, clearer_hints);
Expand Down Expand Up @@ -1103,6 +1104,7 @@ void MainWindow::on_player_in_casual_clothes_stateChanged(int arg1) {
DEFINE_STATE_CHANGE_FUNCTION(ho_ho_hints)
DEFINE_STATE_CHANGE_FUNCTION(ho_ho_triforce_hints)
DEFINE_STATE_CHANGE_FUNCTION(korl_hints)
DEFINE_STATE_CHANGE_FUNCTION(korl_sword_hints)
DEFINE_STATE_CHANGE_FUNCTION(kreeb_bow_hints)
DEFINE_STATE_CHANGE_FUNCTION(use_always_hints)
DEFINE_STATE_CHANGE_FUNCTION(clearer_hints)
Expand Down
1 change: 1 addition & 0 deletions gui/desktop/mainwindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ private slots:
void on_ho_ho_hints_stateChanged(int arg1);
void on_ho_ho_triforce_hints_stateChanged(int arg1);
void on_korl_hints_stateChanged(int arg1);
void on_korl_sword_hints_stateChanged(int arg1);
void on_kreeb_bow_hints_stateChanged(int arg1);
void on_use_always_hints_stateChanged(int arg1);
void on_path_hints_valueChanged(int path_hints);
Expand Down
223 changes: 115 additions & 108 deletions gui/desktop/mainwindow.ui

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions gui/desktop/option_descriptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@ static std::unordered_map<std::string, std::string> optionDescriptions = {
"korl_hints",
"Places hints on the King of Red Lions. Talk to the King of Red Lions to get hints.",
},
{
"korl_sword_hints",
"When this option is selected, the King of Red Lions will give an item hint for each Progressive Sword if spoken to in Hyrule.",
},
{
"kreeb_bow_hints",
"When this option is selected, Kreeb will give an item hint for each Progressive Bow after Link reactivates the Windfall lighthouse.",
Expand Down
10 changes: 10 additions & 0 deletions gui/wiiu/OptionActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ namespace OptionCB {
return fromBool(conf.settings.korl_hints);
}

std::string toggleKorlSwordHints() {
conf.settings.korl_sword_hints = !conf.settings.korl_sword_hints;
return fromBool(conf.settings.korl_sword_hints);
}

std::string toggleKreebBowHints() {
conf.settings.kreeb_bow_hints = !conf.settings.kreeb_bow_hints;
return fromBool(conf.settings.kreeb_bow_hints);
Expand Down Expand Up @@ -988,6 +993,8 @@ std::string getValue(const Option& option) {
return fromBool(conf.settings.ho_ho_triforce_hints);
case Option::KorlHints:
return fromBool(conf.settings.korl_hints);
case Option::KorlSwordHints:
return fromBool(conf.settings.korl_sword_hints);
case Option::KreebBowHints:
return fromBool(conf.settings.kreeb_bow_hints);
case Option::ClearerHints:
Expand Down Expand Up @@ -1202,6 +1209,8 @@ TriggerCallback getCallback(const Option& option) {
return &toggleHoHoTriforceHints;
case Option::KorlHints:
return &toggleKorlHints;
case Option::KorlSwordHints:
return &toggleKorlSwordHints;
case Option::KreebBowHints:
return &toggleKreebBowHints;
case Option::ClearerHints:
Expand Down Expand Up @@ -1371,6 +1380,7 @@ std::pair<std::string, std::string> getNameDesc(const Option& option) {
{HoHoHints, {"Place Hints on Old Man Ho Ho", "Places hints on Old Man Ho Ho. Old Man Ho Ho appears at 10 different islands. Simply talk to Old Man Ho Ho to get hints."}},
{HoHoTriforceHints, {"Old Man Ho Ho Hints Shards", "When this option is selected, each Old Man Ho Ho will give an item hint for a Triforce Shard. Hints are not repeated until each shard is hinted once. This setting will override placing other hints on Old Man Ho Ho."}},
{KorlHints, {"Place Hints on King of Red Lions", "Places hints on the King of Red Lions. Talk to the King of Red Lions to get hints."}},
{KorlSwordHints, {"Korl in Hyrule Hints Swords", "When this option is selected, the King of Red Lions will give an item hint for each Progressive Sword if spoken to in Hyrule."}},
{KreebBowHints, {"Kreeb Hints Bows", "When this option is selected, Kreeb will give an item hint for each Progressive Bow after Link reactivates the Windfall lighthouse."}},
{ClearerHints, {"Clearer Hints", "When this option is selected, location and item hints will use the standard check or item name, instead of using cryptic hints."}},
{UseAlwaysHints, {"Use Always Hints", "When the number of location hints is nonzero, certain locations that will always be hinted will take precedence over normal location hints."}},
Expand Down
1 change: 1 addition & 0 deletions gui/wiiu/OptionActions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ namespace OptionCB {
std::string toggleHoHoHints();
std::string toggleHoHoTriforceHints();
std::string toggleKorlHints();
std::string toggleKorlSwordHints();
std::string toggleKreebBowHints();
std::string toggleClearHints();
std::string toggleAlwaysHints();
Expand Down
1 change: 1 addition & 0 deletions gui/wiiu/Page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ HintsPage::HintsPage() {
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::HoHoHints));
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::HoHoTriforceHints));
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::KorlHints));
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::KorlSwordHints));
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::KreebBowHints));
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::ClearerHints));
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::UseAlwaysHints));
Expand Down
24 changes: 24 additions & 0 deletions logic/Hints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,24 @@ static HintError assignKreebHints(World& world, WorldPool& worlds)
return HintError::NONE;
}

static HintError assignKorlSwordHints(World& world, WorldPool& worlds)
{
// Get all sword locations
// Shuffle locations to prevent any possible meta-gaming where the swords bow might be
// since otherwise they'll appear in order of location id
auto allLocations = world.getLocations(/*onlyProgression = */ true);
shufflePool(allLocations);
for (auto& location : allLocations)
{
if (location->currentItem.getGameItemId() == GameItem::ProgressiveSword)
{
world.korlHyruleHints.push_back(location);
LOG_AND_RETURN_IF_ERR(generateItemHintMessage(location));
}
}
return HintError::NONE;
}

HintError generateHints(WorldPool& worlds)
{
LOG_AND_RETURN_IF_ERR(calculatePossiblePathLocations(worlds));
Expand Down Expand Up @@ -775,6 +793,12 @@ HintError generateHints(WorldPool& worlds)
assignKreebHints(world, worlds);
}

// Assign Korl Sword Hints if the setting is enabled
if (settings.korl_sword_hints)
{
assignKorlSwordHints(world, worlds);
}

// Distribute hints evenly among the possible hint placement options
std::vector<std::string> hintPlacementOptions = {};
std::unordered_map<std::string, std::list<Location*>> hintsForCategory = {};
Expand Down
12 changes: 11 additions & 1 deletion logic/SpoilerLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void generateSpoilerLog(WorldPool& worlds)
for (auto& world : worlds)
{
// Don't print "Hints" if there are none
if (world.hohoHints.empty() && world.korlHints.empty() && world.bigOctoFairyHintLocation == nullptr && world.kreebHints.empty())
if (world.hohoHints.empty() && world.korlHints.empty() && world.bigOctoFairyHintLocation == nullptr && world.kreebHints.empty() && world.korlHyruleHints.empty())
{
continue;
}
Expand Down Expand Up @@ -277,6 +277,16 @@ void generateSpoilerLog(WorldPool& worlds)
}
}

if (!world.korlHyruleHints.empty())
{
spoilerLog << " KoRL Hyrule Hints:" << std::endl;
for (auto location : world.korlHyruleHints)
{
spoilerLog << " " << getSpoilerFormatHint(location);
spoilerLog << std::endl;
}
}

if (world.bigOctoFairyHintLocation != nullptr)
{
spoilerLog << " Big Octo Great Fairy:" << std::endl;
Expand Down
1 change: 1 addition & 0 deletions logic/World.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class World
std::list<Location*> goalLocations = {};
std::map<std::string, std::unordered_set<Location*>> barrenRegions = {};
std::list<Location*> korlHints = {};
std::list<Location*> korlHyruleHints = {};
std::list<Location*> kreebHints = {};
std::map<Location*, std::unordered_set<Location*>, PointerLess<Location>> hohoHints = {}; // map of Ho Ho Hint Location to hinted locations
Location* bigOctoFairyHintLocation = nullptr;
Expand Down
7 changes: 7 additions & 0 deletions options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ void Settings::resetDefaultSettings() {
decouple_entrances = false;

korl_hints = false;
korl_sword_hints = false;
kreeb_bow_hints = false;
ho_ho_hints = false;
ho_ho_triforce_hints = false;
Expand Down Expand Up @@ -238,6 +239,8 @@ uint8_t Settings::getSetting(const Option& option) const {
return ho_ho_triforce_hints;
case Option::KorlHints:
return korl_hints;
case Option::KorlSwordHints:
return korl_sword_hints;
case Option::KreebBowHints:
return kreeb_bow_hints;
case Option::ClearerHints:
Expand Down Expand Up @@ -429,6 +432,8 @@ void Settings::setSetting(const Option& option, const size_t& value) {
ho_ho_triforce_hints = value; return;
case Option::KorlHints:
korl_hints = value; return;
case Option::KorlSwordHints:
korl_sword_hints = value; return;
case Option::KreebBowHints:
kreeb_bow_hints = value; return;
case Option::ClearerHints:
Expand Down Expand Up @@ -919,6 +924,7 @@ Option nameToSetting(const std::string& name) {
{"Ho Ho Hints", Option::HoHoHints},
{"Ho Ho Triforce Hints", Option::HoHoTriforceHints},
{"Korl Hints", Option::KorlHints},
{"Korl Sword Hints", Option::KorlSwordHints},
{"Kreeb Bow Hints", Option::KreebBowHints},
{"Clearer Hints", Option::ClearerHints},
{"Use Always Hints", Option::UseAlwaysHints},
Expand Down Expand Up @@ -1022,6 +1028,7 @@ std::string settingToName(const Option& setting) {
{Option::HoHoHints, "Ho Ho Hints"},
{Option::HoHoTriforceHints, "Ho Ho Triforce Hints"},
{Option::KorlHints, "Korl Hints"},
{Option::KorlSwordHints, "Korl Sword Hints"},
{Option::KreebBowHints, "Kreeb Bow Hints"},
{Option::ClearerHints, "Clearer Hints"},
{Option::UseAlwaysHints, "Use Always Hints"},
Expand Down
2 changes: 2 additions & 0 deletions options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ enum struct Option {
HoHoHints,
HoHoTriforceHints,
KorlHints,
KorlSwordHints,
KreebBowHints,
ClearerHints,
UseAlwaysHints,
Expand Down Expand Up @@ -270,6 +271,7 @@ class Settings {
bool ho_ho_hints;
bool ho_ho_triforce_hints;
bool korl_hints;
bool korl_sword_hints;
bool kreeb_bow_hints;
bool clearer_hints;
bool use_always_hints;
Expand Down
4 changes: 4 additions & 0 deletions seedgen/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ ConfigError Config::loadFromFile(const fspath& filePath, const fspath& preferenc
GET_FIELD(root, "ho_ho_hints", settings.ho_ho_hints)
GET_FIELD(root, "ho_ho_triforce_hints", settings.ho_ho_triforce_hints)
GET_FIELD(root, "korl_hints", settings.korl_hints)
GET_FIELD(root, "korl_sword_hints", settings.korl_sword_hints)
GET_FIELD(root, "kreeb_bow_hints", settings.kreeb_bow_hints)
GET_FIELD(root, "clearer_hints", settings.clearer_hints)
GET_FIELD(root, "use_always_hints", settings.use_always_hints)
Expand Down Expand Up @@ -528,6 +529,7 @@ YAML::Node Config::settingsToYaml() const {
SET_FIELD(root, "ho_ho_hints", settings.ho_ho_hints)
SET_FIELD(root, "ho_ho_triforce_hints", settings.ho_ho_triforce_hints)
SET_FIELD(root, "korl_hints", settings.korl_hints)
SET_FIELD(root, "korl_sword_hints", settings.korl_sword_hints)
SET_FIELD(root, "kreeb_bow_hints", settings.kreeb_bow_hints)
SET_FIELD(root, "clearer_hints", settings.clearer_hints)
SET_FIELD(root, "use_always_hints", settings.use_always_hints)
Expand Down Expand Up @@ -810,6 +812,7 @@ static const std::vector<Option> PERMALINK_OPTIONS {
Option::HoHoHints,
Option::HoHoTriforceHints,
Option::KorlHints,
Option::KorlSwordHints,
Option::KreebBowHints,
Option::PathHints,
Option::BarrenHints,
Expand Down Expand Up @@ -905,6 +908,7 @@ static size_t getOptionBitCount(const Option& option) {
case Option::HoHoHints:
case Option::HoHoTriforceHints:
case Option::KorlHints:
case Option::KorlSwordHints:
case Option::KreebBowHints:
case Option::UseAlwaysHints:
case Option::ClearerHints:
Expand Down
25 changes: 25 additions & 0 deletions tweaks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,31 @@ TweakError update_korl_dialog(World& world) {
}
}
}

if (!world.korlHyruleHints.empty()) {
for (const auto& language : Text::supported_languages) {
RandoSession::CacheEntry& entry = g_session.openGameFile("content/Common/Pack/permanent_2d_Us" + language + ".pack@SARC@message2_msbt.szs@YAZ0@[email protected]@MSBT");

entry.addAction([=, &world](RandoSession* session, FileType* data) -> int {
std::u16string hintLines = u"";
size_t i = 0; // counter to know when to add null terminator
for (auto location : world.korlHyruleHints) {
std::u16string hint = u"";
hint += location->hint.text[language];
hint = Text::word_wrap_string(hint, 43);
++i;
if (i == world.korlHyruleHints.size()) {
hint += u'\0'; // add null terminator on last hint before padding
}
hint = Text::pad_str_4_lines(hint);
hintLines += hint;
}
CAST_ENTRY_TO_FILETYPE(msbt, FileTypes::MSBTFile, data)
msbt.messages_by_label["03447"].text.message = hintLines;
return true;
});
}
}
return TweakError::NONE;
}

Expand Down