diff --git a/include/player.h b/include/player.h index e0cbdcfc..6c31cf38 100644 --- a/include/player.h +++ b/include/player.h @@ -398,7 +398,11 @@ typedef struct { extern void (*const gPlayerItemFunctions[])(Entity*); -extern const s16 gWalletSizes[]; +typedef struct { + u16 size; + u16 iconStartTile; +} Wallet; +extern const Wallet gWalletSizes[]; extern const u8 gBombBagSizes[]; extern const u8 gQuiverSizes[]; extern Entity* gPlayerClones[]; diff --git a/src/gameUtils.c b/src/gameUtils.c index dbc22f8b..4f615950 100644 --- a/src/gameUtils.c +++ b/src/gameUtils.c @@ -222,8 +222,8 @@ void ModRupees(s32 delta) { if (newRupeeCount < 0) { newRupeeCount = 0; } else { - if (newRupeeCount > (u16)gWalletSizes[s->walletType * 2]) { - newRupeeCount = (u16)gWalletSizes[s->walletType * 2]; + if (newRupeeCount > gWalletSizes[s->walletType].size) { + newRupeeCount = gWalletSizes[s->walletType].size; } } s->rupees = newRupeeCount; diff --git a/src/itemUtils.c b/src/itemUtils.c index 36ed6bbf..97201c9c 100644 --- a/src/itemUtils.c +++ b/src/itemUtils.c @@ -12,7 +12,12 @@ #include "enemy.h" #include "message.h" -const s16 gWalletSizes[] = { 100, -4000, 300, -3996, 500, -3992, 999, -3988 }; +const Wallet gWalletSizes[] = { + { 100, 0xf060 }, + { 300, 0xf064 }, + { 500, 0xf068 }, + { 999, 0xf06c }, +}; const u8 gBombBagSizes[] = { 10, 30, diff --git a/src/ui.c b/src/ui.c index f412560d..a7834601 100644 --- a/src/ui.c +++ b/src/ui.c @@ -251,7 +251,6 @@ void DrawRupees(void) { u32 temp2; substruct_160* ptr; substruct_160* ptr2; - const u16* ptr3; struct_02035160* ptr4; if ((gUnk_0200AF00.unk_1 & 0x40) != 0) { @@ -277,8 +276,7 @@ void DrawRupees(void) { gUnk_0200AF00.unk_a = 2; ptr4 = &gUnk_02035160; ptr2 = &ptr4->unk_40; - ptr3 = gWalletSizes; - ptr4->unk_0.unk_0 = temp2 = *(ptr3 + (u32)gSave.stats.walletType * 2 + 1); + ptr4->unk_0.unk_0 = temp2 = gWalletSizes[gSave.stats.walletType].iconStartTile; ptr4->unk_0.unk_2 = temp2 + 1; ptr2->unk_0 = temp2 + 2; ptr2->unk_2 = temp2 + 3; @@ -312,7 +310,7 @@ void DrawRupees(void) { } case 1: DrawDigits(0x70, gUnk_0200AF00.rupees, - (u16)gWalletSizes[(u32)gSave.stats.walletType * 2] <= gUnk_0200AF00.rupees, 3); + gWalletSizes[(u32)gSave.stats.walletType].size <= gUnk_0200AF00.rupees, 3); cVar1 = gUnk_0200AF00.unk_c + 1; default: gUnk_0200AF00.unk_c = cVar1;