From 4240f7d8ab0a8c55226fd50d069303b1a729af69 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Tue, 25 Mar 2025 22:53:43 +0000 Subject: [PATCH] fix plandomiser --- .../Enhancements/randomizer/3drando/fill.cpp | 4 ++-- .../Enhancements/randomizer/3drando/hints.cpp | 4 ++-- .../randomizer/3drando/spoiler_log.cpp | 6 ++--- .../Enhancements/randomizer/Plandomizer.cpp | 22 +++++++++---------- soh/soh/Enhancements/randomizer/context.cpp | 4 ++-- soh/soh/Enhancements/randomizer/hint.cpp | 4 ++-- .../Enhancements/randomizer/hook_handlers.cpp | 2 +- soh/soh/Enhancements/randomizer/item_list.cpp | 6 ++--- .../randomizer/randomizer_check_tracker.cpp | 14 ++++++------ soh/soh/SaveManager.cpp | 2 +- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index b55b0f38f..3d3de186a 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -792,7 +792,7 @@ static void AssumedFill(const std::vector& items, const std::vect // NOLINTNEXTLINE(clang-diagnostic-unused-variable) for (const RandomizerGet item : items) { SPDLOG_DEBUG("\t"); - SPDLOG_DEBUG(Rando::StaticData::RetrieveItem(item).GetName().GetEnglish()); + SPDLOG_DEBUG(Rando::StaticData::RetrieveItem(item).GetName().GetForCurrentLanguage(MF_RAW)); SPDLOG_DEBUG("\n"); } SPDLOG_DEBUG("\nAllowed Locations:\n"); @@ -851,7 +851,7 @@ static void AssumedFill(const std::vector& items, const std::vect if (accessibleLocations.empty()) { SPDLOG_DEBUG("\nCANNOT PLACE "); - SPDLOG_DEBUG(Rando::StaticData::RetrieveItem(item).GetName().GetEnglish()); + SPDLOG_DEBUG(Rando::StaticData::RetrieveItem(item).GetName().GetForCurrentLanguage(MF_RAW)); SPDLOG_DEBUG(". TRYING AGAIN...\n"); // reset any locations that got an item diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index f5ce4e4c0..81c9c7654 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -40,7 +40,7 @@ const CustomMessage& HintText::GetClear() const { } const CustomMessage& HintText::GetName() const { - return name.GetEnglish() == "" ? name : clearText; + return name.GetEnglish() == "" ? clearText : name; } const CustomMessage& HintText::GetObscure() const { @@ -454,7 +454,7 @@ static RandomizerCheck CreateRandomHint(std::vector& possibleHi SPDLOG_DEBUG("\n"); SPDLOG_DEBUG("\tItem: "); - SPDLOG_DEBUG(ctx->GetItemLocation(hintedLocation)->GetPlacedItemName().GetForCurrentLanguage()); + SPDLOG_DEBUG(ctx->GetItemLocation(hintedLocation)->GetPlacedItemName().GetForCurrentLanguage(MF_RAW)); SPDLOG_DEBUG("\n"); placed = CreateHint(hintedLocation, copies, type, distributionName); diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index 1f41a46af..b63f41841 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -75,7 +75,7 @@ static void WriteLocation( Rando::Location* location = Rando::StaticData::GetLocation(locationKey); Rando::ItemLocation* itemLocation = Rando::Context::GetInstance()->GetItemLocation(locationKey); - jsonData["playthrough"][sphere][location->GetName()] = itemLocation->GetPlacedItemName().GetForCurrentLanguage(); + jsonData["playthrough"][sphere][location->GetName()] = itemLocation->GetPlacedItemName().GetForCurrentLanguage(MF_RAW); } //Writes a shuffled entrance to the specified node @@ -254,7 +254,7 @@ static void WriteAllLocations() { auto ctx = Rando::Context::GetInstance(); for (const RandomizerCheck key : ctx->allLocations) { Rando::ItemLocation* location = ctx->GetItemLocation(key); - std::string placedItemName = location->GetPlacedItemName().GetForCurrentLanguage(); + std::string placedItemName = location->GetPlacedItemName().GetForCurrentLanguage(MF_RAW); // If it's a simple item (not an ice trap, doesn't have a price) // just add the name of the item and move on @@ -278,7 +278,7 @@ static void WriteAllLocations() { if (location->GetPlacedRandomizerGet() == RG_ICE_TRAP) { jsonData["locations"][Rando::StaticData::GetLocation(location->GetRandomizerCheck())->GetName()]["model"] = - Rando::StaticData::RetrieveItem(ctx->overrides[location->GetRandomizerCheck()].LooksLike()).GetName().GetForCurrentLanguage(); + Rando::StaticData::RetrieveItem(ctx->overrides[location->GetRandomizerCheck()].LooksLike()).GetName().GetForCurrentLanguage(MF_RAW); switch (gSaveContext.language) { case 0: default: diff --git a/soh/soh/Enhancements/randomizer/Plandomizer.cpp b/soh/soh/Enhancements/randomizer/Plandomizer.cpp index 6be7bf1a2..b5977ba3a 100644 --- a/soh/soh/Enhancements/randomizer/Plandomizer.cpp +++ b/soh/soh/Enhancements/randomizer/Plandomizer.cpp @@ -542,8 +542,8 @@ void PlandomizerSaveSpoilerLog() { for (auto& import : plandoLogData) { if (import.checkRewardItem.GetRandomizerGet() == RG_ICE_TRAP) { spoilerSave["locations"][import.checkName] = { - { "item", import.checkRewardItem.GetName().GetForCurrentLanguage() }, - { "model", import.iceTrapModel.GetName().GetForCurrentLanguage() }, + { "item", import.checkRewardItem.GetName().GetForCurrentLanguage(MF_RAW) }, + { "model", import.iceTrapModel.GetName().GetForCurrentLanguage(MF_RAW) }, { "trickName", import.iceTrapName.c_str() } }; if (import.shopPrice > -1) { @@ -551,11 +551,11 @@ void PlandomizerSaveSpoilerLog() { } } else if (import.shopPrice > -1) { spoilerSave["locations"][import.checkName] = { - { "item", import.checkRewardItem.GetName().GetForCurrentLanguage() }, + { "item", import.checkRewardItem.GetName().GetForCurrentLanguage(MF_RAW) }, { "price", import.shopPrice } }; } else { - spoilerSave["locations"][import.checkName] = import.checkRewardItem.GetName().GetForCurrentLanguage(); + spoilerSave["locations"][import.checkName] = import.checkRewardItem.GetName().GetForCurrentLanguage(MF_RAW); } } @@ -669,7 +669,7 @@ void PlandomizerOverlayText(std::pair drawObject ) { ImGui::SetCursorScreenPos(textPos); ImGui::Text("+"); } - std::string parenthesesNum = extractNumberInParentheses(drawObject.first.GetName().GetEnglish().c_str()); + std::string parenthesesNum = extractNumberInParentheses(drawObject.first.GetName().GetEnglish(MF_RAW).c_str()); if (parenthesesNum != "" && parenthesesNum != "WINNER" && parenthesesNum != "LOSER") { textPos = ImVec2(imageMin.x + 2, imageMin.y + 2); @@ -715,7 +715,7 @@ void PlandomizerDrawItemPopup(uint32_t index) { ImGui::PushID(item); ImGui::TableNextColumn(); PlandomizerItemImageCorrection(plandomizerRandoRetrieveItem(item)); - auto name = plandomizerRandoRetrieveItem(item).GetName().GetForCurrentLanguage(); + auto name = plandomizerRandoRetrieveItem(item).GetName().GetForCurrentLanguage(MF_RAW); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding)); auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor); ImGui::PopStyleVar(); @@ -744,7 +744,7 @@ void PlandomizerDrawItemPopup(uint32_t index) { ImGui::PushID(itemIndex); auto itemToDraw = drawSlots.first; PlandomizerItemImageCorrection(drawSlots.first); - auto name = drawSlots.first.GetName().GetForCurrentLanguage(); + auto name = drawSlots.first.GetName().GetForCurrentLanguage(MF_RAW); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding)); auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor); ImGui::PopStyleVar(); @@ -792,7 +792,7 @@ void PlandomizerDrawIceTrapPopUp(uint32_t index) { } ImGui::TableNextColumn(); ImGui::PushID(items.first); - auto name = Rando::StaticData::RetrieveItem(items.first).GetName().GetForCurrentLanguage(); + auto name = Rando::StaticData::RetrieveItem(items.first).GetName().GetForCurrentLanguage(MF_RAW); PlandomizerItemImageCorrection(Rando::StaticData::RetrieveItem(items.first)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding)); auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor); @@ -818,7 +818,7 @@ void PlandomizerDrawItemSlots(uint32_t index) { ImGui::PushID(index); PlandoPushImageButtonStyle(); PlandomizerItemImageCorrection(plandoLogData[index].checkRewardItem); - auto name = plandoLogData[index].checkRewardItem.GetName().GetForCurrentLanguage(); + auto name = plandoLogData[index].checkRewardItem.GetName().GetForCurrentLanguage(MF_RAW); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding)); auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor); ImGui::PopStyleVar(); @@ -854,7 +854,7 @@ void PlandomizerDrawIceTrapSetup(uint32_t index) { ImGui::TableNextColumn(); PlandomizerItemImageCorrection(plandoLogData[index].iceTrapModel); PlandoPushImageButtonStyle(); - auto name = plandoLogData[index].iceTrapModel.GetName().GetForCurrentLanguage(); + auto name = plandoLogData[index].iceTrapModel.GetName().GetForCurrentLanguage(MF_RAW); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(imagePadding, imagePadding)); auto ret = ImGui::ImageButton(name.c_str(), textureID, imageSize, textureUV0, textureUV1, ImVec4(0, 0, 0, 0), itemColor); ImGui::PopStyleVar(); @@ -1090,7 +1090,7 @@ void PlandomizerDrawLocationsWindow(RandomizerCheckArea rcArea) { ImGui::TableNextColumn(); ImGui::TextWrapped(spoilerData.checkName.c_str()); ImGui::TableNextColumn(); - ImGui::TextWrapped(spoilerData.checkRewardItem.GetName().GetForCurrentLanguage().c_str()); + ImGui::TextWrapped(spoilerData.checkRewardItem.GetName().GetForCurrentLanguage(MF_RAW).c_str()); ImGui::TableNextColumn(); PlandomizerDrawItemSlots(index); if (plandoLogData[index].checkRewardItem.GetRandomizerGet() == RG_ICE_TRAP) { diff --git a/soh/soh/Enhancements/randomizer/context.cpp b/soh/soh/Enhancements/randomizer/context.cpp index 4d70d0a12..f104773c3 100644 --- a/soh/soh/Enhancements/randomizer/context.cpp +++ b/soh/soh/Enhancements/randomizer/context.cpp @@ -120,7 +120,7 @@ ItemOverride& Context::GetItemOverride(size_t locKey) { void Context::PlaceItemInLocation(const RandomizerCheck locKey, const RandomizerGet item, const bool applyEffectImmediately, const bool setHidden) { const auto loc = GetItemLocation(locKey); - SPDLOG_DEBUG(StaticData::RetrieveItem(item).GetName().GetEnglish() + " placed at " + StaticData::GetLocation(locKey)->GetName() + "\n"); + SPDLOG_DEBUG(StaticData::RetrieveItem(item).GetName().GetForCurrentLanguage(MF_RAW) + " placed at " + StaticData::GetLocation(locKey)->GetName() + "\n"); if (applyEffectImmediately || mOptions[RSK_LOGIC_RULES].Is(RO_LOGIC_GLITCHLESS) || mOptions[RSK_LOGIC_RULES].Is(RO_LOGIC_VANILLA)) { StaticData::RetrieveItem(item).ApplyEffect(); @@ -294,7 +294,7 @@ void Context::CreateItemOverrides() { } SPDLOG_DEBUG(loc->GetName()); SPDLOG_DEBUG(": "); - SPDLOG_DEBUG(itemLoc->GetPlacedItemName().GetForCurrentLanguage()); + SPDLOG_DEBUG(itemLoc->GetPlacedItemName().GetForCurrentLanguage(MF_RAW)); SPDLOG_DEBUG("\n"); } SPDLOG_DEBUG("Overrides Created: "); diff --git a/soh/soh/Enhancements/randomizer/hint.cpp b/soh/soh/Enhancements/randomizer/hint.cpp index fbe7c7645..9ee29ffed 100644 --- a/soh/soh/Enhancements/randomizer/hint.cpp +++ b/soh/soh/Enhancements/randomizer/hint.cpp @@ -411,11 +411,11 @@ oJson Hint::toJSON() { if (!(StaticData::staticHintInfoMap.contains(ownKey) && StaticData::staticHintInfoMap[ownKey].targetItems.size() > 0)){ if (items.size() == 1){ - log["item"] = StaticData::GetItemTable()[items[0]].GetName().GetForCurrentLanguage(); + log["item"] = StaticData::GetItemTable()[items[0]].GetName().GetForCurrentLanguage(MF_RAW); } else if (items.size() > 1){ std::vector itemStrings = {}; for (size_t c = 0; c < items.size(); c++){ - itemStrings.push_back(StaticData::GetItemTable()[items[c]].GetName().GetForCurrentLanguage()); + itemStrings.push_back(StaticData::GetItemTable()[items[c]].GetName().GetForCurrentLanguage(MF_RAW)); } log["items"] = itemStrings; } diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 3b7e9c81a..63150a1e2 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -1000,7 +1000,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l } else if (item00->itemEntry.modIndex == MOD_RANDOMIZER) { Notification::Emit({ .message = "You found ",//RANDOTODO change based on language - .suffix = Rando::StaticData::RetrieveItem((RandomizerGet)item00->itemEntry.getItemId).GetName().GetForCurrentLanguage(), + .suffix = Rando::StaticData::RetrieveItem((RandomizerGet)item00->itemEntry.getItemId).GetName().GetForCurrentLanguage(MF_RAW), }); } diff --git a/soh/soh/Enhancements/randomizer/item_list.cpp b/soh/soh/Enhancements/randomizer/item_list.cpp index 11dcf910d..29ba00b3e 100644 --- a/soh/soh/Enhancements/randomizer/item_list.cpp +++ b/soh/soh/Enhancements/randomizer/item_list.cpp @@ -409,9 +409,9 @@ void Rando::StaticData::InitItemTable() { if (itemNameToEnum.contains(string) && string != ""){ if (itemNameToEnum[string] != item.GetRandomizerGet()){ SPDLOG_DEBUG("\tREPEATED STRING WITH " + string + "\n\n"); - } else { - itemNameToEnum[string] = item.GetRandomizerGet(); - } + } + } else { + itemNameToEnum[string] = item.GetRandomizerGet(); } } } diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 54dde24a7..176ad9c1b 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -1111,11 +1111,11 @@ bool ShouldShowCheck(RandomizerCheck check) { RandomizerCheckObjects::GetRCAreaName(Rando::StaticData::GetLocation(check)->GetArea())); if (itemLoc->HasObtained() || itemLoc->GetCheckStatus() == RCSHOW_SCUMMED || (!mystery && (itemLoc->GetCheckStatus() == RCSHOW_IDENTIFIED || itemLoc->GetCheckStatus() == RCSHOW_SEEN) && itemLoc->GetPlacedRandomizerGet() != RG_ICE_TRAP)) { - search += " " + itemLoc->GetPlacedItemName().GetForCurrentLanguage(); + search += " " + itemLoc->GetPlacedItemName().GetForCurrentLanguage(MF_RAW); } else if (itemLoc->GetCheckStatus() == RCSHOW_IDENTIFIED && !mystery) { search += OTRGlobals::Instance->gRandoContext->overrides[check].GetTrickName().GetForLanguage(gSaveContext.language); } else if (itemLoc->GetCheckStatus() == RCSHOW_SEEN && !mystery) { - search += Rando::StaticData::RetrieveItem(OTRGlobals::Instance->gRandoContext->overrides[check].LooksLike()).GetName().GetForCurrentLanguage(); + search += Rando::StaticData::RetrieveItem(OTRGlobals::Instance->gRandoContext->overrides[check].LooksLike()).GetName().GetForCurrentLanguage(MF_RAW); } return ( IsVisibleInCheckTracker(check) && @@ -1607,10 +1607,10 @@ void DrawLocation(RandomizerCheck rc) { case RCSHOW_COLLECTED: case RCSHOW_SCUMMED: if (IS_RANDO) { - txt = itemLoc->GetPlacedItem().GetName().GetForCurrentLanguage(); + txt = itemLoc->GetPlacedItem().GetName().GetForCurrentLanguage(MF_RAW); } else { if (IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID())) { - txt = Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetName().GetForCurrentLanguage(); + txt = Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetName().GetForCurrentLanguage(MF_RAW); } } break; @@ -1621,10 +1621,10 @@ void DrawLocation(RandomizerCheck rc) { if (status == RCSHOW_IDENTIFIED) { txt = OTRGlobals::Instance->gRandoContext->overrides[rc].GetTrickName().GetForLanguage(gSaveContext.language); } else { - txt = Rando::StaticData::RetrieveItem(OTRGlobals::Instance->gRandoContext->overrides[rc].LooksLike()).GetName().GetForCurrentLanguage(); + txt = Rando::StaticData::RetrieveItem(OTRGlobals::Instance->gRandoContext->overrides[rc].LooksLike()).GetName().GetForCurrentLanguage(MF_RAW); } } else if (!mystery && !itemLoc->IsAddedToPool()) { - txt = itemLoc->GetPlacedItem().GetName().GetForCurrentLanguage(); + txt = itemLoc->GetPlacedItem().GetName().GetForCurrentLanguage(MF_RAW); } if (IsVisibleInCheckTracker(rc) && status == RCSHOW_IDENTIFIED && !mystery && !itemLoc->IsAddedToPool()) { auto price = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->GetPrice(); @@ -1634,7 +1634,7 @@ void DrawLocation(RandomizerCheck rc) { } } else { if (IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID())) { - txt = Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetName().GetForCurrentLanguage(); + txt = Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetName().GetForCurrentLanguage(MF_RAW); } } break; diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 55c7d204e..a5c651c97 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -541,7 +541,7 @@ void SaveManager::SaveRandomizer(SaveContext* saveContext, int sectionID, bool f std::vector items = hint->GetHintedItems(); SaveManager::Instance->SaveArray("items", items.size(), [&](size_t i) { - SaveManager::Instance->SaveData("", Rando::StaticData::GetItemTable()[items[i]].GetName().GetEnglish()); + SaveManager::Instance->SaveData("", Rando::StaticData::GetItemTable()[items[i]].GetName().GetEnglish(MF_RAW)); }); std::vector itemNamesChosen = hint->GetItemNamesChosen();