From 9e617f89234b62ea42ca7e9623955845868b402d Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sun, 4 Sep 2022 12:32:07 -0400 Subject: [PATCH] Implement's Tycoon Wallet. --- .../Enhancements/debugger/debugSaveEditor.cpp | 10 +++++++- .../Enhancements/randomizer/randomizer.cpp | 23 +++++++++++++++---- .../Enhancements/randomizer/randomizerTypes.h | 1 + soh/src/code/code_80097A00.c | 2 +- soh/src/code/z_parameter.c | 15 +++++++++--- 5 files changed, 42 insertions(+), 9 deletions(-) diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index 3765f5d6bfc..62fb0c78f0c 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -1201,11 +1201,19 @@ void DrawEquipmentTab() { DrawUpgradeIcon("Strength", UPG_STRENGTH, strengthValues); // There is no icon for child wallet, so default to a text list - const std::vector walletNames = { + // this was const, but I needed to append to it depending in rando settings. + std::vector walletNamesImpl = { "Child (99)", "Adult (200)", "Giant (500)", }; + // only display Tycoon wallet if you're in a save file that would allow it. + if (gSaveContext.n64ddFlag && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SHOPSANITY) > 1) { + const std::string walletName = "Tycoon (999)"; + walletNamesImpl.push_back(walletName); + } + // copy it to const value for display in ImGui. + const std::vector walletNames = walletNamesImpl; DrawUpgrade("Wallet", UPG_WALLET, walletNames); const std::vector stickNames = { diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index b3df105f7ed..058791d8372 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -1403,6 +1403,11 @@ ItemObtainability Randomizer::GetItemObtainabilityFromRandomizerCheck(Randomizer } ItemObtainability Randomizer::GetItemObtainabilityFromRandomizerGet(RandomizerGet randoGet) { + + // Shopsanity with at least one item shuffled allows for a third wallet upgrade. + // This is needed since Plentiful item pool also adds a third progressive wallet + // but we should *not* get Tycoon's Wallet in that mode. + u8 numWallets = GetRandoSettingValue(RSK_SHOPSANITY) > 1 ? 3 : 2; switch (randoGet) { case RG_NONE: case RG_TRIFORCE: @@ -1593,7 +1598,7 @@ ItemObtainability Randomizer::GetItemObtainabilityFromRandomizerGet(RandomizerGe case RG_PROGRESSIVE_STRENGTH: return CUR_UPG_VALUE(UPG_STRENGTH) < 3 ? CAN_OBTAIN : CANT_OBTAIN_ALREADY_HAVE; case RG_PROGRESSIVE_WALLET: - return CUR_UPG_VALUE(UPG_WALLET) < 2 ? CAN_OBTAIN : CANT_OBTAIN_ALREADY_HAVE; + return CUR_UPG_VALUE(UPG_WALLET) < numWallets ? CAN_OBTAIN : CANT_OBTAIN_ALREADY_HAVE; case RG_PROGRESSIVE_SCALE: return CUR_UPG_VALUE(UPG_SCALE) < 2 ? CAN_OBTAIN : CANT_OBTAIN_ALREADY_HAVE; case RG_PROGRESSIVE_MAGIC_METER: @@ -1985,6 +1990,8 @@ GetItemID Randomizer::GetItemIdFromRandomizerGet(RandomizerGet randoGet, GetItem return GI_WALLET_ADULT; case 1: return GI_WALLET_GIANT; + case 2: + return (GetItemID)RG_TYCOON_WALLET; } case RG_PROGRESSIVE_SCALE: switch (CUR_UPG_VALUE(UPG_SCALE)) { @@ -2155,7 +2162,6 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { case RG_PROGRESSIVE_BOMB_BAG: case RG_PROGRESSIVE_BOW: case RG_PROGRESSIVE_SLINGSHOT: - case RG_PROGRESSIVE_WALLET: case RG_PROGRESSIVE_SCALE: case RG_PROGRESSIVE_NUT_UPGRADE: case RG_PROGRESSIVE_STICK_UPGRADE: @@ -2224,6 +2230,12 @@ bool Randomizer::IsItemVanilla(RandomizerGet randoGet) { case RG_BUY_RED_POTION_40: case RG_BUY_RED_POTION_50: return true; + case RG_PROGRESSIVE_WALLET: + if (CUR_UPG_VALUE(UPG_WALLET) < 2) { + return true; + } else { + return false; + } case RG_FOREST_TEMPLE_SMALL_KEY: case RG_FIRE_TEMPLE_SMALL_KEY: case RG_WATER_TEMPLE_SMALL_KEY: @@ -5487,7 +5499,9 @@ void Randomizer::CreateCustomMessages() { GIMESSAGE(RG_MAGIC_BEAN_PACK, ITEM_BEAN, "You got a %rPack of Magic Beans%w!&Find a suitable spot for a garden&and plant them. Then, wait for&something fun to happen!", "Du hast eine %rPackung&Magic Beans%w! Finde&einen geeigneten Platz fur einen&Garten und pflanze sie. Dann^warte auf etwas Lustiges passiert!", - "Vous avez un %rPack de&haricots magiques%w ! Trouvez&un endroit convenable pour un&jardin et plantez-les.^Ensuite, attendez quelque&chose d'amusant doit arriver !") + "Vous avez un %rPack de&haricots magiques%w ! Trouvez&un endroit convenable pour un&jardin et plantez-les.^Ensuite, attendez quelque&chose d'amusant doit arriver !"), + GIMESSAGE_UNTRANSLATED(RG_TYCOON_WALLET, ITEM_WALLET_GIANT, + "You got a %rTycoon's Wallet%w!&It's gigantic! Now you can carry&up to %y999 rupees%w!") }; CreateGetItemMessages(getItemMessages); CreateMerchantMessages(); @@ -5587,7 +5601,8 @@ void InitRandoItemTable() { GET_ITEM(RG_SHADOW_TEMPLE_COMPASS, OBJECT_GI_COMPASS, GID_COMPASS, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_SHADOW_TEMPLE_COMPASS), GET_ITEM(RG_BOTTOM_OF_THE_WELL_COMPASS, OBJECT_GI_COMPASS, GID_COMPASS, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_BOTTOM_OF_THE_WELL_COMPASS), GET_ITEM(RG_ICE_CAVERN_COMPASS, OBJECT_GI_COMPASS, GID_COMPASS, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_ICE_CAVERN_COMPASS), - GET_ITEM(RG_MAGIC_BEAN_PACK, OBJECT_GI_BEAN, GID_BEAN, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_MAGIC_BEAN_PACK) + GET_ITEM(RG_MAGIC_BEAN_PACK, OBJECT_GI_BEAN, GID_BEAN, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_MAGIC_BEAN_PACK), + GET_ITEM(RG_TYCOON_WALLET, OBJECT_GI_PURSE, GID_WALLET_GIANT, TEXT_RANDOMIZER_CUSTOM_ITEM, 0x80, CHEST_ANIM_LONG, MOD_RANDOMIZER, RG_TYCOON_WALLET), }; ItemTableManager::Instance->AddItemTable(MOD_RANDOMIZER); for (int i = 0; i < ARRAY_COUNT(extendedVanillaGetItemTable); i++) { diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index 9a7e15071a0..a0c1fd2a9de 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -961,6 +961,7 @@ typedef enum { RG_BUY_RED_POTION_50, RG_TRIFORCE, RG_HINT, + RG_TYCOON_WALLET, RG_MAX } RandomizerGet; diff --git a/soh/src/code/code_80097A00.c b/soh/src/code/code_80097A00.c index f07102b0fe2..727c199ac68 100644 --- a/soh/src/code/code_80097A00.c +++ b/soh/src/code/code_80097A00.c @@ -27,7 +27,7 @@ u16 gUpgradeCapacities[][4] = { { 0, 20, 30, 40 }, // Bomb Bags { 0, 0, 0, 0 }, // Unused (Scale) { 0, 0, 0, 0 }, // Unused (Strength) - { 99, 200, 500, 500 }, // Wallets + { 99, 200, 500, 999 }, // Wallets { 0, 30, 40, 50 }, // Deku Seed Bullet Bags { 0, 10, 20, 30 }, // Deku Stick Upgrades { 0, 20, 30, 40 }, // Deku Nut Upgrades diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 4d480744283..fe759fe14d6 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -2392,6 +2392,14 @@ u16 Randomizer_Item_Give(GlobalContext* globalCtx, GetItemEntry giEntry) { } } + if (item == RG_TYCOON_WALLET) { + Inventory_ChangeUpgrade(UPG_WALLET, 3); + if (gSaveContext.n64ddFlag && Randomizer_GetSettingValue(RSK_FULL_WALLETS)) { + Rupees_ChangeBy(999); + } + return RG_NONE; + } + temp = gSaveContext.inventory.items[slot]; osSyncPrintf("Item_Register(%d)=%d %d\n", slot, item, temp); INV_CONTENT(item) = item; @@ -4626,14 +4634,15 @@ void Interface_Draw(GlobalContext* globalCtx) { static s16 D_80125B1C[][3] = { { 0, 150, 0 }, { 100, 255, 0 }, { 255, 255, 255 }, { 0, 0, 0 }, { 255, 255, 255 }, }; - static s16 rupeeDigitsFirst[] = { 1, 0, 0 }; - static s16 rupeeDigitsCount[] = { 2, 3, 3 }; + static s16 rupeeDigitsFirst[] = { 1, 0, 0, 0 }; + static s16 rupeeDigitsCount[] = { 2, 3, 3, 3 }; // courtesy of https://github.com/TestRunnerSRL/OoT-Randomizer/blob/Dev/ASM/c/hud_colors.c - static s16 rupeeWalletColors[3][3] = { + static s16 rupeeWalletColors[4][3] = { { 0xC8, 0xFF, 0x64 }, // Base Wallet (Green) { 0x82, 0x82, 0xFF }, // Adult's Wallet (Blue) { 0xFF, 0x64, 0x64 }, // Giant's Wallet (Red) + { 0xFF, 0x5A, 0xFF }, // Tycoon's Wallet (Purple). Only used in rando shopsanity. }; Color_RGB8 rColor_ori = { 200, 255, 100 }; Color_RGB8 rColor;