Fix excluded locs, ap icon in notifs, death link while connecting

This commit is contained in:
aMannus
2025-07-30 20:17:27 +02:00
parent c64c8f6c0f
commit f1ba0fe156
5 changed files with 25 additions and 14 deletions

View File

@@ -421,6 +421,7 @@ void Context::ParseArchipelago() {
mSeedGenerated = false; mSeedGenerated = false;
mSpoilerLoaded = false; mSpoilerLoaded = false;
Rando::Settings::GetInstance()->ResetExcludedLocations();
ArchipelagoClient& apClient = ArchipelagoClient::GetInstance(); ArchipelagoClient& apClient = ArchipelagoClient::GetInstance();
ParseArchipelagoItemsLocations(apClient.GetScoutedItems()); ParseArchipelagoItemsLocations(apClient.GetScoutedItems());
ParseArchipelagoOptions(apClient.GetSlotData()); ParseArchipelagoOptions(apClient.GetSlotData());

View File

@@ -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<Context> ctx) { void Settings::AssignContext(std::shared_ptr<Context> ctx) {
mContext = ctx; mContext = ctx;
} }

View File

@@ -115,7 +115,8 @@ class Settings {
*/ */
void ParseJson(nlohmann::json spoilerFileJson); void ParseJson(nlohmann::json spoilerFileJson);
void ParseArchipelago(const std::map<std::string, int>& slot_data); void ResetExcludedLocations();
std::map<RandomizerArea, std::vector<RandomizerTrick>> mTricksByArea = {}; std::map<RandomizerArea, std::vector<RandomizerTrick>> mTricksByArea = {};
/** /**

View File

@@ -262,6 +262,20 @@ bool ArchipelagoClient::StopClient() {
} }
void ArchipelagoClient::GameLoaded() { 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 (apClient == nullptr) {
if(IS_ARCHIPELAGO) { if(IS_ARCHIPELAGO) {
CVarSetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), gSaveContext.ship.quest.data.archipelago.archiUri); CVarSetString(CVAR_REMOTE_ARCHIPELAGO("ServerAddress"), gSaveContext.ship.quest.data.archipelago.archiUri);
@@ -560,7 +574,7 @@ void ArchipelagoClient::SendDeathLink() {
} }
void ArchipelagoClient::SetDeathLinkTag() { void ArchipelagoClient::SetDeathLinkTag() {
if (!apClient) { if (!ArchipelagoClient::IsConnected()) {
return; return;
} }
std::list<std::string> tags; std::list<std::string> tags;

View File

@@ -75,18 +75,6 @@ void ArchipelagoSettingsWindow::DrawElement() {
UIWidgets::CheckboxOptions().Color(THEME_COLOR).Tooltip("You die, others die. Others die, you die!"))) { UIWidgets::CheckboxOptions().Color(THEME_COLOR).Tooltip("You die, others die. Others die, you die!"))) {
apClient.SetDeathLinkTag(); 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() { void ArchipelagoSettingsWindow::InitElement() {