Added Silver Rupee Counts to the GetItem Message

This commit is contained in:
Christopher Leggett 2024-03-09 20:05:21 -05:00
parent f26d954cf8
commit cae433ddfa
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
3 changed files with 23 additions and 13 deletions

View File

@ -8,6 +8,13 @@ void EnGSwitch_Randomizer_SilverRupeeIdle(EnGSwitch* self, PlayState* play) {
self->actor.shape.rot.y += 0x800;
if (self->actor.xyzDistToPlayerSq < 900.0f) {
if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_SILVER_RUPEES) != RO_SILVER_SHUFFLE_VANILLA) {
player->getItemEntry = *self->giEntry;
if (self->giEntry->getItemId == RG_ICE_TRAP) {
Message_StartTextbox(play, 0xF8, NULL);
} else {
Message_StartTextbox(play, self->giEntry->textId, NULL);
}
if (self->giEntry->modIndex == MOD_NONE) {
// RANDOTOD: Move this into Item_Give() or some other more central location
if (self->giEntry->getItemId == GI_SWORD_BGS) {
@ -27,14 +34,6 @@ void EnGSwitch_Randomizer_SilverRupeeIdle(EnGSwitch* self, PlayState* play) {
// player->actor.freezeTimer = 10;
// }
player->getItemEntry = *self->giEntry;
if (self->giEntry->getItemId == RG_ICE_TRAP) {
Message_StartTextbox(play, 0xF8, NULL);
} else {
Message_StartTextbox(play, self->giEntry->textId, NULL);
}
if (IS_RANDO) {
if (self->giEntry->getItemId != RG_ICE_TRAP) {
Audio_PlayFanfare_Rando(*self->giEntry);

View File

@ -2851,10 +2851,11 @@ void CreateGetItemMessages(const std::array<GetItemMessage, N>* messageEntries)
}
// Special Case for Silver Rupees
//TODO: AI Translated Text, get translation from native speaker.
customMessageManager->CreateMessage(Randomizer::getItemMessageTableID, RG_SILVER_RUPEE_FIRST,
CustomMessage("You got a %cSilver Rupee%w for the&%g{{location}}%w!",
"Du hast eine %cSilberne Rupie%w für die&%g{{location}}%w!",
"Vous avez reçu une %cRoupie d'Argent%w pour le&%g{{location}}%w!",
customMessageManager->CreateMessage(
Randomizer::getItemMessageTableID, RG_SILVER_RUPEE_FIRST,
CustomMessage("You got a %cSilver Rupee%w for the&%g{{location}}%w!&{{count_text}}!",
"Du hast eine %cSilberne Rupie%w für die&%g{{location}}%w!{{count_text}}!",
"Vous avez reçu une %cRoupie d'Argent%w pour le&%g{{location}}%w!{{count_text}}!",
TEXTBOX_TYPE_BLUE, TEXTBOX_POS_BOTTOM));
// Special Case for Silver Rupee Pouches
// customMessageManager->CreateMessage(Randomizer::getItemMessageTableID, RG_SILVER_RUPEE_POUCH_FIRST,

View File

@ -171,6 +171,16 @@ namespace Rando {
if (rgid >= RG_SILVER_RUPEE_FIRST && rgid <= RG_SILVER_RUPEE_LAST) {
messageEntry =
CustomMessageManager::Instance->RetrieveMessage(Randomizer::getItemMessageTableID, RG_SILVER_RUPEE_FIRST);
auto ctx = Rando::Context::GetInstance();
// Get the collected amount + 1, since the text is retrieved before the count is incremented in `Randomizer_Item_Give`
int srCount = ctx->GetSilverRupees()->GetInfo(static_cast<RandomizerGet>(rgid)).GetCollected() + 1;
bool complete = ctx->GetSilverRupees()->GetInfo(static_cast<RandomizerGet>(rgid)).GetTotal() <= srCount;
if (complete) {
messageEntry.Replace("{{count_text}}", "That's all of them");
} else {
messageEntry.Replace("{{count_text}}", "You have collected %g{{count}}%w of them so far");
messageEntry.Replace("{{count}}", std::to_string(srCount));
}
}/* else if (rgid >= RG_SILVER_RUPEE_POUCH_FIRST && rgid <= RG_SILVER_RUPEE_POUCH_LAST) {
messageEntry =
CustomMessageManager::Instance->RetrieveMessage(Randomizer::getItemMessageTableID, RG_SILVER_RUPEE_POUCH_FIRST);