From 4c75fd14a77018a2dfce2679e8e8a15af6f233b1 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Mon, 22 Apr 2024 13:29:05 -0400 Subject: [PATCH 1/3] Fix hint generation bugs on develop-rando (#4001) * Fix hint generation bugs on develop-rando 1. Fixed Ganon Non-hint text from loading as Saria's Magic Hint. 2. Fixed Ganon Non-hint text from not getting saved correctly. 3. Fixed gossip stone hint generation from not generating any non-always hints on No Logic. For #3, the hint distribution and placement algorithm was bailing out too early when it wasn't able to place a hint. For No Logic, what it was doing was failing to place WOTH hints (since No Logic seeds don't calculate WOTH candidacy), returning the amount of hints it failed to place, and then it called the function to redistribute the hints, but did not call the function to attempt to place the remaining hints. Additionally, it was not accounting for the fact that we shouldn't redistribute the hints into the categories we failed to place a hint in, so it would redistribute hints right back into those categories. I changed it so that when DistributeHints gets called after PlaceHints fails to place the hint, it checks if the distribution settings copies attribute was set to 0. In this case, it breaks while looping for the type distribution settings, and moves on to the next category. Also, it now repeatedly attempts to distribute and place hints until PlaceHints returns 0 (meaning it placed all of its hints successfully). * Fixes some further seed-bleed type issues with hint generation. --- soh/soh/Enhancements/randomizer/3drando/hints.cpp | 8 +++++--- soh/soh/Enhancements/randomizer/3drando/text.hpp | 10 ++++++++-- soh/soh/Enhancements/randomizer/hint.cpp | 4 ++++ soh/soh/Enhancements/randomizer/randomizer.cpp | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index ce29c95d0..ba4fce24b 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -287,7 +287,7 @@ Text AutoFormatHintText(const Text& unformattedHintText, const std::vector dungeonInfoData; @@ -615,6 +615,7 @@ void CreateGanonAndSheikText() { } ctx->AddHint(RH_GANONDORF_HINT, AutoFormatHintText(ganonHintText), lightArrowLocation[0], HINT_TYPE_STATIC, "Static", lightArrowArea); + ctx->AddHint(RH_GANONDORF_NOHINT, AutoFormatHintText(ganonText), lightArrowLocation[0], HINT_TYPE_STATIC, "Static", lightArrowArea); if (!ctx->GetOption(RSK_TRIAL_COUNT).Is(0)) { sheikText = ::Hint(RHT_SHEIK_LIGHT_ARROW_HINT).GetText() + LightArrowAreaText + "%w."; @@ -963,7 +964,7 @@ static void DistributeHints(std::vector& selected, size_t stoneCount, s for (uint8_t distribution = 0; distribution < distTable.size(); distribution++){ currentWeight -= distTable[distribution].weight; if (currentWeight <= 0){ - if (stoneCount >= distTable[distribution].copies){ + if (stoneCount >= distTable[distribution].copies || distTable[distribution].copies == 0){ selected[distribution] += 1; stoneCount -= distTable[distribution].copies; break; @@ -1074,8 +1075,9 @@ void CreateStoneHints() { while(totalStones != 0){ totalStones = PlaceHints(selectedHints, distTable); - if (totalStones != 0){ + while (totalStones != 0){ DistributeHints(selectedHints, totalStones, distTable, hintSetting.junkWeight, false); + totalStones = PlaceHints(selectedHints, distTable); } } diff --git a/soh/soh/Enhancements/randomizer/3drando/text.hpp b/soh/soh/Enhancements/randomizer/3drando/text.hpp index 7f7d16736..49e598f63 100644 --- a/soh/soh/Enhancements/randomizer/3drando/text.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/text.hpp @@ -13,13 +13,19 @@ public: : english(std::move(english_)), french(std::move(french_)), spanish(std::move(spanish_)), - german(std::move("")) {} + german(std::move("")) { + // german defaults to english text until a translation is provided. + german = english; + } Text(std::string english_, std::string french_, std::string spanish_, std::string german_) : english(std::move(english_)), french(std::move(french_)), spanish(std::move(spanish_)), german(std::move(german_)) {} - Text(std::string english_) : english(std::move(english_)), french(std::move("")), spanish(std::move("")), german(std::move("")) {} + Text(std::string english_) : english(std::move(english_)), french(std::move("")), spanish(std::move("")), german(std::move("")) { + // default unprovided languages to english text + french = spanish = german = english; + } const std::string& GetEnglish() const { return english; diff --git a/soh/soh/Enhancements/randomizer/hint.cpp b/soh/soh/Enhancements/randomizer/hint.cpp index 3827c40f8..ff9dfdf81 100644 --- a/soh/soh/Enhancements/randomizer/hint.cpp +++ b/soh/soh/Enhancements/randomizer/hint.cpp @@ -47,6 +47,10 @@ const std::string& Hint::GetDistribution() { void Hint::ResetVariables() { hintedLocation = RC_UNKNOWN_CHECK; + text = Text{}; + distribution = ""; + hintedArea = RA_NONE; + hintType = HINT_TYPE_STATIC; addedToPool = false; } } \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 5d32e7a35..3e861962b 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -271,7 +271,7 @@ void Randomizer::LoadHintMessages() { CustomMessage(ctx->GetHint(RH_GANONDORF_HINT)->GetText())); CustomMessageManager::Instance->CreateMessage( Randomizer::hintMessageTableID, TEXT_GANONDORF_NOHINT, - CustomMessage(ctx->GetHint(RH_SARIA)->GetText()));//RANDOTODO: Change to RH_BLANK or remove {{message}} replacment + CustomMessage(ctx->GetHint(RH_GANONDORF_NOHINT)->GetText())); CustomMessageManager::Instance->CreateMessage( Randomizer::hintMessageTableID, TEXT_SHEIK_NEED_HOOK, CustomMessage("{{message}}", "{{message}}", "{{message}}")); From b65a15028b926e8aac73988f7241c01edcfecda2 Mon Sep 17 00:00:00 2001 From: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Date: Mon, 22 Apr 2024 19:44:12 +0200 Subject: [PATCH 2/3] Update z_horse.c (#4014) --- soh/src/code/z_horse.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soh/src/code/z_horse.c b/soh/src/code/z_horse.c index 6f7aa2d3a..48c76396f 100644 --- a/soh/src/code/z_horse.c +++ b/soh/src/code/z_horse.c @@ -75,6 +75,9 @@ void func_8006D0EC(PlayState* play, Player* player) { } else if ((play->sceneNum == gSaveContext.horseData.scene) && (((Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) != 0) && (!IS_RANDO || (IS_RANDO && CHECK_QUEST_ITEM(QUEST_SONG_EPONA) && + Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_UP) && + Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_LEFT) && + Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT) && (INV_CONTENT(ITEM_OCARINA_FAIRY) != ITEM_NONE)))) || DREG(1) != 0)) { // "Set by existence of horse %d %d %d" osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horseData.scene, Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED), From 6b831f9256333933388b167785b7f98bb214afbf Mon Sep 17 00:00:00 2001 From: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Date: Mon, 22 Apr 2024 19:44:59 +0200 Subject: [PATCH 3/3] Fix swim softlock (#3965) * Update mods.cpp * Update mods.cpp --- soh/soh/Enhancements/mods.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 0c157110b..5d86b11f4 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -1464,40 +1464,44 @@ typedef struct { //special respawns used when voided out without swim to prevent infinite loops std::map swimSpecialRespawnInfo = { { - 0x1D9,//hf to zr in water + ENTR_ZORAS_RIVER_3,//hf to zr in water { { -1455.443, -20, 1384.826 }, 28761 } }, { - 0x311,//zr to hf in water + ENTR_HYRULE_FIELD_14,//zr to hf in water { { 5830.209, -92.16, 3925.911 }, -20025 } }, { - 0x4DA,//zr to lw + ENTR_LOST_WOODS_7,//zr to lw { { 1978.718, -36.908, -855 }, -16384 } }, { - 0x1DD,//lw to zr + ENTR_ZORAS_RIVER_4,//lw to zr { { 4082.366, 860.442, -1018.949 }, -32768 } }, { - 0x219,//gv to lh + ENTR_LAKE_HYLIA_1,//gv to lh { { -3276.416, -1033, 2908.421 }, 11228 } }, { - 0x10,//lh to water temple + ENTR_WATER_TEMPLE_0,//lh to water temple { { -182, 780, 759.5 }, -32768 } }, { - 0x21D,//water temple to lh + ENTR_LAKE_HYLIA_2,//water temple to lh { { -955.028, -1306.9, 6768.954 }, -32768 } }, { - 0x328,//lh to zd + ENTR_ZORAS_DOMAIN_4,//lh to zd { { -109.86, 11.396, -9.933 }, -29131 } }, { - 0x560,//zd to lh + ENTR_LAKE_HYLIA_7,//zd to lh { { -912, -1326.967, 3391 }, 0 } + }, + { + ENTR_GERUDO_VALLEY_1,//caught by gerudos as child + { { -424, -2051, -74 }, 16384 } } };