From 29af294b0c1e67febd530d7f1342b78feec98556 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Thu, 17 Apr 2025 15:22:12 +0100 Subject: [PATCH 01/44] fix TODO_TRANSLATE language replacement in cases where the text is already formatted (#5415) * fix TODO_TRANSLATE language replacement in cases where the text is already formatted * oops --- soh/include/z64.h | 2 +- .../Enhancements/custom-message/CustomMessageManager.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/soh/include/z64.h b/soh/include/z64.h index 83e1498db..53b76e8fb 100644 --- a/soh/include/z64.h +++ b/soh/include/z64.h @@ -544,7 +544,7 @@ typedef enum { LANGUAGE_MAX } Language; -#define TODO_TRANSLATE "__Translate_This__" +#define TODO_TRANSLATE "TranslateThis" // TODO get these properties from the textures themselves #define FONT_CHAR_TEX_WIDTH 16 diff --git a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp index 278b8db0c..a9c19f11f 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp +++ b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp @@ -155,12 +155,12 @@ const std::string CustomMessage::GetFrench(MessageFormat format) const { } const std::string CustomMessage::GetForCurrentLanguage(MessageFormat format) const { - return GetForLanguage(((Language)gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language, - format); + return GetForLanguage( + ((Language)gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : (Language)gSaveContext.language, format); } const std::string CustomMessage::GetForLanguage(uint8_t language, MessageFormat format) const { - std::string output = messages[language] != TODO_TRANSLATE ? messages[language] : messages[LANGUAGE_ENG]; + std::string output = !messages[language].starts_with(TODO_TRANSLATE) ? messages[language] : messages[LANGUAGE_ENG]; ProcessMessageFormat(output, format); return output; } From 3c4f38e2f02f6d16de6faf8ddb162033851aceb1 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Wed, 23 Apr 2025 01:16:16 +0100 Subject: [PATCH 02/44] make sure adult is spawned for big poe check (#5431) --- soh/soh/Enhancements/randomizer/3drando/fill.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index dcae4842c..8885117c3 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -625,6 +625,8 @@ void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAcce if (ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF)) { Rando::StaticData::RetrieveItem(RG_GUARD_HOUSE_KEY).ApplyEffect(); } + RegionTable(RR_ROOT)->adultNight = true; + RegionTable(RR_ROOT)->adultDay = true; } else { ApplyAllAdvancmentItems(); } From 103a36e5fefd817f8254e43ee15e3083505bcff3 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Wed, 23 Apr 2025 04:38:14 +0100 Subject: [PATCH 03/44] fix MQGTG right side resetting (#5442) --- soh/soh/Enhancements/randomizer/logic.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/soh/Enhancements/randomizer/logic.cpp b/soh/soh/Enhancements/randomizer/logic.cpp index 0c4ed2e89..252806473 100644 --- a/soh/soh/Enhancements/randomizer/logic.cpp +++ b/soh/soh/Enhancements/randomizer/logic.cpp @@ -2498,6 +2498,7 @@ void Logic::Reset() { ForestOpenBossCorridor = false; ShadowTrialFirstChest = false; MQGTGMazeSwitch = false; + MQGTGRightSideSwitch = false; GTGPlatformSilverRupees = false; MQJabuHolesRoomDoor = false; JabuWestTentacle = false; From 8a8ea676babef7587e6ce12188ea4cf114850cde Mon Sep 17 00:00:00 2001 From: Malkierian Date: Tue, 22 Apr 2025 20:38:45 -0700 Subject: [PATCH 04/44] Prevents hidden button combo setting from hiding the personal notes window when window type is Window. (#5441) --- .../randomizer/randomizer_item_tracker.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 9b7b1fd39..5996fea1f 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -1532,8 +1532,9 @@ void ItemTrackerWindow::DrawElement() { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW && - CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == - TRACKER_DISPLAY_ALWAYS) { + (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING && + CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == + TRACKER_DISPLAY_ALWAYS)) { DrawNotes(); } EndFloatingWindows(); @@ -1642,7 +1643,10 @@ void ItemTrackerWindow::DrawElement() { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE && - CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { + (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW || + (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING && + CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) != + TRACKER_DISPLAY_COMBO_BUTTON))) { ImGui::SetNextWindowSize(ImVec2(400, 300), ImGuiCond_FirstUseEver); BeginFloatingWindows("Personal Notes", ImGuiWindowFlags_NoFocusOnAppearing); DrawNotes(true); @@ -1943,7 +1947,10 @@ void ItemTrackerSettingsWindow::DrawElement() { shouldUpdateVectors = true; } - if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW || + (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING && + CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) != + TRACKER_DISPLAY_COMBO_BUTTON)) { if (CVarCombobox("Personal notes", CVAR_TRACKER_ITEM("DisplayType.Notes"), displayTypes, ComboboxOptions() .DefaultIndex(SECTION_DISPLAY_HIDDEN) From 3d3d9c5226c373ae19c37f6f4106e21b4879ef75 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Tue, 22 Apr 2025 23:39:10 -0400 Subject: [PATCH 05/44] add some imgui ids in input editor (#5439) * add some imgui ids in input editor * clang format --- .../controls/SohInputEditorWindow.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index 3f77d1ed4..8a8227073 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -642,10 +642,14 @@ void SohInputEditorWindow::DrawStickSection(uint8_t port, uint8_t stick, int32_t ImGui::SameLine(); ImGui::BeginGroup(); - DrawStickDirectionLine(ICON_FA_ARROW_UP, port, stick, Ship::UP, color); - DrawStickDirectionLine(ICON_FA_ARROW_DOWN, port, stick, Ship::DOWN, color); - DrawStickDirectionLine(ICON_FA_ARROW_LEFT, port, stick, Ship::LEFT, color); - DrawStickDirectionLine(ICON_FA_ARROW_RIGHT, port, stick, Ship::RIGHT, color); + DrawStickDirectionLine(StringHelper::Sprintf("%s##%d", ICON_FA_ARROW_UP, stick).c_str(), port, stick, Ship::UP, + color); + DrawStickDirectionLine(StringHelper::Sprintf("%s##%d", ICON_FA_ARROW_DOWN, stick).c_str(), port, stick, Ship::DOWN, + color); + DrawStickDirectionLine(StringHelper::Sprintf("%s##%d", ICON_FA_ARROW_LEFT, stick).c_str(), port, stick, Ship::LEFT, + color); + DrawStickDirectionLine(StringHelper::Sprintf("%s##%d", ICON_FA_ARROW_RIGHT, stick).c_str(), port, stick, + Ship::RIGHT, color); ImGui::EndGroup(); ImGui::SetNextItemOpen(true, ImGuiCond_Once); if (ImGui::TreeNode(StringHelper::Sprintf("Analog Stick Options##%d", id).c_str())) { @@ -1335,12 +1339,12 @@ void SohInputEditorWindow::DrawOcarinaControlPanel() { ImGui::AlignTextToFramePadding(); ImGui::BulletText("Disable song detection"); - DrawButtonLine(ICON_FA_BAN, 0, BTN_CUSTOM_OCARINA_DISABLE_SONGS); + DrawButtonLine(ICON_FA_BAN "##DisableSongDetection", 0, BTN_CUSTOM_OCARINA_DISABLE_SONGS); ImGui::AlignTextToFramePadding(); ImGui::BulletText("Pitch"); - DrawButtonLine(ICON_FA_ARROW_UP, 0, BTN_CUSTOM_OCARINA_PITCH_UP); - DrawButtonLine(ICON_FA_ARROW_DOWN, 0, BTN_CUSTOM_OCARINA_PITCH_DOWN); + DrawButtonLine(ICON_FA_ARROW_UP "##Pitch", 0, BTN_CUSTOM_OCARINA_PITCH_UP); + DrawButtonLine(ICON_FA_ARROW_DOWN "##Pitch", 0, BTN_CUSTOM_OCARINA_PITCH_DOWN); if (!CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0)) { ImGui::EndDisabled(); From fec676bbf89109394b867e526841176843c33851 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Wed, 23 Apr 2025 17:29:44 -0400 Subject: [PATCH 06/44] Fix C-Down Position with Anchor Left (#5423) --- soh/src/code/z_parameter.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 4ead0d268..ba9e1f703 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -4112,7 +4112,8 @@ void Interface_DrawItemButtons(PlayState* play) { if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) { X_Margins_CD = Left_HUD_Margin; }; - C_Down_BTN_Pos[0] = (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0) + X_Margins_CD); + C_Down_BTN_Pos[0] = + OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0) + X_Margins_CD); } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == ANCHOR_RIGHT) { if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) { X_Margins_CD = Right_HUD_Margin; From 17ed54dbc51cbb6937f7ba5c768d90360522d865 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Tue, 29 Apr 2025 17:20:04 -0400 Subject: [PATCH 07/44] add DC boss switch exception + tooltip (#5447) --- soh/soh/Enhancements/timesaver_hook_handlers.cpp | 4 ++++ soh/soh/SohGui/SohMenuEnhancements.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index b738e2fc1..523021050 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -275,6 +275,10 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li } switch (actor->id) { case ACTOR_OBJ_SWITCH: { + if (actor->params == 8224 && gPlayState->sceneNum == SCENE_DODONGOS_CAVERN && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding"), 0)) { + break; + } ObjSwitch* switchActor = (ObjSwitch*)actor; switchActor->cooldownTimer = 0; *should = false; diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 0b78892d4..415c5a33f 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -334,10 +334,10 @@ void SohMenu::AddMenuEnhancements() { .Options(CheckboxOptions().DefaultValue(IS_RANDO)); AddWidget(path, "Exclude Glitch-Aiding Cutscenes", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding")) - .Options(CheckboxOptions().Tooltip( - "Don't skip cutscenes that are associated with useful glitches. Currently, it is " - "only the Fire Temple Darunia CS, Forest Temple Poe Sisters CS, and the Box Skip One " - "Point in Jabu.")); + .Options( + CheckboxOptions().Tooltip("Don't skip cutscenes that are associated with useful glitches. Currently, it is " + "only the Fire Temple Darunia CS, Forest Temple Poe Sisters CS, Dodongo Boss " + "Door Switch, and the Box Skip One Point in Jabu.")); AddWidget(path, "Text", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Skip Pickup Messages", WIDGET_CVAR_CHECKBOX) From a01645304262a91b8242885ef2cc1d1b5b77be9e Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Thu, 1 May 2025 21:59:37 -0400 Subject: [PATCH 08/44] Ganon's Tower barrier dispelled if cutscene is skipped (#5462) * Ganon's Tower barrier dispelled if cutscene is skipped * More format-compliant comment --- .../Enhancements/timesaver_hook_handlers.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 523021050..cffa70643 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -217,6 +217,25 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), IS_RANDO) && (entranceFlag != EVENTCHKINF_EPONA_OBTAINED) && entranceIndex != ENTR_SPIRIT_TEMPLE_BOSS_ENTRANCE) { *should = false; + + // Check for dispulsion of Ganon's Tower barrier + switch (entranceIndex) { + case ENTR_INSIDE_GANONS_CASTLE_2: + case ENTR_INSIDE_GANONS_CASTLE_3: + case ENTR_INSIDE_GANONS_CASTLE_4: + case ENTR_INSIDE_GANONS_CASTLE_5: + case ENTR_INSIDE_GANONS_CASTLE_6: + case ENTR_INSIDE_GANONS_CASTLE_7: + if (Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_FOREST_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_WATER_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_SHADOW_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_FIRE_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_LIGHT_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_SPIRIT_TRIAL)) { + Flags_SetEventChkInf(EVENTCHKINF_DISPELLED_GANONS_TOWER_BARRIER); + } + break; + } } break; } From 6c14311b66bc4398a440c1d4362bcfe707616ae9 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Thu, 1 May 2025 21:59:47 -0400 Subject: [PATCH 09/44] add dragon room CS (#5461) --- soh/soh/Enhancements/timesaver_hook_handlers.cpp | 5 +++-- soh/soh/SohGui/SohMenuEnhancements.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index cffa70643..32de18552 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -294,8 +294,9 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li } switch (actor->id) { case ACTOR_OBJ_SWITCH: { - if (actor->params == 8224 && gPlayState->sceneNum == SCENE_DODONGOS_CAVERN && - CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding"), 0)) { + if ((actor->params == 8224 && gPlayState->sceneNum == SCENE_DODONGOS_CAVERN) || + (actor->params == 6979 && gPlayState->sceneNum == SCENE_WATER_TEMPLE) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding"), 0)) { break; } ObjSwitch* switchActor = (ObjSwitch*)actor; diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 415c5a33f..9305c8ec5 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -334,10 +334,10 @@ void SohMenu::AddMenuEnhancements() { .Options(CheckboxOptions().DefaultValue(IS_RANDO)); AddWidget(path, "Exclude Glitch-Aiding Cutscenes", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding")) - .Options( - CheckboxOptions().Tooltip("Don't skip cutscenes that are associated with useful glitches. Currently, it is " - "only the Fire Temple Darunia CS, Forest Temple Poe Sisters CS, Dodongo Boss " - "Door Switch, and the Box Skip One Point in Jabu.")); + .Options(CheckboxOptions().Tooltip( + "Don't skip cutscenes that are associated with useful glitches. Currently, it is " + "only the Fire Temple Darunia CS, Forest Temple Poe Sisters CS, Dodongo Boss " + "Door Switch CS, Water Temple Dragon Switch CS, and the Box Skip One Point in Jabu.")); AddWidget(path, "Text", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Skip Pickup Messages", WIDGET_CVAR_CHECKBOX) From baa91cbadbd357dfb3244fa53322b77f10161016 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Fri, 2 May 2025 03:00:22 +0100 Subject: [PATCH 10/44] Format map GI text (#5417) * Format map GI text * dum --- .../Enhancements/randomizer/3drando/hint_list.cpp | 12 ++++++------ soh/soh/Enhancements/randomizer/randomizer.cpp | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/hint_list.cpp b/soh/soh/Enhancements/randomizer/3drando/hint_list.cpp index 90ddcef06..72c90fa19 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hint_list.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hint_list.cpp @@ -2412,13 +2412,13 @@ void StaticData::HintTable_Init() { hintTextTable[RHT_ISOLATED_PLACE] = HintText(CustomMessage("an Isolated Place")); - hintTextTable[RHT_DUNGEON_ORDINARY] = HintText(CustomMessage(" It's ordinary.", - /*german*/ "&Sieht aus wie immer.", - /*french*/ "&Elle vous semble %rordinaire%w.")); + hintTextTable[RHT_DUNGEON_ORDINARY] = HintText(CustomMessage("&It's %gordinary%w.", + /*german*/ "&Sieht aus %gwie immer%w.", + /*french*/ "&Elle vous semble %gordinaire%w.")); - hintTextTable[RHT_DUNGEON_MASTERFUL] = HintText(CustomMessage(" It's masterful!", - /*german*/ "&Man kann darauf die Worte&%r\"Master Quest\"%w entziffern...", - /*french*/ "&Étrange... les mots %r\"Master&Quest\"%w sont gravés dessus.")); + hintTextTable[RHT_DUNGEON_MASTERFUL] = HintText(CustomMessage("&It's %rmasterful%w!", + /*german*/ "&Man kann darauf die Worte %r\"Master_Quest\"%w entziffern...", + /*french*/ "&Étrange... les mots %r\"Master_Quest\"%w sont gravés dessus.")); // clang-format on } diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index f1ecd608c..29d1c4293 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -4515,6 +4515,9 @@ CustomMessage Randomizer::GetMapGetItemMessageWithHint(GetItemEntry itemEntry) { messageEntry.Replace("[[typeHint]]", Rando::StaticData::hintTextTable[RHT_DUNGEON_ORDINARY].GetHintMessage()); } + // BUG: the icon is not in the message yet so are not accounted for, so overflows are possible + messageEntry.AutoFormat(); + return messageEntry; } From bc3b17f4abdae665b0aafbd7b877a110efe90695 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Thu, 1 May 2025 22:00:43 -0400 Subject: [PATCH 11/44] Add coloured text as current BGM indicator in Audio Editor (#5392) --- soh/soh/Enhancements/audio/AudioEditor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/audio/AudioEditor.cpp b/soh/soh/Enhancements/audio/AudioEditor.cpp index 9865615bd..4cf1f389d 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.cpp +++ b/soh/soh/Enhancements/audio/AudioEditor.cpp @@ -265,6 +265,9 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN } } + auto playingFromMenu = CVarGetInteger(CVAR_AUDIO("Playing"), 0); + auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); + // Longest text in Audio Editor ImVec2 columnSize = ImGui::CalcTextSize("Navi - Look/Hey/Watchout (Target Enemy)"); ImGui::BeginTable(tabId.c_str(), 3, ImGuiTableFlags_SizingFixedFit); @@ -291,10 +294,13 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN const std::string lockedButton = ICON_FA_LOCK + hiddenKey; const std::string unlockedButton = ICON_FA_UNLOCK + hiddenKey; const int currentValue = CVarGetInteger(cvarKey.c_str(), defaultValue); + const bool isCurrentlyPlaying = currentValue == playingFromMenu || seqData.sequenceId == currentBGM; ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::Text("%s", seqData.label.c_str()); + ImGui::TextColored( + UIWidgets::ColorValues.at(isCurrentlyPlaying ? UIWidgets::Colors::Yellow : UIWidgets::Colors::White), "%s", + seqData.label.c_str()); ImGui::TableNextColumn(); ImGui::PushItemWidth(-FLT_MIN); const int initialValue = map.contains(currentValue) ? currentValue : defaultValue; From 19eb4f39abe6e10cbc603c3d2f2e407e6d173b80 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Thu, 1 May 2025 23:27:20 -0400 Subject: [PATCH 12/44] Skip trial barrier dispel cutscenes (#5464) --- .../vanilla-behavior/GIVanillaBehavior.h | 8 +++++++ .../Enhancements/timesaver_hook_handlers.cpp | 21 +++++++++++++++++++ .../actors/ovl_Demo_Kekkai/z_demo_kekkai.c | 17 ++++++++------- .../actors/ovl_Demo_Kekkai/z_demo_kekkai.h | 2 +- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index d57d5029a..3eb7916a7 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -1358,6 +1358,14 @@ typedef enum { // - `*BgTreemouth` VB_PLAY_DEKU_TREE_INTRO_CS, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*DemoKekkai` + VB_PLAY_DISPEL_BARRIER_CS, + // #### `result` // ```c // true diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 32de18552..0a9a77e40 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -19,6 +19,7 @@ extern "C" { #include "src/overlays/actors/ovl_En_Zl4/z_en_zl4.h" #include "src/overlays/actors/ovl_En_Box/z_en_box.h" #include "src/overlays/actors/ovl_Demo_Im/z_demo_im.h" +#include "src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h" #include "src/overlays/actors/ovl_En_Sa/z_en_sa.h" #include "src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h" #include "src/overlays/actors/ovl_En_Tk/z_en_tk.h" @@ -465,6 +466,26 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li *should = false; } break; + case VB_PLAY_DISPEL_BARRIER_CS: { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO)) { + static s16 trialEntrances[] = { + 0, + ENTR_INSIDE_GANONS_CASTLE_3, + ENTR_INSIDE_GANONS_CASTLE_6, + ENTR_INSIDE_GANONS_CASTLE_5, + ENTR_INSIDE_GANONS_CASTLE_4, + ENTR_INSIDE_GANONS_CASTLE_7, + ENTR_INSIDE_GANONS_CASTLE_2, + }; + RateLimitedSuccessChime(); + DemoKekkai* kekkai = va_arg(args, DemoKekkai*); + gPlayState->nextEntranceIndex = trialEntrances[kekkai->actor.params]; + gPlayState->transitionTrigger = TRANS_TRIGGER_START; + gPlayState->transitionType = TRANS_TYPE_FADE_BLACK; + *should = false; + } + break; + } case VB_OWL_INTERACTION: { if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), IS_RANDO) && *should) { EnOwl* enOwl = va_arg(args, EnOwl*); diff --git a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index ad1c76a3d..3d50bf330 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -7,6 +7,7 @@ #include "z_demo_kekkai.h" #include "objects/object_demo_kekkai/object_demo_kekkai.h" #include "scenes/dungeons/ganontika/ganontika_scene.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ResourceManagerHelpers.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -257,13 +258,15 @@ void DemoKekkai_TrialBarrierIdle(Actor* thisx, PlayState* play) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); if (this->collider2.base.acFlags & AC_HIT) { - Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); - // "I got it" - LOG_STRING("当ったよ"); - this->actor.update = DemoKekkai_TrialBarrierDispel; - this->timer = 0; - play->csCtx.segment = SEGMENTED_TO_VIRTUAL(sSageCutscenes[this->actor.params]); - gSaveContext.cutsceneTrigger = 1; + if (GameInteractor_Should(VB_PLAY_DISPEL_BARRIER_CS, true, this)) { + Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); + // "I got it" + LOG_STRING("当ったよ"); + this->actor.update = DemoKekkai_TrialBarrierDispel; + this->timer = 0; + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(sSageCutscenes[this->actor.params]); + gSaveContext.cutsceneTrigger = 1; + } } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); func_8002F974(&this->actor, NA_SE_EV_TOWER_ENERGY - SFX_FLAG); diff --git a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h index 4e4a06c18..a8df145c2 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h +++ b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h @@ -6,7 +6,7 @@ struct DemoKekkai; -typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* this, PlayState* play); +typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* thisx, PlayState* play); typedef struct DemoKekkai { /* 0x0000 */ Actor actor; From 6a93625f5cfbaca71262a4fdce1a90d055a282ba Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Tue, 6 May 2025 20:00:33 -0400 Subject: [PATCH 13/44] VBify Crawl Speed Enhancement and Add Exlcude Glitch-Aiding Crawlspace Option (#5465) * add menu option * VBify + add conditions * oops wrong func * clean up includes + casting * move z_player externed functions * better name * correct menu text * one last name final final * maintain glitch-aiding selection --- soh/include/functions.h | 2 + .../Enhancements/TimeSavers/CrawlSpeed.cpp | 110 ++++++++++++++++++ .../vanilla-behavior/GIVanillaBehavior.h | 37 ++++++ soh/soh/SohGui/SohMenuEnhancements.cpp | 5 + soh/src/code/z_onepointdemo.c | 27 ++--- .../actors/ovl_player_actor/z_player.c | 52 ++------- 6 files changed, 170 insertions(+), 63 deletions(-) create mode 100644 soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp diff --git a/soh/include/functions.h b/soh/include/functions.h index 86e3bf77f..ad615d173 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -1044,6 +1044,7 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec); VecSph* OLib_Vec3fToVecSphGeo(VecSph* arg0, Vec3f* arg1); VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* arg0, Vec3f* a, Vec3f* b); Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b); +void OnePointCutscene_SetCsCamPoints(Camera* camera, s16 actionParameters, s16 initTimer, CutsceneCameraPoint* atPoints, CutsceneCameraPoint* eyePoints); s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 camIdx); s16 OnePointCutscene_EndCutscene(PlayState* play, s16 camIdx); s32 OnePointCutscene_Attention(PlayState* play, Actor* actor); @@ -1102,6 +1103,7 @@ void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx); s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input); u8 PlayerGrounded(Player* player); void Player_SetBootData(PlayState* play, Player* player); +void Player_StartAnimMovement(PlayState* play, Player* player, s32 flags); s32 Player_InBlockingCsMode(PlayState* play, Player* player); s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction); s32 Player_InCsMode(PlayState* play); diff --git a/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp b/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp new file mode 100644 index 000000000..b9f65df04 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp @@ -0,0 +1,110 @@ +#include +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" +#include "global.h" + +extern "C" { +#include "functions.h" +#include "objects/gameplay_keep/gameplay_keep.h" +extern PlayState* gPlayState; +} + +#define CVAR_CRAWL_SPEED_NAME CVAR_ENHANCEMENT("CrawlSpeed") +#define CVAR_CRAWL_SPEED_DEFAULT 1 +#define CVAR_CRAWL_SPEED_VALUE CVarGetInteger(CVAR_CRAWL_SPEED_NAME, CVAR_CRAWL_SPEED_DEFAULT) +#define CVAR_GLITCH_AIDING_NAME CVAR_ENHANCEMENT("GlitchAidingCrawlspaces") +#define CVAR_GLITCH_AIDING_DEFAULT 0 +#define CVAR_GLITCH_AIDING_VALUE CVarGetInteger(CVAR_GLITCH_AIDING_NAME, CVAR_GLITCH_AIDING_DEFAULT) + +extern "C" void ExitCrawlspace(Player* player, PlayState* play) { + LinkAnimationHeader* animExit = (LinkAnimationHeader*)gPlayerAnim_link_child_tunnel_end; + LinkAnimationHeader* animEnter = (LinkAnimationHeader*)gPlayerAnim_link_child_tunnel_start; + + if (player->linearVelocity > 0.0f) { + // Leaving a crawlspace forwards + player->actor.shape.rot.y = player->actor.wallYaw + 0x8000; + LinkAnimation_Change(play, &player->skelAnime, animExit, ((CVAR_CRAWL_SPEED_VALUE + 1.0f) / 2.0f), 0.0f, + Animation_GetLastFrame(animExit), ANIMMODE_ONCE, 0.0f); + Player_StartAnimMovement(play, player, 0x9D); + OnePointCutscene_Init(play, 9601, 999, NULL, MAIN_CAM); + } else { + // Leaving a crawlspace backwards + player->actor.shape.rot.y = player->actor.wallYaw; + LinkAnimation_Change(play, &player->skelAnime, animEnter, -1.0f * ((CVAR_CRAWL_SPEED_VALUE + 1.0f) / 2.0f), + Animation_GetLastFrame(animEnter), 0.0f, ANIMMODE_ONCE, 0.0f); + Player_StartAnimMovement(play, player, 0x9D); + OnePointCutscene_Init(play, 9602, 999, NULL, MAIN_CAM); + } +} + +extern "C" void ExitCrawlspaceCS(PlayState* play, Camera* csCam, int16_t actionParameters, int16_t initTimer, + CutsceneCameraPoint* atPoints, CutsceneCameraPoint* eyePoints) { + s16 camCrawlTemp = CVAR_CRAWL_SPEED_VALUE; + s16 camCrawlTimer = initTimer / camCrawlTemp; + + OnePointCutscene_SetCsCamPoints(csCam, actionParameters | 0x1000, camCrawlTimer, atPoints, eyePoints); +} + +extern "C" void EnterCrawlspace(Player* player, PlayState* play) { + LinkAnimationHeader* anim = (LinkAnimationHeader*)gPlayerAnim_link_child_tunnel_start; + + LinkAnimation_Change(play, &player->skelAnime, anim, ((CVAR_CRAWL_SPEED_VALUE + 1.0f) / 2.0f), 0.0f, + Animation_GetLastFrame(anim), ANIMMODE_ONCE, 0.0f); +} + +extern "C" void IncreaseCrawlSpeed(Player* player, PlayState* play) { + Input* sControlInput = &play->state.input[0]; + player->linearVelocity = sControlInput->rel.stick_y * 0.03f * CVAR_CRAWL_SPEED_VALUE; +} + +void CrawlSpeed_Register() { + bool shouldRegister = CVAR_CRAWL_SPEED_VALUE > 1; + + COND_VB_SHOULD(VB_CRAWL_SPEED_EXIT, shouldRegister, { + Player* player = GET_PLAYER(gPlayState); + bool excludeWellBackroom = (player->actor.world.pos.x > 950.0f) && (player->actor.world.pos.x < 1025.0f) && + (player->actor.world.pos.z > -1510.0f) && (player->actor.world.pos.z < -1490.0f) && + gPlayState->sceneNum == SCENE_BOTTOM_OF_THE_WELL; + bool excludeGlitchAiding = CVAR_GLITCH_AIDING_VALUE; + if (excludeGlitchAiding && excludeWellBackroom) { + *should = true; + } else { + ExitCrawlspace(player, gPlayState); + *should = false; + } + }); + + COND_VB_SHOULD(VB_CRAWL_SPEED_EXIT_CS, shouldRegister, { + Player* player = GET_PLAYER(gPlayState); + Camera* csCam = va_arg(args, Camera*); + s16 csId = va_arg(args, s16); + s16 actionParameters = va_arg(args, s16); + s16 initTimer = va_arg(args, s16); + CutsceneCameraPoint* atPoints = va_arg(args, CutsceneCameraPoint*); + CutsceneCameraPoint* eyePoints = va_arg(args, CutsceneCameraPoint*); + bool excludeWellBackroom = (player->actor.world.pos.x > 950.0f) && (player->actor.world.pos.x < 1025.0f) && + (player->actor.world.pos.z > -1510.0f) && (player->actor.world.pos.z < -1490.0f) && + gPlayState->sceneNum == SCENE_BOTTOM_OF_THE_WELL; + bool excludeGlitchAiding = CVAR_GLITCH_AIDING_VALUE; + if (excludeGlitchAiding && excludeWellBackroom) { + *should = true; + } else { + ExitCrawlspaceCS(gPlayState, csCam, actionParameters, initTimer, atPoints, eyePoints); + *should = false; + } + }); + + COND_VB_SHOULD(VB_CRAWL_SPEED_ENTER, shouldRegister, { + Player* player = GET_PLAYER(gPlayState); + EnterCrawlspace(player, gPlayState); + *should = false; + }); + + COND_VB_SHOULD(VB_CRAWL_SPEED_INCREASE, shouldRegister, { + Player* player = GET_PLAYER(gPlayState); + IncreaseCrawlSpeed(player, gPlayState); + *should = false; + }); +} + +static RegisterShipInitFunc initSpeed(CrawlSpeed_Register, { CVAR_CRAWL_SPEED_NAME }); \ No newline at end of file diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index d57d5029a..0748d913a 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -294,6 +294,43 @@ typedef enum { // - `*ObjKibako2` VB_CRATE_SETUP_DRAW, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - None + VB_CRAWL_SPEED_ENTER, + + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - None + VB_CRAWL_SPEED_EXIT, + + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*Camera` + // - 'int16_t' (csId) + // - 'int16_t' (actionParameters) + // - 'int16_t' (initTimer) + // - 'CutsceneCameraPoint*' (atPoints) + // - 'CutsceneCameraPoint*' (eyePoints) + VB_CRAWL_SPEED_EXIT_CS, + + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - None + VB_CRAWL_SPEED_INCREASE, + // #### `result` // ```c // !Flags_GetItemGetInf(ITEMGETINF_1C) diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 0b78892d4..82a1d0fae 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -382,6 +382,11 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "Crawl Speed %dx", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_ENHANCEMENT("CrawlSpeed")) .Options(IntSliderOptions().Min(1).Max(4).DefaultValue(1).Format("%dx")); + AddWidget(path, "Exclude Glitch-Aiding Crawlspaces", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("GlitchAidingCrawlspaces")) + .PreFunc([](WidgetInfo& info) { info.isHidden = CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 0) == 1; }) + .Options(CheckboxOptions().Tooltip("Don't increase crawl speed when exiting glitch-useful crawlspaces." + "Currently it is only the BOTW crawlspace to locked door")); AddWidget(path, "King Zora Speed: %.2fx", WIDGET_CVAR_SLIDER_FLOAT) .CVar(CVAR_ENHANCEMENT("MweepSpeed")) .Options(FloatSliderOptions().Min(0.1f).Max(5.0f).DefaultValue(1.0f).Format("%.2fx")); diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c index 40f5c1474..c68f1b522 100644 --- a/soh/src/code/z_onepointdemo.c +++ b/soh/src/code/z_onepointdemo.c @@ -71,12 +71,6 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor f32 tempRand; Unique9OnePointCs* csInfo = ONEPOINT_CS_INFO(csCam); - // #region SOH [Enhancement] - // the default is 90, lower values necessary to prevent camera swing as animation speeds up - s16 camCrawlTemp = CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1); - s16 camCrawlTimer = D_8012042C / camCrawlTemp; - // #endregion - switch (csId) { case 1020: if (timer < 20) { @@ -336,26 +330,19 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor case 9601: Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); - if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { - OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, camCrawlTimer, D_80120308, D_80120398); - } else { + if (GameInteractor_Should(VB_CRAWL_SPEED_EXIT_CS, true, csCam, csId, D_80120430, D_8012042C, D_80120308, + D_80120398)) { OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120398); } break; case 9602: - // #region SOH [Enhancement] - if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { - Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); - Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); - OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, camCrawlTimer, D_80120308, D_80120434); - break; - // #endregion - } else { - Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); - Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); + Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); + Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); + if (GameInteractor_Should(VB_CRAWL_SPEED_EXIT_CS, true, csCam, csId, D_80120430, D_8012042C, D_80120308, + D_80120434)) { OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120434); - break; } + break; case 4175: csInfo->keyFrames = D_8012147C; csInfo->keyFrameCnt = 4; diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 6638893f5..4da9e0deb 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -7679,19 +7679,10 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall this->actor.world.pos.z = zVertex1 + (distToInteractWall * wallPolyNormZ); func_80832224(this); this->actor.prevPos = this->actor.world.pos; - // #region SOH [Enhancement] - if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { - // increase animation speed when entering a tunnel - LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, - ((CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) + 1.0f) / 2.0f), 0.0f, - Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), ANIMMODE_ONCE, - 0.0f); - Player_StartAnimMovement(play, this, 0x9D); - // #endregion - } else { + if (GameInteractor_Should(VB_CRAWL_SPEED_ENTER, true)) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_start); - Player_StartAnimMovement(play, this, 0x9D); } + Player_StartAnimMovement(play, this, 0x9D); return true; } } @@ -7773,36 +7764,16 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { if (ABS(yawToWall) > 0x4000) { Player_SetupAction(play, this, Player_Action_8084C81C, 0); - if (this->linearVelocity > 0.0f) { - // Leaving a crawlspace forwards - this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; - // #region SOH [Enhancement] - if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { - LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_end, - ((CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) + 1.0f) / 2.0f), 0.0f, - Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_end), ANIMMODE_ONCE, - 0.0f); - Player_StartAnimMovement(play, this, 0x9D); - OnePointCutscene_Init(play, 9601, 999, NULL, MAIN_CAM); - // #endregion - } else { + if (GameInteractor_Should(VB_CRAWL_SPEED_EXIT, true)) { + if (this->linearVelocity > 0.0f) { + // Leaving a crawlspace forwards + this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_end); Player_StartAnimMovement(play, this, 0x9D); OnePointCutscene_Init(play, 9601, 999, NULL, MAIN_CAM); - } - } else { - // Leaving a crawlspace backwards - this->actor.shape.rot.y = this->actor.wallYaw; - // #region SOH [Enhancement] - if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { - LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, - -1.0f * ((CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) + 1.0f) / 2.0f), - Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), 0.0f, - ANIMMODE_ONCE, 0.0f); - Player_StartAnimMovement(play, this, 0x9D); - OnePointCutscene_Init(play, 9602, 999, NULL, MAIN_CAM); - // #endregion } else { + // Leaving a crawlspace backwards + this->actor.shape.rot.y = this->actor.wallYaw; LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, -1.0f, Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), 0.0f, ANIMMODE_ONCE, 0.0f); @@ -13587,12 +13558,7 @@ void Player_Action_8084C760(Player* this, PlayState* play) { // player speed in a tunnel if (!Player_TryLeavingCrawlspace(this, play)) { - // #region SOH [Enhancement] - if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { - this->linearVelocity = - sControlInput->rel.stick_y * 0.03f * CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1); - // #endregion - } else { + if (GameInteractor_Should(VB_CRAWL_SPEED_INCREASE, true)) { this->linearVelocity = sControlInput->rel.stick_y * 0.03f; } } From 6cbb298f76f2c1b809891eeb38c4d9d6110ecf82 Mon Sep 17 00:00:00 2001 From: Jordan Longstaff Date: Tue, 6 May 2025 20:01:36 -0400 Subject: [PATCH 14/44] Skip Kakariko and Hyrule Castle gate cutscenes (#5314) * Skip Kakariko gate cutscenes * Simplify a bit * Revert "Simplify a bit" This reverts commit ffa68c130fede6962bb4488b85c9ec61ccc60170. * Add Hyrule Castle gate skip * Add missing backtick * Redo simplifications * Run clang-format * Proper casting of clearCamera argument Co-authored-by: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> --------- Co-authored-by: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> --- .../vanilla-behavior/GIVanillaBehavior.h | 9 +++ .../Enhancements/timesaver_hook_handlers.cpp | 13 +++ .../actors/ovl_En_Heishi2/z_en_heishi2.c | 80 +++++++++++-------- 3 files changed, 68 insertions(+), 34 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 3eb7916a7..0c11e3c93 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -1430,6 +1430,15 @@ typedef enum { // - None VB_PLAY_FIRE_ARROW_CS, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*EnHeishi2` + // - `bool` (clearCamera - true if the code clears a sub-camera, false otherwise) + VB_PLAY_GATE_OPENING_OR_CLOSING_CS, + // #### `result` // ```c // true diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 0a9a77e40..13c14b0a6 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -13,6 +13,7 @@ extern "C" { #include "src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h" #include "src/overlays/actors/ovl_En_Owl/z_en_owl.h" #include "src/overlays/actors/ovl_En_Go2/z_en_go2.h" +#include "src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h" #include "src/overlays/actors/ovl_En_Ko/z_en_ko.h" #include "src/overlays/actors/ovl_En_Ma1/z_en_ma1.h" #include "src/overlays/actors/ovl_En_Ru2/z_en_ru2.h" @@ -765,6 +766,18 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li break; } + case VB_PLAY_GATE_OPENING_OR_CLOSING_CS: { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO)) { + EnHeishi2* enHeishi2 = va_arg(args, EnHeishi2*); + enHeishi2->unk_2F2[0] = 0; + + // The second argument determines whether the vanilla code should be run anyway. It + // should be set to `true` ONLY IF said code calls `Play_ClearCamera`, false otherwise. + bool clearCamera = (bool)va_arg(args, int); + *should = clearCamera && enHeishi2->cameraId != MAIN_CAM; + } + break; + } case VB_PLAY_RAINBOW_BRIDGE_CS: { if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { *should = false; diff --git a/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index 61a10b056..192d749d4 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -314,19 +314,21 @@ void func_80A5372C(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); - this->unk_2F2[0] = 200; - this->cameraId = Play_CreateSubCamera(play); - Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); - Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); - this->unk_280.x = 947.0f; - this->unk_280.y = 1195.0f; - this->unk_280.z = 2682.0f; + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) { + this->unk_2F2[0] = 200; + this->cameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); + this->unk_280.x = 947.0f; + this->unk_280.y = 1195.0f; + this->unk_280.z = 2682.0f; - this->unk_28C.x = 1164.0f; - this->unk_28C.y = 1145.0f; - this->unk_28C.z = 3014.0f; + this->unk_28C.x = 1164.0f; + this->unk_28C.y = 1145.0f; + this->unk_28C.z = 3014.0f; - Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + } this->actionFunc = func_80A53850; } @@ -334,11 +336,15 @@ void func_80A53850(EnHeishi2* this, PlayState* play) { BgSpot15Saku* gate; SkelAnime_Update(&this->skelAnime); - Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) { + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + } gate = (BgSpot15Saku*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->unk_168 == 0)) { - Play_ClearCamera(play, this->cameraId); - Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, true)) { + Play_ClearCamera(play, this->cameraId); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + } Message_CloseTextbox(play); this->unk_30C = 1; Player_SetCsActionWithHaltedActors(play, NULL, 7); @@ -479,23 +485,25 @@ void func_80A53DF8(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); - this->unk_2F2[0] = 200; - this->cameraId = Play_CreateSubCamera(play); - Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); - Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); - this->unk_2BC.x = -71.0f; - this->unk_280.x = -71.0f; - this->unk_2BC.y = 571.0f; - this->unk_280.y = 571.0f; - this->unk_2BC.z = -1487.0f; - this->unk_280.z = -1487.0f; - this->unk_298.x = 181.0f; - this->unk_28C.x = 181.0f; - this->unk_298.y = 417.0f; - this->unk_28C.y = 417.0f; - this->unk_298.z = -1079.0f; - this->unk_28C.z = -1079.0f; - Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) { + this->unk_2F2[0] = 200; + this->cameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); + this->unk_2BC.x = -71.0f; + this->unk_280.x = -71.0f; + this->unk_2BC.y = 571.0f; + this->unk_280.y = 571.0f; + this->unk_2BC.z = -1487.0f; + this->unk_280.z = -1487.0f; + this->unk_298.x = 181.0f; + this->unk_28C.x = 181.0f; + this->unk_298.y = 417.0f; + this->unk_28C.y = 417.0f; + this->unk_298.z = -1079.0f; + this->unk_28C.z = -1079.0f; + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + } this->actionFunc = func_80A53F30; } @@ -503,11 +511,15 @@ void func_80A53F30(EnHeishi2* this, PlayState* play) { BgGateShutter* gate; SkelAnime_Update(&this->skelAnime); - Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) { + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + } gate = (BgGateShutter*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->openingState == 0)) { - Play_ClearCamera(play, this->cameraId); - Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, true)) { + Play_ClearCamera(play, this->cameraId); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + } if ((this->unk_30A != 2)) { if (this->unk_30A == 0) { this->actor.textId = 0x2015; From 804a24861b2dd888efbd4be57d65fb24ecbf0ad1 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Wed, 7 May 2025 17:45:42 -0400 Subject: [PATCH 15/44] add option description to LACS reward options (#5472) --- soh/soh/Enhancements/randomizer/settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 6f3553261..6e494a6b5 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -250,7 +250,7 @@ void Settings::CreateOptions() { OPT_U8(RSK_LACS_REWARD_COUNT, "GCBK Reward Count", {NumOpts(0, 10)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsRewardCount"), "", WidgetType::Slider, 9, true); OPT_U8(RSK_LACS_DUNGEON_COUNT, "GCBK Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsDungeonCount"), "", WidgetType::Slider, 8, true); OPT_U8(RSK_LACS_TOKEN_COUNT, "GCBK Token Count", {NumOpts(0, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsTokenCount"), "", WidgetType::Slider, 100, true); - OPT_U8(RSK_LACS_OPTIONS, "GCBK LACS Reward Options", {"Standard Reward", "Greg as Reward", "Greg as Wildcard"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsRewardOptions"), "", WidgetType::Combobox, RO_LACS_STANDARD_REWARD); + OPT_U8(RSK_LACS_OPTIONS, "GCBK LACS Reward Options", {"Standard Reward", "Greg as Reward", "Greg as Wildcard"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsRewardOptions"), mOptionDescriptions[RSK_LACS_OPTIONS], WidgetType::Combobox, RO_LACS_STANDARD_REWARD); OPT_U8(RSK_KEYRINGS, "Key Rings", {"Off", "Random", "Count", "Selection"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), mOptionDescriptions[RSK_KEYRINGS], WidgetType::Combobox, RO_KEYRINGS_OFF); OPT_U8(RSK_KEYRINGS_RANDOM_COUNT, "Keyring Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsRandomCount"), "", WidgetType::Slider, 8); OPT_U8(RSK_KEYRINGS_GERUDO_FORTRESS, "Gerudo Fortress Keyring", {"No", "Random", "Yes"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGerudoFortress"), "", WidgetType::Combobox, 0); From f72085b6caff7817d5c5872885f6acdfb4aab8dc Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Tue, 13 May 2025 04:31:40 +0100 Subject: [PATCH 16/44] fix oversight in dragon room of MQ water (#5482) --- .../randomizer/location_access/dungeons/water_temple.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp index 0ae5ac289..04c1279bd 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp @@ -658,7 +658,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_MQ_DRAGON_ROOM_ALCOVE] = Region("Water Temple MQ Dragon Room Alcove", "Water Temple", {RA_WATER_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->MQWaterDragonTorches, []{return true;}), + EventAccess(&logic->MQWaterDragonTorches, []{return logic->HasFireSource();}), }, { //Locations From f9cde383b7c17faadf875f19e6caf060255bcf3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 13 May 2025 03:33:21 +0000 Subject: [PATCH 17/44] ignore out of bounds entrance overrides in json (#5253) was causing segfault when using settings from door shuffle on develop --- soh/soh/Enhancements/randomizer/entrance.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/entrance.cpp b/soh/soh/Enhancements/randomizer/entrance.cpp index ac0e4868c..f58dad3bc 100644 --- a/soh/soh/Enhancements/randomizer/entrance.cpp +++ b/soh/soh/Enhancements/randomizer/entrance.cpp @@ -1645,7 +1645,7 @@ void EntranceShuffler::ParseJson(nlohmann::json spoilerFileJson) { try { nlohmann::json entrancesJson = spoilerFileJson["entrances"]; size_t i = 0; - for (auto it = entrancesJson.begin(); it != entrancesJson.end(); ++it, i++) { + for (auto it = entrancesJson.begin(); it != entrancesJson.end() && i < entranceOverrides.size(); ++it, i++) { nlohmann::json entranceJson = *it; for (auto entranceIt = entranceJson.begin(); entranceIt != entranceJson.end(); ++entranceIt) { if (entranceIt.key() == "type") { From eb95f9060f26b5f78bb9dd716f297955c04990db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 13 May 2025 19:30:04 +0000 Subject: [PATCH 18/44] Faster empty bottle, faster bean skulltula (#5355) * Faster empty bottle, faster bean skulltula * shipinit --- .../TimeSavers/FasterBeanSkulltula.cpp | 13 +++++++++++++ .../TimeSavers/FasterBottleEmpty.cpp | 19 +++++++++++++++++++ .../vanilla-behavior/GIVanillaBehavior.h | 16 ++++++++++++++++ soh/soh/SohGui/SohMenuEnhancements.cpp | 7 +++++++ .../ovl_Obj_Makekinsuta/z_obj_makekinsuta.c | 4 +++- .../actors/ovl_player_actor/z_player.c | 2 ++ 6 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp create mode 100644 soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp diff --git a/soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp b/soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp new file mode 100644 index 000000000..20011bba3 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp @@ -0,0 +1,13 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "z64save.h" +} + +void RegisterFasterBeanSkulltula() { + COND_VB_SHOULD(VB_SPAWN_BEAN_SKULLTULA, CVarGetInteger(CVAR_ENHANCEMENT("FasterBeanSkull"), 0), + { *should = true; }); +} + +static RegisterShipInitFunc initFunc(RegisterFasterBeanSkulltula, { CVAR_ENHANCEMENT("FasterBeanSkull") }); diff --git a/soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp b/soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp new file mode 100644 index 000000000..47b6b7461 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp @@ -0,0 +1,19 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "z64save.h" +} + +void RegisterFasterEmptyBottle() { + COND_VB_SHOULD(VB_EMPTYING_BOTTLE, CVarGetInteger(CVAR_ENHANCEMENT("FasterBottleEmpty"), 0), { + Player* player = va_arg(args, Player*); + if (player->skelAnime.curFrame <= 60.0f) { + player->skelAnime.playSpeed = 3.0f; + } else { + player->skelAnime.playSpeed = 1.0f; + } + }); +} + +static RegisterShipInitFunc initFunc(RegisterFasterEmptyBottle, { CVAR_ENHANCEMENT("FasterBottleEmpty") }); diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 0748d913a..597be2a97 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -462,6 +462,14 @@ typedef enum { // - `*int16_t` (item id) VB_DRAW_AMMO_COUNT, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - Player* + VB_EMPTYING_BOTTLE, + // #### `result` // ```c // (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play) @@ -1827,6 +1835,14 @@ typedef enum { // - `*ObjBean` VB_SPAWN_BEAN_STALK_FAIRIES, + // #### `result` + // ```c + // this->timer >= 60 + // ``` + // #### `args` + // - `None` + VB_SPAWN_BEAN_SKULLTULA, + // #### `result` // ```c // true diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 82a1d0fae..95c942d37 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -373,6 +373,9 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim")) .Options(CheckboxOptions().Tooltip("Skips Link's taking breath animation after coming up from water. " "This setting does not interfere with getting items from underwater.")); + AddWidget(path, "Empty Bottles Faster", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("FasterBottleEmpty")) + .Options(CheckboxOptions().Tooltip("Speeds up emptying animation when dumping out the contents of a bottle.")); AddWidget(path, "Vine/Ladder Climb Speed +%d", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_ENHANCEMENT("ClimbSpeed")) .Options(IntSliderOptions().Min(0).Max(12).DefaultValue(0).Format("+%d")); @@ -430,6 +433,10 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "Link as Default File Name", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("LinkDefaultName")) .Options(CheckboxOptions().Tooltip("Allows you to have \"Link\" as a premade file name.")); + AddWidget(path, "Spawn Bean Skulltula Faster", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("FasterBeanSkull")) + .Options(CheckboxOptions().Tooltip( + "Makes Gold Skulltulas come out of bean patches faster after bugs dig into center.")); AddWidget(path, "Biggoron Forge Time: %d days", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_ENHANCEMENT("ForgeTime")) .Options(IntSliderOptions().Min(0).Max(3).DefaultValue(3).Format("%d days").Tooltip( diff --git a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 1fb3effc1..c193ede65 100644 --- a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -7,6 +7,8 @@ #include "z_obj_makekinsuta.h" #include "vt.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED void ObjMakekinsuta_Init(Actor* thisx, PlayState* play); @@ -47,7 +49,7 @@ void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { void func_80B98320(ObjMakekinsuta* this, PlayState* play) { if (this->unk_152 != 0) { - if (this->timer >= 60 && !func_8002DEEC(GET_PLAYER(play))) { + if (GameInteractor_Should(VB_SPAWN_BEAN_SKULLTULA, this->timer >= 60) && !func_8002DEEC(GET_PLAYER(play))) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, (this->actor.params | 0x8000), true); this->actionFunc = ObjMakekinsuta_DoNothing; diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 4da9e0deb..d97dcdc08 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -14752,6 +14752,8 @@ static AnimSfxEntry D_80854A34[] = { void Player_Action_8084EFC0(Player* this, PlayState* play) { Player_DecelerateToZero(this); + GameInteractor_Should(VB_EMPTYING_BOTTLE, true, this); + if (LinkAnimation_Update(play, &this->skelAnime)) { func_8083C0E8(this, play); func_8005B1A4(Play_GetCamera(play, 0)); From afc52f07d20a2d429183ee6c1829155bd5b289c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 13 May 2025 19:30:22 +0000 Subject: [PATCH 19/44] location_access: don't short circuit event access logic (#5216) event logic is only run while event isn't set --- .../Enhancements/randomizer/location_access.cpp | 2 +- .../location_access/dungeons/deku_tree.cpp | 2 +- .../location_access/dungeons/dodongos_cavern.cpp | 2 +- .../location_access/dungeons/fire_temple.cpp | 6 +++--- .../location_access/dungeons/forest_temple.cpp | 10 +++++----- .../location_access/dungeons/ganons_castle.cpp | 4 ++-- .../location_access/dungeons/jabujabus_belly.cpp | 2 +- .../location_access/dungeons/shadow_temple.cpp | 2 +- .../location_access/dungeons/spirit_temple.cpp | 2 +- .../location_access/dungeons/water_temple.cpp | 8 ++++---- .../location_access/gerudo_fortress.cpp | 2 +- .../location_access/overworld/castle_grounds.cpp | 2 +- .../overworld/death_mountain_crater.cpp | 2 +- .../overworld/death_mountain_trail.cpp | 2 +- .../overworld/desert_colossus.cpp | 2 +- .../location_access/overworld/gerudo_valley.cpp | 2 +- .../location_access/overworld/goron_city.cpp | 16 ++++++++-------- .../location_access/overworld/graveyard.cpp | 4 ++-- .../location_access/overworld/kakariko.cpp | 2 +- .../location_access/overworld/kokiri_forest.cpp | 4 ++-- .../location_access/overworld/lake_hylia.cpp | 8 ++++---- .../location_access/overworld/lon_lon_ranch.cpp | 4 ++-- .../location_access/overworld/lost_woods.cpp | 2 +- .../location_access/overworld/market.cpp | 4 ++-- .../location_access/overworld/zoras_domain.cpp | 8 ++++---- .../location_access/overworld/zoras_fountain.cpp | 2 +- .../location_access/overworld/zoras_river.cpp | 4 ++-- 27 files changed, 55 insertions(+), 55 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index 3e5664ff8..4a32e8955 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -312,7 +312,7 @@ void RegionTable_Init() { logic = ctx->GetLogic(); // RANDOTODO do not hardcode, instead allow accepting a Logic class somehow grottoEvents = { EventAccess(&logic->GossipStoneFairy, [] { return logic->CallGossipFairy(); }), - EventAccess(&logic->ButterflyFairy, [] { return logic->ButterflyFairy || (logic->CanUse(RG_STICKS)); }), + EventAccess(&logic->ButterflyFairy, [] { return logic->CanUse(RG_STICKS); }), EventAccess(&logic->BugShrub, [] { return logic->CanCutShrubs(); }), EventAccess(&logic->LoneFish, [] { return true; }), }; diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp index f327c9992..109799285 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp @@ -445,7 +445,7 @@ void RegionTable_Init_DekuTree() { areaTable[RR_DEKU_TREE_BOSS_ROOM] = Region("Deku Tree Boss Room", "Deku Tree", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->DekuTreeClear, []{return logic->DekuTreeClear || logic->CanKillEnemy(RE_GOHMA);}), + EventAccess(&logic->DekuTreeClear, []{return logic->CanKillEnemy(RE_GOHMA);}), }, { // Locations LOCATION(RC_QUEEN_GOHMA, logic->DekuTreeClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/dodongos_cavern.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/dodongos_cavern.cpp index 8cd60f268..c268f4691 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/dodongos_cavern.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/dodongos_cavern.cpp @@ -567,7 +567,7 @@ void RegionTable_Init_DodongosCavern() { areaTable[RR_DODONGOS_CAVERN_BOSS_ROOM] = Region("Dodongos Cavern Boss Room", "Dodongos Cavern", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->DodongosCavernClear, []{return logic->DodongosCavernClear || (Here(RR_DODONGOS_CAVERN_BOSS_ROOM, []{return logic->HasExplosives() || (logic->CanUse(RG_MEGATON_HAMMER) && ctx->GetTrickOption(RT_DC_HAMMER_FLOOR));}) && logic->CanKillEnemy(RE_KING_DODONGO)); /*todo add chu kill to tricks*/}), + EventAccess(&logic->DodongosCavernClear, []{return Here(RR_DODONGOS_CAVERN_BOSS_ROOM, []{return logic->HasExplosives() || (logic->CanUse(RG_MEGATON_HAMMER) && ctx->GetTrickOption(RT_DC_HAMMER_FLOOR));}) && logic->CanKillEnemy(RE_KING_DODONGO); /*todo add chu kill to tricks*/}), }, { // Locations LOCATION(RC_DODONGOS_CAVERN_BOSS_ROOM_CHEST, true), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp index 8888cdac9..c3ccf27c6 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp @@ -27,7 +27,7 @@ void RegionTable_Init_FireTemple() { areaTable[RR_FIRE_TEMPLE_NEAR_BOSS_ROOM] = Region("Fire Temple Near Boss Room", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->FairyPot, []{return logic->FairyPot || (logic->CanUse(RG_HOVER_BOOTS) || logic->CanUse(RG_HOOKSHOT));}), + EventAccess(&logic->FairyPot, []{return logic->CanUse(RG_HOVER_BOOTS) || logic->CanUse(RG_HOOKSHOT);}), }, { //Locations LOCATION(RC_FIRE_TEMPLE_NEAR_BOSS_CHEST, true), @@ -67,7 +67,7 @@ void RegionTable_Init_FireTemple() { areaTable[RR_FIRE_TEMPLE_LOOP_HAMMER_SWITCH] = Region("Fire Temple Loop Hammer Switch", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->FireLoopSwitch, []{return logic->FireLoopSwitch || logic->CanUse(RG_MEGATON_HAMMER);}), + EventAccess(&logic->FireLoopSwitch, []{return logic->CanUse(RG_MEGATON_HAMMER);}), }, {}, { //Exits Entrance(RR_FIRE_TEMPLE_LOOP_FLARE_DANCER, []{return true;}), @@ -745,7 +745,7 @@ void RegionTable_Init_FireTemple() { areaTable[RR_FIRE_TEMPLE_BOSS_ROOM] = Region("Fire Temple Boss Room", "Fire Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->FireTempleClear, []{return logic->FireTempleClear || (logic->FireTimer() >= 64 && logic->CanKillEnemy(RE_VOLVAGIA));}), + EventAccess(&logic->FireTempleClear, []{return logic->FireTimer() >= 64 && logic->CanKillEnemy(RE_VOLVAGIA);}), }, { // Locations LOCATION(RC_FIRE_TEMPLE_VOLVAGIA_HEART, logic->FireTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/forest_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/forest_temple.cpp index 2f5ba96bf..a74642324 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/forest_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/forest_temple.cpp @@ -34,7 +34,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_LOBBY] = Region("Forest Temple Lobby", "Forest Temple", {RA_FOREST_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ForestTempleMeg, []{return logic->ForestTempleMeg || (logic->ForestTempleJoelle && logic->ForestTempleBeth && logic->ForestTempleAmy && logic->CanUse(RG_FAIRY_BOW));}), + EventAccess(&logic->ForestTempleMeg, []{return logic->ForestTempleJoelle && logic->ForestTempleBeth && logic->ForestTempleAmy && logic->CanUse(RG_FAIRY_BOW);}), }, { //Locations LOCATION(RC_FOREST_TEMPLE_GS_LOBBY, logic->HookshotOrBoomerang()), @@ -203,7 +203,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_RED_POE_ROOM] = Region("Forest Temple Red Poe Room", "Forest Temple", {RA_FOREST_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ForestTempleJoelle, []{return logic->ForestTempleJoelle || logic->CanUse(RG_FAIRY_BOW);}), + EventAccess(&logic->ForestTempleJoelle, []{return logic->CanUse(RG_FAIRY_BOW);}), }, { //Locations LOCATION(RC_FOREST_TEMPLE_RED_POE_CHEST, logic->ForestTempleJoelle), @@ -228,7 +228,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_BLUE_POE_ROOM] = Region("Forest Temple Blue Poe Room", "Forest Temple", {RA_FOREST_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ForestTempleBeth, []{return logic->ForestTempleBeth || logic->CanUse(RG_FAIRY_BOW);}), + EventAccess(&logic->ForestTempleBeth, []{return logic->CanUse(RG_FAIRY_BOW);}), }, { //Locations LOCATION(RC_FOREST_TEMPLE_BLUE_POE_CHEST, logic->ForestTempleBeth), @@ -274,7 +274,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_GREEN_POE_ROOM] = Region("Forest Temple Green Poe Room", "Forest Temple", {RA_FOREST_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ForestTempleAmy, []{return logic->ForestTempleAmy || logic->CanUse(RG_FAIRY_BOW);}), + EventAccess(&logic->ForestTempleAmy, []{return logic->CanUse(RG_FAIRY_BOW);}), }, { //Locations LOCATION(RC_FOREST_TEMPLE_GREEN_POE_POT_1, logic->CanBreakPots()), @@ -608,7 +608,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_BOSS_ROOM] = Region("Forest Temple Boss Room", "Forest Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->ForestTempleClear, []{return logic->ForestTempleClear || logic->CanKillEnemy(RE_PHANTOM_GANON);}), + EventAccess(&logic->ForestTempleClear, []{return logic->CanKillEnemy(RE_PHANTOM_GANON);}), }, { // Locations LOCATION(RC_FOREST_TEMPLE_PHANTOM_GANON_HEART, logic->ForestTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/ganons_castle.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/ganons_castle.cpp index 451225273..040c10a90 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/ganons_castle.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/ganons_castle.cpp @@ -80,7 +80,7 @@ void RegionTable_Init_GanonsCastle() { areaTable[RR_GANONS_CASTLE_WATER_TRIAL] = Region("Ganon's Castle Water Trial", "Ganon's Castle", {RA_GANONS_CASTLE}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->BlueFireAccess, []{return true;}), - EventAccess(&logic->FairyPot, []{return logic->FairyPot || (logic->BlueFire() && logic->CanKillEnemy(RE_FREEZARD));}), + EventAccess(&logic->FairyPot, []{return logic->BlueFire() && logic->CanKillEnemy(RE_FREEZARD);}), EventAccess(&logic->WaterTrialClear, []{return logic->BlueFire() && logic->IsAdult && logic->CanUse(RG_MEGATON_HAMMER) && logic->CanUse(RG_LIGHT_ARROWS);}), }, { //Locations @@ -109,7 +109,7 @@ void RegionTable_Init_GanonsCastle() { areaTable[RR_GANONS_CASTLE_SPIRIT_TRIAL] = Region("Ganon's Castle Spirit Trial", "Ganon's Castle", {RA_GANONS_CASTLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->NutPot, []{return logic->NutPot || (((ctx->GetTrickOption(RT_GANON_SPIRIT_TRIAL_HOOKSHOT) && logic->CanJumpslashExceptHammer()) || logic->CanUse(RG_HOOKSHOT)) && logic->CanUse(RG_BOMBCHU_5) && logic->CanUse(RG_FAIRY_BOW) && (logic->CanUse(RG_MIRROR_SHIELD) || (ctx->GetOption(RSK_SUNLIGHT_ARROWS) && logic->CanUse(RG_LIGHT_ARROWS))));}), + EventAccess(&logic->NutPot, []{return ((ctx->GetTrickOption(RT_GANON_SPIRIT_TRIAL_HOOKSHOT) && logic->CanJumpslashExceptHammer()) || logic->CanUse(RG_HOOKSHOT)) && logic->CanUse(RG_BOMBCHU_5) && logic->CanUse(RG_FAIRY_BOW) && (logic->CanUse(RG_MIRROR_SHIELD) || (ctx->GetOption(RSK_SUNLIGHT_ARROWS) && logic->CanUse(RG_LIGHT_ARROWS)));}), EventAccess(&logic->SpiritTrialClear, []{return logic->CanUse(RG_LIGHT_ARROWS) && (logic->CanUse(RG_MIRROR_SHIELD) || ctx->GetOption(RSK_SUNLIGHT_ARROWS)) && logic->CanUse(RG_BOMBCHU_5) && ((ctx->GetTrickOption(RT_GANON_SPIRIT_TRIAL_HOOKSHOT) && logic->CanJumpslashExceptHammer()) || logic->CanUse(RG_HOOKSHOT));}), }, { //Locations diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/jabujabus_belly.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/jabujabus_belly.cpp index a43e1b685..bc90e5722 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/jabujabus_belly.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/jabujabus_belly.cpp @@ -361,7 +361,7 @@ void RegionTable_Init_JabuJabusBelly() { areaTable[RR_JABU_JABUS_BELLY_BOSS_ROOM] = Region("Jabu Jabus Belly Boss Room", "Jabu Jabus Belly", {}, NO_DAY_NIGHT_CYCLE, { // Events //todo: add pot kill trick - EventAccess(&logic->JabuJabusBellyClear, []{return logic->JabuJabusBellyClear || logic->CanKillEnemy(RE_BARINADE);}), + EventAccess(&logic->JabuJabusBellyClear, []{return logic->CanKillEnemy(RE_BARINADE);}), }, { // Locations LOCATION(RC_JABU_JABUS_BELLY_BARINADE_POT_1, logic->CanBreakPots()), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/shadow_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/shadow_temple.cpp index 3be1acac4..e7ee515d1 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/shadow_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/shadow_temple.cpp @@ -408,7 +408,7 @@ void RegionTable_Init_ShadowTemple() { areaTable[RR_SHADOW_TEMPLE_BOSS_ROOM] = Region("Shadow Temple Boss Room", "Shadow Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->ShadowTempleClear, []{return logic->ShadowTempleClear || logic->CanKillEnemy(RE_BONGO_BONGO);}), + EventAccess(&logic->ShadowTempleClear, []{return logic->CanKillEnemy(RE_BONGO_BONGO);}), }, { // Locations LOCATION(RC_SHADOW_TEMPLE_BONGO_BONGO_HEART, logic->ShadowTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/spirit_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/spirit_temple.cpp index e7f9c0ee6..c1cf1856f 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/spirit_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/spirit_temple.cpp @@ -556,7 +556,7 @@ void RegionTable_Init_SpiritTemple() { areaTable[RR_SPIRIT_TEMPLE_BOSS_ROOM] = Region("Spirit Temple Boss Room", "Spirit Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->SpiritTempleClear, []{return logic->SpiritTempleClear || logic->CanKillEnemy(RE_TWINROVA);}), + EventAccess(&logic->SpiritTempleClear, []{return logic->CanKillEnemy(RE_TWINROVA);}), }, { // Locations LOCATION(RC_SPIRIT_TEMPLE_TWINROVA_HEART, logic->SpiritTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp index 05efed953..457b3a016 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp @@ -40,7 +40,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_EAST_LOWER] = Region("Water Temple East Lower", "Water Temple", {RA_WATER_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->CanWaterTempleLowFromHigh, []{return logic->CanWaterTempleLowFromHigh || logic->CanUse(RG_ZELDAS_LULLABY);}), + EventAccess(&logic->CanWaterTempleLowFromHigh, []{return logic->CanUse(RG_ZELDAS_LULLABY);}), }, { //Locations LOCATION(RC_WATER_TEMPLE_TORCH_POT_1, logic->CanBreakPots() && (logic->CanWaterTempleLowFromHigh || (logic->CanUse(RG_HOOKSHOT) && logic->CanUse(RG_IRON_BOOTS)))), @@ -165,7 +165,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_CENTRAL_PILLAR_UPPER] = Region("Water Temple Central Pillar Upper", "Water Temple", {RA_WATER_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->CanWaterTempleMiddle, []{return logic->CanWaterTempleMiddle || logic->CanUse(RG_ZELDAS_LULLABY);}), + EventAccess(&logic->CanWaterTempleMiddle, []{return logic->CanUse(RG_ZELDAS_LULLABY);}), }, { //Locations LOCATION(RC_WATER_TEMPLE_GS_CENTRAL_PILLAR, logic->CanUse(RG_LONGSHOT) || (((ctx->GetTrickOption(RT_WATER_FW_CENTRAL_GS) && logic->CanUse(RG_FARORES_WIND) && (logic->CanUse(RG_FAIRY_BOW) || logic->CanUse(RG_DINS_FIRE) || logic->SmallKeys(RR_WATER_TEMPLE, 5))) || (ctx->GetTrickOption(RT_WATER_IRONS_CENTRAL_GS) && logic->CanUse(RG_IRON_BOOTS) && ((logic->CanUse(RG_HOOKSHOT) && logic->CanUse(RG_FAIRY_BOW)) || (logic->CanUse(RG_DINS_FIRE))))) && logic->CanWaterTempleHigh && logic->HookshotOrBoomerang())), @@ -202,7 +202,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_HIGH_WATER] = Region("Water Temple High Water", "Water Temple", {RA_WATER_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->CanWaterTempleHigh, []{return logic->CanWaterTempleHigh || logic->CanUse(RG_ZELDAS_LULLABY);}), + EventAccess(&logic->CanWaterTempleHigh, []{return logic->CanUse(RG_ZELDAS_LULLABY);}), }, {}, { //Exits Entrance(RR_WATER_TEMPLE_LOBBY, []{return true;}), @@ -848,7 +848,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_BOSS_ROOM] = Region("Water Temple Boss Room", "Water Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->WaterTempleClear, []{return logic->WaterTempleClear || logic->CanKillEnemy(RE_MORPHA);}), + EventAccess(&logic->WaterTempleClear, []{return logic->CanKillEnemy(RE_MORPHA);}), }, { // Locations LOCATION(RC_WATER_TEMPLE_MORPHA_HEART, logic->WaterTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/gerudo_fortress.cpp b/soh/soh/Enhancements/randomizer/location_access/gerudo_fortress.cpp index dd95b11fb..20d7817d8 100644 --- a/soh/soh/Enhancements/randomizer/location_access/gerudo_fortress.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/gerudo_fortress.cpp @@ -14,7 +14,7 @@ void RegionTable_Init_GerudoFortress() { //Events EventAccess(&logic->CarpenterRescue, []{return logic->CanFinishGerudoFortress();}), EventAccess(&logic->GF_GateOpen, []{return logic->IsAdult && logic->HasItem(RG_GERUDO_MEMBERSHIP_CARD);}), - EventAccess(&logic->GtG_GateOpen, []{return logic->GtG_GateOpen || (logic->IsAdult && logic->HasItem(RG_GERUDO_MEMBERSHIP_CARD) && logic->HasItem(RG_CHILD_WALLET));}), + EventAccess(&logic->GtG_GateOpen, []{return logic->IsAdult && logic->HasItem(RG_GERUDO_MEMBERSHIP_CARD) && logic->HasItem(RG_CHILD_WALLET);}), }, { //Locations LOCATION(RC_GF_CHEST, logic->CanUse(RG_HOVER_BOOTS) || (logic->IsAdult && logic->CanUse(RG_SCARECROW)) || logic->CanUse(RG_LONGSHOT)), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/castle_grounds.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/castle_grounds.cpp index dbf467b0f..fb9676f50 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/castle_grounds.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/castle_grounds.cpp @@ -17,7 +17,7 @@ void RegionTable_Init_CastleGrounds() { areaTable[RR_HYRULE_CASTLE_GROUNDS] = Region("Hyrule Castle Grounds", "Castle Grounds", {RA_HYRULE_CASTLE}, DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairy();}), - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || logic->CanUse(RG_STICKS);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS);}), EventAccess(&logic->BugRock, []{return true;}), }, { //Locations diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_crater.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_crater.cpp index b05b22c48..29ab7cb41 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_crater.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_crater.cpp @@ -14,7 +14,7 @@ void RegionTable_Init_DeathMountainCrater() { areaTable[RR_DMC_UPPER_LOCAL] = Region("DMC Upper Local", "Death Mountain Crater", {RA_DEATH_MOUNTAIN_CRATER}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->GossipStoneFairy, []{return logic->GossipStoneFairy || (logic->HasExplosives() && logic->CallGossipFairyExceptSuns() && (logic->FireTimer() >= 16 || logic->Hearts() >= 3));}), + EventAccess(&logic->GossipStoneFairy, []{return logic->HasExplosives() && logic->CallGossipFairyExceptSuns() && (logic->FireTimer() >= 16 || logic->Hearts() >= 3);}), }, { //Locations LOCATION(RC_DMC_WALL_FREESTANDING_POH, logic->FireTimer() >= 16 || logic->Hearts() >= 3), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_trail.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_trail.cpp index b9fab96e0..5a0ae001c 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_trail.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_trail.cpp @@ -33,7 +33,7 @@ void RegionTable_Init_DeathMountainTrail() { areaTable[RR_DEATH_MOUNTAIN_SUMMIT] = Region("Death Mountain Summit", "Death Mountain", {RA_DEATH_MOUNTAIN_TRAIL}, DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairy();}), - EventAccess(&logic->BugRock, []{return logic->BugRock || logic->IsChild;}), + EventAccess(&logic->BugRock, []{return logic->IsChild;}), }, { //Locations LOCATION(RC_DMT_TRADE_BROKEN_SWORD, logic->IsAdult && logic->CanUse(RG_BROKEN_SWORD)), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/desert_colossus.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/desert_colossus.cpp index ac0869036..ea0af20c0 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/desert_colossus.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/desert_colossus.cpp @@ -7,7 +7,7 @@ void RegionTable_Init_DesertColossus() { // clang-format off areaTable[RR_DESERT_COLOSSUS] = Region("Desert Colossus", "Desert Colossus", {RA_DESERT_COLOSSUS}, DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->FairyPond, []{return logic->FairyPond || logic->CanUse(RG_SONG_OF_STORMS);}), + EventAccess(&logic->FairyPond, []{return logic->CanUse(RG_SONG_OF_STORMS);}), EventAccess(&logic->BugRock, []{return true;}), }, { //Locations diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/gerudo_valley.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/gerudo_valley.cpp index 86cc1b060..e4e43ac18 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/gerudo_valley.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/gerudo_valley.cpp @@ -7,7 +7,7 @@ void RegionTable_Init_GerudoValley() { // clang-format off areaTable[RR_GERUDO_VALLEY] = Region("Gerudo Valley", "Gerudo Valley", {RA_GERUDO_VALLEY}, DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->BugRock, []{return logic->BugRock || logic->IsChild;}), + EventAccess(&logic->BugRock, []{return logic->IsChild;}), }, { //Locations LOCATION(RC_GV_GS_SMALL_BRIDGE, logic->IsChild && logic->HookshotOrBoomerang() && logic->CanGetNightTimeGS()), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/goron_city.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/goron_city.cpp index 8081757d2..21daeaf21 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/goron_city.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/goron_city.cpp @@ -8,12 +8,12 @@ void RegionTable_Init_GoronCity() { areaTable[RR_GORON_CITY] = Region("Goron City", "Goron City", {RA_GORON_CITY}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairyExceptSuns();}), - EventAccess(&logic->StickPot, []{return logic->StickPot || logic->IsChild;}), - EventAccess(&logic->BugRock, []{return logic->BugRock || (logic->BlastOrSmash() || logic->CanUse(RG_SILVER_GAUNTLETS));}), - EventAccess(&logic->GoronCityChildFire, []{return logic->GoronCityChildFire || (logic->IsChild && logic->CanUse(RG_DINS_FIRE));}), - EventAccess(&logic->GCWoodsWarpOpen, []{return logic->GCWoodsWarpOpen || (logic->BlastOrSmash() || logic->CanUse(RG_DINS_FIRE) || logic->CanUse(RG_FAIRY_BOW) || logic->HasItem(RG_GORONS_BRACELET) || logic->GoronCityChildFire);}), - EventAccess(&logic->GCDaruniasDoorOpenChild, []{return logic->GCDaruniasDoorOpenChild || (logic->IsChild && logic->CanUse(RG_ZELDAS_LULLABY));}), - EventAccess(&logic->StopGCRollingGoronAsAdult, []{return logic->StopGCRollingGoronAsAdult || (logic->IsAdult && (logic->HasItem(RG_GORONS_BRACELET) || logic->HasExplosives() || logic->CanUse(RG_FAIRY_BOW) || (ctx->GetTrickOption(RT_GC_LINK_GORON_DINS) && logic->CanUse(RG_DINS_FIRE))));}), + EventAccess(&logic->StickPot, []{return logic->IsChild;}), + EventAccess(&logic->BugRock, []{return logic->BlastOrSmash() || logic->CanUse(RG_SILVER_GAUNTLETS);}), + EventAccess(&logic->GoronCityChildFire, []{return logic->IsChild && logic->CanUse(RG_DINS_FIRE);}), + EventAccess(&logic->GCWoodsWarpOpen, []{return logic->BlastOrSmash() || logic->CanUse(RG_DINS_FIRE) || logic->CanUse(RG_FAIRY_BOW) || logic->HasItem(RG_GORONS_BRACELET) || logic->GoronCityChildFire;}), + EventAccess(&logic->GCDaruniasDoorOpenChild, []{return logic->IsChild && logic->CanUse(RG_ZELDAS_LULLABY);}), + EventAccess(&logic->StopGCRollingGoronAsAdult, []{return logic->IsAdult && (logic->HasItem(RG_GORONS_BRACELET) || logic->HasExplosives() || logic->CanUse(RG_FAIRY_BOW) || (ctx->GetTrickOption(RT_GC_LINK_GORON_DINS) && logic->CanUse(RG_DINS_FIRE)));}), }, { //Locations LOCATION(RC_GC_MAZE_LEFT_CHEST, logic->CanUse(RG_MEGATON_HAMMER) || logic->CanUse(RG_SILVER_GAUNTLETS) || (ctx->GetTrickOption(RT_GC_LEFTMOST) && logic->HasExplosives() && logic->CanUse(RG_HOVER_BOOTS))), @@ -58,7 +58,7 @@ void RegionTable_Init_GoronCity() { areaTable[RR_GC_WOODS_WARP] = Region("GC Woods Warp", "Goron City", {RA_GORON_CITY}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->GCWoodsWarpOpen, []{return logic->GCWoodsWarpOpen || (logic->BlastOrSmash() || logic->CanUse(RG_DINS_FIRE));}), + EventAccess(&logic->GCWoodsWarpOpen, []{return logic->BlastOrSmash() || logic->CanUse(RG_DINS_FIRE);}), }, {}, { //Exits Entrance(RR_GORON_CITY, []{return logic->CanLeaveForest() && logic->GCWoodsWarpOpen;}), @@ -67,7 +67,7 @@ void RegionTable_Init_GoronCity() { areaTable[RR_GC_DARUNIAS_CHAMBER] = Region("GC Darunias Chamber", "Goron City", {RA_GORON_CITY}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->GoronCityChildFire, []{return logic->GoronCityChildFire || (logic->IsChild && logic->CanUse(RG_STICKS));}), + EventAccess(&logic->GoronCityChildFire, []{return logic->IsChild && logic->CanUse(RG_STICKS);}), }, { //Locations LOCATION(RC_GC_DARUNIAS_JOY, logic->IsChild && logic->CanUse(RG_SARIAS_SONG)), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/graveyard.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/graveyard.cpp index 012503d9a..046b5334c 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/graveyard.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/graveyard.cpp @@ -7,7 +7,7 @@ void RegionTable_Init_Graveyard() { // clang-format off areaTable[RR_THE_GRAVEYARD] = Region("The Graveyard", "The Graveyard", {RA_THE_GRAVEYARD}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || (logic->CanUse(RG_STICKS) && logic->AtDay);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS) && logic->AtDay;}), EventAccess(&logic->BeanPlantFairy, []{return logic->IsChild && logic->CanUse(RG_MAGIC_BEAN) && logic->CanUse(RG_SONG_OF_STORMS);}), EventAccess(&logic->BugRock, []{return true;}), }, { @@ -88,7 +88,7 @@ void RegionTable_Init_Graveyard() { areaTable[RR_GRAVEYARD_DAMPES_GRAVE] = Region("Graveyard Dampes Grave", "Windmill and Dampes Grave", {}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->NutPot, []{return true;}), - EventAccess(&logic->DampesWindmillAccess, []{return logic->DampesWindmillAccess || (logic->IsAdult && logic->CanUse(RG_SONG_OF_TIME));}), + EventAccess(&logic->DampesWindmillAccess, []{return logic->IsAdult && logic->CanUse(RG_SONG_OF_TIME);}), }, { //Locations LOCATION(RC_GRAVEYARD_HOOKSHOT_CHEST, true), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp index 777e29050..056767cee 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp @@ -166,7 +166,7 @@ void RegionTable_Init_Kakariko() { areaTable[RR_KAK_WINDMILL] = Region("Kak Windmill", "Windmill and Dampes Grave", {}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->DrainWell, []{return logic->DrainWell || (logic->IsChild && logic->CanUse(RG_SONG_OF_STORMS));}), + EventAccess(&logic->DrainWell, []{return logic->IsChild && logic->CanUse(RG_SONG_OF_STORMS);}), }, { //Locations LOCATION(RC_KAK_WINDMILL_FREESTANDING_POH, logic->CanUse(RG_BOOMERANG) || logic->DampesWindmillAccess || (logic->IsAdult && ctx->GetTrickOption(RT_KAK_ADULT_WINDMILL_POH)) || (logic->IsChild && logic->CanJumpslashExceptHammer() && ctx->GetTrickOption(RT_KAK_CHILD_WINDMILL_POH))), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp index 80df2bb91..06bdcc268 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp @@ -9,7 +9,7 @@ void RegionTable_Init_KokiriForest() { //Events EventAccess(&logic->BeanPlantFairy, []{return logic->IsChild && logic->CanUse(RG_MAGIC_BEAN) && logic->CanUse(RG_SONG_OF_STORMS);}), EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairyExceptSuns();}), - EventAccess(&logic->ShowedMidoSwordAndShield, []{return logic->ShowedMidoSwordAndShield || (logic->IsChild && logic->CanUse(RG_KOKIRI_SWORD) && logic->CanUse(RG_DEKU_SHIELD));}), + EventAccess(&logic->ShowedMidoSwordAndShield, []{return logic->IsChild && logic->CanUse(RG_KOKIRI_SWORD) && logic->CanUse(RG_DEKU_SHIELD);}), }, { //Locations LOCATION(RC_KF_KOKIRI_SWORD_CHEST, logic->IsChild), @@ -93,7 +93,7 @@ void RegionTable_Init_KokiriForest() { //Events EventAccess(&logic->DekuBabaSticks, []{return logic->CanGetDekuBabaSticks();}), EventAccess(&logic->DekuBabaNuts, []{return logic->CanGetDekuBabaNuts();}), - EventAccess(&logic->ShowedMidoSwordAndShield, []{return logic->ShowedMidoSwordAndShield || (logic->IsChild && logic->CanUse(RG_KOKIRI_SWORD) && logic->CanUse(RG_DEKU_SHIELD));}), + EventAccess(&logic->ShowedMidoSwordAndShield, []{return logic->IsChild && logic->CanUse(RG_KOKIRI_SWORD) && logic->CanUse(RG_DEKU_SHIELD);}), }, { //Locations LOCATION(RC_KF_DEKU_TREE_LEFT_GOSSIP_STONE_FAIRY, logic->CallGossipFairyExceptSuns()), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/lake_hylia.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/lake_hylia.cpp index 36d3ee1a3..364dc074b 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/lake_hylia.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/lake_hylia.cpp @@ -9,10 +9,10 @@ void RegionTable_Init_LakeHylia() { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairy();}), EventAccess(&logic->BeanPlantFairy, []{return logic->IsChild && logic->CanUse(RG_MAGIC_BEAN) && logic->CanUse(RG_SONG_OF_STORMS);}), - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || logic->CanUse(RG_STICKS);}), - EventAccess(&logic->BugShrub, []{return logic->BugShrub || (logic->IsChild && logic->CanCutShrubs());}), - EventAccess(&logic->ChildScarecrow, []{return logic->ChildScarecrow || (logic->IsChild && logic->HasItem(RG_FAIRY_OCARINA) && logic->OcarinaButtons() >= 2);}), - EventAccess(&logic->AdultScarecrow, []{return logic->AdultScarecrow || (logic->IsAdult && logic->HasItem(RG_FAIRY_OCARINA) && logic->OcarinaButtons() >= 2);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS);}), + EventAccess(&logic->BugShrub, []{return logic->IsChild && logic->CanCutShrubs();}), + EventAccess(&logic->ChildScarecrow, []{return logic->IsChild && logic->HasItem(RG_FAIRY_OCARINA) && logic->OcarinaButtons() >= 2;}), + EventAccess(&logic->AdultScarecrow, []{return logic->IsAdult && logic->HasItem(RG_FAIRY_OCARINA) && logic->OcarinaButtons() >= 2;}), }, { //Locations LOCATION(RC_LH_UNDERWATER_ITEM, logic->IsChild && logic->HasItem(RG_SILVER_SCALE)), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/lon_lon_ranch.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/lon_lon_ranch.cpp index fae41664e..0d5e90c70 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/lon_lon_ranch.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/lon_lon_ranch.cpp @@ -7,8 +7,8 @@ void RegionTable_Init_LonLonRanch() { // clang-format off areaTable[RR_LON_LON_RANCH] = Region("Lon Lon Ranch", "Lon Lon Ranch", {RA_LON_LON_RANCH}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->FreedEpona, []{return logic->FreedEpona || ((logic->HasItem(RG_CHILD_WALLET) || ctx->GetOption(RSK_SKIP_EPONA_RACE)) && logic->CanUse(RG_EPONAS_SONG) && logic->IsAdult && logic->AtDay);}), - EventAccess(&logic->LinksCow, []{return logic->LinksCow || (logic->HasItem(RG_CHILD_WALLET) && logic->CanUse(RG_EPONAS_SONG) && logic->IsAdult && logic->AtDay);}), + EventAccess(&logic->FreedEpona, []{return (logic->HasItem(RG_CHILD_WALLET) || ctx->GetOption(RSK_SKIP_EPONA_RACE)) && logic->CanUse(RG_EPONAS_SONG) && logic->IsAdult && logic->AtDay;}), + EventAccess(&logic->LinksCow, []{return logic->HasItem(RG_CHILD_WALLET) && logic->CanUse(RG_EPONAS_SONG) && logic->IsAdult && logic->AtDay;}), }, { //Locations LOCATION(RC_SONG_FROM_MALON, logic->IsChild && logic->HasItem(RG_ZELDAS_LETTER) && logic->HasItem(RG_FAIRY_OCARINA) && logic->AtDay), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp index 812b33a55..569cbf3e6 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp @@ -64,7 +64,7 @@ void RegionTable_Init_LostWoods() { areaTable[RR_LW_BEYOND_MIDO] = Region("LW Beyond Mido", "Lost Woods", {RA_THE_LOST_WOODS}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || logic->CanUse(RG_STICKS);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS);}), }, { //Locations LOCATION(RC_LW_DEKU_SCRUB_NEAR_DEKU_THEATER_RIGHT, logic->IsChild && logic->CanStunDeku()), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp index 0314bfde0..a96f5b37a 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp @@ -138,8 +138,8 @@ void RegionTable_Init_Market() { areaTable[RR_MARKET_MASK_SHOP] = Region("Market Mask Shop", "Market Mask Shop", {}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->SkullMask, []{return logic->SkullMask || (logic->HasItem(RG_ZELDAS_LETTER) && (ctx->GetOption(RSK_COMPLETE_MASK_QUEST) || ChildCanAccess(RR_KAKARIKO_VILLAGE)));}), //RANDOTODO Complete mask quest does not need this location, so should be tied to link's pocket - EventAccess(&logic->MaskOfTruth, []{return logic->MaskOfTruth || (logic->SkullMask && (ctx->GetOption(RSK_COMPLETE_MASK_QUEST) || (ChildCanAccess(RR_THE_LOST_WOODS) && logic->CanUse(RG_SARIAS_SONG) && RegionTable(RR_THE_GRAVEYARD)->childDay && ChildCanAccess(RR_HYRULE_FIELD) && logic->StoneCount() == 3)));}), + EventAccess(&logic->SkullMask, []{return logic->HasItem(RG_ZELDAS_LETTER) && (ctx->GetOption(RSK_COMPLETE_MASK_QUEST) || ChildCanAccess(RR_KAKARIKO_VILLAGE));}), //RANDOTODO Complete mask quest does not need this location, so should be tied to link's pocket + EventAccess(&logic->MaskOfTruth, []{return logic->SkullMask && (ctx->GetOption(RSK_COMPLETE_MASK_QUEST) || (ChildCanAccess(RR_THE_LOST_WOODS) && logic->CanUse(RG_SARIAS_SONG) && RegionTable(RR_THE_GRAVEYARD)->childDay && ChildCanAccess(RR_HYRULE_FIELD) && logic->StoneCount() == 3));}), }, { //Locations LOCATION(RC_MASK_SHOP_HINT, true), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_domain.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_domain.cpp index 3bee82b26..2e75be23a 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_domain.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_domain.cpp @@ -9,10 +9,10 @@ void RegionTable_Init_ZorasDomain() { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairyExceptSuns();}), EventAccess(&logic->NutPot, []{return true;}), - EventAccess(&logic->StickPot, []{return logic->StickPot || logic->IsChild;}), - EventAccess(&logic->FishGroup, []{return logic->FishGroup || logic->IsChild;}), - EventAccess(&logic->KingZoraThawed, []{return logic->KingZoraThawed || (logic->IsAdult && logic->BlueFire());}), - EventAccess(&logic->DeliverLetter, []{return logic->DeliverLetter || (logic->CanUse(RG_RUTOS_LETTER) && logic->IsChild && ctx->GetOption(RSK_ZORAS_FOUNTAIN).IsNot(RO_ZF_OPEN));}), + EventAccess(&logic->StickPot, []{return logic->IsChild;}), + EventAccess(&logic->FishGroup, []{return logic->IsChild;}), + EventAccess(&logic->KingZoraThawed, []{return logic->IsAdult && logic->BlueFire();}), + EventAccess(&logic->DeliverLetter, []{return logic->CanUse(RG_RUTOS_LETTER) && logic->IsChild && ctx->GetOption(RSK_ZORAS_FOUNTAIN).IsNot(RO_ZF_OPEN);}), }, { //Locations LOCATION(RC_ZD_DIVING_MINIGAME, logic->HasItem(RG_BRONZE_SCALE) && logic->HasItem(RG_CHILD_WALLET) && logic->IsChild), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_fountain.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_fountain.cpp index 3ac0921a3..9ab099625 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_fountain.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_fountain.cpp @@ -8,7 +8,7 @@ void RegionTable_Init_ZorasFountain() { areaTable[RR_ZORAS_FOUNTAIN] = Region("Zoras Fountain", "Zoras Fountain", {RA_ZORAS_FOUNTAIN}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairyExceptSuns();}), - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || (logic->CanUse(RG_STICKS) && logic->AtDay);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS) && logic->AtDay;}), }, { //Locations LOCATION(RC_ZF_GS_TREE, logic->IsChild), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_river.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_river.cpp index 3fbf8bdbd..212c61c70 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_river.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_river.cpp @@ -30,8 +30,8 @@ void RegionTable_Init_ZoraRiver() { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairy();}), EventAccess(&logic->BeanPlantFairy, []{return logic->IsChild && logic->CanUse(RG_MAGIC_BEAN) && logic->CanUse(RG_SONG_OF_STORMS);}), - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || logic->CanUse(RG_STICKS);}), - EventAccess(&logic->BugShrub, []{return logic->BugShrub || logic->CanCutShrubs();}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS);}), + EventAccess(&logic->BugShrub, []{return logic->CanCutShrubs();}), }, { //Locations LOCATION(RC_ZR_MAGIC_BEAN_SALESMAN, logic->HasItem(RG_CHILD_WALLET) && logic->IsChild), From 45d9fe54d214c9cfaf287578ad70a6e9e1b93fc3 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Tue, 13 May 2025 19:30:04 -0700 Subject: [PATCH 20/44] Warnings Squashing Round 1 (#5469) * Fix truncation warning in `entrance.h`. * Fix type warning in fishsanity.cpp * Fix implicit conversion warnings in BossRush, Mouse, and UIWidgets.hpp. * Add Random_Float and use it in GameInteractor_RawAction.cpp. Make non-specified seed init a separate function. * clang after type change * Fix truncation and conversion warnings in ExtraTraps.cpp. * Resolve type conversion warnings in InputViewer.cpp. * Resolve some type conversion warnings in hook_handlers.cpp. * Remove `Random_Float`, and apply `RandomDouble` where it was being used instead. Add proper range notation to `RandomDouble` to denote the lack of inclusivity for the max part of the range. * Convert c-style casts to static_cast. --- soh/soh/Enhancements/ExtraTraps.cpp | 16 ++++----- soh/soh/Enhancements/boss-rush/BossRush.cpp | 5 +-- soh/soh/Enhancements/controls/InputViewer.cpp | 6 ++-- soh/soh/Enhancements/controls/Mouse.cpp | 20 +++++------ .../GameInteractor_RawAction.cpp | 6 ++-- .../randomizer/3drando/random.cpp | 10 ++++-- .../randomizer/3drando/random.hpp | 18 +++++----- soh/soh/Enhancements/randomizer/entrance.h | 2 +- .../Enhancements/randomizer/fishsanity.cpp | 5 +-- .../Enhancements/randomizer/hook_handlers.cpp | 35 ++++++++++--------- soh/soh/SohGui/UIWidgets.hpp | 8 ++--- 11 files changed, 69 insertions(+), 62 deletions(-) diff --git a/soh/soh/Enhancements/ExtraTraps.cpp b/soh/soh/Enhancements/ExtraTraps.cpp index 92806bacc..e88a8f1fe 100644 --- a/soh/soh/Enhancements/ExtraTraps.cpp +++ b/soh/soh/Enhancements/ExtraTraps.cpp @@ -61,8 +61,8 @@ std::vector getEnabledAddTraps() { }; static void RollRandomTrap(uint32_t seed) { - uint32_t finalSeed = - seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSeed() : gSaveContext.ship.stats.fileCreatedAt); + uint32_t finalSeed = seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSeed() + : static_cast(gSaveContext.ship.stats.fileCreatedAt)); Random_Init(finalSeed); roll = RandomElement(getEnabledAddTraps()); @@ -126,12 +126,12 @@ static void OnPlayerUpdate() { Play_TriggerRespawn(gPlayState); break; case ADD_AMMO_TRAP: - AMMO(ITEM_STICK) = AMMO(ITEM_STICK) * 0.5; - AMMO(ITEM_NUT) = AMMO(ITEM_NUT) * 0.5; - AMMO(ITEM_SLINGSHOT) = AMMO(ITEM_SLINGSHOT) * 0.5; - AMMO(ITEM_BOW) = AMMO(ITEM_BOW) * 0.5; - AMMO(ITEM_BOMB) = AMMO(ITEM_BOMB) * 0.5; - AMMO(ITEM_BOMBCHU) = AMMO(ITEM_BOMBCHU) * 0.5; + AMMO(ITEM_STICK) = static_cast(floor(AMMO(ITEM_STICK) * 0.5f)); + AMMO(ITEM_NUT) = static_cast(floor(AMMO(ITEM_NUT) * 0.5f)); + AMMO(ITEM_SLINGSHOT) = static_cast(floor(AMMO(ITEM_SLINGSHOT) * 0.5f)); + AMMO(ITEM_BOW) = static_cast(floor(AMMO(ITEM_BOW) * 0.5f)); + AMMO(ITEM_BOMB) = static_cast(floor(AMMO(ITEM_BOMB) * 0.5f)); + AMMO(ITEM_BOMBCHU) = static_cast(floor(AMMO(ITEM_BOMBCHU) * 0.5f)); Audio_PlaySoundGeneral(NA_SE_VO_FR_SMILE_0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); break; diff --git a/soh/soh/Enhancements/boss-rush/BossRush.cpp b/soh/soh/Enhancements/boss-rush/BossRush.cpp index 76cf5637e..979f0ad6a 100644 --- a/soh/soh/Enhancements/boss-rush/BossRush.cpp +++ b/soh/soh/Enhancements/boss-rush/BossRush.cpp @@ -111,7 +111,7 @@ const char* BossRush_GetSettingChoiceName(u8 optionIndex, u8 choiceIndex, u8 lan } u8 BossRush_GetSettingOptionsAmount(u8 optionIndex) { - return BossRushOptions[optionIndex].choices.size(); + return static_cast(BossRushOptions[optionIndex].choices.size()); } void BossRush_SpawnBlueWarps(PlayState* play) { @@ -311,7 +311,8 @@ void BossRush_HandleCompleteBoss(PlayState* play) { play->sceneNum == SCENE_GANON_BOSS) { gSaveContext.ship.stats.playTimer += 2; gSaveContext.ship.stats.gameComplete = 1; - gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_BOSSRUSH_FINISH] = GAMEPLAYSTAT_TOTAL_TIME; + gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_BOSSRUSH_FINISH] = + static_cast(GAMEPLAYSTAT_TOTAL_TIME); } } diff --git a/soh/soh/Enhancements/controls/InputViewer.cpp b/soh/soh/Enhancements/controls/InputViewer.cpp index 1d6695d25..5df02f5da 100644 --- a/soh/soh/Enhancements/controls/InputViewer.cpp +++ b/soh/soh/Enhancements/controls/InputViewer.cpp @@ -345,7 +345,7 @@ void InputViewer::DrawElement() { // Analog Stick const int analogOutlineMode = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.OutlineMode"), STICK_MODE_ALWAYS_SHOWN); - const float maxStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.Movement"), 12); + const int32_t maxStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.Movement"), 12); if (analogOutlineMode == STICK_MODE_ALWAYS_SHOWN || (analogOutlineMode == STICK_MODE_HIDDEN_IN_DEADZONE && !analogStickIsInDeadzone)) { ImGui::SetNextItemAllowOverlap(); @@ -367,7 +367,7 @@ void InputViewer::DrawElement() { } // Right Stick - const float maxRightStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.Movement"), 7); + const int32_t maxRightStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.Movement"), 7); const int rightOutlineMode = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.OutlineMode"), STICK_MODE_ALWAYS_HIDDEN); if (rightOutlineMode == STICK_MODE_ALWAYS_SHOWN || @@ -401,7 +401,7 @@ void InputViewer::DrawElement() { ImGui::PushFont(ImGui::GetFont()); // Calculate polar R coordinate from X and Y angles, squared to avoid sqrt - const float rSquared = pads[0].stick_x * pads[0].stick_x + pads[0].stick_y * pads[0].stick_y; + const int32_t rSquared = pads[0].stick_x * pads[0].stick_x + pads[0].stick_y * pads[0].stick_y; // ESS range const int range1Min = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Min"), 8); diff --git a/soh/soh/Enhancements/controls/Mouse.cpp b/soh/soh/Enhancements/controls/Mouse.cpp index 4282c3718..4ad9d11d0 100644 --- a/soh/soh/Enhancements/controls/Mouse.cpp +++ b/soh/soh/Enhancements/controls/Mouse.cpp @@ -50,8 +50,8 @@ void Mouse_HandleFirstPerson(Player* player) { : 1; s8 invertYAxisMulti = CVarGetInteger(CVAR_SETTING("Controls.InvertAimingYAxis"), 1) ? 1 : -1; if (MOUSE_ENABLED) { - player->actor.focus.rot.y -= mouseCoordRel.x * 6.0f * xAxisMulti * invertXAxisMulti; - player->actor.focus.rot.x += mouseCoordRel.y * 6.0f * yAxisMulti * invertYAxisMulti; + player->actor.focus.rot.y -= static_cast(mouseCoordRel.x * 6.0f * xAxisMulti * invertXAxisMulti); + player->actor.focus.rot.x += static_cast(mouseCoordRel.y * 6.0f * yAxisMulti * invertYAxisMulti); } } @@ -59,7 +59,7 @@ void Mouse_RecenterCursor() { u32 width = GetWindow()->GetWidth(); u32 height = GetWindow()->GetHeight(); if (MOUSE_ENABLED) { - GetWindow()->SetMousePos({ (s32)(width / 2), (s32)(height / 2) }); + GetWindow()->SetMousePos({ static_cast(width / 2), static_cast(height / 2) }); } } @@ -67,8 +67,8 @@ void Mouse_HandleShield(f32* sp50, f32* sp54) { if (MOUSE_ENABLED) { s32 width = GetWindow()->GetWidth(); s32 height = GetWindow()->GetHeight(); - f32 xBound = 7200 / ((f32)width / 2); - f32 yBound = 6000 / ((f32)height / 2); + f32 xBound = 7200 / (width / 2.0f); + f32 yBound = 6000 / (height / 2.0f); *sp50 += (mouseCoord.x - (width / 2)) * xBound * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? 1 : -1); *sp54 += (mouseCoord.y - (height / 2)) * yBound; @@ -78,8 +78,8 @@ void Mouse_HandleShield(f32* sp50, f32* sp54) { } static s8 iterMouse = 0; -static f32 mouseQuickspinX[5] = {}; -static f32 mouseQuickspinY[5] = {}; +static s32 mouseQuickspinX[5] = {}; +static s32 mouseQuickspinY[5] = {}; static u8 quickspinCount = 0; void Mouse_UpdateQuickspinCount() { @@ -102,9 +102,9 @@ bool Mouse_HandleQuickspin(bool* should, s8* iter2, s8* sp3C) { for (i = 0; i < 4; i++, iter2++) { // Calculating angles as per z_lib.c:func_80077D10() - f32 relY = mouseQuickspinY[i + 1] - mouseQuickspinY[i]; - f32 relX = mouseQuickspinX[i + 1] - mouseQuickspinX[i]; - s16 aTan = Math_Atan2S(relY, -relX); + s32 relY = mouseQuickspinY[i + 1] - mouseQuickspinY[i]; + s32 relX = mouseQuickspinX[i + 1] - mouseQuickspinX[i]; + s16 aTan = Math_Atan2S((f32)relY, (f32)-relX); iterMouse = (u16)(aTan + 0x2000) >> 9; // See z_player.c:Player_ProcessControlStick() if ((*iter2 = iterMouse) < 0) { return *should = false; diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp index ac99859b5..779b37981 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp @@ -112,7 +112,7 @@ void GameInteractor::RawAction::FreezePlayer() { void GameInteractor::RawAction::BurnPlayer() { Player* player = GET_PLAYER(gPlayState); for (int i = 0; i < 18; i++) { - player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); + player->bodyFlameTimers[i] = static_cast(Rand_S16Offset(0, 200)); } player->bodyIsBurning = true; func_80837C0C(gPlayState, player, 0, 0, 0, 0, 0); @@ -559,7 +559,7 @@ void GameInteractor::RawAction::SetRandomWind(bool active) { GameInteractor::State::RandomWindActive = 0; GameInteractor::State::RandomWindSecondsSinceLastDirectionChange = 0; player->pushedSpeed = 0.0f; - player->pushedYaw = 0.0f; + player->pushedYaw = 0; } } @@ -617,7 +617,7 @@ GameInteractionEffectQueryResult GameInteractor::RawAction::SpawnEnemyWithOffset } // Generate point in random angle with a radius. - float angle = Random(0, 2 * M_PI); + float angle = static_cast(RandomDouble() * 2 * M_PI); float radius = 150; float posXOffset = radius * cos(angle); float posZOffset = radius * sin(angle); diff --git a/soh/soh/Enhancements/randomizer/3drando/random.cpp b/soh/soh/Enhancements/randomizer/3drando/random.cpp index f2599da94..97e57dbec 100644 --- a/soh/soh/Enhancements/randomizer/3drando/random.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/random.cpp @@ -14,8 +14,7 @@ void Random_Init(uint32_t seed) { generator = boost::random::mt19937{ seed }; } -// Returns a random integer in range [min, max-1] -uint32_t Random(int min, int max) { +void Random_InitSeed() { if (!init) { // No seed given, get a random number from device to seed #if !defined(__SWITCH__) && !defined(__WIIU__) @@ -25,11 +24,16 @@ uint32_t Random(int min, int max) { #endif Random_Init(seed); } +} + +// Returns a random unsigned integer in range [min, max-1] +uint32_t Random(uint32_t min, uint32_t max) { + Random_InitSeed(); boost::random::uniform_int_distribution distribution(min, max - 1); return distribution(generator); } -// Returns a random floating point number in [0.0, 1.0] +// Returns a random floating point number in [0.0, 1.0) double RandomDouble() { boost::random::uniform_real_distribution distribution(0.0, 1.0); return distribution(generator); diff --git a/soh/soh/Enhancements/randomizer/3drando/random.hpp b/soh/soh/Enhancements/randomizer/3drando/random.hpp index cc519d5f9..2d9ffa6f1 100644 --- a/soh/soh/Enhancements/randomizer/3drando/random.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/random.hpp @@ -8,7 +8,7 @@ #include void Random_Init(uint32_t seed); -uint32_t Random(int min, int max); +uint32_t Random(uint32_t min, uint32_t max); double RandomDouble(); // Get a random element from a vector or array @@ -21,17 +21,17 @@ template T RandomElement(std::vector& vector, bool erase) { return selected; } template auto& RandomElement(Container& container) { - return container[Random(0, std::size(container))]; + return container[Random(0, static_cast(std::size(container)))]; } template const auto& RandomElement(const Container& container) { - return container[Random(0, std::size(container))]; + return container[Random(0, static_cast(std::size(container)))]; } template const T RandomElementFromSet(const std::set& set) { if (set.size() == 1) { return *set.begin(); } - uint32_t rand = Random(0, set.size()); + uint32_t rand = Random(0, static_cast(set.size())); auto it = set.begin(); for (uint32_t i = 0; i < rand; i++) { it++; @@ -43,12 +43,12 @@ template const T RandomElementFromSet(const std::set& set) { // Shuffle items within a vector or array // RANDOTODO There's probably a more efficient way to do what this does. template void Shuffle(std::vector& vector) { - for (std::size_t i = 0; i + 1 < vector.size(); i++) { - std::swap(vector[i], vector[Random(i, vector.size())]); + for (size_t i = 0; i + 1 < vector.size(); i++) { + std::swap(vector[i], vector[Random(static_cast(i), static_cast(vector.size()))]); } } -template void Shuffle(std::array& arr) { - for (std::size_t i = 0; i + 1 < arr.size(); i++) { - std::swap(arr[i], arr[Random(i, arr.size())]); +template void Shuffle(std::array& arr) { + for (size_t i = 0; i + 1 < arr.size(); i++) { + std::swap(arr[i], arr[Random(static_cast(i), static_cast(arr.size()))]); } } diff --git a/soh/soh/Enhancements/randomizer/entrance.h b/soh/soh/Enhancements/randomizer/entrance.h index 026da7426..8fc192ca1 100644 --- a/soh/soh/Enhancements/randomizer/entrance.h +++ b/soh/soh/Enhancements/randomizer/entrance.h @@ -90,7 +90,7 @@ class Entrance { Entrance* reverse = nullptr; Entrance* assumed = nullptr; Entrance* replacement = nullptr; - int16_t index = 0xFFFF; + int16_t index = -1; bool shuffled = false; bool primary = false; bool addedToPool = false; diff --git a/soh/soh/Enhancements/randomizer/fishsanity.cpp b/soh/soh/Enhancements/randomizer/fishsanity.cpp index 99636d1a4..1b7eb7b92 100644 --- a/soh/soh/Enhancements/randomizer/fishsanity.cpp +++ b/soh/soh/Enhancements/randomizer/fishsanity.cpp @@ -136,8 +136,9 @@ Fishsanity::GetFishingPondLocations(FishsanityOptionsSource optionsSource) { } // NOTE: This only works because we can assume activeFish is already sorted; changes that break this assumption will // also break this - FilterAndEraseFromPool(remainingFish, - [&](uint32_t loc) { return std::binary_search(activeFish.begin(), activeFish.end(), loc); }); + FilterAndEraseFromPool(remainingFish, [&](RandomizerCheck loc) { + return std::binary_search(activeFish.begin(), activeFish.end(), loc); + }); return std::make_pair(activeFish, remainingFish); } diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index bd267aebe..9c0d1a5e3 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -328,7 +328,7 @@ void RandomizerOnPlayerUpdateForRCQueueHandler() { (getItemEntry.getItemCategory == ITEM_CATEGORY_JUNK || getItemEntry.getItemCategory == ITEM_CATEGORY_SKULLTULA_TOKEN || getItemEntry.getItemCategory == ITEM_CATEGORY_LESSER))))) { - Item_DropCollectible(gPlayState, &spawnPos, ITEM00_SOH_GIVE_ITEM_ENTRY | 0x8000); + Item_DropCollectible(gPlayState, &spawnPos, static_cast(ITEM00_SOH_GIVE_ITEM_ENTRY | 0x8000)); } } @@ -2157,7 +2157,7 @@ void RandomizerOnGameFrameUpdateHandler() { } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER)) { - gSaveContext.magic = gSaveContext.magicCapacity; + gSaveContext.magic = static_cast(gSaveContext.magicCapacity); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BOMBCHUS)) { @@ -2203,7 +2203,8 @@ void RandomizerOnActorUpdateHandler(void* refActor) { if (actor->id == ACTOR_OBJ_COMB) { ObjComb* combActor = reinterpret_cast(actor); combActor->actor.shape.rot.x = - Math_SinS(combActor->unk_1B2) * CLAMP_MIN(combActor->unk_1B0, 0) + combActor->actor.home.rot.x; + static_cast(Math_SinS(combActor->unk_1B2)) * CLAMP_MIN(combActor->unk_1B0, 0) + + combActor->actor.home.rot.x; } } @@ -2216,29 +2217,29 @@ typedef struct { // special respawns used when voided out without swim to prevent infinite loops std::map swimSpecialRespawnInfo = { { ENTR_ZORAS_RIVER_3, // hf to zr in water - { { -1455.443, -20, 1384.826 }, 28761 } }, + { { -1455.443f, -20.0f, 1384.826f }, 28761 } }, { ENTR_HYRULE_FIELD_14, // zr to hf in water - { { 5730.209, -20, 3725.911 }, -20025 } }, + { { 5730.209f, -20.0f, 3725.911f }, -20025 } }, { ENTR_LOST_WOODS_UNDERWATER_SHORTCUT, // zr to lw - { { 1978.718, -36.908, -855 }, -16384 } }, + { { 1978.718f, -36.908f, -855.0f }, -16384 } }, { ENTR_ZORAS_RIVER_UNDERWATER_SHORTCUT, // lw to zr - { { 4082.366, 860.442, -1018.949 }, -32768 } }, + { { 4082.366f, 860.442f, -1018.949f }, -32768 } }, { ENTR_LAKE_HYLIA_RIVER_EXIT, // gv to lh - { { -3276.416, -1033, 2908.421 }, 11228 } }, + { { -3276.416f, -1033.0f, 2908.421f }, 11228 } }, { ENTR_WATER_TEMPLE_ENTRANCE, // lh to water temple - { { -182, 780, 759.5 }, -32768 } }, + { { -182.0f, 780.0f, 759.5f }, -32768 } }, { ENTR_LAKE_HYLIA_OUTSIDE_TEMPLE, // water temple to lh - { { -955.028, -1306.9, 6768.954 }, -32768 } }, + { { -955.028f, -1306.9f, 6768.954f }, -32768 } }, { ENTR_ZORAS_DOMAIN_UNDERWATER_SHORTCUT, // lh to zd - { { -109.86, 11.396, -9.933 }, -29131 } }, + { { -109.86f, 11.396f, -9.933f }, -29131 } }, { ENTR_LAKE_HYLIA_UNDERWATER_SHORTCUT, // zd to lh - { { -912, -1326.967, 3391 }, 0 } }, + { { -912.0f, -1326.967f, 3391.0f }, 0 } }, { ENTR_GERUDO_VALLEY_1, // caught by gerudos as child - { { -424, -2051, -74 }, 16384 } }, + { { -424.0f, -2051.0f, -74.0f }, 16384 } }, { ENTR_HYRULE_FIELD_ON_BRIDGE_SPAWN, // mk to hf (can be a problem when it then turns night) - { { 0, 0, 1100 }, 0 } }, + { { 0.0f, 0.0f, 1100.0f }, 0 } }, { ENTR_ZORAS_FOUNTAIN_JABU_JABU_BLUE_WARP, // jabu blue warp to zf - { { -1580, 150, 1670 }, 8000 } }, + { { -1580.0f, 150.0f, 1670.0f }, 8000 } }, }; f32 triforcePieceScale; @@ -2298,8 +2299,8 @@ void RandomizerOnSceneSpawnActorsHandler() { switch (gPlayState->sceneNum) { case SCENE_TEMPLE_OF_TIME: if (gPlayState->roomCtx.curRoom.num == 1) { - Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_XC, -104, -40, 2382, 0, 0x8000, 0, - SHEIK_TYPE_RANDO, false); + Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_XC, -104, -40, 2382, 0, + static_cast(0x8000), 0, SHEIK_TYPE_RANDO, false); } break; case SCENE_INSIDE_GANONS_CASTLE: diff --git a/soh/soh/SohGui/UIWidgets.hpp b/soh/soh/SohGui/UIWidgets.hpp index 2382bb7f6..0008b4cfa 100644 --- a/soh/soh/SohGui/UIWidgets.hpp +++ b/soh/soh/SohGui/UIWidgets.hpp @@ -606,9 +606,9 @@ bool Combobox(const char* label, T* value, const std::vector& combo PushStyleCombobox(options.color); const char* longest; - int length = 0; + size_t length = 0; for (auto& string : comboVector) { - int len = strlen(string); + size_t len = strlen(string); if (len > length) { longest = string; length = len; @@ -690,9 +690,9 @@ bool Combobox(const char* label, T* value, const std::vector& combo PushStyleCombobox(options.color); const char* longest; - int length = 0; + size_t length = 0; for (auto& string : comboVector) { - int len = string.length(); + size_t len = string.length(); if (len > length) { longest = string.c_str(); length = len; From e8c2db815129a8a3e93425c7f08384ce9d1d80ae Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Fri, 16 May 2025 03:51:14 +0100 Subject: [PATCH 21/44] remove all refernces to Doge (#5488) --- .../Enhancements/randomizer/randomizer.cpp | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 29d1c4293..d3e2c83b5 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -65,7 +65,7 @@ const std::string Randomizer::NaviRandoMessageTableID = "RandomizerNavi"; const std::string Randomizer::IceTrapRandoMessageTableID = "RandomizerIceTrap"; const std::string Randomizer::randoMiscHintsTableID = "RandomizerMiscHints"; -static const char* englishRupeeNames[190] = { +static const char* englishRupeeNames[188] = { "[P]", "Bad RNG Rolls", "Baht", @@ -111,8 +111,6 @@ static const char* englishRupeeNames[190] = { "Dimes", "Dinars", "DNA", - "Doge", - "Dogecoin", "Doll Hairs", "Dollars", "Dollarydoos", @@ -258,25 +256,25 @@ static const char* englishRupeeNames[190] = { "Zorkmids", }; -static const char* germanRupeeNames[80] = { - "Baht", "Bananen", "Bitcoin", "Bonbons", "Bratwürste", "Brause UFOs", "Brötchen", "Cent", - "Diamanten", "Dinar", "Diridari", "Dogecoin", "Dollar", "Draken", "ECU", "Elexit", - "Erz", "Erzbrocken", "Euro", "EXP", "Forint", "Franken", "Freunde", "Gil", - "Gold", "Groschen", "Gulden", "Gummibären", "Heller", "Juwelen", "Karolin", "Kartoffeln", - "Kies", "Knete", "Knochen", "Kohle", "Kraniche", "Kreuzer", "Kronen", "Kronkorken", - "Kröten", "Lira", "Mark", "Mäuse", "Monde", "Moorhühner", "Moos", "Münzen", - "Naira", "Penunze", "Pesa", "Pfandflaschen", "Pfennig", "Pfund", "Pilze", "Plastiks", - "Pokédollar", "Radieschen", "Rand", "Rappen", "Real", "Rial", "Riyal", "Rubine", - "Rupien", "Saphire", "Schilling", "Seelen", "Septime", "Smaragde", "Steine", "Sterne", - "Sternis", "Tael", "Taler", "Wagenchips", "Won", "Yen", "Yuan", "Zenny", +static const char* germanRupeeNames[79] = { + "Baht", "Bananen", "Bitcoin", "Bonbons", "Bratwürste", "Brause UFOs", "Brötchen", "Cent", + "Diamanten", "Dinar", "Diridari", "Dollar", "Draken", "ECU", "Elexit", "Erz", + "Erzbrocken", "Euro", "EXP", "Forint", "Franken", "Freunde", "Gil", "Gold", + "Groschen", "Gulden", "Gummibären", "Heller", "Juwelen", "Karolin", "Kartoffeln", "Kies", + "Knete", "Knochen", "Kohle", "Kraniche", "Kreuzer", "Kronen", "Kronkorken", "Kröten", + "Lira", "Mark", "Mäuse", "Monde", "Moorhühner", "Moos", "Münzen", "Naira", + "Penunze", "Pesa", "Pfandflaschen", "Pfennig", "Pfund", "Pilze", "Plastiks", "Pokédollar", + "Radieschen", "Rand", "Rappen", "Real", "Rial", "Riyal", "Rubine", "Rupien", + "Saphire", "Schilling", "Seelen", "Septime", "Smaragde", "Steine", "Sterne", "Sternis", + "Tael", "Taler", "Wagenchips", "Won", "Yen", "Yuan", "Zenny", }; -static const char* frenchRupeeNames[40] = { - "Anneaux", "Baguettes", "Balles", "Bananes", "Bitcoin", "Blés", "Bling", "Capsules", - "Centimes", "Champignons", "Clochettes", "Crédits", "Croissants", "Diamants", "Dogecoin", "Dollars", - "Émeraudes", "Éthers", "Étoiles", "Euros", "Florens", "Francs", "Galds", "Gils", - "Grouses", "Halos", "Joyaux", "Lunes", "Mailles", "Munnies", "Orbes", "Orens", - "Pépètes", "Pièces", "Plastyks", "Pokédollars", "Pokémon", "Radis", "Rubis", "Zennies", +static const char* frenchRupeeNames[39] = { + "Anneaux", "Baguettes", "Balles", "Bananes", "Bitcoin", "Blés", "Bling", "Capsules", + "Centimes", "Champignons", "Clochettes", "Crédits", "Croissants", "Diamants", "Dollars", "Émeraudes", + "Éthers", "Étoiles", "Euros", "Florens", "Francs", "Galds", "Gils", "Grouses", + "Halos", "Joyaux", "Lunes", "Mailles", "Munnies", "Orbes", "Orens", "Pépètes", + "Pièces", "Plastyks", "Pokédollars", "Pokémon", "Radis", "Rubis", "Zennies", }; Randomizer::Randomizer() { From 4fd0bf402ee2cc354225f921d1f2e976bfa9f486 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Fri, 16 May 2025 18:07:52 -0400 Subject: [PATCH 22/44] set c standard to 17 (#5492) --- CMakeLists.txt | 1 + soh/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec9f14f5b..b9a5afe4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.26.0 FATAL_ERROR) set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") +set(CMAKE_C_STANDARD 17 CACHE STRING "The C standard to use") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 7277b2dfb..3511a0caf 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -4,6 +4,7 @@ set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) project(soh LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") +set(CMAKE_C_STANDARD 17 CACHE STRING "The C standard to use") if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") enable_language(OBJCXX) From b900f8599abeb1b1aea9b1ad7cc6298beebf6d35 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Fri, 16 May 2025 21:14:55 -0700 Subject: [PATCH 23/44] Bump LUS to latest, and handle tinyxml and gfx_pc changes. (#5470) --- libultraship | 2 +- soh/soh/OTRGlobals.cpp | 54 ++++++++++++++++--- soh/soh/ResourceManagerHelpers.cpp | 4 +- soh/soh/SohGui/ImGuiUtils.cpp | 1 + soh/soh/SohGui/ResolutionEditor.cpp | 21 +++++++- soh/soh/SohGui/SohGui.cpp | 1 - soh/soh/resource/importer/ArrayFactory.cpp | 2 +- .../importer/CollisionHeaderFactory.cpp | 1 + soh/soh/resource/importer/PathFactory.cpp | 1 + soh/soh/resource/importer/SceneFactory.cpp | 1 + soh/soh/resource/importer/SkeletonFactory.cpp | 1 + .../resource/importer/SkeletonLimbFactory.cpp | 1 + soh/soh/resource/importer/TextFactory.cpp | 1 + .../scenecommand/EndMarkerFactory.cpp | 1 + .../scenecommand/SetActorListFactory.cpp | 1 + .../SetAlternateHeadersFactory.cpp | 1 + .../scenecommand/SetCameraSettingsFactory.cpp | 1 + .../SetCollisionHeaderFactory.cpp | 1 + .../scenecommand/SetCsCameraFactory.cpp | 1 + .../scenecommand/SetCutscenesFactory.cpp | 1 + .../scenecommand/SetEchoSettingsFactory.cpp | 1 + .../scenecommand/SetEntranceListFactory.cpp | 1 + .../scenecommand/SetExitListFactory.cpp | 1 + .../scenecommand/SetLightListFactory.cpp | 1 + .../SetLightingSettingsFactory.cpp | 1 + .../importer/scenecommand/SetMeshFactory.cpp | 1 + .../scenecommand/SetObjectListFactory.cpp | 1 + .../scenecommand/SetPathwaysFactory.cpp | 1 + .../scenecommand/SetRoomBehaviorFactory.cpp | 1 + .../scenecommand/SetRoomListFactory.cpp | 1 + .../scenecommand/SetSkyboxModifierFactory.cpp | 1 + .../scenecommand/SetSkyboxSettingsFactory.cpp | 1 + .../scenecommand/SetSoundSettingsFactory.cpp | 1 + .../scenecommand/SetSpecialObjectsFactory.cpp | 1 + .../SetStartPositionListFactory.cpp | 1 + .../scenecommand/SetTimeSettingsFactory.cpp | 1 + .../SetTransitionActorListFactory.cpp | 1 + .../scenecommand/SetWindSettingsFactory.cpp | 1 + soh/soh/resource/logging/PathLogger.cpp | 1 + .../resource/logging/SceneCommandLoggers.cpp | 1 + soh/soh/resource/type/Array.cpp | 2 +- soh/soh/resource/type/Array.h | 5 +- 42 files changed, 110 insertions(+), 15 deletions(-) diff --git a/libultraship b/libultraship index ffc062cbf..ce38cb688 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit ffc062cbf44ce8dc07ac9fc0185224010bd78cc5 +Subproject commit ce38cb6883ca030e61749eae584b6d9a7cb7bca5 diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 87cb361e1..935c388d4 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -51,7 +51,7 @@ #include "Extractor/Extract.h" #endif -#include +#include #ifdef __APPLE__ #include @@ -1899,7 +1899,7 @@ extern "C" void OTRControllerCallback(uint8_t rumble) { } extern "C" float OTRGetAspectRatio() { - return gfx_current_dimensions.aspect_ratio; + return Ship::Context::GetInstance()->GetWindow()->GetAspectRatio(); } extern "C" float OTRGetDimensionFromLeftEdge(float v) { @@ -1912,12 +1912,34 @@ extern "C" float OTRGetDimensionFromRightEdge(float v) { // Gets the width of the current render target area extern "C" uint32_t OTRGetGameRenderWidth() { - return gfx_current_dimensions.width; + auto fastWnd = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); + auto intP = fastWnd->GetInterpreterWeak().lock(); + + if (!intP) { + assert(false && "Lost reference to Fast::Interpreter"); + return 320; + } + + uint32_t height, width; + intP->GetCurDimensions(&width, &height); + + return width; } // Gets the height of the current render target area extern "C" uint32_t OTRGetGameRenderHeight() { - return gfx_current_dimensions.height; + auto fastWnd = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); + auto intP = fastWnd->GetInterpreterWeak().lock(); + + if (!intP) { + assert(false && "Lost reference to Fast::Interpreter"); + return 240; + } + + uint32_t height, width; + intP->GetCurDimensions(&width, &height); + + return height; } f32 floorf(f32 x); // RANDOTODO False positive error "allowing all exceptions is incompatible with previous function" @@ -2496,11 +2518,23 @@ extern "C" void EntranceTracker_SetLastEntranceOverride(s16 entranceIndex) { } extern "C" void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement) { - gfx_register_blended_texture(name, mask, replacement); + if (auto intP = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()) + ->GetInterpreterWeak() + .lock()) { + intP->RegisterBlendedTexture(name, mask, replacement); + } else { + assert(false && "Lost reference to Fast::Interpreter"); + } } extern "C" void Gfx_UnregisterBlendedTexture(const char* name) { - gfx_unregister_blended_texture(name); + if (auto intP = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()) + ->GetInterpreterWeak() + .lock()) { + intP->UnregisterBlendedTexture(name); + } else { + assert(false && "Lost reference to Fast::Interpreter"); + } } extern "C" void Gfx_TextureCacheDelete(const uint8_t* texAddr) { @@ -2514,7 +2548,13 @@ extern "C" void Gfx_TextureCacheDelete(const uint8_t* texAddr) { texAddr = (const uint8_t*)ResourceMgr_GetResourceDataByNameHandlingMQ(imgName); } - gfx_texture_cache_delete(texAddr); + if (auto intP = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()) + ->GetInterpreterWeak() + .lock()) { + intP->TextureCacheDelete(texAddr); + } else { + assert(false && "Lost reference to Fast::Interpreter"); + } } void SoH_ProcessDroppedFiles(std::string filePath) { diff --git a/soh/soh/ResourceManagerHelpers.cpp b/soh/soh/ResourceManagerHelpers.cpp index e1074e517..57e0ab270 100644 --- a/soh/soh/ResourceManagerHelpers.cpp +++ b/soh/soh/ResourceManagerHelpers.cpp @@ -11,7 +11,7 @@ #include "resource/type/Array.h" #include "resource/type/Skeleton.h" #include "resource/type/PlayerAnimation.h" -#include +#include #include extern "C" PlayState* gPlayState; @@ -292,7 +292,7 @@ extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) { } extern "C" void ResourceMgr_PushCurrentDirectory(char* path) { - gfx_push_current_dir(path); + Fast::gfx_push_current_dir(path); } extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path) { diff --git a/soh/soh/SohGui/ImGuiUtils.cpp b/soh/soh/SohGui/ImGuiUtils.cpp index 87a8b20e6..ab3d8f59c 100644 --- a/soh/soh/SohGui/ImGuiUtils.cpp +++ b/soh/soh/SohGui/ImGuiUtils.cpp @@ -1,5 +1,6 @@ #include "ImGuiUtils.h" #include +#include #include "assets/soh_assets.h" #include "soh/Enhancements/randomizer/rando_hash.h" diff --git a/soh/soh/SohGui/ResolutionEditor.cpp b/soh/soh/SohGui/ResolutionEditor.cpp index d33a7b43c..41026e1e2 100644 --- a/soh/soh/SohGui/ResolutionEditor.cpp +++ b/soh/soh/SohGui/ResolutionEditor.cpp @@ -3,7 +3,8 @@ #include #include "soh/SohGui/UIWidgets.hpp" -#include +#include +#include #include "soh/OTRGlobals.h" #include "soh/SohGui/SohMenu.h" #include "soh/SohGui/SohGui.hpp" @@ -86,6 +87,16 @@ static bool disabled_pixelCount; using namespace UIWidgets; +static std::weak_ptr mInterpreter; + +std::shared_ptr GetInterpreter() { + auto intP = mInterpreter.lock(); + if (!intP) { + assert(false && "Lost reference to Fast::Interpreter"); + } + return intP; +} + void ResolutionCustomWidget(WidgetInfo& info) { ImGui::BeginDisabled(disabled_everything); // Vertical Resolution @@ -368,18 +379,23 @@ void ResolutionCustomWidget(WidgetInfo& info) { } void RegisterResolutionWidgets() { + auto fastWnd = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); + mInterpreter = fastWnd->GetInterpreterWeak(); + WidgetPath path = { "Settings", "Graphics", SECTION_COLUMN_2 }; // Resolution visualiser mSohMenu->AddWidget(path, "Viewport dimensions: {} x {}", WIDGET_TEXT) .RaceDisable(false) .PreFunc([](WidgetInfo& info) { + auto gfx_current_game_window_viewport = GetInterpreter().get()->mGameWindowViewport; info.name = fmt::format("Viewport dimensions: {} x {}", gfx_current_game_window_viewport.width, gfx_current_game_window_viewport.height); }); mSohMenu->AddWidget(path, "Internal resolution: {} x {}", WIDGET_TEXT) .RaceDisable(false) .PreFunc([](WidgetInfo& info) { + auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions; info.name = fmt::format("Internal resolution: {} x {}", gfx_current_dimensions.width, gfx_current_dimensions.height); }); @@ -486,6 +502,7 @@ void RegisterResolutionWidgets() { } } else if (showHorizontalResField) { // Show calculated aspect ratio if (item_aspectRatio) { + auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions; ImGui::Dummy({ 0, 2 }); const float resolvedAspectRatio = (float)gfx_current_dimensions.width / gfx_current_dimensions.height; @@ -539,6 +556,8 @@ void UpdateResolutionVars() { short integerScale_maximumBounds = 1; // can change when window is resized // This is mostly just for UX purposes, as Fit Automatically logic is part of LUS. + auto gfx_current_game_window_viewport = GetInterpreter().get()->mGameWindowViewport; + auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions; if (((float)gfx_current_game_window_viewport.width / gfx_current_game_window_viewport.height) > ((float)gfx_current_dimensions.width / gfx_current_dimensions.height)) { // Scale to window height diff --git a/soh/soh/SohGui/SohGui.cpp b/soh/soh/SohGui/SohGui.cpp index 7eb3fc6c7..f4088b6a5 100644 --- a/soh/soh/SohGui/SohGui.cpp +++ b/soh/soh/SohGui/SohGui.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #ifdef __APPLE__ #include "graphic/Fast3D/gfx_metal.h" diff --git a/soh/soh/resource/importer/ArrayFactory.cpp b/soh/soh/resource/importer/ArrayFactory.cpp index 0d80d1ef4..0762704ff 100644 --- a/soh/soh/resource/importer/ArrayFactory.cpp +++ b/soh/soh/resource/importer/ArrayFactory.cpp @@ -20,7 +20,7 @@ ResourceFactoryBinaryArrayV0::ReadResource(std::shared_ptr file, for (uint32_t i = 0; i < array->ArrayCount; i++) { if (array->ArrayType == ArrayResourceType::Vertex) { // OTRTODO: Implement Vertex arrays as just a vertex resource. - F3DVtx data; + Fast::F3DVtx data; data.v.ob[0] = reader->ReadInt16(); data.v.ob[1] = reader->ReadInt16(); data.v.ob[2] = reader->ReadInt16(); diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.cpp b/soh/soh/resource/importer/CollisionHeaderFactory.cpp index 35e51d2af..39bf885a0 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/CollisionHeaderFactory.cpp @@ -1,6 +1,7 @@ #include "soh/resource/importer/CollisionHeaderFactory.h" #include "soh/resource/type/CollisionHeader.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/PathFactory.cpp b/soh/soh/resource/importer/PathFactory.cpp index 6848fde30..945e36c5f 100644 --- a/soh/soh/resource/importer/PathFactory.cpp +++ b/soh/soh/resource/importer/PathFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/Path.h" #include "soh/resource/logging/PathLogger.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/SceneFactory.cpp b/soh/soh/resource/importer/SceneFactory.cpp index 9f79cd80c..730842b7e 100644 --- a/soh/soh/resource/importer/SceneFactory.cpp +++ b/soh/soh/resource/importer/SceneFactory.cpp @@ -1,4 +1,5 @@ #include "spdlog/spdlog.h" +#include #include "soh/resource/type/SohResourceType.h" #include "soh/resource/importer/SceneFactory.h" #include "soh/resource/type/Scene.h" diff --git a/soh/soh/resource/importer/SkeletonFactory.cpp b/soh/soh/resource/importer/SkeletonFactory.cpp index 108d600de..56338cd03 100644 --- a/soh/soh/resource/importer/SkeletonFactory.cpp +++ b/soh/soh/resource/importer/SkeletonFactory.cpp @@ -1,6 +1,7 @@ #include "soh/resource/importer/SkeletonFactory.h" #include "soh/resource/type/Skeleton.h" #include +#include #include namespace SOH { diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.cpp b/soh/soh/resource/importer/SkeletonLimbFactory.cpp index 7b58976ab..731892f2a 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.cpp +++ b/soh/soh/resource/importer/SkeletonLimbFactory.cpp @@ -1,6 +1,7 @@ #include "soh/resource/importer/SkeletonLimbFactory.h" #include "soh/resource/type/SkeletonLimb.h" #include "spdlog/spdlog.h" +#include #include "libultraship/libultraship.h" namespace SOH { diff --git a/soh/soh/resource/importer/TextFactory.cpp b/soh/soh/resource/importer/TextFactory.cpp index 54ed691f8..0a2c1afb4 100644 --- a/soh/soh/resource/importer/TextFactory.cpp +++ b/soh/soh/resource/importer/TextFactory.cpp @@ -1,6 +1,7 @@ #include "soh/resource/importer/TextFactory.h" #include "soh/resource/type/Text.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp index b54f1cade..f96d541f5 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/EndMarker.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr EndMarkerFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp index 94eb62f14..5b9f851d1 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetActorList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetActorListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp index 70b045d07..5a6d35cc2 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetAlternateHeaders.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include #include "libultraship/libultraship.h" namespace SOH { diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp index 318f6d4fe..e2f4de65b 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetCameraSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp index c348b8986..cc0a7b005 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp @@ -3,6 +3,7 @@ #include "soh/resource/logging/SceneCommandLoggers.h" #include "libultraship/libultraship.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp index eb54b0a22..ed08c88be 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetCsCamera.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetCsCameraFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp index 20f96ec46..a8883b2e4 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp @@ -3,6 +3,7 @@ #include "soh/resource/logging/SceneCommandLoggers.h" #include #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetCutscenesFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp index f71925bdd..3352a2ef2 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetEchoSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetEchoSettingsFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp index e033e7d79..eab272b89 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetEntranceList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetEntranceListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp index cc0128a4f..a1cb515ff 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetExitList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetExitListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp index 9ef1e944f..ebb819634 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetLightList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetLightListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp index 545d24f69..01c5d59e1 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetLightingSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp index 05e3169ce..2f6bf5568 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetMesh.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include #include "libultraship/libultraship.h" namespace SOH { diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp index 37d340e36..fbee15e8a 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetObjectList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetObjectListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp index 084d05aae..62a3d0d7f 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetPathways.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include #include namespace SOH { diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp index de9a01e77..9b18593f5 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetRoomBehavior.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetRoomBehaviorFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp index cc03b9f12..7925a012f 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetRoomList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetRoomListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp index 5168b8c32..a071cc4d0 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetSkyboxModifier.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp index e5d3c55c3..3434505cb 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetSkyboxSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp index 6826eae4c..a72acce8c 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetSoundSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp index 44adb5d28..2877dc88a 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetSpecialObjects.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp index 3a8c885ac..d370cde2b 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetStartPositionList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp index 2a3ec29cf..714570208 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetTimeSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetTimeSettingsFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp index e026302a0..fd028b6e3 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetTransitionActorList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp index 7c810c233..86f0af515 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetWindSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetWindSettingsFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/logging/PathLogger.cpp b/soh/soh/resource/logging/PathLogger.cpp index 437815000..47b0081f3 100644 --- a/soh/soh/resource/logging/PathLogger.cpp +++ b/soh/soh/resource/logging/PathLogger.cpp @@ -1,5 +1,6 @@ #include "soh/resource/type/Path.h" #include "spdlog/spdlog.h" +#include namespace SOH { void LogPathAsXML(std::shared_ptr resource) { diff --git a/soh/soh/resource/logging/SceneCommandLoggers.cpp b/soh/soh/resource/logging/SceneCommandLoggers.cpp index b0821bdb9..8a464172d 100644 --- a/soh/soh/resource/logging/SceneCommandLoggers.cpp +++ b/soh/soh/resource/logging/SceneCommandLoggers.cpp @@ -24,6 +24,7 @@ #include "soh/resource/type/scenecommand/SetTransitionActorList.h" #include "soh/resource/type/scenecommand/SetWindSettings.h" #include "spdlog/spdlog.h" +#include #include namespace SOH { diff --git a/soh/soh/resource/type/Array.cpp b/soh/soh/resource/type/Array.cpp index d9c3b1cb4..a4bbc0e5e 100644 --- a/soh/soh/resource/type/Array.cpp +++ b/soh/soh/resource/type/Array.cpp @@ -23,7 +23,7 @@ size_t Array::GetPointerSize() { size_t typeSize = 0; switch (ArrayType) { case ArrayResourceType::Vertex: - typeSize = sizeof(F3DVtx); + typeSize = sizeof(Fast::F3DVtx); break; case ArrayResourceType::Scalar: default: diff --git a/soh/soh/resource/type/Array.h b/soh/soh/resource/type/Array.h index cefea1bc8..c7d15a22a 100644 --- a/soh/soh/resource/type/Array.h +++ b/soh/soh/resource/type/Array.h @@ -2,7 +2,10 @@ #include "resource/Resource.h" +namespace Fast { union F3DVtx; +} + namespace SOH { typedef union ScalarData { uint8_t u8; @@ -80,6 +83,6 @@ class Array : public Ship::Resource { size_t ArrayCount; // OTRTODO: Should be a vector of resource pointers... std::vector Scalars; - std::vector Vertices; + std::vector Vertices; }; } // namespace SOH From 5b6844ccd896d967530e0abbac6597bd8bdce36c Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Sat, 17 May 2025 05:41:14 +0100 Subject: [PATCH 24/44] reapply changes needed for C23 build on develop (#5467) --- soh/include/functions.h | 2 +- soh/include/z64animation.h | 41 ++++++++------- soh/src/code/code_800A9F30.c | 2 +- soh/src/code/z_kankyo.c | 2 +- soh/src/code/z_player_lib.c | 4 +- soh/src/code/z_skelanime.c | 28 +++++----- .../overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 6 +-- .../overlays/actors/ovl_Demo_Ik/z_demo_ik.c | 4 +- soh/src/overlays/actors/ovl_En_In/z_en_in.c | 2 +- soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c | 2 +- soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 12 ++--- .../overlays/actors/ovl_En_Test/z_en_test.c | 2 +- soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c | 8 +-- soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 2 +- soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 2 +- .../actors/ovl_Obj_Hsblock/z_obj_hsblock.c | 4 +- .../actors/ovl_player_actor/z_player.c | 52 +++++++++---------- 17 files changed, 89 insertions(+), 86 deletions(-) diff --git a/soh/include/functions.h b/soh/include/functions.h index ad615d173..98e938a75 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -1378,7 +1378,7 @@ void func_800AA0B4(); void func_800AA0F0(void); u32 func_800AA148(); void func_800AA15C(); -void func_800AA16C(); +void Rumble_ClearRequests(); void func_800AA178(u32); View* View_New(GraphicsContext* gfxCtx); void View_Free(View* view); diff --git a/soh/include/z64animation.h b/soh/include/z64animation.h index b61627a27..3edba982d 100755 --- a/soh/include/z64animation.h +++ b/soh/include/z64animation.h @@ -245,27 +245,30 @@ typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCu typedef s32 (*AnimUpdateFunc)(); typedef struct SkelAnime { - /* 0x00 */ u8 limbCount; // Number of limbs in the skeleton - /* 0x01 */ u8 mode; // See `AnimationMode` - /* 0x02 */ u8 dListCount; // Number of display lists in a flexible skeleton - /* 0x03 */ s8 taper; // Tapering to use when morphing between animations. Only used by Door_Warp1. - /* 0x04 */ void** skeleton; // An array of pointers to limbs. Can be StandardLimb, LodLimb, or SkinLimb. - /* 0x08 */ void* animation; // Can be an AnimationHeader or LinkAnimationHeader. - /* 0x0C */ f32 startFrame; // In mode ANIMMODE_LOOP_PARTIAL*, start of partial loop. - /* 0x10 */ f32 endFrame; // In mode ANIMMODE_ONCE*, Update returns true when curFrame is equal to this. In mode ANIMMODE_LOOP_PARTIAL*, end of partial loop. - /* 0x14 */ f32 animLength; // Total number of frames in the current animation. - /* 0x18 */ f32 curFrame; // Current frame in the animation - /* 0x1C */ f32 playSpeed; // Multiplied by R_UPDATE_RATE / 3 to get the animation's frame rate. + /* 0x00 */ u8 limbCount; // Number of limbs in the skeleton + /* 0x01 */ u8 mode; // See `AnimationMode` + /* 0x02 */ u8 dListCount; // Number of display lists in a flexible skeleton + /* 0x03 */ s8 taper; // Tapering to use when morphing between animations. Only used by Door_Warp1. + /* 0x04 */ void** skeleton; // An array of pointers to limbs. Can be StandardLimb, LodLimb, or SkinLimb. + /* 0x08 */ void* animation; // Can be an AnimationHeader or LinkAnimationHeader. + /* 0x0C */ f32 startFrame; // In mode ANIMMODE_LOOP_PARTIAL*, start of partial loop. + /* 0x10 */ f32 endFrame; // In mode ANIMMODE_ONCE*, Update returns true when curFrame is equal to this. In mode ANIMMODE_LOOP_PARTIAL*, end of partial loop. + /* 0x14 */ f32 animLength; // Total number of frames in the current animation. + /* 0x18 */ f32 curFrame; // Current frame in the animation + /* 0x1C */ f32 playSpeed; // Multiplied by R_UPDATE_RATE / 3 to get the animation's frame rate. /* 0x20 */ Vec3s* jointTable; // Current translation of model and rotations of all limbs /* 0x24 */ Vec3s* morphTable; // Table of values used to morph between animations - /* 0x28 */ f32 morphWeight; // Weight of the current animation morph as a fraction in [0,1] - /* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph - /* 0x30 */ s32 (*update)(); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph. Link only has Loop, Play once, and Morph. - /* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton - /* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace. - /* 0x36 */ s16 prevRot; // Previous rotation in worldspace. - /* 0x38 */ Vec3s prevTransl; // Previous modelspace translation. - /* 0x3E */ Vec3s baseTransl; // Base modelspace translation. + /* 0x28 */ f32 morphWeight; // Weight of the current animation morph as a fraction in [0,1] + /* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph + /* 0x30 */ union { + s32 (*normal)(struct SkelAnime*); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph + s32 (*link)(struct PlayState*, struct SkelAnime*); // Can be Loop, Play once, or Morph + } update; + /* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton + /* 0x35 */ u8 movementFlags; // Flags used for animations that move the actor in worldspace. + /* 0x36 */ s16 prevRot; // Previous rotation in worldspace. + /* 0x38 */ Vec3s prevTransl; // Previous modelspace translation. + /* 0x3E */ Vec3s baseTransl; // Base modelspace translation. SkeletonHeader* skeletonHeader; } SkelAnime; // size = 0x44 diff --git a/soh/src/code/code_800A9F30.c b/soh/src/code/code_800A9F30.c index d0ca380f4..2eba3774c 100644 --- a/soh/src/code/code_800A9F30.c +++ b/soh/src/code/code_800A9F30.c @@ -84,7 +84,7 @@ void func_800AA15C(void) { D_80160FD0.unk_104 = 2; } -void func_800AA16C(void) { +void Rumble_ClearRequests(void) { D_80160FD0.unk_104 = 0; } diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index 090cce962..d78a93c6c 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -892,7 +892,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex if ((((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL) && (((void)0, gSaveContext.gameMode) != GAMEMODE_END_CREDITS)) { - func_800AA16C(play); + Rumble_ClearRequests(); } if (pauseCtx->state == 0) { diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index c5c600459..58829aee8 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -1289,12 +1289,12 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** D_80160000 = &this->meleeWeaponInfo[2].base; if (!LINK_IS_ADULT) { - if (!(this->skelAnime.moveFlags & 4) || (this->skelAnime.moveFlags & 1)) { + if (!(this->skelAnime.movementFlags & 4) || (this->skelAnime.movementFlags & 1)) { pos->x *= 0.64f; pos->z *= 0.64f; } - if (!(this->skelAnime.moveFlags & 4) || (this->skelAnime.moveFlags & 2)) { + if (!(this->skelAnime.movementFlags & 4) || (this->skelAnime.movementFlags & 2)) { pos->y *= 0.64f; } } diff --git a/soh/src/code/z_skelanime.c b/soh/src/code/z_skelanime.c index 0773eb4e0..e9f84980c 100644 --- a/soh/src/code/z_skelanime.c +++ b/soh/src/code/z_skelanime.c @@ -1170,9 +1170,9 @@ void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeade */ void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) { if (skelAnime->mode <= ANIMMODE_LOOP_INTERP) { - skelAnime->update = LinkAnimation_Loop; + skelAnime->update.link = LinkAnimation_Loop; } else { - skelAnime->update = LinkAnimation_Once; + skelAnime->update.link = LinkAnimation_Once; } skelAnime->morphWeight = 0.0f; } @@ -1182,7 +1182,7 @@ void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) { * finishes. */ s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime) { - return skelAnime->update(play, skelAnime); + return skelAnime->update.link(play, skelAnime); } /** @@ -1294,7 +1294,7 @@ void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHe SkelAnime_CopyFrameTable(skelAnime, skelAnime->morphTable, skelAnime->jointTable); morphFrames = -morphFrames; } else { - skelAnime->update = LinkAnimation_Morph; + skelAnime->update.link = LinkAnimation_Morph; AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount, skelAnime->morphTable); } @@ -1559,11 +1559,11 @@ s32 SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* sk */ void SkelAnime_SetUpdate(SkelAnime* skelAnime) { if (skelAnime->mode <= ANIMMODE_LOOP_INTERP) { - skelAnime->update = SkelAnime_LoopFull; + skelAnime->update.normal = SkelAnime_LoopFull; } else if (skelAnime->mode <= ANIMMODE_ONCE_INTERP) { - skelAnime->update = SkelAnime_Once; + skelAnime->update.normal = SkelAnime_Once; } else { - skelAnime->update = SkelAnime_LoopPartial; + skelAnime->update.normal = SkelAnime_LoopPartial; } } @@ -1572,7 +1572,7 @@ void SkelAnime_SetUpdate(SkelAnime* skelAnime) { * finishes. */ s32 SkelAnime_Update(SkelAnime* skelAnime) { - return skelAnime->update(skelAnime); + return skelAnime->update.normal(skelAnime); } /** @@ -1741,10 +1741,10 @@ void Animation_ChangeImpl(SkelAnime* skelAnime, AnimationHeader* animation, f32 morphFrames = -morphFrames; } else { if (taper != ANIMTAPER_NONE) { - skelAnime->update = SkelAnime_MorphTaper; + skelAnime->update.normal = SkelAnime_MorphTaper; skelAnime->taper = taper; } else { - skelAnime->update = SkelAnime_Morph; + skelAnime->update.normal = SkelAnime_Morph; } SkelAnime_GetFrameData(animation, startFrame, skelAnime->limbCount, skelAnime->morphTable); } @@ -1895,7 +1895,7 @@ void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle) { f32 sin; f32 cos; - if (skelAnime->moveFlags & ANIM_FLAG_NOMOVE) { + if (skelAnime->movementFlags & ANIM_FLAG_NOMOVE) { diff->x = diff->z = 0.0f; } else { x = skelAnime->jointTable[0].x; @@ -1917,8 +1917,8 @@ void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle) { skelAnime->jointTable[0].x = skelAnime->baseTransl.x; skelAnime->prevTransl.z = skelAnime->jointTable[0].z; skelAnime->jointTable[0].z = skelAnime->baseTransl.z; - if (skelAnime->moveFlags & ANIM_FLAG_UPDATEY) { - if (skelAnime->moveFlags & ANIM_FLAG_NOMOVE) { + if (skelAnime->movementFlags & ANIM_FLAG_UPDATEY) { + if (skelAnime->movementFlags & ANIM_FLAG_NOMOVE) { diff->y = 0.0f; } else { diff->y = skelAnime->jointTable[0].y - skelAnime->prevTransl.y; @@ -1929,7 +1929,7 @@ void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle) { diff->y = 0.0f; skelAnime->prevTransl.y = skelAnime->jointTable[0].y; } - skelAnime->moveFlags &= ~ANIM_FLAG_NOMOVE; + skelAnime->movementFlags &= ~ANIM_FLAG_NOMOVE; } /** diff --git a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 44b67f1bb..29debf9d6 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -175,19 +175,19 @@ void DemoEc_UpdateBgFlags(DemoEc* this, PlayState* play) { } void func_8096D594(DemoEc* this, PlayState* play) { - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_8096D5D4(DemoEc* this, PlayState* play) { this->skelAnime.baseTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_8096D64C(DemoEc* this, PlayState* play) { - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } diff --git a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index 825ee35dc..e7ba4364e 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -55,12 +55,12 @@ s32 DemoIk_CheckCue(PlayState* play, u16 action, s32 index) { } void DemoIk_SetMove(DemoIk* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void DemoIk_EndMove(DemoIk* this) { - this->skelAnime.moveFlags &= ~1; + this->skelAnime.movementFlags &= ~1; } f32 DemoIk_GetCurFrame(DemoIk* this) { diff --git a/soh/src/overlays/actors/ovl_En_In/z_en_in.c b/soh/src/overlays/actors/ovl_En_In/z_en_in.c index e84d4d8ff..18903bfbb 100644 --- a/soh/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/soh/src/overlays/actors/ovl_En_In/z_en_in.c @@ -342,7 +342,7 @@ void func_80A795C8(EnIn* this, PlayState* play) { void func_80A79690(SkelAnime* skelAnime, EnIn* this, PlayState* play) { if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { - skelAnime->moveFlags |= 3; + skelAnime->movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } diff --git a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 73c966288..5acfe5a80 100644 --- a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -743,7 +743,7 @@ void EnNb_InitDemo6KInConfrontation(EnNb* this, PlayState* play) { } void func_80AB2688(EnNb* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } diff --git a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index d70e0af12..e03a8ed20 100644 --- a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -393,17 +393,17 @@ s32 EnRu1_UpdateSkelAnime(EnRu1* this) { } void func_80AEB364(EnRu1* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80AEB3A4(EnRu1* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; func_80AEB364(this, play); } void func_80AEB3CC(EnRu1* this) { - this->skelAnime.moveFlags &= ~0x1; + this->skelAnime.movementFlags &= ~0x1; } void func_80AEB3DC(EnRu1* this, PlayState* play) { @@ -464,7 +464,7 @@ void func_80AEB6E0(EnRu1* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { - skelAnime->moveFlags |= 3; + skelAnime->movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } @@ -475,13 +475,13 @@ void func_80AEB738(EnRu1* this, PlayState* play) { skelAnime->baseTransl = skelAnime->jointTable[0]; skelAnime->prevTransl = skelAnime->jointTable[0]; if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { - skelAnime->moveFlags |= 3; + skelAnime->movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } void func_80AEB7D0(EnRu1* this) { - this->skelAnime.moveFlags &= ~0x3; + this->skelAnime.movementFlags &= ~0x3; } f32 func_80AEB7E0(CsCmdActorCue* csCmdNPCAction, PlayState* play) { diff --git a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c index 72969cc2e..0bcf45a8b 100644 --- a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -1595,7 +1595,7 @@ void func_8086318C(EnTest* this, PlayState* play) { void EnTest_SetupRecoil(EnTest* this) { this->meleeWeaponState = 0; - this->skelAnime.moveFlags = 2; + this->skelAnime.movementFlags = 2; this->unk_7C8 = 0x13; this->skelAnime.playSpeed = -1.0f; this->skelAnime.startFrame = this->skelAnime.curFrame; diff --git a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 30f035c5d..84500db21 100644 --- a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -249,25 +249,25 @@ void func_80B3C8CC(EnXc* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; if (skelAnime->jointTable[0].y >= skelAnime->baseTransl.y) { - skelAnime->moveFlags |= 3; + skelAnime->movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } void func_80B3C924(EnXc* this, PlayState* play) { - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80B3C964(EnXc* this, PlayState* play) { this->skelAnime.baseTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80B3C9DC(EnXc* this) { - this->skelAnime.moveFlags &= ~0x3; + this->skelAnime.movementFlags &= ~0x3; } void func_80B3C9EC(EnXc* this) { diff --git a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 380f80bc9..c02744959 100644 --- a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -348,7 +348,7 @@ void func_80B4B834(CsCmdActorCue* npcAction, Vec3f* pos) { } void func_80B4B874(EnZl1* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } diff --git a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 42a3942dd..aab3e9505 100644 --- a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -305,7 +305,7 @@ void EnZl4_UpdateFace(EnZl4* this) { } void EnZl4_SetMove(EnZl4* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } diff --git a/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index a3541a246..34606904b 100644 --- a/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -53,12 +53,12 @@ void ObjHsblock_SetupAction(ObjHsblock* this, ObjHsblockActionFunc actionFunc) { this->actionFunc = actionFunc; } -void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision, s32 moveFlags) { +void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision, s32 movementFlags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2[2]; - DynaPolyActor_Init(&this->dyna, moveFlags); + DynaPolyActor_Init(&this->dyna, movementFlags); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index d97dcdc08..6cc57ca22 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -1926,14 +1926,14 @@ void Player_ZeroRootLimbYaw(Player* this) { * it can also be called within action functions to change animations in the middle of an action. */ void Player_FinishAnimMovement(Player* this) { - if (this->skelAnime.moveFlags != 0) { + if (this->skelAnime.movementFlags != 0) { Player_ApplyYawFromAnim(this); this->skelAnime.jointTable[0].x = this->skelAnime.baseTransl.x; this->skelAnime.jointTable[0].z = this->skelAnime.baseTransl.z; - if (this->skelAnime.moveFlags & 8) { - if (this->skelAnime.moveFlags & 2) { + if (this->skelAnime.movementFlags & 8) { + if (this->skelAnime.movementFlags & 2) { this->skelAnime.jointTable[0].y = this->skelAnime.prevTransl.y; } } else { @@ -1942,7 +1942,7 @@ void Player_FinishAnimMovement(Player* this) { Player_ResetAnimMovement(this); - this->skelAnime.moveFlags = 0; + this->skelAnime.movementFlags = 0; } } @@ -1958,7 +1958,7 @@ void Player_FinishAnimMovement(Player* this) { void Player_ApplyAnimMovementScaledByAge(Player* this, s32 movementFlags) { Vec3f diff; - this->skelAnime.moveFlags = movementFlags; + this->skelAnime.movementFlags = movementFlags; this->skelAnime.prevTransl = this->skelAnime.baseTransl; SkelAnime_UpdateTranslation(&this->skelAnime, &diff, this->actor.shape.rot.y); @@ -2005,7 +2005,7 @@ void Player_ApplyAnimMovementScaledByAge(Player* this, s32 movementFlags) { void Player_StartAnimMovement(PlayState* play, Player* this, s32 flags) { if (flags & PLAYER_ANIM_MOVEMENT_RESET_BY_AGE) { Player_ResetAnimMovementScaledByAge(this); - } else if ((flags & PLAYER_ANIM_MOVEMENT_RESET) || (this->skelAnime.moveFlags != 0)) { + } else if ((flags & PLAYER_ANIM_MOVEMENT_RESET) || (this->skelAnime.movementFlags != 0)) { // If AnimMovement is already in use when this function is called and // `PLAYER_ANIM_MOVEMENT_RESET_BY_AGE` is not set, then this case will be used. Player_ResetAnimMovement(this); @@ -2017,7 +2017,7 @@ void Player_StartAnimMovement(PlayState* play, Player* this, s32 flags) { } // Remove Player specific flags by masking the lower byte before setting to `skelAnime.movementFlags` - this->skelAnime.moveFlags = flags /*&& 0xFF*/; + this->skelAnime.movementFlags = flags /*&& 0xFF*/; Player_ZeroSpeedXZ(this); AnimationContext_DisableQueue(play); @@ -3138,7 +3138,7 @@ s32 func_80835588(Player* this, PlayState* play) { void Player_SetParallel(Player* this) { this->stateFlags1 |= PLAYER_STATE1_PARALLEL; - if (!(this->skelAnime.moveFlags & 0x80) && (this->actor.bgCheckFlags & 0x200) && + if (!(this->skelAnime.movementFlags & 0x80) && (this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x2000)) { // snap to the wall this->yaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; @@ -3362,14 +3362,14 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun void Player_SetupActionPreserveAnimMovement(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { s32 savedMovementFlags; - savedMovementFlags = this->skelAnime.moveFlags; + savedMovementFlags = this->skelAnime.movementFlags; // Setting `skelAnime.movementFlags` to 0 will prevent `Player_FinishAnimMovement` from ending // AnimMovement when `Player_SetupAction` is called. - this->skelAnime.moveFlags = 0; + this->skelAnime.movementFlags = 0; Player_SetupAction(play, this, actionFunc, flags); - this->skelAnime.moveFlags = savedMovementFlags; + this->skelAnime.movementFlags = savedMovementFlags; } /** @@ -5779,7 +5779,7 @@ void func_8083AA10(Player* this, PlayState* play) { return; } - if (!(this->stateFlags3 & PLAYER_STATE3_MIDAIR) && !(this->skelAnime.moveFlags & 0x80) && + if (!(this->stateFlags3 & PLAYER_STATE3_MIDAIR) && !(this->skelAnime.movementFlags & 0x80) && (Player_Action_8084411C != this->actionFunc) && (Player_Action_80844A44 != this->actionFunc)) { if ((sPrevFloorProperty == 7) || (this->meleeWeaponState != 0)) { @@ -6927,7 +6927,7 @@ void func_8083D53C(PlayState* play, Player* this) { } } else if ((this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (this->actor.yDistToWater < this->ageProperties->unk_24)) { - if ((this->skelAnime.moveFlags == 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) { + if ((this->skelAnime.movementFlags == 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) { Player_SetupTurnInPlace(play, this, this->actor.shape.rot.y); } func_8083D0A8(play, this, this->actor.velocity.y); @@ -12059,7 +12059,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { func_8084FF7C(this); } - if (!(this->skelAnime.moveFlags & 0x80)) { + if (!(this->skelAnime.movementFlags & 0x80)) { if (((this->actor.bgCheckFlags & 1) && (sFloorType == 5) && (this->currentBoots != PLAYER_BOOTS_IRON)) || ((this->currentBoots == PLAYER_BOOTS_HOVER || GameInteractor_GetSlipperyFloorActive()) && !(this->stateFlags1 & (PLAYER_STATE1_IN_WATER | PLAYER_STATE1_IN_CUTSCENE)))) { @@ -12246,9 +12246,9 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_UpdateCamAndSeqModes(play, this); - if (this->skelAnime.moveFlags & 8) { + if (this->skelAnime.movementFlags & 8) { AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, - (this->skelAnime.moveFlags & 4) ? 1.0f : this->ageProperties->unk_08); + (this->skelAnime.movementFlags & 4) ? 1.0f : this->ageProperties->unk_08); } Player_UpdateShapeYaw(this, play); @@ -13113,7 +13113,7 @@ void Player_Action_Talk(Player* this, PlayState* play) { } else if (func_808332B8(this)) { Player_Action_8084D610(this, play); } else if (!Player_CheckHostileLockOn(this) && LinkAnimation_Update(play, &this->skelAnime)) { - if (this->skelAnime.moveFlags != 0) { + if (this->skelAnime.movementFlags != 0) { Player_FinishAnimMovement(this); if ((this->talkActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) { @@ -13551,8 +13551,8 @@ void Player_Action_8084C760(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (!(this->stateFlags1 & PLAYER_STATE1_LOADING)) { - if (this->skelAnime.moveFlags != 0) { - this->skelAnime.moveFlags = 0; + if (this->skelAnime.movementFlags != 0) { + this->skelAnime.movementFlags = 0; return; } @@ -15261,7 +15261,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (!Player_ActionHandler_7(this, play)) { - u8 sp43 = this->skelAnime.moveFlags; + u8 sp43 = this->skelAnime.movementFlags; LinkAnimationHeader* sp3C; if (Player_CheckHostileLockOn(this)) { @@ -15271,7 +15271,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { } func_80832318(this); - this->skelAnime.moveFlags = 0; + this->skelAnime.movementFlags = 0; if ((sp3C == &gPlayerAnim_link_fighter_Lpower_jump_kiru_end) && (this->modelAnimType != PLAYER_ANIMTYPE_3)) { @@ -15280,7 +15280,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { func_8083A098(this, sp3C, play); - this->skelAnime.moveFlags = sp43; + this->skelAnime.movementFlags = sp43; this->stateFlags3 |= PLAYER_STATE3_FINISHED_ATTACKING; } } else if (this->heldItemAction == PLAYER_IA_HAMMER) { @@ -16553,7 +16553,7 @@ void func_80852A54(PlayState* play, Player* this, CsCmdActorCue* cue) { func_808529D0(play, this, cue); } - this->skelAnime.moveFlags = 0; + this->skelAnime.movementFlags = 0; Player_ZeroRootLimbYaw(this); } @@ -16564,7 +16564,7 @@ void func_80852B4C(PlayState* play, Player* this, CsCmdActorCue* cue, struct_808 arg3->func(play, this, cue); } - if ((D_80858AA0 & 4) && !(this->skelAnime.moveFlags & 4)) { + if ((D_80858AA0 & 4) && !(this->skelAnime.movementFlags & 4)) { this->skelAnime.morphTable[0].y /= this->ageProperties->unk_08; D_80858AA0 = 0; } @@ -16603,7 +16603,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cue) { } } - D_80858AA0 = this->skelAnime.moveFlags; + D_80858AA0 = this->skelAnime.movementFlags; Player_FinishAnimMovement(this); osSyncPrintf("TOOL MODE=%d\n", sp24); @@ -16626,7 +16626,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cue) { void Player_Action_CsAction(Player* this, PlayState* play) { if (this->csAction != this->prevCsAction) { - D_80858AA0 = this->skelAnime.moveFlags; + D_80858AA0 = this->skelAnime.movementFlags; Player_FinishAnimMovement(this); this->prevCsAction = this->csAction; From e673eaefb684c80c2ee0ab2d41a11ae2e4db4e88 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Fri, 16 May 2025 21:54:36 -0700 Subject: [PATCH 25/44] Warnings Round 2 (mostly Rando) (#5486) * Handle virtually all warnings in `soh/Enhancements/randomizer`. Handle order of operations warning in FasterHeavyBlockLift. * Missed a few. * Add float-specific versions of some M_PI and M_SQRT defines, and swap them in for the static casts in draw.cpp. * Swap a static cast for M_PIf in check tracker code. --- .../TimeSavers/FasterHeavyBlockLift.cpp | 2 +- .../Enhancements/randomizer/3drando/fill.cpp | 4 +-- .../Enhancements/randomizer/3drando/hints.cpp | 6 ++-- .../randomizer/3drando/item_pool.cpp | 2 +- .../Enhancements/randomizer/3drando/menu.cpp | 4 +-- .../randomizer/3drando/random.hpp | 2 +- .../Enhancements/randomizer/3drando/shops.cpp | 5 +-- .../Enhancements/randomizer/Plandomizer.cpp | 6 ++-- .../Enhancements/randomizer/ShuffleCows.cpp | 5 +-- .../Enhancements/randomizer/ShuffleCrates.cpp | 6 ++-- .../Enhancements/randomizer/ShuffleGrass.cpp | 2 +- .../Enhancements/randomizer/ShufflePots.cpp | 2 +- soh/soh/Enhancements/randomizer/draw.cpp | 14 ++++---- soh/soh/Enhancements/randomizer/hint.cpp | 3 +- .../Enhancements/randomizer/hook_handlers.cpp | 14 ++++---- soh/soh/Enhancements/randomizer/logic.cpp | 4 +-- soh/soh/Enhancements/randomizer/option.cpp | 16 ++++----- soh/soh/Enhancements/randomizer/option.h | 4 +-- .../Enhancements/randomizer/randomizer.cpp | 25 +++++++++----- .../randomizer/randomizer_check_tracker.cpp | 8 ++--- .../randomizer_entrance_tracker.cpp | 2 +- .../randomizer/randomizer_item_tracker.cpp | 34 +++++++++---------- soh/soh/Enhancements/randomizer/savefile.cpp | 2 +- soh/soh/Enhancements/randomizer/settings.cpp | 6 ++-- soh/soh/OTRGlobals.h | 5 +++ 25 files changed, 98 insertions(+), 85 deletions(-) diff --git a/soh/soh/Enhancements/TimeSavers/FasterHeavyBlockLift.cpp b/soh/soh/Enhancements/TimeSavers/FasterHeavyBlockLift.cpp index 10a22d903..97c253073 100644 --- a/soh/soh/Enhancements/TimeSavers/FasterHeavyBlockLift.cpp +++ b/soh/soh/Enhancements/TimeSavers/FasterHeavyBlockLift.cpp @@ -41,7 +41,7 @@ void FasterHeavyBlockLift_Register() { LinkAnimationHeader* anim = va_arg(args, LinkAnimationHeader*); // Same actor is used for small and large silver rocks, use actor params to identify large ones - bool isLargeSilverRock = interactActorId == ACTOR_EN_ISHI && interactRangeActor->params & 1 == 1; + bool isLargeSilverRock = (interactActorId == ACTOR_EN_ISHI) && ((interactRangeActor->params & 1) == 1); if (CVarGetInteger(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 0) && (isLargeSilverRock || interactActorId == ACTOR_BG_HEAVY_BLOCK)) { *should = false; diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 7fccd0950..49bfc4012 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -712,11 +712,11 @@ static void PareDownPlaythrough() { auto ctx = Rando::Context::GetInstance(); std::vector toAddBackItem; // Start at sphere before Ganon's and count down - for (int i = ctx->playthroughLocations.size() - 2; i >= 0; i--) { + for (size_t i = ctx->playthroughLocations.size() - 2; i >= 0; i--) { // Check each item location in sphere std::vector erasableIndices; std::vector sphere = ctx->playthroughLocations.at(i); - for (int j = sphere.size() - 1; j >= 0; j--) { + for (size_t j = sphere.size() - 1; j >= 0; j--) { RandomizerCheck loc = sphere.at(j); RandomizerGet locGet = ctx->GetItemLocation(loc)->GetPlacedRandomizerGet(); // Copy out item diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index 8e928185f..6a83c498e 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -63,11 +63,11 @@ const CustomMessage& HintText::GetAmbiguous(uint8_t selection) const { } uint8_t HintText::GetAmbiguousSize() const { - return ambiguousText.size(); + return static_cast(ambiguousText.size()); } uint8_t HintText::GetObscureSize() const { - return obscureText.size(); + return static_cast(obscureText.size()); } const CustomMessage& HintText::GetHintMessage(uint8_t selection) const { @@ -598,7 +598,7 @@ static void DistributeHints(std::vector& selected, size_t stoneCount, } // if stones are left, assign junk to every remaining stone as a fallback. if (stoneCount > 0) { - selected[selected.size() - 1] += stoneCount; + selected[static_cast(selected.size()) - 1] += static_cast(stoneCount); } } diff --git a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp index a04a7d65c..9a858e059 100644 --- a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp @@ -325,7 +325,7 @@ RandomizerGet GetJunkItem() { return RandomElement(JunkPoolItems); } // Ice Trap is the last item in JunkPoolItems, so subtract 1 to never hit that index - uint8_t idx = Random(0, JunkPoolItems.size() - 1); + uint8_t idx = Random(0, static_cast(JunkPoolItems.size()) - 1); return JunkPoolItems[idx]; } diff --git a/soh/soh/Enhancements/randomizer/3drando/menu.cpp b/soh/soh/Enhancements/randomizer/3drando/menu.cpp index 831330571..cf3a0bc3d 100644 --- a/soh/soh/Enhancements/randomizer/3drando/menu.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/menu.cpp @@ -27,7 +27,7 @@ bool GenerateRandomizer(std::set excludedLocations, std::set(time(NULL))); // if a blank seed was entered, make a random one if (seedInput.empty()) { seedInput = std::to_string(rand() % 0xFFFFFFFF); @@ -35,7 +35,7 @@ bool GenerateRandomizer(std::set excludedLocations, std::set T RandomElement(std::vector& vector, bool erase) { - const auto idx = Random(0, vector.size()); + const auto idx = Random(0, static_cast(vector.size())); const T selected = vector[idx]; if (erase) { vector.erase(vector.begin() + idx); diff --git a/soh/soh/Enhancements/randomizer/3drando/shops.cpp b/soh/soh/Enhancements/randomizer/3drando/shops.cpp index 110ab8a76..115f36394 100644 --- a/soh/soh/Enhancements/randomizer/3drando/shops.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/shops.cpp @@ -115,7 +115,7 @@ uint16_t GetPriceFromSettings(Rando::Location* loc, PriceSettingsStruct priceSet if (random < ShopPriceProbability[i]) { // The randomly generated value has surpassed the total probability up to this point, so this is the // generated price i in range [0, 59], output in range [0, 295] in increments of 5 - return i * 5; + return static_cast(i) * 5; } } return 150; @@ -196,7 +196,8 @@ uint16_t GetCheapBalancedPrice() { double random = RandomDouble(); for (size_t i = 0; i < CheapPriceProbability.size(); i++) { if (random < CheapPriceProbability[i]) { - return i * 5; // i in range [0, 19], output in range [0, 95] in increments of 5 + // i in range [0, 19], output in range [0, 95] in increments of 5 + return static_cast(i) * 5; } } return -1; diff --git a/soh/soh/Enhancements/randomizer/Plandomizer.cpp b/soh/soh/Enhancements/randomizer/Plandomizer.cpp index dc32dc999..4e03e8b8f 100644 --- a/soh/soh/Enhancements/randomizer/Plandomizer.cpp +++ b/soh/soh/Enhancements/randomizer/Plandomizer.cpp @@ -632,7 +632,7 @@ void PlandomizerLoadSpoilerLog(std::string logFile) { PlandomizerAddToItemList(plandomizerRandoRetrieveItem(RG_SOLD_OUT)); } } - } catch (nlohmann::json::parse_error& e) { + } catch (nlohmann::json::parse_error&) { Notification::Emit({ .message = "Invalid Spoiler Log Format", .remainingTime = 10.0f }); } } @@ -967,7 +967,7 @@ void PlandomizerDrawOptions() { } ImGui::TableNextColumn(); - size_t index = 0; + int32_t index = 0; PlandoPushImageButtonStyle(); for (auto& hash : plandoHash) { ImGui::PushID(index); @@ -995,7 +995,7 @@ void PlandomizerDrawOptions() { ImGui::PopStyleVar(); if (downRet) { if (hash == 0) { - hash = gSeedTextures.size() - 1; + hash = static_cast(gSeedTextures.size()) - 1; } else { hash--; } diff --git a/soh/soh/Enhancements/randomizer/ShuffleCows.cpp b/soh/soh/Enhancements/randomizer/ShuffleCows.cpp index 203981133..5dfe02b26 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleCows.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleCows.cpp @@ -19,7 +19,7 @@ void EnCow_MoveForRandomizer(EnCow* enCow, PlayState* play) { // Move left cow in lon lon tower enCow->actor.world.pos.x = -229.0f; enCow->actor.world.pos.z = 157.0f; - enCow->actor.shape.rot.y = 15783.0f; + enCow->actor.shape.rot.y = 15783; moved = true; } else if (play->sceneNum == SCENE_STABLE && enCow->actor.world.pos.x == -3 && enCow->actor.world.pos.z == -254) { // Move right cow in lon lon stable @@ -39,7 +39,8 @@ void RegisterShuffleCows() { COND_VB_SHOULD(VB_GIVE_ITEM_FROM_COW, shouldRegister, { EnCow* enCow = va_arg(args, EnCow*); CowIdentity cowIdentity = OTRGlobals::Instance->gRandomizer->IdentifyCow( - gPlayState->sceneNum, enCow->actor.world.pos.x, enCow->actor.world.pos.z); + gPlayState->sceneNum, static_cast(enCow->actor.world.pos.x), + static_cast(enCow->actor.world.pos.z)); // Has this cow already rewarded an item? if (!Flags_GetRandomizerInf(cowIdentity.randomizerInf)) { Flags_SetRandomizerInf(cowIdentity.randomizerInf); diff --git a/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp b/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp index 808078789..343221d63 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp @@ -3,6 +3,7 @@ #include "static_data.h" #include #include "global.h" +#include "soh/ResourceManagerHelpers.h" extern "C" { #include "variables.h" @@ -11,7 +12,6 @@ extern "C" { #include "overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h" #include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "soh/Enhancements/enhancementTypes.h" -#include "soh/ResourceManagerHelpers.h" extern PlayState* gPlayState; } @@ -195,7 +195,7 @@ void ObjKibako2_RandomizerSpawnCollectible(ObjKibako2* crateActor, PlayState* pl item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; item00->actor.velocity.y = 8.0f; item00->actor.speedXZ = 2.0f; - item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f); + item00->actor.world.rot.y = static_cast(Rand_CenteredFloat(65536.0f)); } void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState* play) { @@ -206,7 +206,7 @@ void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState* item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; item00->actor.velocity.y = 8.0f; item00->actor.speedXZ = 2.0f; - item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f); + item00->actor.world.rot.y = static_cast(Rand_CenteredFloat(65536.0f)); } void ObjKibako2_RandomizerInit(void* actorRef) { diff --git a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp index b2e485a34..1aa0970d2 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp @@ -117,7 +117,7 @@ void EnKusa_RandomizerSpawnCollectible(EnKusa* grassActor, PlayState* play) { item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; item00->actor.velocity.y = 8.0f; item00->actor.speedXZ = 2.0f; - item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f); + item00->actor.world.rot.y = static_cast(Rand_CenteredFloat(65536.0f)); } void EnKusa_RandomizerInit(void* actorRef) { diff --git a/soh/soh/Enhancements/randomizer/ShufflePots.cpp b/soh/soh/Enhancements/randomizer/ShufflePots.cpp index 20ef1922a..2021d225a 100644 --- a/soh/soh/Enhancements/randomizer/ShufflePots.cpp +++ b/soh/soh/Enhancements/randomizer/ShufflePots.cpp @@ -48,7 +48,7 @@ void ObjTsubo_RandomizerSpawnCollectible(ObjTsubo* potActor, PlayState* play) { item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; item00->actor.velocity.y = 8.0f; item00->actor.speedXZ = 2.0f; - item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f); + item00->actor.world.rot.y = static_cast(Rand_CenteredFloat(65536.0f)); } void ObjTsubo_RandomizerInit(void* actorRef) { diff --git a/soh/soh/Enhancements/randomizer/draw.cpp b/soh/soh/Enhancements/randomizer/draw.cpp index 0403966b7..b9cc0b10b 100644 --- a/soh/soh/Enhancements/randomizer/draw.cpp +++ b/soh/soh/Enhancements/randomizer/draw.cpp @@ -597,7 +597,7 @@ extern "C" s32 OverrideLimbDrawBarinade(PlayState* play, s32 limbIndex, Gfx** dL (uintptr_t)Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, (play->gameplayFrames * -2) % 64, 16, 16)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 200); - Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY); + Matrix_RotateX(-M_PIf / 2.0f, MTXMODE_APPLY); } else if ((limbIndex >= 10) && (limbIndex < 20)) { rot->x -= 0x4000; *dList = NULL; @@ -1097,7 +1097,7 @@ extern "C" void Randomizer_DrawBronzeScale(PlayState* play, GetItemEntry* getIte gSPSegment(POLY_XLU_DISP++, 0x08, (uintptr_t)Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2), -1 * (play->state.frames * 2), 64, 64, 1, 1 * (play->state.frames * 4), - 1 * -(play->state.frames * 4), 32, 32)); + -1 * (play->state.frames * 4), 32, 32)); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); @@ -1116,7 +1116,7 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI // Draw rod Gfx_SetupDL_25Opa(play->state.gfxCtx); - Matrix_Scale(0.2, 0.2, 0.2, MTXMODE_APPLY); + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingPoleGiDL); @@ -1126,8 +1126,8 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI Matrix_Scale(5.0f, 5.0f, 5.0f, MTXMODE_APPLY); pos = { 0.0f, -25.5f, -4.0f }; Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_APPLY); - Matrix_RotateZ(-M_PI_2, MTXMODE_APPLY); - Matrix_RotateY(-M_PI_2 - 0.2f, MTXMODE_APPLY); + Matrix_RotateZ(-M_PI_2f, MTXMODE_APPLY); + Matrix_RotateY(-M_PI_2f - 0.2f, MTXMODE_APPLY); Matrix_Scale(0.006f, 0.006f, 0.006f, MTXMODE_APPLY); Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), @@ -1140,7 +1140,7 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL); - Matrix_RotateZ(M_PI_2, MTXMODE_APPLY); + Matrix_RotateZ(M_PI_2f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL); @@ -1149,7 +1149,7 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL); - Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); + Matrix_RotateZ(M_PIf / 2.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL); diff --git a/soh/soh/Enhancements/randomizer/hint.cpp b/soh/soh/Enhancements/randomizer/hint.cpp index d81e94f2f..3b1cb23f4 100644 --- a/soh/soh/Enhancements/randomizer/hint.cpp +++ b/soh/soh/Enhancements/randomizer/hint.cpp @@ -226,7 +226,8 @@ uint8_t Hint::GetNumberOfMessages() const { if (numMessages == 0) { numMessages = 1; // RANDOTODO make std::max actually fucking work for 3 arguments } - return numMessages; + // RANDOTODO will number of messages always be u8? + return static_cast(numMessages); } const std::vector Hint::GetAllMessageStrings(MessageFormat format) const { diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 9c0d1a5e3..5fe050170 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -1013,7 +1013,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l if (item00->itemEntry.getItemId == GI_SWORD_BGS) { gSaveContext.bgsFlag = true; } - Item_Give(gPlayState, item00->itemEntry.itemId); + Item_Give(gPlayState, static_cast(item00->itemEntry.itemId)); } else if (item00->itemEntry.modIndex == MOD_RANDOMIZER) { if (item00->itemEntry.getItemId == RG_ICE_TRAP) { gSaveContext.ship.pendingIceTrapCount++; @@ -2137,23 +2137,23 @@ void RandomizerOnActorInitHandler(void* actorRef) { void RandomizerOnGameFrameUpdateHandler() { if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_QUIVER)) { - AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER); + AMMO(ITEM_BOW) = static_cast(CUR_CAPACITY(UPG_QUIVER)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BOMB_BAG)) { - AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); + AMMO(ITEM_BOMB) = static_cast(CUR_CAPACITY(UPG_BOMB_BAG)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BULLET_BAG)) { - AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG); + AMMO(ITEM_SLINGSHOT) = static_cast(CUR_CAPACITY(UPG_BULLET_BAG)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_STICK_UPGRADE)) { - AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); + AMMO(ITEM_STICK) = static_cast(CUR_CAPACITY(UPG_STICKS)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_NUT_UPGRADE)) { - AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); + AMMO(ITEM_NUT) = static_cast(CUR_CAPACITY(UPG_NUTS)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER)) { @@ -2165,7 +2165,7 @@ void RandomizerOnGameFrameUpdateHandler() { } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MONEY)) { - gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET); + gSaveContext.rupees = static_cast(CUR_CAPACITY(UPG_WALLET)); } if (!Flags_GetRandomizerInf(RAND_INF_HAS_WALLET)) { diff --git a/soh/soh/Enhancements/randomizer/logic.cpp b/soh/soh/Enhancements/randomizer/logic.cpp index 72f23275b..d3b93c3f6 100644 --- a/soh/soh/Enhancements/randomizer/logic.cpp +++ b/soh/soh/Enhancements/randomizer/logic.cpp @@ -1814,7 +1814,7 @@ void Logic::ApplyItemEffect(Item& item, bool state) { if (randoGet == RG_BOTTLE_WITH_BIG_POE) { BigPoes++; } - mSaveContext->inventory.items[slot] = itemId; + mSaveContext->inventory.items[slot] = static_cast(itemId); } break; case RG_RUTOS_LETTER: SetRandoInf(RAND_INF_OBTAINED_RUTOS_LETTER, state); @@ -2306,7 +2306,7 @@ void Logic::SetEventChkInf(int32_t flag, bool state) { } uint8_t Logic::GetGSCount() { - return mSaveContext->inventory.gsTokens; + return static_cast(mSaveContext->inventory.gsTokens); } uint8_t Logic::GetAmmo(uint32_t item) { diff --git a/soh/soh/Enhancements/randomizer/option.cpp b/soh/soh/Enhancements/randomizer/option.cpp index bec719d4b..f027fd066 100644 --- a/soh/soh/Enhancements/randomizer/option.cpp +++ b/soh/soh/Enhancements/randomizer/option.cpp @@ -83,11 +83,11 @@ void Option::RestoreDelayedOption() { contextSelection = delayedSelection; } -void Option::SetContextIndex(size_t idx) { +void Option::SetContextIndex(uint8_t idx) { // TODO: Set to Context's OptionValue array. contextSelection = idx; - if (contextSelection > options.size() - 1) { - contextSelection = options.size() - 1; + if (contextSelection > static_cast(options.size() - 1)) { + contextSelection = static_cast(options.size() - 1); } } @@ -105,7 +105,7 @@ bool Option::IsHidden() const { void Option::ChangeOptions(std::vector opts) { if (GetOptionIndex() >= opts.size()) { - CVarSetInteger(cvarName.c_str(), opts.size() - 1); + CVarSetInteger(cvarName.c_str(), static_cast(opts.size() - 1)); } options = std::move(opts); } @@ -206,8 +206,8 @@ bool Option::RenderCheckbox() { bool Option::RenderCombobox() { bool changed = false; uint8_t selected = CVarGetInteger(cvarName.c_str(), defaultOption); - if (selected >= options.size()) { - selected = options.size(); + if (selected >= static_cast(options.size())) { + selected = static_cast(options.size()); CVarSetInteger(cvarName.c_str(), selected); changed = true; Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); @@ -231,13 +231,13 @@ bool Option::RenderSlider() { bool changed = false; int val = CVarGetInteger(cvarName.c_str(), defaultOption); if (val > options.size() - 1) { - val = options.size() - 1; + val = static_cast(options.size()) - 1; changed = true; } UIWidgets::IntSliderOptions widgetOptions = UIWidgets::IntSliderOptions() .Color(THEME_COLOR) .Min(0) - .Max(options.size() - 1) + .Max(static_cast(options.size() - 1)) .Tooltip(description.c_str()) .Format(options[val].c_str()) .DefaultValue(defaultOption); diff --git a/soh/soh/Enhancements/randomizer/option.h b/soh/soh/Enhancements/randomizer/option.h index 507729498..55a06ed86 100644 --- a/soh/soh/Enhancements/randomizer/option.h +++ b/soh/soh/Enhancements/randomizer/option.h @@ -241,11 +241,11 @@ class Option { void RestoreDelayedOption(); /** - * @brief Set the rando context index for this Option. Also calls `SetVariable()`. + * @brief Set the rando context index for this Option. * * @param idx the index to set as the selected index. */ - void SetContextIndex(size_t idx); + void SetContextIndex(uint8_t idx); /** * @brief Hides this Option in the menu. (Not currently being used afaik, we prefer to diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index f4cd391a9..a956532ba 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -355,9 +355,12 @@ std::unordered_map getItemIdToItemId = { { GI_CLAIM_CHECK, ITEM_CLAIM_CHECK }, }; +#ifdef _MSC_VER #pragma optimize("", off) +#else #pragma GCC push_options #pragma GCC optimize("O0") +#endif bool Randomizer::SpoilerFileExists(const char* spoilerFileName) { if (strcmp(spoilerFileName, "") != 0) { std::ifstream spoilerFileStream(SohUtils::Sanitize(spoilerFileName)); @@ -370,8 +373,11 @@ bool Randomizer::SpoilerFileExists(const char* spoilerFileName) { return false; } -#pragma GCC pop_options +#ifdef _MSC_VER #pragma optimize("", on) +#else +#pragma GCC pop_options +#endif void Randomizer::LoadHintMessages() { auto ctx = Rando::Context::GetInstance(); @@ -3504,9 +3510,9 @@ CrateIdentity Randomizer::IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ) { crateSceneNum = SCENE_MARKET_DAY; } else if (sceneNum == SCENE_GERUDOS_FORTRESS && gPlayState->linkAgeOnLoad == 1 && posX == 310) { if (posZ == -1830) { - posZ = -1842.0f; + posZ = -1842; } else if (posZ == -1770) { - posZ = -1782.0f; + posZ = -1782; } } @@ -4098,7 +4104,7 @@ void RandomizerSettingsWindow::DrawElement() { Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } - if (ImGui::BeginTable("trickTags", showTag.size(), + if (ImGui::BeginTable("trickTags", static_cast(showTag.size()), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) { for (auto [rtTag, isShown] : showTag) { @@ -5573,7 +5579,7 @@ void RandomizerSettingsWindow::InitElement() { // (special cases for rando items) void Randomizer_GameplayStats_SetTimestamp(uint16_t item) { - u32 time = GAMEPLAYSTAT_TOTAL_TIME; + u32 time = static_cast(GAMEPLAYSTAT_TOTAL_TIME); // Have items in Link's pocket shown as being obtained at 0.1 seconds if (time == 0) { @@ -5869,7 +5875,7 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { case RG_GREG_RUPEE: Rupees_ChangeBy(1); Flags_SetRandomizerInf(RAND_INF_GREG_FOUND); - gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_FOUND_GREG] = GAMEPLAYSTAT_TOTAL_TIME; + gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_FOUND_GREG] = static_cast(GAMEPLAYSTAT_TOTAL_TIME); break; case RG_TRIFORCE_PIECE: gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected++; @@ -5878,7 +5884,8 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { // Teleport to credits when goal is reached. if (gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected == (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1)) { - gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = GAMEPLAYSTAT_TOTAL_TIME; + gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = + static_cast(GAMEPLAYSTAT_TOTAL_TIME); gSaveContext.ship.stats.gameComplete = 1; Flags_SetRandomizerInf(RAND_INF_GRANT_GANONS_BOSSKEY); Play_PerformSave(play); @@ -5911,12 +5918,12 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { case RG_DEKU_STICK_BAG: Inventory_ChangeUpgrade(UPG_STICKS, 1); INV_CONTENT(ITEM_STICK) = ITEM_STICK; - AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); + AMMO(ITEM_STICK) = static_cast(CUR_CAPACITY(UPG_STICKS)); break; case RG_DEKU_NUT_BAG: Inventory_ChangeUpgrade(UPG_NUTS, 1); INV_CONTENT(ITEM_NUT) = ITEM_NUT; - AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); + AMMO(ITEM_NUT) = static_cast(CUR_CAPACITY(UPG_NUTS)); break; default: LUSLOG_WARN("Randomizer_Item_Give didn't have behaviour specified for getItemId=%d", item); diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 6c670e447..34dfc18e7 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -1892,16 +1892,16 @@ static std::set rainbowCVars = { int hue = 0; void RainbowTick() { - float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat(CVAR_COSMETIC("RainbowSpeed"), 0.6f)); + float freqHue = hue * 2 * M_PIf / (360 * CVarGetFloat(CVAR_COSMETIC("RainbowSpeed"), 0.6f)); for (auto& cvar : rainbowCVars) { if (CVarGetInteger((cvar + ".Rainbow").c_str(), 0) == 0) { continue; } Color_RGBA8 newColor; - newColor.r = sin(freqHue + 0) * 127 + 128; - newColor.g = sin(freqHue + (2 * M_PI / 3)) * 127 + 128; - newColor.b = sin(freqHue + (4 * M_PI / 3)) * 127 + 128; + newColor.r = static_cast(sin(freqHue + 0) * 127) + 128; + newColor.g = static_cast(sin(freqHue + (2 * M_PI / 3)) * 127) + 128; + newColor.b = static_cast(sin(freqHue + (4 * M_PI / 3)) * 127) + 128; newColor.a = 255; CVarSetColor((cvar + ".Value").c_str(), newColor); diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index b71bae5b3..eaa928705 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -382,7 +382,7 @@ const EntranceData entranceData[] = { }; // Check if Link is in the area and return that scene/entrance for tracking -s8 LinkIsInArea(const EntranceData* entrance) { +int16_t LinkIsInArea(const EntranceData* entrance) { bool result = false; if (gPlayState == nullptr) { diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 5996fea1f..bd26b1d44 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -670,17 +670,17 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) { void DrawEquip(ItemTrackerItem item) { bool hasEquip = HasEquipment(item); - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName( hasEquip && IsValidSaveFile() ? item.name : item.nameFaded), - ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); + ImVec2(iconSize, iconSize), ImVec2(0.0f, 0.0f), ImVec2(1, 1)); Tooltip(SohUtils::GetItemName(item.id).c_str()); } void DrawQuest(ItemTrackerItem item) { bool hasQuestItem = HasQuestItem(item); - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); ImGui::BeginGroup(); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName( hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded), @@ -698,7 +698,7 @@ void DrawQuest(ItemTrackerItem item) { void DrawItem(ItemTrackerItem item) { uint32_t actualItemId = GameInteractor::IsSaveLoaded() ? INV_CONTENT(item.id) : ITEM_NONE; - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); bool hasItem = actualItemId != ITEM_NONE; std::string itemName = ""; @@ -1015,7 +1015,7 @@ void DrawBottle(ItemTrackerItem item) { item = actualItemTrackerItemMap[actualItemId]; } - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName( hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); @@ -1027,7 +1027,7 @@ void DrawDungeonItem(ItemTrackerItem item) { uint32_t itemId = item.id; ImU32 dungeonColor = IM_COL_WHITE; uint32_t bitMask = 1 << (item.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); bool hasItem = GameInteractor::IsSaveLoaded() ? (bitMask & gSaveContext.inventory.dungeonItems[item.data]) : false; bool hasSmallKey = GameInteractor::IsSaveLoaded() ? ((gSaveContext.inventory.dungeonKeys[item.data]) >= 0) : false; ImGui::BeginGroup(); @@ -1078,19 +1078,19 @@ void DrawDungeonItem(ItemTrackerItem item) { } void DrawSong(ItemTrackerItem item) { - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); ImVec2 p = ImGui::GetCursorScreenPos(); bool hasSong = HasSong(item); ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y)); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName( hasSong && IsValidSaveFile() ? item.name : item.nameFaded), - ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1)); + ImVec2(iconSize / 1.5f, iconSize), ImVec2(0, 0), ImVec2(1, 1)); Tooltip(SohUtils::GetQuestItemName(item.id).c_str()); } void DrawNotes(bool resizeable = false) { ImGui::BeginGroup(); - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); struct ItemTrackerNotes { @@ -1113,7 +1113,7 @@ void DrawNotes(bool resizeable = false) { } }; ImVec2 size = resizeable ? ImVec2(-FLT_MIN, ImGui::GetContentRegionAvail().y) - : ImVec2(((iconSize + iconSpacing) * 6) - 8, 200); + : ImVec2(((iconSize + iconSpacing) * 6) - 8.0f, 200.0f); if (GameInteractor::IsSaveLoaded()) { if (ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size, ImGuiInputTextFlags_AllowTabInput)) { @@ -1185,7 +1185,7 @@ void EndFloatingWindows() { * Takes in a vector of ItemTrackerItem and draws them in rows of N items */ void DrawItemsInRows(std::vector items, int columns = 6) { - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); int topPadding = (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW) ? 20 : 0; @@ -1194,7 +1194,7 @@ void DrawItemsInRows(std::vector items, int columns = 6) { int row = i / columns; int column = i % columns; ImGui::SetCursorPos( - ImVec2((column * (iconSize + iconSpacing) + 8), (row * (iconSize + iconSpacing)) + 8 + topPadding)); + ImVec2((column * (iconSize + iconSpacing) + 8.0f), (row * (iconSize + iconSpacing)) + 8.0f + topPadding)); items[i].drawFunc(items[i]); } } @@ -1208,10 +1208,10 @@ void DrawItemsInACircle(std::vector items) { int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); ImVec2 max = ImGui::GetWindowContentRegionMax(); - float radius = (iconSize + iconSpacing) * 2; + float radius = (iconSize + iconSpacing) * 2.0f; for (int i = 0; i < items.size(); i++) { - float angle = (float)i / items.size() * 2.0f * M_PI; + float angle = static_cast(i / items.size() * 2.0f * M_PI); float x = (radius / 2.0f) * cos(angle) + max.x / 2.0f; float y = (radius / 2.0f) * sin(angle) + max.y / 2.0f; ImGui::SetCursorPos(ImVec2(x - (CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36) - 8) / 2.0f, y + 4)); @@ -1225,14 +1225,12 @@ void DrawItemsInACircle(std::vector items) { * to then call DrawItemsInRows */ std::vector GetDungeonItemsVector(std::vector dungeons, int columns = 6) { - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); - int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); std::vector dungeonItems = {}; int rowCount = 0; for (int i = 0; i < dungeons.size(); i++) { if (dungeons[i].items.size() > rowCount) - rowCount = dungeons[i].items.size(); + rowCount = static_cast(dungeons[i].items.size()); } for (int i = 0; i < rowCount; i++) { @@ -1469,7 +1467,7 @@ void ItemTrackerSaveFile(SaveContext* saveContext, int sectionID, bool fullSave) void ItemTrackerLoadFile() { std::string initialTrackerNotes = ""; SaveManager::Instance->LoadData("personalNotes", initialTrackerNotes); - itemTrackerNotes.resize(initialTrackerNotes.length() + 1); + itemTrackerNotes.resize(static_cast(initialTrackerNotes.length() + 1)); if (initialTrackerNotes != "") { SohUtils::CopyStringToCharArray(itemTrackerNotes.Data, initialTrackerNotes.c_str(), itemTrackerNotes.size()); } else { diff --git a/soh/soh/Enhancements/randomizer/savefile.cpp b/soh/soh/Enhancements/randomizer/savefile.cpp index cb8c7eaef..266a2cc42 100644 --- a/soh/soh/Enhancements/randomizer/savefile.cpp +++ b/soh/soh/Enhancements/randomizer/savefile.cpp @@ -22,7 +22,7 @@ void StartingItemGive(GetItemEntry getItemEntry, RandomizerCheck randomizerCheck if (getItemEntry.getItemId == GI_SWORD_BGS) { gSaveContext.bgsFlag = true; } - Item_Give(NULL, getItemEntry.itemId); + Item_Give(NULL, static_cast(getItemEntry.itemId)); } else if (getItemEntry.modIndex == MOD_RANDOMIZER) { if (getItemEntry.getItemId == RG_ICE_TRAP) { gSaveContext.ship.pendingIceTrapCount++; diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 9157e2922..8f56c9cb5 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -24,7 +24,7 @@ std::vector NumOpts(const int min, const int max, const int step = } std::vector MultiVecOpts(const std::vector>& optionsVector) { - uint32_t totalSize = 0; + size_t totalSize = 0; for (const auto& vector : optionsVector) { totalSize += vector.size(); } @@ -2638,7 +2638,7 @@ void Context::FinalizeSettings(const std::set& excludedLocation mqSet += 1; break; case RO_MQ_SET_RANDOM: - randMQOption.push_back(i); + randMQOption.push_back(static_cast(i)); dungeons[i]->SetDungeonKnown(false); break; default: @@ -2659,7 +2659,7 @@ void Context::FinalizeSettings(const std::set& excludedLocation // otherwise, make everything a possibility and unknown } else { for (size_t i = 0; i < dungeons.size(); i++) { - randMQOption.push_back(i); + randMQOption.push_back(static_cast(i)); dungeons[i]->SetDungeonKnown(false); mOptions[dungeons[i]->GetMQSetting()].Set(RO_MQ_SET_RANDOM); } diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 6f83d78ad..2d1464e47 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -15,6 +15,11 @@ #define BTN_CUSTOM_OCARINA_PITCH_UP ((CONTROLLERBUTTONS_T)0x00400000) #define BTN_CUSTOM_OCARINA_PITCH_DOWN ((CONTROLLERBUTTONS_T)0x00800000) +#define M_PIf 3.14159265358979323846f +#define M_PI_2f 1.57079632679489661923f // pi/2 +#define M_SQRT2f 1.41421356237309504880f +#define M_SQRT1_2f 0.70710678118654752440f /* 1/sqrt(2) */ + #ifdef __cplusplus #include #include "Enhancements/savestates.h" From 9010b8c540d84b56a0d8944dbc247df7be88bb72 Mon Sep 17 00:00:00 2001 From: Archez Date: Sat, 17 May 2025 01:09:23 -0400 Subject: [PATCH 26/44] port over nametag improvements from 2ship (#5160) --- soh/soh/Enhancements/debugger/actorViewer.cpp | 133 +++++++++++++----- soh/soh/Enhancements/debugger/actorViewer.h | 2 +- .../GameInteractor_HookTable.h | 1 + .../game-interactor/GameInteractor_Hooks.cpp | 7 + .../game-interactor/GameInteractor_Hooks.h | 1 + soh/soh/Enhancements/mods.cpp | 2 - soh/soh/Enhancements/nametag.cpp | 101 +++++++++---- soh/soh/Enhancements/nametag.h | 13 +- soh/src/code/z_actor.c | 3 + 9 files changed, 193 insertions(+), 70 deletions(-) diff --git a/soh/soh/Enhancements/debugger/actorViewer.cpp b/soh/soh/Enhancements/debugger/actorViewer.cpp index 515da6491..2e94e1391 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.cpp +++ b/soh/soh/Enhancements/debugger/actorViewer.cpp @@ -5,6 +5,7 @@ #include "soh/ActorDB.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/nametag.h" +#include "soh/ShipInit.hpp" #include #include @@ -13,6 +14,7 @@ #include #include #include +#include #include "soh/OTRGlobals.h" #include "soh/cvar_prefixes.h" @@ -31,6 +33,10 @@ extern PlayState* gPlayState; #define DEKUNUTS_FLOWER 10 #define DEBUG_ACTOR_NAMETAG_TAG "debug_actor_viewer" +#define CVAR_ACTOR_NAME_TAGS(val) CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags." val) +#define CVAR_ACTOR_NAME_TAGS_ENABLED_NAME CVAR_ACTOR_NAME_TAGS("Enabled") +#define CVAR_ACTOR_NAME_TAGS_ENABLED CVarGetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 0) + typedef struct { u16 id; u16 params; @@ -67,6 +73,10 @@ const std::string GetActorDescription(u16 id) { return ActorDB::Instance->RetrieveEntry(id).entry.valid ? ActorDB::Instance->RetrieveEntry(id).entry.desc : "???"; } +const std::string GetActorDebugName(u16 id) { + return ActorDB::Instance->RetrieveEntry(id).entry.valid ? ActorDB::Instance->RetrieveEntry(id).entry.name : "???"; +} + template void DrawGroupWithBorder(T&& drawFunc, std::string section) { // First group encapsulates the inner portion and border ImGui::BeginChild(std::string("##" + section).c_str(), ImVec2(0, 0), @@ -812,25 +822,37 @@ std::vector GetActorsWithDescriptionContainingString(std::string s) { } void ActorViewer_AddTagForActor(Actor* actor) { - int val = CVarGetInteger(CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags"), ACTORVIEWER_NAMETAGS_NONE); - auto entry = ActorDB::Instance->RetrieveEntry(actor->id); - std::string tag; - - if (val > 0 && entry.entry.valid) { - switch (val) { - case ACTORVIEWER_NAMETAGS_DESC: - tag = entry.desc; - break; - case ACTORVIEWER_NAMETAGS_NAME: - tag = entry.name; - break; - case ACTORVIEWER_NAMETAGS_BOTH: - tag = entry.name + '\n' + entry.desc; - break; - } - - NameTag_RegisterForActorWithOptions(actor, tag.c_str(), { .tag = DEBUG_ACTOR_NAMETAG_TAG }); + if (!CVarGetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 0)) { + return; } + + std::vector parts; + + if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayID"), 0)) { + parts.push_back(GetActorDebugName(actor->id)); + } + if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayDescription"), 0)) { + parts.push_back(GetActorDescription(actor->id)); + } + if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayCategory"), 0)) { + parts.push_back(acMapping[actor->category]); + } + if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayParams"), 0)) { + parts.push_back(fmt::format("0x{:04X} ({})", (u16)actor->params, actor->params)); + } + + std::string tag = ""; + for (size_t i = 0; i < parts.size(); i++) { + if (i != 0) { + tag += "\n"; + } + tag += parts.at(i); + } + + bool withZBuffer = CVarGetInteger(CVAR_ACTOR_NAME_TAGS("WithZBuffer"), 0); + + NameTag_RegisterForActorWithOptions(actor, tag.c_str(), + { .tag = DEBUG_ACTOR_NAMETAG_TAG, .noZBuffer = !withZBuffer }); } void ActorViewer_AddTagForAllActors() { @@ -881,6 +903,57 @@ void ActorViewerWindow::DrawElement() { } lastSceneId = gPlayState->sceneNum; + if (ImGui::BeginChild("options", ImVec2(0, 0), ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY)) { + bool toggled = false; + bool optionChange = false; + + ImGui::SeparatorText("Options"); + + toggled = UIWidgets::CVarCheckbox("Actor Name Tags", CVAR_ACTOR_NAME_TAGS("Enabled"), + { { .tooltip = "Adds \"name tags\" above actors for identification" } }); + + ImGui::SameLine(); + + UIWidgets::Button("Display Items", { { .tooltip = "Click to add display items on the name tags" } }); + + if (ImGui::BeginPopupContextItem(nullptr, ImGuiPopupFlags_MouseButtonLeft | ImGuiPopupFlags_NoReopen)) { + optionChange |= UIWidgets::CVarCheckbox("ID", CVAR_ACTOR_NAME_TAGS("DisplayID")); + optionChange |= UIWidgets::CVarCheckbox("Description", CVAR_ACTOR_NAME_TAGS("DisplayDescription")); + optionChange |= UIWidgets::CVarCheckbox("Category", CVAR_ACTOR_NAME_TAGS("DisplayCategory")); + optionChange |= UIWidgets::CVarCheckbox("Params", CVAR_ACTOR_NAME_TAGS("DisplayParams")); + + ImGui::EndPopup(); + } + + optionChange |= UIWidgets::CVarCheckbox( + "Name tags with Z-Buffer", CVAR_ACTOR_NAME_TAGS("WithZBuffer"), + { { .tooltip = "Allow name tags to be obstructed when behind geometry and actors" } }); + + if (toggled || optionChange) { + bool tagsEnabled = CVarGetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 0); + bool noOptionsEnabled = !CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayID"), 0) && + !CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayDescription"), 0) && + !CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayCategory"), 0) && + !CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayParams"), 0); + + // Save the user an extra click and prevent adding "empty" tags by enabling, + // disabling, or setting an option based on what changed + if (tagsEnabled && noOptionsEnabled) { + if (toggled) { + CVarSetInteger(CVAR_ACTOR_NAME_TAGS("DisplayID"), 1); + } else { + CVarSetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 0); + } + } else if (optionChange && !tagsEnabled && !noOptionsEnabled) { + CVarSetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 1); + } + + NameTag_RemoveAllByTag(DEBUG_ACTOR_NAMETAG_TAG); + ActorViewer_AddTagForAllActors(); + } + } + ImGui::EndChild(); + PushStyleCombobox(THEME_COLOR); if (ImGui::BeginCombo("Actor Type", acMapping[category])) { for (int i = 0; i < acMapping.size(); i++) { @@ -1160,20 +1233,6 @@ void ActorViewerWindow::DrawElement() { ImGui::TreePop(); } PopStyleHeader(); - - static std::unordered_map nameTagOptions = { - { 0, "None" }, - { 1, "Short Description" }, - { 2, "Actor ID" }, - { 3, "Both" }, - }; - - if (CVarCombobox( - "Actor Name Tags", CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags"), nameTagOptions, - ComboboxOptions().Color(THEME_COLOR).Tooltip("Adds \"name tags\" above actors for identification"))) { - NameTag_RemoveAllByTag(DEBUG_ACTOR_NAMETAG_TAG); - ActorViewer_AddTagForAllActors(); - } } else { ImGui::Text("Global Context needed for actor info!"); if (needs_reset) { @@ -1190,9 +1249,9 @@ void ActorViewerWindow::DrawElement() { ImGui::EndDisabled(); } -void ActorViewerWindow::InitElement() { - GameInteractor::Instance->RegisterGameHook([](void* refActor) { - Actor* actor = static_cast(refActor); - ActorViewer_AddTagForActor(actor); - }); +void ActorViewer_RegisterNameTagHooks() { + COND_HOOK(OnActorInit, CVAR_ACTOR_NAME_TAGS_ENABLED, + [](void* actor) { ActorViewer_AddTagForActor(static_cast(actor)); }); } + +RegisterShipInitFunc nametagInit(ActorViewer_RegisterNameTagHooks, { CVAR_ACTOR_NAME_TAGS_ENABLED_NAME }); diff --git a/soh/soh/Enhancements/debugger/actorViewer.h b/soh/soh/Enhancements/debugger/actorViewer.h index 5d5bcdf88..709380544 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.h +++ b/soh/soh/Enhancements/debugger/actorViewer.h @@ -7,6 +7,6 @@ class ActorViewerWindow final : public Ship::GuiWindow { using GuiWindow::GuiWindow; void DrawElement() override; - void InitElement() override; + void InitElement() override{}; void UpdateElement() override{}; }; diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h index e70c0d33e..10655cc35 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h @@ -29,6 +29,7 @@ DEFINE_HOOK(OnShopSlotChange, (uint8_t cursorIndex, int16_t price)); DEFINE_HOOK(OnActorInit, (void* actor)); DEFINE_HOOK(OnActorUpdate, (void* actor)); DEFINE_HOOK(OnActorKill, (void* actor)); +DEFINE_HOOK(OnActorDestroy, (void* actor)); DEFINE_HOOK(OnEnemyDefeat, (void* actor)); DEFINE_HOOK(OnBossDefeat, (void* actor)); DEFINE_HOOK(OnTimestamp, (u8 item)); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp index 08f2660dd..b31c38b48 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp @@ -122,6 +122,13 @@ void GameInteractor_ExecuteOnActorKill(void* actor) { GameInteractor::Instance->ExecuteHooksForFilter(actor); } +void GameInteractor_ExecuteOnActorDestroy(void* actor) { + GameInteractor::Instance->ExecuteHooks(actor); + GameInteractor::Instance->ExecuteHooksForID(((Actor*)actor)->id, actor); + GameInteractor::Instance->ExecuteHooksForPtr((uintptr_t)actor, actor); + GameInteractor::Instance->ExecuteHooksForFilter(actor); +} + void GameInteractor_ExecuteOnEnemyDefeat(void* actor) { GameInteractor::Instance->ExecuteHooks(actor); GameInteractor::Instance->ExecuteHooksForID(((Actor*)actor)->id, actor); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h index cd8e7962e..a8133820b 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h @@ -31,6 +31,7 @@ void GameInteractor_ExecuteOnCuccoOrChickenHatch(); void GameInteractor_ExecuteOnActorInit(void* actor); void GameInteractor_ExecuteOnActorUpdate(void* actor); void GameInteractor_ExecuteOnActorKill(void* actor); +void GameInteractor_ExecuteOnActorDestroy(void* actor); void GameInteractor_ExecuteOnEnemyDefeat(void* actor); void GameInteractor_ExecuteOnBossDefeat(void* actor); void GameInteractor_ExecuteOnTimestamp(u8 item); diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 2c357fd34..a183680a8 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -12,7 +12,6 @@ #include "soh/Enhancements/randomizer/3drando/random.hpp" #include "soh/Enhancements/cosmetics/authenticGfxPatches.h" #include -#include "soh/Enhancements/nametag.h" #include "soh/Enhancements/timesaver_hook_handlers.h" #include "soh/Enhancements/TimeSavers/TimeSavers.h" #include "soh/Enhancements/randomizer/hook_handlers.h" @@ -1090,7 +1089,6 @@ void InitMods() { RegisterRandomizedEnemySizes(); RegisterOpenAllHours(); RegisterToTMedallions(); - NameTag_RegisterHooks(); RegisterFloorSwitchesHook(); RegisterPatchHandHandler(); RegisterHurtContainerModeHandler(); diff --git a/soh/soh/Enhancements/nametag.cpp b/soh/soh/Enhancements/nametag.cpp index 253c0980b..1989b3552 100644 --- a/soh/soh/Enhancements/nametag.cpp +++ b/soh/soh/Enhancements/nametag.cpp @@ -5,7 +5,7 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/custom-message/CustomMessageInterfaceAddon.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" -#include "soh/OTRGlobals.h" +#include "soh/ShipUtils.h" extern "C" { #include "z64.h" @@ -26,12 +26,16 @@ typedef struct { int16_t height; // Textbox height int16_t width; // Textbox width int16_t yOffset; // Addition Y offset + uint8_t noZBuffer; // Allow rendering over geometry Mtx* mtx; // Allocated Mtx for rendering Vtx* vtx; // Allocated Vtx for rendering } NameTag; static std::vector nameTags; static std::vector nameTagDl; +static bool sMirrorWorldActive = false; + +void NameTag_RegisterHooks(); void FreeNameTag(NameTag* nameTag) { if (nameTag->vtx != nullptr) { @@ -51,14 +55,14 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) { } // Name tag is too far away to meaningfully read, don't bother rendering it - if (nameTag->actor->xyzDistToPlayerSq > 200000.0f) { + if (nameTag->actor->xyzDistToPlayerSq > 440000.0f) { return; } // Fade out name tags that are far away float alpha = 1.0f; - if (nameTag->actor->xyzDistToPlayerSq > 160000.0f) { - alpha = (200000.0f - nameTag->actor->xyzDistToPlayerSq) / 40000.0f; + if (nameTag->actor->xyzDistToPlayerSq > 360000.0f) { + alpha = (440000.0f - nameTag->actor->xyzDistToPlayerSq) / 80000.0f; } float scale = 75.0f / 100.f; @@ -79,7 +83,7 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) { textColor = CVarGetColor(CVAR_COSMETIC("HUD.NameTagActorText.Value"), textColor); } - FrameInterpolation_RecordOpenChild(nameTag->actor, 10); + FrameInterpolation_RecordOpenChild(nameTag->actor, 0); // Prefer the highest between world position and focus position if targetable float posY = nameTag->actor->world.pos.y; @@ -92,7 +96,7 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) { // Set position, billboard effect, scale (with mirror mode), then center nametag Matrix_Translate(nameTag->actor->world.pos.x, posY, nameTag->actor->world.pos.z, MTXMODE_NEW); Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(scale * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1), -scale, 1.0f, MTXMODE_APPLY); + Matrix_Scale(scale * (sMirrorWorldActive ? -1.0f : 1.0f), -scale, 1.0f, MTXMODE_APPLY); Matrix_Translate(-(float)nameTag->width / 2, -nameTag->height, 0, MTXMODE_APPLY); Matrix_ToMtx(nameTag->mtx, (char*)__FILE__, __LINE__); @@ -154,15 +158,27 @@ void DrawNameTags() { OPEN_DISPS(gPlayState->state.gfxCtx); // Setup before rendering name tags - Gfx_SetupDL_38Xlu(gPlayState->state.gfxCtx); - nameTagDl.push_back(gsDPSetAlphaDither(G_AD_DISABLE)); - nameTagDl.push_back(gsSPClearGeometryMode(G_SHADE)); + POLY_XLU_DISP = Gfx_SetupDL_39(POLY_XLU_DISP); + nameTagDl.push_back(gsDPSetAlphaCompare(G_AC_NONE)); nameTagDl.push_back( gsDPSetCombineLERP(0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0)); + bool zbufferEnabled = false; + // Add all the name tags for (const auto& nameTag : nameTags) { + // Toggle ZBuffer mode based on last state and next tag + if (zbufferEnabled == nameTag.noZBuffer) { + if (nameTag.noZBuffer) { + nameTagDl.push_back(gsSPClearGeometryMode(G_ZBUFFER)); + zbufferEnabled = false; + } else { + nameTagDl.push_back(gsSPSetGeometryMode(G_ZBUFFER)); + zbufferEnabled = true; + } + } + DrawNameTag(gPlayState, &nameTag); } @@ -189,22 +205,22 @@ void UpdateNameTags() { return aDistToCamera > bDistToCamera; }); + + sMirrorWorldActive = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0); } extern "C" void NameTag_RegisterForActorWithOptions(Actor* actor, const char* text, NameTagOptions options) { std::string processedText = std::string(Interface_ReplaceSpecialCharacters((char*)text)); // Strip out unsupported characters - processedText.erase(std::remove_if(processedText.begin(), processedText.end(), - [](const char& c) { - // 172 is max supported texture for the in-game font system, - // and filter anything less than a space but not the newline or nul - // characters - return (unsigned char)c > 172 || (c < ' ' && c != '\n' && c != '\0'); - }), - processedText.end()); + // 172 is max supported texture for the in-game font system, + // and filter anything less than a space but not the newline or nul characters + processedText.erase( + std::remove_if(processedText.begin(), processedText.end(), + [](const char& c) { return (uint8_t)c > 172 || (c < ' ' && c != '\n' && c != '\0'); }), + processedText.end()); - int16_t numChar = processedText.length(); + size_t numChar = processedText.length(); int16_t numLines = 1; int16_t offsetX = 0; int16_t maxOffsetX = 0; @@ -213,7 +229,7 @@ extern "C" void NameTag_RegisterForActorWithOptions(Actor* actor, const char* te Vtx* vertices = (Vtx*)calloc(sizeof(Vtx[4]), numChar + 1); // Set all the char vtx first to get the total size for the textbox - for (int16_t i = 0; i < numChar; i++) { + for (size_t i = 0; i < numChar; i++) { if (processedText[i] == '\n') { offsetX = 0; numLines++; @@ -249,10 +265,13 @@ extern "C" void NameTag_RegisterForActorWithOptions(Actor* actor, const char* te nameTag.height = height; nameTag.width = width; nameTag.yOffset = options.yOffset; + nameTag.noZBuffer = options.noZBuffer; nameTag.mtx = new Mtx(); nameTag.vtx = vertices; nameTags.push_back(nameTag); + + NameTag_RegisterHooks(); } extern "C" void NameTag_RegisterForActor(Actor* actor, const char* text) { @@ -268,6 +287,8 @@ extern "C" void NameTag_RemoveAllForActor(Actor* actor) { it++; } } + + NameTag_RegisterHooks(); } extern "C" void NameTag_RemoveAllByTag(const char* tag) { @@ -279,6 +300,8 @@ extern "C" void NameTag_RemoveAllByTag(const char* tag) { it++; } } + + NameTag_RegisterHooks(); } void RemoveAllNameTags() { @@ -287,23 +310,49 @@ void RemoveAllNameTags() { } nameTags.clear(); + + NameTag_RegisterHooks(); } -static bool sRegisteredHooks = false; - void NameTag_RegisterHooks() { - if (sRegisteredHooks) { + static HOOK_ID gameStatUpdateHookID = 0; + static HOOK_ID drawHookID = 0; + static HOOK_ID playDestroyHookID = 0; + static HOOK_ID actorDestroyHookID = 0; + static bool sRegisteredHooks = false; + + // Hooks already (un)registered based on nametags + if ((nameTags.size() > 0) == sRegisteredHooks) { + return; + } + + GameInteractor::Instance->UnregisterGameHook(gameStatUpdateHookID); + GameInteractor::Instance->UnregisterGameHook(drawHookID); + GameInteractor::Instance->UnregisterGameHook(playDestroyHookID); + GameInteractor::Instance->UnregisterGameHook(actorDestroyHookID); + gameStatUpdateHookID = 0; + drawHookID = 0; + playDestroyHookID = 0; + actorDestroyHookID = 0; + sRegisteredHooks = false; + + if (nameTags.size() == 0) { return; } sRegisteredHooks = true; // Reorder tags every frame to mimic depth rendering - GameInteractor::Instance->RegisterGameHook([]() { UpdateNameTags(); }); + gameStatUpdateHookID = + GameInteractor::Instance->RegisterGameHook(UpdateNameTags); - // Render name tags at the end of player draw to avoid overflowing the display buffers - GameInteractor::Instance->RegisterGameHook([]() { DrawNameTags(); }); + // Render name tags at the end of the Play World drawing + drawHookID = GameInteractor::Instance->RegisterGameHook(DrawNameTags); // Remove all name tags on play state destroy as all actors are removed anyways - GameInteractor::Instance->RegisterGameHook([]() { RemoveAllNameTags(); }); + playDestroyHookID = GameInteractor::Instance->RegisterGameHook(RemoveAllNameTags); + + // Remove all name tags for actor on destroy + actorDestroyHookID = GameInteractor::Instance->RegisterGameHook( + [](void* actor) { NameTag_RemoveAllForActor((Actor*)actor); }); } diff --git a/soh/soh/Enhancements/nametag.h b/soh/soh/Enhancements/nametag.h index 98b83f7cc..47908e875 100644 --- a/soh/soh/Enhancements/nametag.h +++ b/soh/soh/Enhancements/nametag.h @@ -1,11 +1,16 @@ -#ifndef _NAMETAG_H_ -#define _NAMETAG_H_ -#include +#ifndef NAMETAG_H +#define NAMETAG_H + +#include +#include + +struct Actor; typedef struct { const char* tag; // Tag identifier to filter/remove multiple tags int16_t yOffset; // Additional Y offset to apply for the name tag Color_RGBA8 textColor; // Text color override. Global color is used if alpha is 0 + uint8_t noZBuffer; // Allow rendering over geometry } NameTagOptions; // Register required hooks for nametags on startup @@ -28,4 +33,4 @@ void NameTag_RemoveAllByTag(const char* tag); } #endif -#endif // _NAMETAG_H_ +#endif // NAMETAG_H diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 3ca67ad3b..ac9e4f3f6 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -3466,6 +3466,9 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { player = GET_PLAYER(play); + // Execute before actor memory is freed + GameInteractor_ExecuteOnActorDestroy(actor); + dbEntry = ActorDB_Retrieve(actor->id); if (HREG(20) != 0) { From 6acabae38f9445b199979861bcadf432d37522a7 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sat, 17 May 2025 02:11:04 -0400 Subject: [PATCH 27/44] Prevent another use of gSaveContext during Seed Generation (#5458) * Prevent BeanPlanted using gSaveContext for seed gen * address malk's comment about extern --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> --- soh/soh/Enhancements/randomizer/location_access.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index 6cf2aa2ab..ade8cbf72 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -12,7 +12,6 @@ #include extern "C" { -extern SaveContext gSaveContext; extern PlayState* gPlayState; } @@ -275,7 +274,7 @@ bool BeanPlanted(const RandomizerRegion region) { if (gPlayState != nullptr && gPlayState->sceneNum == sceneID) { swch = gPlayState->actorCtx.flags.swch; } else if (sceneID != SCENE_ID_MAX) { - swch = gSaveContext.sceneFlags[sceneID].swch; + swch = Rando::Context::GetInstance()->GetLogic()->GetSaveContext()->sceneFlags[sceneID].swch; } else { swch = 0; } From 026c7619da21ec945916bee4d64b9f12e786a755 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sat, 17 May 2025 02:16:59 -0400 Subject: [PATCH 28/44] set soh c standard to 23 (#5498) --- CMakeLists.txt | 2 +- soh/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9a5afe4c..cf9c55b5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.26.0 FATAL_ERROR) set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") -set(CMAKE_C_STANDARD 17 CACHE STRING "The C standard to use") +set(CMAKE_C_STANDARD 23 CACHE STRING "The C standard to use") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 3511a0caf..8f36a94cd 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -4,7 +4,7 @@ set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) project(soh LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") -set(CMAKE_C_STANDARD 17 CACHE STRING "The C standard to use") +set(CMAKE_C_STANDARD 23 CACHE STRING "The C standard to use") if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") enable_language(OBJCXX) From 4f0ed2949e60d29543fd68e2a73f37651a00bb63 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sat, 17 May 2025 10:55:21 -0400 Subject: [PATCH 29/44] fix seed gen underflow (#5499) --- soh/soh/Enhancements/randomizer/3drando/fill.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 49bfc4012..f0954231b 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -712,11 +712,11 @@ static void PareDownPlaythrough() { auto ctx = Rando::Context::GetInstance(); std::vector toAddBackItem; // Start at sphere before Ganon's and count down - for (size_t i = ctx->playthroughLocations.size() - 2; i >= 0; i--) { + for (int32_t i = static_cast(ctx->playthroughLocations.size()) - 2; i >= 0; i--) { // Check each item location in sphere std::vector erasableIndices; std::vector sphere = ctx->playthroughLocations.at(i); - for (size_t j = sphere.size() - 1; j >= 0; j--) { + for (int32_t j = static_cast(sphere.size()) - 1; j >= 0; j--) { RandomizerCheck loc = sphere.at(j); RandomizerGet locGet = ctx->GetItemLocation(loc)->GetPlacedRandomizerGet(); // Copy out item From b418db77924dc36055a509629fc7e3f2adfd558a Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sat, 17 May 2025 15:35:51 -0400 Subject: [PATCH 30/44] bump lus (#5500) --- CMake/lus-cvars.cmake | 2 -- libultraship | 2 +- soh/soh/OTRGlobals.cpp | 10 ++++++---- soh/soh/SohGui/Menu.h | 2 +- soh/soh/SohGui/SohGui.cpp | 2 +- soh/soh/SohGui/SohMenu.h | 8 ++++---- soh/soh/SohGui/SohMenuBar.cpp | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/CMake/lus-cvars.cmake b/CMake/lus-cvars.cmake index f6a036479..c64782e75 100644 --- a/CMake/lus-cvars.cmake +++ b/CMake/lus-cvars.cmake @@ -1,7 +1,5 @@ set(CVAR_VSYNC_ENABLED "${CVAR_PREFIX_SETTING}.VsyncEnabled" CACHE STRING "") set(CVAR_Z_FIGHTING_MODE "${CVAR_PREFIX_SETTING}.ZFightingMode" CACHE STRING "") -set(CVAR_NEW_FILE_DROPPED "${CVAR_PREFIX_GENERAL}.NewFileDropped" CACHE STRING "") -set(CVAR_DROPPED_FILE "${CVAR_PREFIX_GENERAL}.DroppedFile" CACHE STRING "") set(CVAR_INTERNAL_RESOLUTION "${CVAR_PREFIX_SETTING}.InternalResolution" CACHE STRING "") set(CVAR_MSAA_VALUE "${CVAR_PREFIX_SETTING}.MSAAValue" CACHE STRING "") set(CVAR_SDL_WINDOWED_FULLSCREEN "${CVAR_PREFIX_SETTING}.SdlWindowedFullscreen" CACHE STRING "") diff --git a/libultraship b/libultraship index ce38cb688..7135d1494 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit ce38cb6883ca030e61749eae584b6d9a7cb7bca5 +Subproject commit 7135d1494e74c38aa7fca734b92ec50bba543b44 diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 935c388d4..bcd23c260 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -40,6 +40,7 @@ #include "z64.h" #include "macros.h" #include "Fonts.h" +#include "window/FileDropMgr.h" #include "window/gui/resource/Font.h" #include #include "Enhancements/custom-message/CustomMessageManager.h" @@ -307,6 +308,7 @@ OTRGlobals::OTRGlobals() { context->InitGfxDebugger(); context->InitConfiguration(); context->InitConsoleVariables(); + context->InitFileDropMgr(); // tell LUS to reserve 3 SoH specific threads (Game, Audio, Save) context->InitResourceManager(OTRFiles, {}, 3); @@ -1434,13 +1436,13 @@ extern "C" void Graph_StartFrame() { } #endif - if (CVarGetInteger(CVAR_NEW_FILE_DROPPED, 0)) { - std::string filePath = SohUtils::Sanitize(CVarGetString(CVAR_DROPPED_FILE, "")); + auto dropMgr = Ship::Context::GetInstance()->GetFileDropMgr(); + if (dropMgr->FileDropped()) { + std::string filePath = dropMgr->GetDroppedFile(); if (!filePath.empty()) { GameInteractor::Instance->ExecuteHooks(filePath); } - CVarClear(CVAR_NEW_FILE_DROPPED); - CVarClear(CVAR_DROPPED_FILE); + dropMgr->ClearDroppedFile(); } } diff --git a/soh/soh/SohGui/Menu.h b/soh/soh/SohGui/Menu.h index 139f90030..a7facffd1 100644 --- a/soh/soh/SohGui/Menu.h +++ b/soh/soh/SohGui/Menu.h @@ -2,7 +2,7 @@ #define MENU_H #include -#include "graphic/Fast3D/gfx_rendering_api.h" +#include "graphic/Fast3D/backends/gfx_rendering_api.h" #include "MenuTypes.h" namespace Ship { diff --git a/soh/soh/SohGui/SohGui.cpp b/soh/soh/SohGui/SohGui.cpp index f4088b6a5..e9b27eda1 100644 --- a/soh/soh/SohGui/SohGui.cpp +++ b/soh/soh/SohGui/SohGui.cpp @@ -13,7 +13,7 @@ #include #ifdef __APPLE__ -#include "graphic/Fast3D/gfx_metal.h" +#include "graphic/Fast3D/backends/gfx_metal.h" #endif #ifdef __SWITCH__ diff --git a/soh/soh/SohGui/SohMenu.h b/soh/soh/SohGui/SohMenu.h index eb3b1f4f7..362cc4721 100644 --- a/soh/soh/SohGui/SohMenu.h +++ b/soh/soh/SohGui/SohMenu.h @@ -4,7 +4,7 @@ #include #include "UIWidgets.hpp" #include "Menu.h" -#include "graphic/Fast3D/gfx_rendering_api.h" +#include "graphic/Fast3D/backends/gfx_rendering_api.h" #include "soh/cvar_prefixes.h" #include "soh/Enhancements/enhancementTypes.h" #include "soh/Enhancements/Presets/Presets.h" @@ -53,9 +53,9 @@ static const std::unordered_map menuThemeOptions = { }; static const std::unordered_map textureFilteringMap = { - { FILTER_THREE_POINT, "Three-Point" }, - { FILTER_LINEAR, "Linear" }, - { FILTER_NONE, "None" }, + { Fast::FILTER_THREE_POINT, "Three-Point" }, + { Fast::FILTER_LINEAR, "Linear" }, + { Fast::FILTER_NONE, "None" }, }; static const std::unordered_map logLevels = { diff --git a/soh/soh/SohGui/SohMenuBar.cpp b/soh/soh/SohGui/SohMenuBar.cpp index aa747c168..418d02eb5 100644 --- a/soh/soh/SohGui/SohMenuBar.cpp +++ b/soh/soh/SohGui/SohMenuBar.cpp @@ -5,7 +5,7 @@ #include #include "UIWidgets.hpp" #include "include/z64audio.h" -#include "graphic/Fast3D/gfx_rendering_api.h" +#include "graphic/Fast3D/backends/gfx_rendering_api.h" #include "soh/OTRGlobals.h" #include "soh/SaveManager.h" #include "z64.h" From 3c0e7bcf726b16914c242033d13ca1cc88437ab2 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sat, 17 May 2025 17:12:05 -0400 Subject: [PATCH 31/44] bump lus (to bump imgui) (#5501) --- libultraship | 2 +- soh/soh/Enhancements/controls/InputViewer.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libultraship b/libultraship index 7135d1494..6a3f6cd32 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 7135d1494e74c38aa7fca734b92ec50bba543b44 +Subproject commit 6a3f6cd327b99f617b623e5b9a3afeae460aac2b diff --git a/soh/soh/Enhancements/controls/InputViewer.cpp b/soh/soh/Enhancements/controls/InputViewer.cpp index 5df02f5da..1fbab40c2 100644 --- a/soh/soh/Enhancements/controls/InputViewer.cpp +++ b/soh/soh/Enhancements/controls/InputViewer.cpp @@ -49,14 +49,14 @@ void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTex if (outlineMode == BUTTON_OUTLINE_ALWAYS_SHOWN || (outlineMode == BUTTON_OUTLINE_NOT_PRESSED && !state) || (outlineMode == BUTTON_OUTLINE_PRESSED && state)) { ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnOutlineTexture), size, - ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } // Render button if pressed if (state) { ImGui::SetCursorPos(pos); ImGui::SetNextItemAllowOverlap(); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnTexture), size, - ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } } @@ -201,7 +201,7 @@ void InputViewer::DrawElement() { // Background ImGui::Image( Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Input-Viewer-Background"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } // A/B @@ -352,7 +352,7 @@ void InputViewer::DrawElement() { ImGui::SetCursorPos(aPos); ImGui::Image( Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick Outline"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } const int analogStickMode = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.VisibilityMode"), STICK_MODE_ALWAYS_SHOWN); @@ -363,7 +363,7 @@ void InputViewer::DrawElement() { ImVec2(aPos.x + maxStickDistance * ((float)(pads[0].stick_x) / MAX_AXIS_RANGE) * scale, aPos.y - maxStickDistance * ((float)(pads[0].stick_y) / MAX_AXIS_RANGE) * scale)); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } // Right Stick @@ -376,7 +376,7 @@ void InputViewer::DrawElement() { ImGui::SetCursorPos(aPos); ImGui::Image( Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick Outline"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } const int rightStickMode = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.VisibilityMode"), STICK_MODE_ALWAYS_HIDDEN); @@ -387,7 +387,7 @@ void InputViewer::DrawElement() { ImVec2(aPos.x + maxRightStickDistance * ((float)(pads[0].right_stick_x) / MAX_AXIS_RANGE) * scale, aPos.y - maxRightStickDistance * ((float)(pads[0].right_stick_y) / MAX_AXIS_RANGE) * scale)); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } // Analog stick angle text From 9cb65308584bb863d00c016d77210057905ea47a Mon Sep 17 00:00:00 2001 From: xxAtrain223 Date: Sat, 17 May 2025 19:29:53 -0500 Subject: [PATCH 32/44] Fix Enable Available Checks from title screen. (#5502) --- soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 6c670e447..5346a31ef 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -2114,7 +2114,10 @@ void CheckTrackerSettingsWindow::DrawElement() { "with your current progress.") .Color(THEME_COLOR))) { enableAvailableChecks = CVarGetInteger(CVAR_TRACKER_CHECK("EnableAvailableChecks"), 0); - RecalculateAvailableChecks(); + + if (GameInteractor::IsSaveLoaded(true)) { + RecalculateAvailableChecks(); + } } ImGui::EndDisabled(); From 66351fa4e4b23711bc80fd9fe3e00c2a05fbdb11 Mon Sep 17 00:00:00 2001 From: xxAtrain223 Date: Sat, 17 May 2025 19:30:01 -0500 Subject: [PATCH 33/44] Remove freestanding key from Bottom of the Well Perimeter. (#5496) --- .../randomizer/location_access/dungeons/bottom_of_the_well.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp index 44c3fa817..8a8393ba1 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp @@ -25,7 +25,6 @@ void RegionTable_Init_BottomOfTheWell() { }, { //Locations LOCATION(RC_BOTTOM_OF_THE_WELL_FRONT_CENTER_BOMBABLE_CHEST, logic->HasExplosives()), - LOCATION(RC_BOTTOM_OF_THE_WELL_FREESTANDING_KEY, (logic->HasItem(RG_BRONZE_SCALE) || logic->LoweredWaterInsideBotw) && logic->CanUse(RG_STICKS) || logic->CanUse(RG_DINS_FIRE)), LOCATION(RC_BOTTOM_OF_THE_WELL_UNDERWATER_FRONT_CHEST, logic->LoweredWaterInsideBotw), LOCATION(RC_BOTTOM_OF_THE_WELL_UNDERWATER_LEFT_CHEST, logic->LoweredWaterInsideBotw), LOCATION(RC_BOTTOM_OF_THE_WELL_NEAR_ENTRANCE_POT_1, logic->CanBreakPots()), From b30fff5d57500c65e8fe246fabb49c2303e74a60 Mon Sep 17 00:00:00 2001 From: Eric Hoey <121978037+A-Green-Spoon@users.noreply.github.com> Date: Sat, 17 May 2025 20:56:57 -0400 Subject: [PATCH 34/44] Skip Forest Temple Basement Pillars Cutscene (#5473) * vb forest pillar cs skip * change to one point cutscene skip * rm whitespace --- .../vanilla-behavior/GIVanillaBehavior.h | 8 ++++++++ soh/soh/Enhancements/timesaver_hook_handlers.cpp | 5 +++++ .../ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c | 13 ++++++++++--- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 0c11e3c93..223001711 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -474,6 +474,14 @@ typedef enum { // - `*BgHeavyBlock` VB_FREEZE_LINK_FOR_BLOCK_THROW, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - None + VB_FREEZE_LINK_FOR_FOREST_PILLARS, + // #### `result` // ```c // true diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index 13c14b0a6..9f488efce 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -375,6 +375,11 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li } break; } + case VB_FREEZE_LINK_FOR_FOREST_PILLARS: + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO)) { + *should = false; + } + break; case VB_SHOW_TITLE_CARD: if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), IS_RANDO)) { *should = false; diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index 04aff53be..692497415 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -6,6 +6,7 @@ #include "z_bg_mori_kaitenkabe.h" #include "objects/object_mori_objects/object_mori_objects.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS 0 @@ -97,7 +98,9 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { if ((this->timer > (28 - CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 4)) && !Player_InCsMode(play)) { BgMoriKaitenkabe_SetupRotate(this); - Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, 8); + if (GameInteractor_Should(VB_FREEZE_LINK_FOR_FOREST_PILLARS, true)) { + Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, 8); + } Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); push.x = Math_SinS(this->dyna.unk_158); push.y = 0.0f; @@ -131,7 +134,9 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { Math_StepToF(&this->rotSpeed, 0.6f, 0.02f); if (Math_StepToF(&this->rotYdeg, this->rotDirection * 45.0f, this->rotSpeed)) { BgMoriKaitenkabe_SetupWait(this); - Player_SetCsActionWithHaltedActors(play, thisx, 7); + if (GameInteractor_Should(VB_FREEZE_LINK_FOR_FOREST_PILLARS, true)) { + Player_SetCsActionWithHaltedActors(play, thisx, 7); + } if (this->rotDirection > 0.0f) { thisx->home.rot.y += 0x2000; } else { @@ -148,7 +153,9 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } - Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); + if (GameInteractor_Should(VB_FREEZE_LINK_FOR_FOREST_PILLARS, true)) { + Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); + } } void BgMoriKaitenkabe_Update(Actor* thisx, PlayState* play) { From e0d5fbec42d270a17e0b14c4a1d836136c6fe66e Mon Sep 17 00:00:00 2001 From: xxAtrain223 Date: Sat, 17 May 2025 20:05:20 -0500 Subject: [PATCH 35/44] Available Checks Prices (#5446) * Improved the item location price availability. * Moved the available checks price logic into location_access.cpp. * Fixed typo and clarified check status identified. --- .../Enhancements/randomizer/3drando/fill.cpp | 2 +- .../Enhancements/randomizer/3drando/fill.hpp | 2 +- .../randomizer/location_access.cpp | 66 +++++++++++++++++-- .../Enhancements/randomizer/location_access.h | 3 +- .../randomizer/randomizer_check_tracker.cpp | 11 +--- 5 files changed, 67 insertions(+), 17 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 8885117c3..94b495639 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -421,7 +421,7 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals Rando::ItemLocation* location = ctx->GetItemLocation(loc); RandomizerGet locItem = location->GetPlacedRandomizerGet(); - if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAvailableChecks)) { + if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion)) { if (gals.calculatingAvailableChecks) { gals.accessibleLocations.push_back(loc); StopPerformanceTimer(PT_LOCATION_LOGIC); diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.hpp b/soh/soh/Enhancements/randomizer/3drando/fill.hpp index bb013cc13..a9b864ce2 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.hpp @@ -70,4 +70,4 @@ void GeneratePlaythrough(); bool CheckBeatable(RandomizerGet ignore=RG_NONE); -void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess); \ No newline at end of file +void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess); diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index ade8cbf72..e9da7568e 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -10,7 +10,9 @@ #include "soh/Enhancements/debugger/performanceTimer.h" #include +#include +#include "3drando/shops.hpp" extern "C" { extern PlayState* gPlayState; } @@ -31,7 +33,7 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const { return GetConditionsMet(); } -bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const { +bool LocationAccess::ConditionsMet(Region* parentRegion) const { // WARNING enterance validation can run this after resetting the access for sphere 0 validation // When refactoring ToD access, either fix the above or do not assume that we // have any access at all just because this is being run @@ -44,17 +46,71 @@ bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailab conditionsMet = true; } - return conditionsMet && - (calculatingAvailableChecks || CanBuy()); // TODO: run CanBuy when price is known due to settings + return conditionsMet && CanBuy(); +} + +static uint16_t GetMinimumPrice(const Rando::Location* loc) { + extern PriceSettingsStruct shopsanityPrices; + extern PriceSettingsStruct scrubPrices; + extern PriceSettingsStruct merchantPrices; + PriceSettingsStruct priceSettings = loc->GetRCType() == RCTYPE_SHOP ? shopsanityPrices + : loc->GetRCType() == RCTYPE_SCRUB ? scrubPrices + : merchantPrices; + + auto ctx = Rando::Context::GetInstance(); + switch (ctx->GetOption(priceSettings.main).Get()) { + case RO_PRICE_VANILLA: + return loc->GetVanillaPrice(); + case RO_PRICE_CHEAP_BALANCED: + return 0; + case RO_PRICE_BALANCED: + return 0; + case RO_PRICE_FIXED: + return ctx->GetOption(priceSettings.fixedPrice).Get() * 5; + case RO_PRICE_RANGE: { + uint16_t range1 = ctx->GetOption(priceSettings.range1).Get() * 5; + uint16_t range2 = ctx->GetOption(priceSettings.range1).Get() * 5; + return range1 < range2 ? range1 : range2; + } + case RO_PRICE_SET_BY_WALLET: { + if (ctx->GetOption(priceSettings.noWallet).Get()) { + return 0; + } else if (ctx->GetOption(priceSettings.childWallet).Get()) { + return 1; + } else if (ctx->GetOption(priceSettings.adultWallet).Get()) { + return 100; + } else if (ctx->GetOption(priceSettings.giantWallet).Get()) { + return 201; + } else { + return 501; + } + } + default: + return 0; + } } bool LocationAccess::CanBuy() const { - return CanBuyAnother(location); + const auto& loc = Rando::StaticData::GetLocation(location); + const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location); + + if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) { + // Checks should only be identified while playing + if (itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) { + return CanBuyAnother(GetMinimumPrice(loc)); + } else { + return CanBuyAnother(itemLoc->GetPrice()); + } + } + + return true; } bool CanBuyAnother(RandomizerCheck rc) { - uint16_t price = ctx->GetItemLocation(rc)->GetPrice(); + return CanBuyAnother(ctx->GetItemLocation(rc)->GetPrice()); +} +bool CanBuyAnother(uint16_t price) { if (price > 500) { return logic->HasItem(RG_TYCOON_WALLET); } else if (price > 200) { diff --git a/soh/soh/Enhancements/randomizer/location_access.h b/soh/soh/Enhancements/randomizer/location_access.h index 828c31a08..8d6815089 100644 --- a/soh/soh/Enhancements/randomizer/location_access.h +++ b/soh/soh/Enhancements/randomizer/location_access.h @@ -84,7 +84,7 @@ class LocationAccess { bool CheckConditionAtAgeTime(bool& age, bool& time) const; - bool ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const; + bool ConditionsMet(Region* parentRegion) const; RandomizerCheck GetLocation() const { return location; @@ -103,6 +103,7 @@ class LocationAccess { bool CanBuy() const; }; +bool CanBuyAnother(uint16_t price); bool CanBuyAnother(RandomizerCheck rc); namespace Rando { diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 5346a31ef..8648c9826 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -1967,7 +1967,7 @@ void RecalculateAvailableChecks() { StartPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS); std::vector targetLocations; - targetLocations.reserve(RR_MAX); + targetLocations.reserve(RC_MAX); for (auto& location : Rando::StaticData::GetLocationTable()) { RandomizerCheck rc = location.GetRandomizerCheck(); Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); @@ -1979,15 +1979,8 @@ void RecalculateAvailableChecks() { std::vector availableChecks = ReachabilitySearch(targetLocations, RG_NONE, true); for (auto& rc : availableChecks) { - const auto& location = Rando::StaticData::GetLocation(rc); const auto& itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); - if (location->GetRCType() == RCTYPE_SHOP && itemLocation->GetCheckStatus() == RCSHOW_IDENTIFIED) { - if (CanBuyAnother(rc)) { - itemLocation->SetAvailable(true); - } - } else { - itemLocation->SetAvailable(true); - } + itemLocation->SetAvailable(true); } totalChecksAvailable = 0; From 8e349429245aee3590b801ed04027cdb46695c28 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Sun, 18 May 2025 02:06:24 +0100 Subject: [PATCH 36/44] Toggle the vanilla flags instead of the rando flags when removing one time scrubs (#5504) --- soh/soh/Enhancements/randomizer/savefile.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/savefile.cpp b/soh/soh/Enhancements/randomizer/savefile.cpp index cb8c7eaef..1bed22a71 100644 --- a/soh/soh/Enhancements/randomizer/savefile.cpp +++ b/soh/soh/Enhancements/randomizer/savefile.cpp @@ -269,9 +269,9 @@ extern "C" void Randomizer_InitSaveFile() { // Remove One Time Scrubs with Scrubsanity off if (Randomizer_GetSettingValue(RSK_SHUFFLE_SCRUBS) == RO_SCRUBS_OFF) { - Flags_SetRandomizerInf(RAND_INF_SCRUBS_PURCHASED_LW_DEKU_SCRUB_NEAR_BRIDGE); - Flags_SetRandomizerInf(RAND_INF_SCRUBS_PURCHASED_LW_DEKU_SCRUB_GROTTO_FRONT); - Flags_SetRandomizerInf(RAND_INF_SCRUBS_PURCHASED_HF_DEKU_SCRUB_GROTTO); + Flags_SetItemGetInf(ITEMGETINF_DEKU_SCRUB_HEART_PIECE); + Flags_SetInfTable(INFTABLE_BOUGHT_STICK_UPGRADE); + Flags_SetInfTable(INFTABLE_BOUGHT_NUT_UPGRADE); } int startingAge = OTRGlobals::Instance->gRandoContext->GetOption(RSK_SELECTED_STARTING_AGE).Get(); From ecad59e31fe134dea65f8da7b160b17692276011 Mon Sep 17 00:00:00 2001 From: Malkierian Date: Sat, 17 May 2025 18:52:45 -0700 Subject: [PATCH 37/44] Add tooltip to Generate Seed button when disabled indicating the need to be on File Select. (#5509) --- soh/soh/Enhancements/randomizer/randomizer.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index d3e2c83b5..18a23df53 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -3724,13 +3724,15 @@ void RandomizerSettingsWindow::DrawElement() { } UIWidgets::Spacer(0); - ImGui::BeginDisabled((gSaveContext.gameMode != GAMEMODE_FILE_SELECT) || GameInteractor::IsSaveLoaded()); - if (UIWidgets::Button("Generate Randomizer", - UIWidgets::ButtonOptions().Size(ImVec2(250.f, 0.f)).Color(THEME_COLOR))) { + UIWidgets::ButtonOptions options = UIWidgets::ButtonOptions().Size(ImVec2(250.f, 0.f)).Color(THEME_COLOR); + options.Disabled((gSaveContext.gameMode != GAMEMODE_FILE_SELECT) || GameInteractor::IsSaveLoaded()); + if (options.disabled) { + options.DisabledTooltip("Must be on File Select to generate a randomizer seed."); + } + if (UIWidgets::Button("Generate Randomizer", options)) { ctx->SetSpoilerLoaded(false); GenerateRandomizer(CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0) ? seedString : ""); } - ImGui::EndDisabled(); ImGui::SameLine(); if (!CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) { From 50f42b93fee9ec6b3b568d4f96f5686876f90ac0 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sun, 18 May 2025 16:25:00 -0400 Subject: [PATCH 38/44] fix "is valid for C/ObjC but not for C++" warnings (#5512) --- soh/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 8f36a94cd..19851f690 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -512,10 +512,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-parentheses -Wno-narrowing -Wno-missing-braces - -Wno-int-conversion $<$: -Werror-implicit-function-declaration -Wno-incompatible-pointer-types + -Wno-int-conversion > $<$:-fpermissive> $<$: @@ -588,11 +588,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-parentheses -Wno-narrowing -Wno-missing-braces - -Wno-int-conversion - -Wno-implicit-int $<$: -Werror-implicit-function-declaration + -Wno-implicit-int -Wno-incompatible-pointer-types + -Wno-int-conversion > $<$:-fpermissive> $<$:-Wno-deprecated-enum-enum-conversion> From 53566c9a73a3f176824547af2f940085e5f425ae Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sun, 18 May 2025 16:25:24 -0400 Subject: [PATCH 39/44] fix incorrect `__VA_ARGS__` use in `lusprintf` version of `osSyncPrintf` (#5510) --- soh/include/functions.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/include/functions.h b/soh/include/functions.h index 86e3bf77f..f29153a9c 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -15,7 +15,7 @@ extern "C" #include #if defined(INCLUDE_GAME_PRINTF) && defined(_DEBUG) -#define osSyncPrintf(fmt, ...) lusprintf(__FILE__, __LINE__, 0, fmt, __VA_ARGS__) +#define osSyncPrintf(fmt, ...) lusprintf(__FILE__, __LINE__, 0, fmt, ##__VA_ARGS__) #else #define osSyncPrintf(fmt, ...) osSyncPrintfUnused(fmt, ##__VA_ARGS__) #endif From f16e34e8b8f538725229c2d4ff9018e50596d7de Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Sun, 18 May 2025 22:25:18 +0100 Subject: [PATCH 40/44] fix and rename IsKeysanity to IsFireLoopLocked (#5515) * c * fix and rename IsKeysanity * add comment --- .../randomizer/location_access/dungeons/fire_temple.cpp | 4 ++-- soh/soh/Enhancements/randomizer/logic.cpp | 9 +++++---- soh/soh/Enhancements/randomizer/logic.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp index 8888cdac9..70cf890b0 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp @@ -20,7 +20,7 @@ void RegionTable_Init_FireTemple() { //Exits Entrance(RR_FIRE_TEMPLE_ENTRYWAY, []{return true;}), Entrance(RR_FIRE_TEMPLE_NEAR_BOSS_ROOM, []{return logic->FireTimer() >= 24;}), - Entrance(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return Here(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->CanUse(RG_MEGATON_HAMMER);}) && (logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsKeysanity);}), + Entrance(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return Here(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->CanUse(RG_MEGATON_HAMMER);}) && (logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsFireLoopLocked);}), Entrance(RR_FIRE_TEMPLE_LOOP_EXIT, []{return true;}), Entrance(RR_FIRE_TEMPLE_BIG_LAVA_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 2) && logic->FireTimer() >= 24;}), }); @@ -43,7 +43,7 @@ void RegionTable_Init_FireTemple() { areaTable[RR_FIRE_TEMPLE_LOOP_ENEMIES] = Region("Fire Temple Loop Enemies", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, {}, { //Exits - Entrance(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsKeysanity;}), + Entrance(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsFireLoopLocked;}), Entrance(RR_FIRE_TEMPLE_LOOP_TILES, []{return Here(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return logic->CanKillEnemy(RE_TORCH_SLUG) && logic->CanKillEnemy(RE_FIRE_KEESE);});}), }); diff --git a/soh/soh/Enhancements/randomizer/logic.cpp b/soh/soh/Enhancements/randomizer/logic.cpp index 252806473..7f4b7e102 100644 --- a/soh/soh/Enhancements/randomizer/logic.cpp +++ b/soh/soh/Enhancements/randomizer/logic.cpp @@ -1389,6 +1389,7 @@ bool Logic::SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless static_cast(GlitchDifficulty::INTERMEDIATE) || GetDifficultyValueFromString(GlitchHover) >= static_cast(GlitchDifficulty::INTERMEDIATE))) { return FireTempleKeys >= requiredAmountGlitched; }*/ + // If the Fire Temple loop lock is removed, Small key Count is set to 1 before starting return GetSmallKeyCount(SCENE_FIRE_TEMPLE) >= requiredAmountGlitchless; case RR_WATER_TEMPLE: @@ -2336,9 +2337,9 @@ void Logic::Reset() { StartPerformanceTimer(PT_LOGIC_RESET); memset(inLogic, false, sizeof(inLogic)); // Settings-dependent variables - IsKeysanity = ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) || - ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) || - ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE); + IsFireLoopLocked = ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) || + ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_OVERWORLD) || + ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANY_DUNGEON); // AmmoCanDrop = /*AmmoDrops.IsNot(AMMODROPS_NONE)*/ false; TODO: AmmoDrop setting @@ -2400,7 +2401,7 @@ void Logic::Reset() { // If not keysanity, start with 1 logical key to account for automatically unlocking the basement door in vanilla // FiT - if (!IsKeysanity && ctx->GetDungeon(Rando::FIRE_TEMPLE)->IsVanilla()) { + if (!IsFireLoopLocked && ctx->GetDungeon(Rando::FIRE_TEMPLE)->IsVanilla()) { SetSmallKeyCount(SCENE_FIRE_TEMPLE, 1); } diff --git a/soh/soh/Enhancements/randomizer/logic.h b/soh/soh/Enhancements/randomizer/logic.h index 4f966f5de..77c49d25f 100644 --- a/soh/soh/Enhancements/randomizer/logic.h +++ b/soh/soh/Enhancements/randomizer/logic.h @@ -59,7 +59,7 @@ class Logic { bool LightTrialClear = false; // Logical keysanity - bool IsKeysanity = false; + bool IsFireLoopLocked = false; // Bottle Count uint8_t Bottles = 0; From f0e40fd1dc09b894c0ee6956ca2e4fc369436e85 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Sun, 18 May 2025 17:26:10 -0400 Subject: [PATCH 41/44] fix incorrect token count in messages when tokensanity is off (#5503) * fix incorrect token count in messages when tokensanity is off * Update OTRGlobals.cpp --- soh/soh/OTRGlobals.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 72030657e..dcabfca70 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -2437,15 +2437,15 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { // animation until the text box auto-dismisses. // RANDOTODO: Implement a way to determine if an item came from a skulltula and // inject the auto-dismiss control code if it did. - if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && - !(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF)) { + bool gsTokensShuffled = Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF; + if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && !(IS_RANDO && gsTokensShuffled)) { textId = TEXT_GS_NO_FREEZE; } else { textId = TEXT_GS_FREEZE; } // In vanilla, GS token count is incremented prior to the text box displaying // In rando we need to bump the token count by one to show the correct count - s16 gsCount = gSaveContext.inventory.gsTokens + (IS_RANDO ? 1 : 0); + s16 gsCount = gSaveContext.inventory.gsTokens + ((IS_RANDO && gsTokensShuffled) ? 1 : 0); messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, textId, MF_FORMATTED); messageEntry.Replace("[[gsCount]]", std::to_string(gsCount)); } else if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && From 4334a132e31ef12a1cccf2c77e7006ed9c54c88d Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Sun, 18 May 2025 22:28:55 +0100 Subject: [PATCH 42/44] fix the wrong codepath being used in CanBuy when generating seeds (#5514) --- soh/soh/Enhancements/randomizer/3drando/fill.cpp | 2 +- soh/soh/Enhancements/randomizer/location_access.cpp | 8 ++++---- soh/soh/Enhancements/randomizer/location_access.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 94b495639..8885117c3 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -421,7 +421,7 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals Rando::ItemLocation* location = ctx->GetItemLocation(loc); RandomizerGet locItem = location->GetPlacedRandomizerGet(); - if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion)) { + if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAvailableChecks)) { if (gals.calculatingAvailableChecks) { gals.accessibleLocations.push_back(loc); StopPerformanceTimer(PT_LOCATION_LOGIC); diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index e9da7568e..cdd684f04 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -33,7 +33,7 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const { return GetConditionsMet(); } -bool LocationAccess::ConditionsMet(Region* parentRegion) const { +bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const { // WARNING enterance validation can run this after resetting the access for sphere 0 validation // When refactoring ToD access, either fix the above or do not assume that we // have any access at all just because this is being run @@ -46,7 +46,7 @@ bool LocationAccess::ConditionsMet(Region* parentRegion) const { conditionsMet = true; } - return conditionsMet && CanBuy(); + return conditionsMet && CanBuy(calculatingAvailableChecks); } static uint16_t GetMinimumPrice(const Rando::Location* loc) { @@ -90,13 +90,13 @@ static uint16_t GetMinimumPrice(const Rando::Location* loc) { } } -bool LocationAccess::CanBuy() const { +bool LocationAccess::CanBuy(bool calculatingAvailableChecks) const { const auto& loc = Rando::StaticData::GetLocation(location); const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location); if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) { // Checks should only be identified while playing - if (itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) { + if (calculatingAvailableChecks && itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) { return CanBuyAnother(GetMinimumPrice(loc)); } else { return CanBuyAnother(itemLoc->GetPrice()); diff --git a/soh/soh/Enhancements/randomizer/location_access.h b/soh/soh/Enhancements/randomizer/location_access.h index 8d6815089..9c8df0e9b 100644 --- a/soh/soh/Enhancements/randomizer/location_access.h +++ b/soh/soh/Enhancements/randomizer/location_access.h @@ -84,7 +84,7 @@ class LocationAccess { bool CheckConditionAtAgeTime(bool& age, bool& time) const; - bool ConditionsMet(Region* parentRegion) const; + bool ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const; RandomizerCheck GetLocation() const { return location; @@ -100,7 +100,7 @@ class LocationAccess { std::string condition_str; // Makes sure shop locations are buyable - bool CanBuy() const; + bool CanBuy(bool calculatingAvailableChecks) const; }; bool CanBuyAnother(uint16_t price); From 081f82875a8afbacc77d2baa1230040dc785266c Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Mon, 19 May 2025 00:24:57 -0400 Subject: [PATCH 43/44] fix link voice missing when hanging off ledges (#5506) * fix link voice missing when hanging off ledges * remove unused bitrate var * hardcoded but justified * format --- soh/soh/stubs.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/soh/soh/stubs.c b/soh/soh/stubs.c index 56013e56f..118b36e72 100644 --- a/soh/soh/stubs.c +++ b/soh/soh/stubs.c @@ -145,7 +145,47 @@ void Audio_osWritebackDCache(void* mem, s32 size) { } s32 osAiSetFrequency(u32 freq) { - return 1; + // this is based off the math from the original method + /* + + s32 osAiSetFrequency(u32 frequency) { + u8 bitrate; + f32 dacRateF = ((f32)osViClock / frequency) + 0.5f; + u32 dacRate = dacRateF; + + if (dacRate < 132) { + return -1; + } + + bitrate = (dacRate / 66); + if (bitrate > 16) { + bitrate = 16; + } + + HW_REG(AI_DACRATE_REG, u32) = dacRate - 1; + HW_REG(AI_BITRATE_REG, u32) = bitrate - 1; + return osViClock / (s32)dacRate; + } + + */ + + // bitrate is unused + + // osViClock comes from + // #define VI_NTSC_CLOCK 48681812 /* Hz = 48.681812 MHz */ + // s32 osViClock = VI_NTSC_CLOCK; + + // frequency was originally 32000 + + // given all of that, dacRate is + // (u32)(((f32)48681812 / 32000) + 0.5f) + // which evaluates to 1521 (which is > 132) + + // this leaves us with a final calculation of + // 48681812 / 1521 + // which evaluates to 32006 + + return 32006; } void osInvalDCache(void* vaddr, s32 nbytes) { From 4216776cd6e8a2ac015e31c5dcb0924deb033cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20Dub=C3=A9?= Date: Tue, 20 May 2025 05:47:04 +0000 Subject: [PATCH 44/44] Fix entrance optimization (#5520) I'm an idiot --- soh/soh/Enhancements/randomizer/location_access.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index 9d4f9a29b..d6efe7b9a 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -535,17 +535,17 @@ std::string CleanCheckConditionString(std::string condition) { } namespace Regions { -const auto GetAllRegions() { +auto GetAllRegions() { static const size_t regionCount = RR_MAX - (RR_NONE + 1); static std::array allRegions = {}; - static bool intialized = false; - if (!intialized) { + static bool initialized = false; + if (!initialized) { for (size_t i = 0; i < regionCount; i++) { allRegions[i] = (RandomizerRegion)((RR_NONE + 1) + i); } - intialized = true; + initialized = true; } return allRegions; @@ -684,7 +684,7 @@ std::vector GetShuffleableEntrances(Rando::EntranceType type, Rando::Entrance* GetEntrance(RandomizerRegion source, RandomizerRegion destination) { for (auto& exit : RegionTable(source)->exits) { - if (exit.GetConnectedRegionKey() == destination) { + if (exit.GetOriginalConnectedRegionKey() == destination) { return &exit; } }