diff options
author | PikalaxALT <pikalaxalt@gmail.com> | 2017-11-29 08:19:54 -0500 |
---|---|---|
committer | PikalaxALT <pikalaxalt@gmail.com> | 2017-11-29 08:19:54 -0500 |
commit | 10068b03456d701655662286ea8cf3cde50c4784 (patch) | |
tree | 310f9217fd6307bd3849ca81f30fbfe14aba639e /src | |
parent | 1ac177723de817a85533adc3e984425d3ab86e00 (diff) | |
parent | 54da96309186b98263b4434911e1c5b8d4b4e3ec (diff) |
Merge branch 'master' into field_poison
Diffstat (limited to 'src')
-rw-r--r-- | src/coins.c | 28 | ||||
-rw-r--r-- | src/unk_81BAD84.c | 47 |
2 files changed, 65 insertions, 10 deletions
diff --git a/src/coins.c b/src/coins.c index e1694b29c..50c31cac0 100644 --- a/src/coins.c +++ b/src/coins.c @@ -2,8 +2,9 @@ #include "coins.h" #include "text.h" #include "window.h" -#include "text_window.h" +#include "strings.h" #include "string_util.h" +#include "new_menu_helpers.h" #include "menu.h" #include "international_string_util.h" @@ -11,10 +12,6 @@ EWRAM_DATA u8 sCoinsWindowId = 0; -extern void sub_819746C(u8 windowId, bool8 copyToVram); - -extern const u8 gText_Coins[]; - void PrintCoinsString(u32 coinAmount) { u32 xAlign; @@ -53,7 +50,6 @@ void SetCoins(u16 coinAmount) gSaveBlock1Ptr->coins = coinAmount ^ gSaveBlock2Ptr->encryptionKey; } -/* Can't match it lol bool8 GiveCoins(u16 toAdd) { u16 newAmount; @@ -67,10 +63,22 @@ bool8 GiveCoins(u16 toAdd) } else { - newAmount = ownedCoins + toAdd; - if (newAmount > MAX_COINS) - newAmount = MAX_COINS; + ownedCoins += toAdd; + if (ownedCoins > MAX_COINS) + ownedCoins = MAX_COINS; + newAmount = ownedCoins; } SetCoins(newAmount); return TRUE; -}*/ +} + +bool8 TakeCoins(u16 toSub) +{ + u16 ownedCoins = GetCoins(); + if (ownedCoins >= toSub) + { + SetCoins(ownedCoins - toSub); + return TRUE; + } + return FALSE; +} diff --git a/src/unk_81BAD84.c b/src/unk_81BAD84.c new file mode 100644 index 000000000..9ba98dd87 --- /dev/null +++ b/src/unk_81BAD84.c @@ -0,0 +1,47 @@ +#include "global.h" +#include "graphics.h" + +const struct { + const u8 *gfx; + const u8 *tileMap; + const u16 *pltt; +} gUnknown_08617128[] = { + { + gUnknown_08DD87C0, + gUnknown_08DD8EE0, + gUnknown_08DD8780 + }, { + gUnknown_08DD90E0, + gUnknown_08DD9718, + gUnknown_08DD9080 + }, { + gUnknown_08DD98B4, + gUnknown_08DD9E58, + gUnknown_08DD9874 + }, { + gUnknown_08DDA02C, + gUnknown_08DDA63C, + gUnknown_08DD9FEC + }, { + gUnknown_08DDA840, + gUnknown_08DDAE40, + gUnknown_08DDA800 + }, { + gUnknown_08DDB020, + gUnknown_08DDB2C4, + gUnknown_08DDAFE0 + } +}; + +void sub_81BAD84(u32 idx) +{ + REG_DISPCNT = 0x0000; + REG_BG0HOFS = 0x0000; + REG_BG0VOFS = 0x0000; + REG_BLDCNT = 0x0000; + LZ77UnCompVram(gUnknown_08617128[idx].gfx, (void *)BG_CHAR_ADDR(0)); + LZ77UnCompVram(gUnknown_08617128[idx].tileMap, (void *)BG_SCREEN_ADDR(31)); + CpuCopy16(gUnknown_08617128[idx].pltt, (void *)PLTT, 0x200); + REG_BG0CNT = 0x1f00; + REG_DISPCNT = DISPCNT_BG0_ON; +} |