Skip to content

Commit 648c9f1

Browse files
authored
Merge pull request #147 from gymnast86/kreeb-hints
Add setting for Kreeb Hints Bows
2 parents 9b096c6 + b9dfdc4 commit 648c9f1

File tree

15 files changed

+163
-56
lines changed

15 files changed

+163
-56
lines changed

gui/desktop/mainwindow.cpp

Lines changed: 3 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, kreeb_bow_hints);
611612
APPLY_CHECKBOX_SETTING(config, ui, use_always_hints);
612613
APPLY_CHECKBOX_SETTING(config, ui, clearer_hints);
613614
APPLY_CHECKBOX_SETTING(config, ui, hint_importance);
@@ -1102,6 +1103,7 @@ void MainWindow::on_player_in_casual_clothes_stateChanged(int arg1) {
11021103
DEFINE_STATE_CHANGE_FUNCTION(ho_ho_hints)
11031104
DEFINE_STATE_CHANGE_FUNCTION(ho_ho_triforce_hints)
11041105
DEFINE_STATE_CHANGE_FUNCTION(korl_hints)
1106+
DEFINE_STATE_CHANGE_FUNCTION(kreeb_bow_hints)
11051107
DEFINE_STATE_CHANGE_FUNCTION(use_always_hints)
11061108
DEFINE_STATE_CHANGE_FUNCTION(clearer_hints)
11071109
DEFINE_STATE_CHANGE_FUNCTION(hint_importance)
@@ -1372,3 +1374,4 @@ void MainWindow::on_paste_permalink_clicked()
13721374
auto permalink = QGuiApplication::clipboard()->text();
13731375
on_permalink_textEdited(permalink);
13741376
}
1377+

gui/desktop/mainwindow.hpp

Lines changed: 1 addition & 3 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_kreeb_bow_hints_stateChanged(int arg1);
243244
void on_use_always_hints_stateChanged(int arg1);
244245
void on_path_hints_valueChanged(int path_hints);
245246
void on_barren_hints_valueChanged(int barren_hints);
@@ -304,9 +305,6 @@ private slots:
304305
void open_chart_mapping_list(uint8_t islandNum);
305306
void tracker_give_and_map_chart(TrackerLabel* label, GameItem chart);
306307

307-
308-
309-
310308
public:
311309
void update_items_color();
312310
void update_locations_color();

gui/desktop/mainwindow.ui

Lines changed: 59 additions & 52 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+
"kreeb_bow_hints",
309+
"When this option is selected, Kreeb will give an item hint for each Progressive Bow after Link reactivates the Windfall lighthouse.",
310+
},
307311
{
308312
"path_hints",
309313
"Determines the number of path hints that will be placed in the game, distributed using the selected hint placement options.<br>If multiple hint placement options are selected, the hint count will be split evenly among the placement options.",

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 toggleKreebBowHints() {
356+
conf.settings.kreeb_bow_hints = !conf.settings.kreeb_bow_hints;
357+
return fromBool(conf.settings.kreeb_bow_hints);
358+
}
359+
355360
std::string toggleClearHints() {
356361
conf.settings.clearer_hints = !conf.settings.clearer_hints;
357362
return fromBool(conf.settings.clearer_hints);
@@ -983,6 +988,8 @@ std::string getValue(const Option& option) {
983988
return fromBool(conf.settings.ho_ho_triforce_hints);
984989
case Option::KorlHints:
985990
return fromBool(conf.settings.korl_hints);
991+
case Option::KreebBowHints:
992+
return fromBool(conf.settings.kreeb_bow_hints);
986993
case Option::ClearerHints:
987994
return fromBool(conf.settings.clearer_hints);
988995
case Option::UseAlwaysHints:
@@ -1195,6 +1202,8 @@ TriggerCallback getCallback(const Option& option) {
11951202
return &toggleHoHoTriforceHints;
11961203
case Option::KorlHints:
11971204
return &toggleKorlHints;
1205+
case Option::KreebBowHints:
1206+
return &toggleKreebBowHints;
11981207
case Option::ClearerHints:
11991208
return &toggleClearHints;
12001209
case Option::UseAlwaysHints:
@@ -1362,6 +1371,7 @@ std::pair<std::string, std::string> getNameDesc(const Option& option) {
13621371
{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."}},
13631372
{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."}},
13641373
{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."}},
1374+
{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."}},
13651375
{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."}},
13661376
{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."}},
13671377
{HintImportance, {"Hint Importance", "When this option is selected, item and location hints will also indicate if the hinted item is required, possibly required, or not required. Only progress items will have these additions; non-progress items are trivially not required."}},

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 toggleKreebBowHints();
6263
std::string toggleClearHints();
6364
std::string toggleAlwaysHints();
6465
std::string toggleHintImportance();

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::KreebBowHints));
273274
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::ClearerHints));
274275
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::UseAlwaysHints));
275276
buttonColumns[0].emplace_back(std::make_unique<BasicButton>(Option::HintImportance));

logic/Hints.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,24 @@ static HintError assignHoHoHints(World& world, WorldPool& worlds, std::list<Loca
724724
return HintError::NONE;
725725
}
726726

727+
static HintError assignKreebHints(World& world, WorldPool& worlds)
728+
{
729+
// Get all bow locations
730+
// Shuffle locations to prevent any possible meta-gaming where the last bow might be
731+
// since otherwise they'll appear in order of location id
732+
auto allLocations = world.getLocations(/*onlyProgression = */ true);
733+
shufflePool(allLocations);
734+
for (auto& location : allLocations)
735+
{
736+
if (location->currentItem.getGameItemId() == GameItem::ProgressiveBow)
737+
{
738+
world.kreebHints.push_back(location);
739+
LOG_AND_RETURN_IF_ERR(generateItemHintMessage(location));
740+
}
741+
}
742+
return HintError::NONE;
743+
}
744+
727745
HintError generateHints(WorldPool& worlds)
728746
{
729747
LOG_AND_RETURN_IF_ERR(calculatePossiblePathLocations(worlds));
@@ -751,6 +769,12 @@ HintError generateHints(WorldPool& worlds)
751769
uint8_t totalMadeHints = hintLocations.size();
752770
LOG_AND_RETURN_IF_ERR(generateLocationHintLocations(world, hintLocations, totalNumHints - totalMadeHints));
753771

772+
// Assign Kreeb Bow Hints if the setting is enabled
773+
if (settings.kreeb_bow_hints)
774+
{
775+
assignKreebHints(world, worlds);
776+
}
777+
754778
// Distribute hints evenly among the possible hint placement options
755779
std::vector<std::string> hintPlacementOptions = {};
756780
std::unordered_map<std::string, std::list<Location*>> hintsForCategory = {};

logic/LogicTests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ void runLogicTests(Config& newConfig)
184184
TEST(settings1, settings1.ho_ho_hints, "5 item hints");
185185
settings1.location_hints = 5;
186186
TEST(settings1, settings1.ho_ho_hints, "5 location hints");
187+
TEST(settings1, settings1.kreeb_bow_hints, "kreeb bow hints");
187188
TEST(settings1, settings1.use_always_hints, "use always hints");
188189
TEST(settings1, settings1.clearer_hints, "clearer hints");
189190
TEST(settings1, settings1.hint_importance, "hint importance");
@@ -223,6 +224,7 @@ void runLogicTests(Config& newConfig)
223224
TEST(settings2, settings2.hint_importance, "hint importance");
224225
TEST(settings2, settings2.clearer_hints, "clearer hints");
225226
TEST(settings2, settings2.use_always_hints, "use always hints");
227+
TEST(settings2, settings2.kreeb_bow_hints, "kreeb bow hints");
226228
settings2.path_hints = 5;
227229
TEST(settings2, settings2.korl_hints, "5 path hints");
228230
settings2.barren_hints = 5;

logic/SpoilerLog.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ void generateSpoilerLog(WorldPool& worlds)
238238
for (auto& world : worlds)
239239
{
240240
// Don't print "Hints" if there are none
241-
if (world.hohoHints.empty() && world.korlHints.empty() && world.bigOctoFairyHintLocation == nullptr)
241+
if (world.hohoHints.empty() && world.korlHints.empty() && world.bigOctoFairyHintLocation == nullptr && world.kreebHints.empty())
242242
{
243243
continue;
244244
}
@@ -291,6 +291,16 @@ void generateSpoilerLog(WorldPool& worlds)
291291
}
292292
spoilerLog << " " << Utility::Str::toUTF8(hintText) << std::endl;
293293
}
294+
295+
if (!world.kreebHints.empty())
296+
{
297+
spoilerLog << " Kreeb Hints:" << std::endl;
298+
for (auto location : world.kreebHints)
299+
{
300+
spoilerLog << " " << getSpoilerFormatHint(location);
301+
spoilerLog << std::endl;
302+
}
303+
}
294304
}
295305
spoilerLog << std::endl;
296306

0 commit comments

Comments
 (0)