diff --git a/soh/soh/Enhancements/custom_message/CustomMessageTypes.h b/soh/soh/Enhancements/custom_message/CustomMessageTypes.h index fd065f35482..d2f30f123bb 100644 --- a/soh/soh/Enhancements/custom_message/CustomMessageTypes.h +++ b/soh/soh/Enhancements/custom_message/CustomMessageTypes.h @@ -3,7 +3,7 @@ typedef enum { TEXT_GS_NO_FREEZE = 0xB4, TEXT_GS_FREEZE = 0xB5, - TEXT_RANDOMIZER_GI_ESCAPE_HATCH = 0xF8, + TEXT_RANDOMIZER_CUSTOM_ITEM = 0xF8, TEXT_SCRUB_POH = 0x10A2, TEXT_SCRUB_STICK_UPGRADE = 0x10DC, TEXT_SCRUB_NUT_UPGRADE = 0x10DD, @@ -11,4 +11,23 @@ typedef enum { TEXT_ALTAR_CHILD = 0x7040, TEXT_ALTAR_ADULT = 0x7088, TEXT_GANONDORF = 0x70CC, + TEXT_GANONDORF_NOHINT = 0x70CD } TextIDs; + +#ifdef __cplusplus + +typedef struct { + GetItemID giid; + ItemID iid; + std::string english; + std::string german; + std::string french; +} GetItemMessage; + +#define GIMESSAGE(giid, iid, english, german, french) \ + { giid, iid, english, german, french } + +#define GIMESSAGE_UNTRANSLATED(giid, iid, message) \ + { giid, iid, message, message, message } + +#endif diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index dcfa3667524..c0077a97e02 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -15,6 +15,7 @@ #include #include "Lib/ImGui/imgui_internal.h" #include +#include using json = nlohmann::json; using namespace std::literals::string_literals; @@ -1487,19 +1488,19 @@ void Randomizer::LoadHintLocations(const char* spoilerFileName) { CustomMessageManager::Instance->AddCustomMessageTable(Randomizer::hintMessageTableID); CustomMessageManager::Instance->CreateMessage( - Randomizer::hintMessageTableID, 0x7040, + Randomizer::hintMessageTableID, TEXT_ALTAR_CHILD, { TEXTBOX_TYPE_BLUE, TEXTBOX_POS_BOTTOM, gSaveContext.childAltarText, gSaveContext.childAltarText, gSaveContext.childAltarText }); CustomMessageManager::Instance->CreateMessage( - Randomizer::hintMessageTableID, 0x7088, + Randomizer::hintMessageTableID, TEXT_ALTAR_ADULT, { TEXTBOX_TYPE_BLUE, TEXTBOX_POS_BOTTOM, gSaveContext.adultAltarText, gSaveContext.adultAltarText, gSaveContext.adultAltarText }); CustomMessageManager::Instance->CreateMessage( - Randomizer::hintMessageTableID, 0x70CC, + Randomizer::hintMessageTableID, TEXT_GANONDORF, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_BOTTOM, gSaveContext.ganonHintText, gSaveContext.ganonHintText, gSaveContext.ganonHintText }); CustomMessageManager::Instance->CreateMessage( - Randomizer::hintMessageTableID, 0x70CD, + Randomizer::hintMessageTableID, TEXT_GANONDORF_NOHINT, { TEXTBOX_TYPE_BLACK, TEXTBOX_POS_BOTTOM, gSaveContext.ganonText, gSaveContext.ganonText, gSaveContext.ganonText }); @@ -4737,14 +4738,6 @@ void DrawRandoEditor(bool& open) { ImGui::End(); }*/ -typedef struct { - GetItemID giid; - ItemID iid; - std::string english; - std::string german; - std::string french; -} GetItemMessage; - void CreateGetItemMessages(std::vector messageEntries) { CustomMessageManager* customMessageManager = CustomMessageManager::Instance; customMessageManager->AddCustomMessageTable(Randomizer::getItemMessageTableID); @@ -4765,6 +4758,7 @@ void CreateScrubMessages() { { 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\x82J'abandonne! Tu veux bien m'acheter&un %gobjet mystérieux%w?&Ça fera %r" + @@ -4773,45 +4767,26 @@ void CreateScrubMessages() { } } -#define GIMESSAGE(giid, iid, english, german, french) \ - { giid, iid, english, german, french } - void Randomizer::CreateCustomMessages() { + // RANDTODO: Translate into french and german and replace GIMESSAGE_UNTRANSLATED + // with GIMESSAGE(getItemID, itemID, english, german, french). const std::vector getItemMessages = { - GIMESSAGE(GI_BOTTLE_WITH_BLUE_FIRE, ITEM_BLUE_FIRE, - "You got a %rBottle with Blue &Fire%w! Use it to melt Red Ice!", - "You got a %rBottle with Blue &Fire%w! Use it to melt Red Ice!", + GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_BLUE_FIRE, ITEM_BLUE_FIRE, "You got a %rBottle with Blue &Fire%w! Use it to melt Red Ice!"), - GIMESSAGE(GI_BOTTLE_WITH_BIG_POE, ITEM_BIG_POE, - "You got a %rBig Poe in a Bottle%w!&Sell it to the Ghost Shop!", - "You got a %rBig Poe in a Bottle%w!&Sell it to the Ghost Shop!", + GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_BIG_POE, ITEM_BIG_POE, "You got a %rBig Poe in a Bottle%w!&Sell it to the Ghost Shop!"), - GIMESSAGE(GI_BOTTLE_WITH_BLUE_POTION, ITEM_POTION_BLUE, - "You got a %rBottle of Blue Potion%w!&Drink it to replenish your&%ghealth%w and %bmagic%w!", - "You got a %rBottle of Blue Potion%w!&Drink it to replenish your&%ghealth%w and %bmagic%w!", + GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_BLUE_POTION, ITEM_POTION_BLUE, "You got a %rBottle of Blue Potion%w!&Drink it to replenish your&%ghealth%w and %bmagic%w!"), - GIMESSAGE(GI_BOTTLE_WITH_FISH, ITEM_FISH, - "You got a %rFish in a Bottle%w!&It looks fresh and delicious!&They say Jabu-Jabu loves them!", - "You got a %rFish in a Bottle%w!&It looks fresh and delicious!&They say Jabu-Jabu loves them!", + GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_FISH, ITEM_FISH, "You got a %rFish in a Bottle%w!&It looks fresh and delicious!&They say Jabu-Jabu loves them!"), - GIMESSAGE(GI_BOTTLE_WITH_BUGS, ITEM_BUG, - "You got a %rBug in a Bottle%w!&They love to burrow in&dirt holes!", - "You got a %rBug in a Bottle%w!&They love to burrow in&dirt holes!", + GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_BUGS, ITEM_BUG, "You got a %rBug in a Bottle%w!&They love to burrow in&dirt holes!"), - GIMESSAGE(GI_BOTTLE_WITH_FAIRY, ITEM_FAIRY, "You got a %rFairy in a Bottle%w!&Use it wisely!", - "You got a %rFairy in a Bottle%w!&Use it wisely!", - "You got a %rFairy in a Bottle%w!&Use it wisely!"), - GIMESSAGE(GI_BOTTLE_WITH_RED_POTION, ITEM_POTION_RED, - "You got a %rBottle of Red Potion%w!&Drink it to replenish your&%ghealth%w!", - "You got a %rBottle of Red Potion%w!&Drink it to replenish your&%ghealth%w!", + GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_FAIRY, ITEM_FAIRY, "You got a %rFairy in a Bottle%w!&Use it wisely!"), + GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_RED_POTION, ITEM_POTION_RED, "You got a %rBottle of Red Potion%w!&Drink it to replenish your&%ghealth%w!"), - GIMESSAGE(GI_BOTTLE_WITH_GREEN_POTION, ITEM_POTION_GREEN, - "You got a %rBottle of Green Potion%w!&Drink it to replenish your&%bmagic%w!", - "You got a %rBottle of Green Potion%w!&Drink it to replenish your&%bmagic%w!", + GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_GREEN_POTION, ITEM_POTION_GREEN, "You got a %rBottle of Green Potion%w!&Drink it to replenish your&%bmagic%w!"), - GIMESSAGE(GI_BOTTLE_WITH_POE, ITEM_POE, - "You got a %rPoe in a Bottle%w!&That creepy Ghost Shop might&be interested in this...", - "You got a %rPoe in a Bottle%w!&That creepy Ghost Shop might&be interested in this...", + GIMESSAGE_UNTRANSLATED(GI_BOTTLE_WITH_POE, ITEM_POE, "You got a %rPoe in a Bottle%w!&That creepy Ghost Shop might&be interested in this..."), }; CreateGetItemMessages(getItemMessages); diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index aa28b5e98f7..088e589fae8 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -1411,7 +1411,7 @@ extern "C" RandomizerCheck Randomizer_GetCheckFromActor(s16 sceneNum, s16 actorI return OTRGlobals::Instance->gRandomizer->GetCheckFromActor(sceneNum, actorId, actorParams); } -extern "C" CustomMessageEntry Randomizer_CopyScrubMessage(u16 scrubTextId) { +extern "C" CustomMessageEntry Randomizer_GetScrubMessage(u16 scrubTextId) { int price = 0; switch (scrubTextId) { case TEXT_SCRUB_POH: @@ -1425,21 +1425,21 @@ extern "C" CustomMessageEntry Randomizer_CopyScrubMessage(u16 scrubTextId) { return CustomMessageManager::Instance->RetrieveMessage(Randomizer::scrubMessageTableID, price); } -extern "C" CustomMessageEntry Randomizer_CopyAltarMessage() { +extern "C" CustomMessageEntry Randomizer_GetAltarMessage() { return (LINK_IS_ADULT) ? CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, TEXT_ALTAR_ADULT) : CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, TEXT_ALTAR_CHILD); } -extern "C" CustomMessageEntry Randomizer_CopyGanonText() { - return CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, TEXT_GANONDORF + 1); +extern "C" CustomMessageEntry Randomizer_GetGanonText() { + return CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, TEXT_GANONDORF_NOHINT); } -extern "C" CustomMessageEntry Randomizer_CopyGanonHintText() { +extern "C" CustomMessageEntry Randomizer_GetGanonHintText() { return CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, TEXT_GANONDORF); } -extern "C" CustomMessageEntry Randomizer_CopyHintFromCheck(RandomizerCheck check) { +extern "C" CustomMessageEntry Randomizer_GetHintFromCheck(RandomizerCheck check) { // we don't want to make a copy of the std::string returned from GetHintFromCheck // so we're just going to let RVO take care of it const CustomMessageEntry hintText = CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, check); @@ -1467,10 +1467,10 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) { const int maxBufferSize = sizeof(font->msgBuf); CustomMessageEntry messageEntry; if (gSaveContext.n64ddFlag) { - if (textId == TEXT_RANDOMIZER_GI_ESCAPE_HATCH) { + if (textId == TEXT_RANDOMIZER_CUSTOM_ITEM) { messageEntry = Randomizer_GetCustomGetItemMessage((GetItemID)GET_PLAYER(globalCtx)->getItemId, buffer, maxBufferSize); - } else if (textId == 0x2053 && Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) != 0 && + } else if (textId == TEXT_RANDOMIZER_GOSSIP_STONE_HINTS && Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) != 0 && (Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 1 || (Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == 2 && Player_GetMask(globalCtx) == PLAYER_MASK_TRUTH) || @@ -1497,18 +1497,18 @@ extern "C" int CustomMessage_RetrieveIfExists(GlobalContext* globalCtx) { RandomizerCheck hintCheck = Randomizer_GetCheckFromActor(globalCtx->sceneNum, msgCtx->talkActor->id, actorParams); - messageEntry = Randomizer_CopyHintFromCheck(hintCheck); + messageEntry = Randomizer_GetHintFromCheck(hintCheck); } else if (textId == TEXT_ALTAR_CHILD || textId == TEXT_ALTAR_ADULT) { // rando hints at altar - messageEntry = Randomizer_CopyAltarMessage(); + messageEntry = Randomizer_GetAltarMessage(); } else if (textId == TEXT_GANONDORF) { if (INV_CONTENT(ITEM_ARROW_LIGHT) == ITEM_ARROW_LIGHT) { - messageEntry = Randomizer_CopyGanonText(); + messageEntry = Randomizer_GetGanonText(); } else { - messageEntry = Randomizer_CopyGanonHintText(); + messageEntry = Randomizer_GetGanonHintText(); } } else if (textId == TEXT_SCRUB_POH || textId == TEXT_SCRUB_STICK_UPGRADE || textId == TEXT_SCRUB_NUT_UPGRADE) { - messageEntry = Randomizer_CopyScrubMessage(textId); + messageEntry = Randomizer_GetScrubMessage(textId); } } if (textId == TEXT_GS_NO_FREEZE || textId == TEXT_GS_FREEZE) { diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index e1e3813f5b6..707851ce336 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -653,15 +653,15 @@ static GetItemEntry sGetItemTable[] = { GET_ITEM(ITEM_DOUBLE_MAGIC, OBJECT_GI_MAGICPOT, GID_MAGIC_LARGE, 0xE8, 0x80, CHEST_ANIM_LONG), GET_ITEM(ITEM_DOUBLE_DEFENSE, OBJECT_GI_HEARTS, GID_HEART_CONTAINER, 0xE9, 0x80, CHEST_ANIM_LONG), - GET_ITEM(ITEM_BOTTLE_WITH_RED_POTION, OBJECT_GI_LIQUID, GID_POTION_RED, TEXT_RANDOMIZER_GI_ESCAPE_HATCH, 0x80, CHEST_ANIM_LONG), - GET_ITEM(ITEM_BOTTLE_WITH_GREEN_POTION, OBJECT_GI_LIQUID, GID_POTION_GREEN, TEXT_RANDOMIZER_GI_ESCAPE_HATCH, 0x80, CHEST_ANIM_LONG), - GET_ITEM(ITEM_BOTTLE_WITH_BLUE_POTION, OBJECT_GI_LIQUID, GID_POTION_BLUE, TEXT_RANDOMIZER_GI_ESCAPE_HATCH, 0x80, CHEST_ANIM_LONG), - GET_ITEM(ITEM_BOTTLE_WITH_FAIRY, OBJECT_GI_BOTTLE, GID_BOTTLE, TEXT_RANDOMIZER_GI_ESCAPE_HATCH, 0x80, CHEST_ANIM_LONG), - GET_ITEM(ITEM_BOTTLE_WITH_FISH, OBJECT_GI_FISH, GID_FISH, TEXT_RANDOMIZER_GI_ESCAPE_HATCH, 0x80, CHEST_ANIM_LONG), - GET_ITEM(ITEM_BOTTLE_WITH_BLUE_FIRE, OBJECT_GI_FIRE, GID_BLUE_FIRE, TEXT_RANDOMIZER_GI_ESCAPE_HATCH, 0x80, CHEST_ANIM_LONG), - GET_ITEM(ITEM_BOTTLE_WITH_BUGS, OBJECT_GI_INSECT, GID_BUG, TEXT_RANDOMIZER_GI_ESCAPE_HATCH, 0x80, CHEST_ANIM_LONG), - GET_ITEM(ITEM_BOTTLE_WITH_POE, OBJECT_GI_GHOST, GID_POE, TEXT_RANDOMIZER_GI_ESCAPE_HATCH, 0x80, CHEST_ANIM_LONG), - GET_ITEM(ITEM_BOTTLE_WITH_BIG_POE, OBJECT_GI_GHOST, GID_BIG_POE, TEXT_RANDOMIZER_GI_ESCAPE_HATCH, 0x80, CHEST_ANIM_LONG), + GET_ITEM(ITEM_BOTTLE_WITH_RED_POTION, OBJECT_GI_LIQUID, GID_POTION_RED, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG), + GET_ITEM(ITEM_BOTTLE_WITH_GREEN_POTION, OBJECT_GI_LIQUID, GID_POTION_GREEN, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG), + GET_ITEM(ITEM_BOTTLE_WITH_BLUE_POTION, OBJECT_GI_LIQUID, GID_POTION_BLUE, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG), + GET_ITEM(ITEM_BOTTLE_WITH_FAIRY, OBJECT_GI_BOTTLE, GID_BOTTLE, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG), + GET_ITEM(ITEM_BOTTLE_WITH_FISH, OBJECT_GI_FISH, GID_FISH, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG), + GET_ITEM(ITEM_BOTTLE_WITH_BLUE_FIRE, OBJECT_GI_FIRE, GID_BLUE_FIRE, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG), + GET_ITEM(ITEM_BOTTLE_WITH_BUGS, OBJECT_GI_INSECT, GID_BUG, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG), + GET_ITEM(ITEM_BOTTLE_WITH_POE, OBJECT_GI_GHOST, GID_POE, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG), + GET_ITEM(ITEM_BOTTLE_WITH_BIG_POE, OBJECT_GI_GHOST, GID_BIG_POE, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG), GET_ITEM_NONE, GET_ITEM_NONE,