Skip to content

Commit

Permalink
Merge pull request #3 from leggettc18/pr/garrettjoecox/1329
Browse files Browse the repository at this point in the history
Implement's Tycoon Wallet.
  • Loading branch information
garrettjoecox authored Sep 4, 2022
2 parents f282e25 + 9e617f8 commit adb7ce7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 9 deletions.
10 changes: 9 additions & 1 deletion soh/soh/Enhancements/debugger/debugSaveEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> walletNames = {
// this was const, but I needed to append to it depending in rando settings.
std::vector<std::string> 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<std::string> walletNames = walletNamesImpl;
DrawUpgrade("Wallet", UPG_WALLET, walletNames);

const std::vector<std::string> stickNames = {
Expand Down
23 changes: 19 additions & 4 deletions soh/soh/Enhancements/randomizer/randomizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1435,6 +1435,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:
Expand Down Expand Up @@ -1625,7 +1630,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:
Expand Down Expand Up @@ -2017,6 +2022,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)) {
Expand Down Expand Up @@ -2187,7 +2194,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:
Expand Down Expand Up @@ -2256,6 +2262,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:
Expand Down Expand Up @@ -5481,7 +5493,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);
CreateRupeeMessages();
Expand Down Expand Up @@ -5580,7 +5594,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++) {
Expand Down
1 change: 1 addition & 0 deletions soh/soh/Enhancements/randomizer/randomizerTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,7 @@ typedef enum {
RG_BUY_RED_POTION_50,
RG_TRIFORCE,
RG_HINT,
RG_TYCOON_WALLET,
RG_MAX
} RandomizerGet;

Expand Down
2 changes: 1 addition & 1 deletion soh/src/code/code_80097A00.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 12 additions & 3 deletions soh/src/code/z_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit adb7ce7

Please sign in to comment.