Skip to content

Commit 75768db

Browse files
authored
Merge pull request #148 from gymnast86/korl-sword-hints
Implement KoRL in Hyrule Hints Swords
2 parents 648c9f1 + 7d36451 commit 75768db

16 files changed

Lines changed: 216 additions & 113 deletions

asm/patch_diffs/flexible_hint_locations_diff.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Data:
66
0x21E6900: [0x38, 0x60, 0x00, 0x00]
77
0x21E6924: [0x38, 0x60, 0x00, 0x00]
88
0x21E6950: [0x38, 0x60, 0x00, 0x00]
9-
0x24734F4: [0x41, 0x82, 0x0C, 0xEC]
9+
0x2473540: [0x48, 0x00, 0x0B, 0xEC]
10+
0x2474194: [0x3B, 0xC0, 0x0D, 0x77]
1011
0x2481050: [0x48, 0x47, 0x8D, 0xB8]
1112
0x28F9E04: [0x00, 0x00, 0x0D, 0x73, 0x81, 0x9F, 0x06, 0x48, 0x2C, 0x0C, 0x0D, 0x73,
1213
0x41, 0x80, 0x00, 0x28, 0x3D, 0x60, 0x02, 0x90, 0x81, 0x6B, 0x9E, 0x04, 0x7C,

asm/patches/flexible_hint_locations.asm

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ continue_check_other_messages:
6565
; - Defeating the Mighty Darknuts in the Master Sword Chamber ("So, despite our efforts, the princess")
6666
; - Being in Hyrule before any of the other 3 have triggered ("I am concerned about Princess Zelda")
6767
; These don't make as much sense in the randomizer, and cause issues if KoRL hints are enabled
68-
; Skip checking for them and just show the randomizer's text instead
69-
.org 0x024734F4 ; In daShip_c::setInitMessage
70-
beq 0x024741E0 ; Show message 3443 (0xD73)
68+
; Skip checking for all of them except the Hyrule one incase KoRL sword hints in Hyrule are enabled
69+
.org 0x02473540 ; In daShip_c::setInitMessage
70+
b 0x0247412C ; begin checking for "Hyrule" stage
71+
72+
.org 0x02474194
73+
li r30, 0xD77 ; Change Hyrule stage message id to this index for Korl Hyrule Hints

gui/desktop/mainwindow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ void MainWindow::apply_config_settings()
608608
APPLY_CHECKBOX_SETTING(config, ui, ho_ho_hints);
609609
APPLY_CHECKBOX_SETTING(config, ui, ho_ho_triforce_hints);
610610
APPLY_CHECKBOX_SETTING(config, ui, korl_hints);
611+
APPLY_CHECKBOX_SETTING(config, ui, korl_sword_hints);
611612
APPLY_CHECKBOX_SETTING(config, ui, kreeb_bow_hints);
612613
APPLY_CHECKBOX_SETTING(config, ui, use_always_hints);
613614
APPLY_CHECKBOX_SETTING(config, ui, clearer_hints);
@@ -1103,6 +1104,7 @@ void MainWindow::on_player_in_casual_clothes_stateChanged(int arg1) {
11031104
DEFINE_STATE_CHANGE_FUNCTION(ho_ho_hints)
11041105
DEFINE_STATE_CHANGE_FUNCTION(ho_ho_triforce_hints)
11051106
DEFINE_STATE_CHANGE_FUNCTION(korl_hints)
1107+
DEFINE_STATE_CHANGE_FUNCTION(korl_sword_hints)
11061108
DEFINE_STATE_CHANGE_FUNCTION(kreeb_bow_hints)
11071109
DEFINE_STATE_CHANGE_FUNCTION(use_always_hints)
11081110
DEFINE_STATE_CHANGE_FUNCTION(clearer_hints)

gui/desktop/mainwindow.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ private slots:
240240
void on_ho_ho_hints_stateChanged(int arg1);
241241
void on_ho_ho_triforce_hints_stateChanged(int arg1);
242242
void on_korl_hints_stateChanged(int arg1);
243+
void on_korl_sword_hints_stateChanged(int arg1);
243244
void on_kreeb_bow_hints_stateChanged(int arg1);
244245
void on_use_always_hints_stateChanged(int arg1);
245246
void on_path_hints_valueChanged(int path_hints);

gui/desktop/mainwindow.ui

Lines changed: 115 additions & 108 deletions
Large diffs are not rendered by default.

gui/desktop/option_descriptions.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,10 @@ static std::unordered_map<std::string, std::string> optionDescriptions = {
304304
"korl_hints",
305305
"Places hints on the King of Red Lions. Talk to the King of Red Lions to get hints.",
306306
},
307+
{
308+
"korl_sword_hints",
309+
"When this option is selected, the King of Red Lions will give an item hint for each Progressive Sword if spoken to in Hyrule.",
310+
},
307311
{
308312
"kreeb_bow_hints",
309313
"When this option is selected, Kreeb will give an item hint for each Progressive Bow after Link reactivates the Windfall lighthouse.",

gui/wiiu/OptionActions.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,11 @@ namespace OptionCB {
352352
return fromBool(conf.settings.korl_hints);
353353
}
354354

355+
std::string toggleKorlSwordHints() {
356+
conf.settings.korl_sword_hints = !conf.settings.korl_sword_hints;
357+
return fromBool(conf.settings.korl_sword_hints);
358+
}
359+
355360
std::string toggleKreebBowHints() {
356361
conf.settings.kreeb_bow_hints = !conf.settings.kreeb_bow_hints;
357362
return fromBool(conf.settings.kreeb_bow_hints);
@@ -988,6 +993,8 @@ std::string getValue(const Option& option) {
988993
return fromBool(conf.settings.ho_ho_triforce_hints);
989994
case Option::KorlHints:
990995
return fromBool(conf.settings.korl_hints);
996+
case Option::KorlSwordHints:
997+
return fromBool(conf.settings.korl_sword_hints);
991998
case Option::KreebBowHints:
992999
return fromBool(conf.settings.kreeb_bow_hints);
9931000
case Option::ClearerHints:
@@ -1202,6 +1209,8 @@ TriggerCallback getCallback(const Option& option) {
12021209
return &toggleHoHoTriforceHints;
12031210
case Option::KorlHints:
12041211
return &toggleKorlHints;
1212+
case Option::KorlSwordHints:
1213+
return &toggleKorlSwordHints;
12051214
case Option::KreebBowHints:
12061215
return &toggleKreebBowHints;
12071216
case Option::ClearerHints:
@@ -1371,6 +1380,7 @@ std::pair<std::string, std::string> getNameDesc(const Option& option) {
13711380
{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."}},
13721381
{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."}},
13731382
{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."}},
1383+
{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."}},
13741384
{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."}},
13751385
{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."}},
13761386
{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."}},

gui/wiiu/OptionActions.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ namespace OptionCB {
5959
std::string toggleHoHoHints();
6060
std::string toggleHoHoTriforceHints();
6161
std::string toggleKorlHints();
62+
std::string toggleKorlSwordHints();
6263
std::string toggleKreebBowHints();
6364
std::string toggleClearHints();
6465
std::string toggleAlwaysHints();

gui/wiiu/Page.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ HintsPage::HintsPage() {
270270
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::HoHoHints));
271271
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::HoHoTriforceHints));
272272
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::KorlHints));
273+
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::KorlSwordHints));
273274
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::KreebBowHints));
274275
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::ClearerHints));
275276
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::UseAlwaysHints));

logic/Hints.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,24 @@ static HintError assignKreebHints(World& world, WorldPool& worlds)
742742
return HintError::NONE;
743743
}
744744

745+
static HintError assignKorlSwordHints(World& world, WorldPool& worlds)
746+
{
747+
// Get all sword locations
748+
// Shuffle locations to prevent any possible meta-gaming where the swords bow might be
749+
// since otherwise they'll appear in order of location id
750+
auto allLocations = world.getLocations(/*onlyProgression = */ true);
751+
shufflePool(allLocations);
752+
for (auto& location : allLocations)
753+
{
754+
if (location->currentItem.getGameItemId() == GameItem::ProgressiveSword)
755+
{
756+
world.korlHyruleHints.push_back(location);
757+
LOG_AND_RETURN_IF_ERR(generateItemHintMessage(location));
758+
}
759+
}
760+
return HintError::NONE;
761+
}
762+
745763
HintError generateHints(WorldPool& worlds)
746764
{
747765
LOG_AND_RETURN_IF_ERR(calculatePossiblePathLocations(worlds));
@@ -775,6 +793,12 @@ HintError generateHints(WorldPool& worlds)
775793
assignKreebHints(world, worlds);
776794
}
777795

796+
// Assign Korl Sword Hints if the setting is enabled
797+
if (settings.korl_sword_hints)
798+
{
799+
assignKorlSwordHints(world, worlds);
800+
}
801+
778802
// Distribute hints evenly among the possible hint placement options
779803
std::vector<std::string> hintPlacementOptions = {};
780804
std::unordered_map<std::string, std::list<Location*>> hintsForCategory = {};

0 commit comments

Comments
 (0)