Skip to content

Commit 668c4c7

Browse files
authored
Merge pull request #143 from gymnast86/hoho-triforce-hints
Add Option for Old Man Ho Ho Hints Shards
2 parents b72f7fe + 9618e65 commit 668c4c7

File tree

13 files changed

+106
-45
lines changed

13 files changed

+106
-45
lines changed

gui/desktop/mainwindow.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,7 @@ void MainWindow::apply_config_settings()
609609

610610
// Hints
611611
APPLY_CHECKBOX_SETTING(config, ui, ho_ho_hints);
612+
APPLY_CHECKBOX_SETTING(config, ui, ho_ho_triforce_hints);
612613
APPLY_CHECKBOX_SETTING(config, ui, korl_hints);
613614
APPLY_CHECKBOX_SETTING(config, ui, use_always_hints);
614615
APPLY_CHECKBOX_SETTING(config, ui, clearer_hints);
@@ -1101,6 +1102,7 @@ void MainWindow::on_player_in_casual_clothes_stateChanged(int arg1) {
11011102

11021103
// Advanced Options
11031104
DEFINE_STATE_CHANGE_FUNCTION(ho_ho_hints)
1105+
DEFINE_STATE_CHANGE_FUNCTION(ho_ho_triforce_hints)
11041106
DEFINE_STATE_CHANGE_FUNCTION(korl_hints)
11051107
DEFINE_STATE_CHANGE_FUNCTION(use_always_hints)
11061108
DEFINE_STATE_CHANGE_FUNCTION(clearer_hints)

gui/desktop/mainwindow.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ private slots:
237237

238238
// Hints
239239
void on_ho_ho_hints_stateChanged(int arg1);
240+
void on_ho_ho_triforce_hints_stateChanged(int arg1);
240241
void on_korl_hints_stateChanged(int arg1);
241242
void on_use_always_hints_stateChanged(int arg1);
242243
void on_path_hints_valueChanged(int path_hints);

gui/desktop/mainwindow.ui

Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<string notr="true"/>
7070
</property>
7171
<property name="currentIndex">
72-
<number>6</number>
72+
<number>5</number>
7373
</property>
7474
<widget class="QWidget" name="getting_started_tab">
7575
<attribute name="title">
@@ -1840,62 +1840,76 @@
18401840
<string>Hints</string>
18411841
</property>
18421842
<layout class="QGridLayout" name="gridLayout_8">
1843-
<item row="2" column="0">
1844-
<layout class="QHBoxLayout" name="horizontalLayout_8">
1843+
<item row="2" column="2">
1844+
<layout class="QHBoxLayout" name="horizontalLayout_15">
18451845
<item>
1846-
<widget class="QLabel" name="label_for_path_hints">
1846+
<widget class="QLabel" name="label_for_location_hints">
18471847
<property name="text">
1848-
<string>Path Hints</string>
1848+
<string>Location Hints</string>
18491849
</property>
18501850
</widget>
18511851
</item>
18521852
<item>
1853-
<widget class="QSpinBox" name="path_hints">
1853+
<widget class="QSpinBox" name="location_hints">
18541854
<property name="maximum">
18551855
<number>7</number>
18561856
</property>
18571857
</widget>
18581858
</item>
18591859
<item>
1860-
<widget class="QWidget" name="widget_3" native="true"/>
1860+
<widget class="QWidget" name="widget_5" native="true">
1861+
<property name="maximumSize">
1862+
<size>
1863+
<width>55</width>
1864+
<height>16777215</height>
1865+
</size>
1866+
</property>
1867+
</widget>
18611868
</item>
18621869
</layout>
18631870
</item>
1864-
<item row="1" column="1">
1865-
<widget class="QCheckBox" name="korl_hints">
1871+
<item row="3" column="0">
1872+
<widget class="QCheckBox" name="use_always_hints">
18661873
<property name="text">
1867-
<string>Place Hints on King of Red Lions</string>
1874+
<string>Use Always Hints</string>
18681875
</property>
18691876
</widget>
18701877
</item>
1871-
<item row="2" column="2">
1872-
<layout class="QHBoxLayout" name="horizontalLayout_15">
1878+
<item row="2" column="0">
1879+
<layout class="QHBoxLayout" name="horizontalLayout_8">
18731880
<item>
1874-
<widget class="QLabel" name="label_for_location_hints">
1881+
<widget class="QLabel" name="label_for_path_hints">
18751882
<property name="text">
1876-
<string>Location Hints</string>
1883+
<string>Path Hints</string>
18771884
</property>
18781885
</widget>
18791886
</item>
18801887
<item>
1881-
<widget class="QSpinBox" name="location_hints">
1888+
<widget class="QSpinBox" name="path_hints">
18821889
<property name="maximum">
18831890
<number>7</number>
18841891
</property>
18851892
</widget>
18861893
</item>
18871894
<item>
1888-
<widget class="QWidget" name="widget_5" native="true">
1889-
<property name="maximumSize">
1890-
<size>
1891-
<width>55</width>
1892-
<height>16777215</height>
1893-
</size>
1894-
</property>
1895-
</widget>
1895+
<widget class="QWidget" name="widget_3" native="true"/>
18961896
</item>
18971897
</layout>
18981898
</item>
1899+
<item row="1" column="0">
1900+
<widget class="QCheckBox" name="ho_ho_hints">
1901+
<property name="text">
1902+
<string>Place Hints on Old Man Ho Ho</string>
1903+
</property>
1904+
</widget>
1905+
</item>
1906+
<item row="3" column="2">
1907+
<widget class="QCheckBox" name="hint_importance">
1908+
<property name="text">
1909+
<string>Hint Importance</string>
1910+
</property>
1911+
</widget>
1912+
</item>
18991913
<item row="2" column="1">
19001914
<layout class="QHBoxLayout" name="horizontalLayout_14">
19011915
<item>
@@ -1917,10 +1931,10 @@
19171931
</item>
19181932
</layout>
19191933
</item>
1920-
<item row="1" column="0">
1921-
<widget class="QCheckBox" name="ho_ho_hints">
1934+
<item row="3" column="1">
1935+
<widget class="QCheckBox" name="clearer_hints">
19221936
<property name="text">
1923-
<string>Place Hints on Old Man Ho Ho</string>
1937+
<string>Clearer Hints</string>
19241938
</property>
19251939
</widget>
19261940
</item>
@@ -1945,24 +1959,17 @@
19451959
</item>
19461960
</layout>
19471961
</item>
1948-
<item row="3" column="0">
1949-
<widget class="QCheckBox" name="use_always_hints">
1950-
<property name="text">
1951-
<string>Use Always Hints</string>
1952-
</property>
1953-
</widget>
1954-
</item>
1955-
<item row="3" column="1">
1956-
<widget class="QCheckBox" name="clearer_hints">
1962+
<item row="1" column="1">
1963+
<widget class="QCheckBox" name="korl_hints">
19571964
<property name="text">
1958-
<string>Clearer Hints</string>
1965+
<string>Place Hints on King of Red Lions</string>
19591966
</property>
19601967
</widget>
19611968
</item>
1962-
<item row="3" column="2">
1963-
<widget class="QCheckBox" name="hint_importance">
1969+
<item row="4" column="0">
1970+
<widget class="QCheckBox" name="ho_ho_triforce_hints">
19641971
<property name="text">
1965-
<string>Hint Importance</string>
1972+
<string>Old Man Ho Ho Hints Shards</string>
19661973
</property>
19671974
</widget>
19681975
</item>

gui/desktop/option_descriptions.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ static std::unordered_map<std::string, std::string> optionDescriptions = {
292292
"ho_ho_hints",
293293
"Places hints on Old Man Ho Ho. Old Man Ho Ho appears at 10 different islands in the game. Simply talk to Old Man Ho Ho to get hints.",
294294
},
295+
{
296+
"ho_ho_triforce_hints",
297+
"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.",
298+
},
295299
{
296300
"korl_hints",
297301
"Places hints on the King of Red Lions. Talk to the King of Red Lions to get hints.",

gui/wiiu/OptionActions.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ namespace OptionCB {
342342
return fromBool(conf.settings.ho_ho_hints);
343343
}
344344

345+
std::string toggleHoHoTriforceHints() {
346+
conf.settings.ho_ho_triforce_hints = !conf.settings.ho_ho_triforce_hints;
347+
return fromBool(conf.settings.ho_ho_hints);
348+
}
349+
345350
std::string toggleKorlHints() {
346351
conf.settings.korl_hints = !conf.settings.korl_hints;
347352
return fromBool(conf.settings.korl_hints);
@@ -969,6 +974,8 @@ std::string getValue(const Option& option) {
969974
return fromBool(conf.settings.decouple_entrances);
970975
case Option::HoHoHints:
971976
return fromBool(conf.settings.ho_ho_hints);
977+
case Option::HoHoTriforceHints:
978+
return fromBool(conf.settings.ho_ho_triforce_hints);
972979
case Option::KorlHints:
973980
return fromBool(conf.settings.korl_hints);
974981
case Option::ClearerHints:
@@ -1177,6 +1184,8 @@ TriggerCallback getCallback(const Option& option) {
11771184
return &toggleDecoupleEntrances;
11781185
case Option::HoHoHints:
11791186
return &toggleHoHoHints;
1187+
case Option::HoHoTriforceHints:
1188+
return &toggleHoHoTriforceHints;
11801189
case Option::KorlHints:
11811190
return &toggleKorlHints;
11821191
case Option::ClearerHints:
@@ -1341,6 +1350,7 @@ std::pair<std::string, std::string> getNameDesc(const Option& option) {
13411350
{Plandomizer, {"Plandomizer", "Allows you to provide a file which manually sets item locations and/or entrances."}},
13421351

13431352
{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."}},
1353+
{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."}},
13441354
{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."}},
13451355
{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."}},
13461356
{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
@@ -57,6 +57,7 @@ namespace OptionCB {
5757
std::string toggleDecoupleEntrances();
5858

5959
std::string toggleHoHoHints();
60+
std::string toggleHoHoTriforceHints();
6061
std::string toggleKorlHints();
6162
std::string toggleClearHints();
6263
std::string toggleAlwaysHints();

gui/wiiu/Page.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ HintsPage::HintsPage() {
268268

269269
// we can't use an initializer list for a vector<unique_ptr> because of copy/move issues
270270
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::HoHoHints));
271+
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::HoHoTriforceHints));
271272
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::KorlHints));
272273
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::ClearerHints));
273274
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::UseAlwaysHints));

logic/GameItem.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,11 @@ bool Item::isBigKey() const
931931
return bigKeys.contains(gameItemId);
932932
}
933933

934+
bool Item::isTriforceShard() const
935+
{
936+
return gameItemId >= GameItem::TriforceShard1 && gameItemId <= GameItem::TriforceShard8;
937+
}
938+
934939
bool Item::isValidItem() const
935940
{
936941
return isNoneOf(gameItemId, GameItem::INVALID, GameItem::NOTHING);

logic/GameItem.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ class Item
444444
bool isCompass() const;
445445
bool isSmallKey() const;
446446
bool isBigKey() const;
447+
bool isTriforceShard() const;
447448
bool isValidItem() const;
448449
bool canBeInBarrenRegion() const;
449450
bool operator==(const Item& rhs) const;

logic/Hints.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,10 @@ static HintError generatePathHintLocations(World& world, std::vector<Location*>&
345345

346346
auto possiblePathLocations = goalLocation->pathLocations;
347347

348-
// Filter out known vanilla items, and expected items
348+
// Filter out known vanilla items, and expected items, and triforce shards if Ho Ho is hinting them
349349
filterAndEraseFromPool(possiblePathLocations, [settings = world.getSettings()](auto location){
350350
auto& item = location->currentItem;
351-
return (location->hasKnownVanillaItem || location->hasExpectedItem);
351+
return (location->hasKnownVanillaItem || location->hasExpectedItem || (settings.ho_ho_triforce_hints && item.isTriforceShard()));
352352
});
353353

354354
auto hintLocation = getHintableLocation(possiblePathLocations);
@@ -517,9 +517,11 @@ static HintError generateItemHintLocations(World& world, std::vector<Location*>&
517517
if (location->progression && // if the location is a progression location...
518518
!location->currentItem.isJunkItem() && // and does not have a junk item...
519519
!location->hasKnownVanillaItem && // and does not have a known vanilla item...
520-
!location->hasExpectedItem && // and does not have an expected item
520+
!location->hasExpectedItem && // and does not have an expected item...
521521
!location->hasBeenHinted && // and has not been hinted at yet...
522+
!(settings.ho_ho_triforce_hints && location->currentItem.isTriforceShard()) && // and isn't a shard when ho ho will hint shards...
522523
(location->hintPriority != "Always" || !world.getSettings().use_always_hints)) // and the hint priority is not "Always" when we're using always hints...
524+
523525
{
524526
// Then the item is a possible item hint location
525527
possibleItemHintLocations.push_back(location.get());
@@ -602,7 +604,7 @@ static HintError generateLocationHintLocations(World& world, std::vector<Locatio
602604
{
603605
alwaysLocations.push_back(location.get());
604606
}
605-
else if (location->hintPriority == "Sometimes")
607+
else if (location->hintPriority == "Sometimes" && !(world.getSettings().ho_ho_triforce_hints && location->currentItem.isTriforceShard()))
606608
{
607609
sometimesLocations.push_back(location.get());
608610
}
@@ -642,6 +644,19 @@ static HintError generateLocationHintLocations(World& world, std::vector<Locatio
642644

643645
static HintError assignHoHoHints(World& world, WorldPool& worlds, std::list<Location*>& locations)
644646
{
647+
// If ho ho is hinting triforces, make those hints now
648+
if (world.getSettings().ho_ho_triforce_hints)
649+
{
650+
for (auto location : world.getLocations(/*onlyProgression =*/ true))
651+
{
652+
if (location->currentItem.isTriforceShard() && !location->isRaceModeLocation)
653+
{
654+
locations.push_back(location);
655+
LOG_AND_RETURN_IF_ERR(generateItemHintMessage(location));
656+
}
657+
}
658+
}
659+
645660
// Shuffle the hints
646661
std::vector<Location*> locationsVector (locations.begin(), locations.end());
647662
shufflePool(locationsVector);
@@ -739,7 +754,8 @@ HintError generateHints(WorldPool& worlds)
739754
// Distribute hints evenly among the possible hint placement options
740755
std::vector<std::string> hintPlacementOptions = {};
741756
std::unordered_map<std::string, std::list<Location*>> hintsForCategory = {};
742-
if (settings.ho_ho_hints)
757+
// Only include ho ho if he's not hinting triforces
758+
if (settings.ho_ho_hints && !settings.ho_ho_triforce_hints)
743759
{
744760
hintPlacementOptions.emplace_back("ho ho");
745761
}
@@ -749,7 +765,7 @@ HintError generateHints(WorldPool& worlds)
749765
}
750766

751767
// No placement options selected, don't use hints
752-
if (hintPlacementOptions.empty())
768+
if (hintPlacementOptions.empty() && !settings.ho_ho_triforce_hints)
753769
{
754770
return HintError::NONE;
755771
}

0 commit comments

Comments
 (0)