diff --git a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h index 1af49d6a6..4c9de90a5 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h +++ b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h @@ -18,7 +18,9 @@ typedef enum { TEXT_RED_RUPEE = 0xF0, TEXT_PURPLE_RUPEE = 0xF1, TEXT_HUGE_RUPEE = 0xF2, - TEXT_BEAN_SALESMAN = 0x405E + TEXT_BEAN_SALESMAN = 0x405E, + TEXT_SCRUB_RANDOM = 0x9000, + TEXT_SHOP_ITEM_RANDOM = 0x9100, } TextIDs; #ifdef __cplusplus diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index e81456a3f..225e7b2ae 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -398,23 +398,23 @@ void Randomizer::LoadMerchantMessages(const char* spoilerFileName) { CustomMessageManager::Instance->ClearMessageTable(Randomizer::merchantMessageTableID); CustomMessageManager::Instance->AddCustomMessageTable(Randomizer::merchantMessageTableID); + + // Prices have a chance of being 0, and the "sell" message below doesn't really make sense for a free item, so manually adding a "free" variation here CustomMessageManager::Instance->CreateMessage(Randomizer::merchantMessageTableID, 0, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_BOTTOM, "\x12\x38\x82\All right! You win! In return for&sparing me, I will give you a&%gmysterious item%w!&Please, take it!\x07\x10\xA3", "\x12\x38\x82\In Ordnung! Du gewinnst! Im Austausch&dafür, dass du mich verschont hast,&werde ich dir einen %gmysteriösen&Gegenstand%w geben! Bitte nimm ihn!\x07\x10\xA3", - "\x12\x38\x82\D'accord! Vous avez gagné! En échange&de m'épargner, je vous donnerai un &%gobjet mystérieux%w! S'il vous plaît,&prenez-le!\x07\x10\xA3", + "\x12\x38\x82\J'me rends! Laisse-moi partir et en&échange, je te donne un %gobjet &mystérieux%w! Vas-y prends le!\x07\x10\xA3", }); - - // Currently these are generated at runtime, one for each price between 0-95. We're soon going to migrate this - // to being generated at save load, with only messages specific to each scrub. + // Currently a scrub message is created for each price between 5-95, identified by the price itself. Soon we'll migrate this + // to be more consistent with shop items, where they are identified by randomizer_inf and only generated where necessary for (u32 price = 5; price <= 95; price += 5) { - CustomMessageManager::Instance->CreateMessage(Randomizer::merchantMessageTableID, price, + CustomMessageManager::Instance->CreateMessage(Randomizer::merchantMessageTableID, TEXT_SCRUB_RANDOM + price, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_BOTTOM, "\x12\x38\x82\All right! You win! In return for&sparing me, I will sell you a&%gmysterious item%w!&%r" + std::to_string(price) + " Rupees%w it is!\x07\x10\xA3", - // RANDTODO: Translate the below string to German. - "\x12\x38\x82\All right! You win! In return for&sparing me, I will sell you a&%gmysterious item%w!&%r" + - std::to_string(price) + " Rupees%w it is!\x07\x10\xA3", + "\x12\x38\x82\Aufgeben! Ich verkaufe dir einen&%ggeheimnisvollen Gegenstand%w&für %r" + + std::to_string(price) + " Rubine%w!\x07\x10\xA3", "\x12\x38\x82J'abandonne! Tu veux bien m'acheter&un %gobjet mystérieux%w?&Ça fera %r" + std::to_string(price) + " Rubis%w!\x07\x10\xA3" }); @@ -432,7 +432,7 @@ void Randomizer::LoadMerchantMessages(const char* spoilerFileName) { "%gobjet mystérieux%w pour 60 Rubis?\x1B&%gOui&Non%w", }); - for (int index = 0; index < shopItemRandomizerChecks.size(); ++index) { + for (int index = 0; index < NUM_SHOP_ITEMS; index++) { RandomizerCheck shopItemCheck = shopItemRandomizerChecks[index]; RandomizerGet shopItemGet = this->itemLocations[shopItemCheck]; // TODO: This should eventually be replaced with a full fledged trick model & trick name system @@ -441,17 +441,18 @@ void Randomizer::LoadMerchantMessages(const char* spoilerFileName) { } std::vector shopItemName = EnumToSpoilerfileGetName[shopItemGet]; u16 shopItemPrice = merchantPrices[shopItemCheck]; - // TODO: Magic number 100, we don't to overwrite deku scrub messages + // Each shop item has two messages, one for when the cursor is over it, and one for when you select it and are + // prompted buy/don't buy, so we're adding the first at {index}, and the second at {index + NUM_SHOP_ITEMS} CustomMessageManager::Instance->CreateMessage( - Randomizer::merchantMessageTableID, index + 100, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE, + Randomizer::merchantMessageTableID, TEXT_SHOP_ITEM_RANDOM + index, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE, "\x08%r" + shopItemName[0] + ": " + std::to_string(shopItemPrice) + " Rupees&%wSpecial deal! ONE LEFT!&Get it while it lasts!\x0A\x02", - "\x08%r" + shopItemName[1] + ": " + std::to_string(shopItemPrice) + " Rupees&%wSpecial deal! ONE LEFT!&Get it while it lasts!\x0A\x02", + "\x08%r" + shopItemName[1] + ": " + std::to_string(shopItemPrice) + " Rubine&%wSonderangebot! NUR NOCH EINES VERFÜGBAR!&Beeilen Sie sich!\x0A\x02", "\x08%r" + shopItemName[2] + ": " + std::to_string(shopItemPrice) + " Rubis&%wOffre spéciale! DERNIER EN STOCK!&Faites vite!\x0A\x02", }); CustomMessageManager::Instance->CreateMessage( - Randomizer::merchantMessageTableID, index + shopItemRandomizerChecks.size() + 100, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE, + Randomizer::merchantMessageTableID, TEXT_SHOP_ITEM_RANDOM + index + NUM_SHOP_ITEMS, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE, "\x08" + shopItemName[0] + ": " + std::to_string(shopItemPrice) + " Rupees\x09&&\x1B%gBuy&Don't buy%w\x09\x02", - "\x08" + shopItemName[1] + ": " + std::to_string(shopItemPrice) + " Rupees\x09&&\x1B%gBuy&Don't buy%w\x09\x02", + "\x08" + shopItemName[1] + ": " + std::to_string(shopItemPrice) + " Rubine\x09&&\x1B%gKaufen&Nicht kaufen%w\x09\x02", "\x08" + shopItemName[2] + ": " + std::to_string(shopItemPrice) + " Rubis\x09&&\x1B%gAcheter&Ne pas acheter%w\x09\x02", }); } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 2cc9c103d..5a91fc28b 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1603,19 +1603,11 @@ extern "C" ShopItemIdentity Randomizer_IdentifyShopItem(s32 sceneNum, u8 slotInd return OTRGlobals::Instance->gRandomizer->IdentifyShopItem(sceneNum, slotIndex); } -extern "C" CustomMessageEntry Randomizer_GetScrubMessage(s16 itemPrice) { - return CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, itemPrice); -} - extern "C" CustomMessageEntry Randomizer_GetNaviMessage() { u16 naviTextId = rand() % NUM_NAVI_MESSAGES; return CustomMessageManager::Instance->RetrieveMessage(Randomizer::NaviRandoMessageTableID, naviTextId); } -extern "C" CustomMessageEntry Randomizer_GetShopMessage(s16 shopItemId) { - return CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, shopItemId); -} - extern "C" CustomMessageEntry Randomizer_GetAltarMessage() { return (LINK_IS_ADULT) ? CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, TEXT_ALTAR_ADULT) @@ -1771,11 +1763,10 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) { } else { messageEntry = Randomizer_GetGanonHintText(); } - } else if (textId >= 0x9000 && textId <= 0x905F) { - messageEntry = Randomizer_GetScrubMessage((textId & ((1 << 8) - 1))); - } else if (textId >= 0x9100 && textId <= 0x9180) { - // TODO: Magic number 100, we don't to overwrite deku scrub messages - messageEntry = Randomizer_GetShopMessage((textId & ((1 << 8) - 1)) + 100); + } else if (textId >= TEXT_SCRUB_RANDOM && textId <= TEXT_SCRUB_RANDOM + 0xFF) { + messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, textId); + } else if (textId >= TEXT_SHOP_ITEM_RANDOM && textId <= TEXT_SHOP_ITEM_RANDOM + 0xFF) { + messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, textId); } else if (CVar_GetS32("gRandomizeRupeeNames", 0) && (textId == TEXT_BLUE_RUPEE || textId == TEXT_RED_RUPEE || textId == TEXT_PURPLE_RUPEE || textId == TEXT_HUGE_RUPEE)) {