From f1ba0fe15657d0c9e17e2ed799e51883c45a4d19 Mon Sep 17 00:00:00 2001 From: aMannus Date: Wed, 30 Jul 2025 20:17:27 +0200 Subject: [PATCH] Fix excluded locs, ap icon in notifs, death link while connecting --- soh/soh/Enhancements/randomizer/context.cpp | 1 + soh/soh/Enhancements/randomizer/settings.cpp | 7 +++++++ soh/soh/Enhancements/randomizer/settings.h | 3 ++- soh/soh/Network/Archipelago/Archipelago.cpp | 16 +++++++++++++++- .../Archipelago/ArchipelagoSettingsWindow.cpp | 12 ------------ 5 files changed, 25 insertions(+), 14 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/context.cpp b/soh/soh/Enhancements/randomizer/context.cpp index 92a18661b..26b37fcde 100644 --- a/soh/soh/Enhancements/randomizer/context.cpp +++ b/soh/soh/Enhancements/randomizer/context.cpp @@ -421,6 +421,7 @@ void Context::ParseArchipelago() { mSeedGenerated = false; mSpoilerLoaded = false; + Rando::Settings::GetInstance()->ResetExcludedLocations(); ArchipelagoClient& apClient = ArchipelagoClient::GetInstance(); ParseArchipelagoItemsLocations(apClient.GetScoutedItems()); ParseArchipelagoOptions(apClient.GetSlotData()); diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 5bc108cde..b9392c64a 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -2929,6 +2929,13 @@ void Settings::ParseJson(nlohmann::json spoilerFileJson) { } } +void Settings::ResetExcludedLocations() { + const auto ctx = Context::GetInstance(); + for (int rc = 1; rc < RC_MAX; rc++) { + ctx->GetItemLocation(rc)->SetExcludedOption(RO_GENERIC_OFF); + } +} + void Settings::AssignContext(std::shared_ptr ctx) { mContext = ctx; } diff --git a/soh/soh/Enhancements/randomizer/settings.h b/soh/soh/Enhancements/randomizer/settings.h index af2575931..f35427983 100644 --- a/soh/soh/Enhancements/randomizer/settings.h +++ b/soh/soh/Enhancements/randomizer/settings.h @@ -115,7 +115,8 @@ class Settings { */ void ParseJson(nlohmann::json spoilerFileJson); - void ParseArchipelago(const std::map& slot_data); + void ResetExcludedLocations(); + std::map> mTricksByArea = {}; /** diff --git a/soh/soh/Network/Archipelago/Archipelago.cpp b/soh/soh/Network/Archipelago/Archipelago.cpp index 9556ed56d..cbf80fb3d 100644 --- a/soh/soh/Network/Archipelago/Archipelago.cpp +++ b/soh/soh/Network/Archipelago/Archipelago.cpp @@ -262,6 +262,20 @@ bool ArchipelagoClient::StopClient() { } void ArchipelagoClient::GameLoaded() { + + // Load textures for the archipelago items that're shown in the notifications + static bool sArchipelagoTexturesLoaded = false; + if (!sArchipelagoTexturesLoaded) { + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( + "Archipelago Progressive Icon", "textures/parameter_static/gArchipelagoProgressive.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( + "Archipelago Useful Icon", "textures/parameter_static/gArchipelagoUseful.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( + "Archipelago Junk Icon", "textures/parameter_static/gArchipelagoJunk.png"); + + sArchipelagoTexturesLoaded = true; + } + if (apClient == nullptr) { if(IS_ARCHIPELAGO) { CVarSetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), gSaveContext.ship.quest.data.archipelago.archiUri); @@ -560,7 +574,7 @@ void ArchipelagoClient::SendDeathLink() { } void ArchipelagoClient::SetDeathLinkTag() { - if (!apClient) { + if (!ArchipelagoClient::IsConnected()) { return; } std::list tags; diff --git a/soh/soh/Network/Archipelago/ArchipelagoSettingsWindow.cpp b/soh/soh/Network/Archipelago/ArchipelagoSettingsWindow.cpp index df953b6e5..a88137e58 100644 --- a/soh/soh/Network/Archipelago/ArchipelagoSettingsWindow.cpp +++ b/soh/soh/Network/Archipelago/ArchipelagoSettingsWindow.cpp @@ -75,18 +75,6 @@ void ArchipelagoSettingsWindow::DrawElement() { UIWidgets::CheckboxOptions().Color(THEME_COLOR).Tooltip("You die, others die. Others die, you die!"))) { apClient.SetDeathLinkTag(); } - - static bool sArchipelagoTexturesLoaded = false; - if (!sArchipelagoTexturesLoaded) { - Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( - "Archipelago Progressive Icon", "textures/parameter_static/gArchipelagoProgressive.png"); - Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( - "Archipelago Useful Icon", "textures/parameter_static/gArchipelagoUseful.png"); - Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( - "Archipelago Junk Icon", "textures/parameter_static/gArchipelagoJunk.png"); - - sArchipelagoTexturesLoaded = true; - } }; void ArchipelagoSettingsWindow::InitElement() {