Fix for overriding deku scrub messages

This commit is contained in:
Garrett Cox 2022-09-03 10:34:35 -05:00
parent 771d1dfbf5
commit ac6843ca57
2 changed files with 8 additions and 5 deletions

View File

@ -790,8 +790,9 @@ void Randomizer::LoadShopMessages(const char* spoilerFileName) {
ParseHintLocationsFile(spoilerFileName);
}
CustomMessageManager::Instance->ClearMessageTable(Randomizer::merchantMessageTableID);
CustomMessageManager::Instance->AddCustomMessageTable(Randomizer::merchantMessageTableID);
// TODO: Remove these after we make sure it's fine that they aren't here
// CustomMessageManager::Instance->ClearMessageTable(Randomizer::merchantMessageTableID);
// CustomMessageManager::Instance->AddCustomMessageTable(Randomizer::merchantMessageTableID);
// Make an inverse of std::unordered_map<std::string, RandomizerGet> SpoilerfileGetNameToEnum
// so that we can get the name of the item from the RandomizerCheck
@ -806,14 +807,15 @@ void Randomizer::LoadShopMessages(const char* spoilerFileName) {
RandomizerCheck shopItemCheck = shopItemRandomizerChecks[index];
std::string shopItemName = GetEnumToSpoilerfileName[this->itemLocations[shopItemCheck]];
u16 shopItemPrice = randomizerMerchantPrices[shopItemCheck];
// TODO: Magic number 100, we don't to overwrite deku scrub messages
CustomMessageManager::Instance->CreateMessage(
Randomizer::merchantMessageTableID, index, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE,
Randomizer::merchantMessageTableID, index + 100, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE,
"\x08%r" + shopItemName + ": " + std::to_string(shopItemPrice) + " Rupees&%wSpecial deal! ONE LEFT!&Get it while it lasts!\x0A\x02",
"\x08%r" + shopItemName + ": " + std::to_string(shopItemPrice) + " Rubis&%wOffre spéciale! DERNIER EN STOCK!&Faites vite!\x0A\x02",
"\x08%r" + shopItemName + ": " + std::to_string(shopItemPrice) + " Rupees&%wSpecial deal! ONE LEFT!&Get it while it lasts!\x0A\x02",
});
CustomMessageManager::Instance->CreateMessage(
Randomizer::merchantMessageTableID, index + shopItemRandomizerChecks.size(), { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE,
Randomizer::merchantMessageTableID, index + shopItemRandomizerChecks.size() + 100, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE,
"\x08" + shopItemName + ": " + std::to_string(shopItemPrice) + " Rupees\x09&&\x1B%gBuy&Don't buy%w\x09\x02",
"\x08" + shopItemName + ": " + std::to_string(shopItemPrice) + " Rubis\x09&&\x1B%gAcheter&Ne pas acheter%w\x09\x02",
"\x08" + shopItemName + ": " + std::to_string(shopItemPrice) + " Rupees\x09&&\x1B%gBuy&Don't buy%w\x09\x02",

View File

@ -1765,7 +1765,8 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) {
} else if (textId >= 0x9000 && textId <= 0x905F) {
messageEntry = Randomizer_GetScrubMessage((textId & ((1 << 8) - 1)));
} else if (textId >= 0x9100 && textId <= 0x9180) {
messageEntry = Randomizer_GetShopMessage((textId & ((1 << 8) - 1)));
// TODO: Magic number 100, we don't to overwrite deku scrub messages
messageEntry = Randomizer_GetShopMessage((textId & ((1 << 8) - 1)) + 100);
} else if (CVar_GetS32("gRandomizeRupeeNames", 0) &&
(textId == TEXT_BLUE_RUPEE || textId == TEXT_RED_RUPEE || textId == TEXT_PURPLE_RUPEE ||
textId == TEXT_HUGE_RUPEE)) {