mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
decompile money
This commit is contained in:
parent
3c8091393c
commit
e41b9cbbb3
@ -6237,7 +6237,7 @@ bag_menu_AddMoney_window: @ 81AE268
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x1
|
||||
movs r2, 0xE
|
||||
bl set_window_border_style_and_print_money_box
|
||||
bl PrintMoneyAmountInMoneyBoxWithBorder
|
||||
movs r0, 0x13
|
||||
movs r1, 0xB
|
||||
bl AddMoneyLabelObject
|
||||
|
311
asm/money.s
311
asm/money.s
@ -1,311 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
thumb_func_start sub_80E51B0
|
||||
sub_80E51B0: @ 80E51B0
|
||||
push {lr}
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
movs r1, 0x92
|
||||
lsls r1, 3
|
||||
adds r0, r1
|
||||
ldr r1, =gSpecialVar_0x8005
|
||||
ldrh r1, [r1]
|
||||
bl IsEnoughMoney
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_80E51B0
|
||||
|
||||
thumb_func_start sub_80E51D4
|
||||
sub_80E51D4: @ 80E51D4
|
||||
push {lr}
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
movs r1, 0x92
|
||||
lsls r1, 3
|
||||
adds r0, r1
|
||||
ldr r1, =gSpecialVar_0x8005
|
||||
ldrh r1, [r1]
|
||||
bl SubtractMoney
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80E51D4
|
||||
|
||||
thumb_func_start PrintMoneyAmountInMoneyBox
|
||||
@ void PrintMoneyAmountInMoneyBox(u8 windowId, int amount, s8 a3)
|
||||
PrintMoneyAmountInMoneyBox: @ 80E51F4
|
||||
push {lr}
|
||||
sub sp, 0x4
|
||||
adds r3, r1, 0
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
str r2, [sp]
|
||||
movs r1, 0x26
|
||||
movs r2, 0x1
|
||||
bl PrintMoneyAmount
|
||||
add sp, 0x4
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end PrintMoneyAmountInMoneyBox
|
||||
|
||||
thumb_func_start PrintMoneyAmount
|
||||
@ void PrintMoneyAmount(u8 windowId, char x, char y, int amount, u8 a5)
|
||||
PrintMoneyAmount: @ 80E5214
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0xC
|
||||
ldr r4, [sp, 0x24]
|
||||
lsls r0, 24
|
||||
lsrs r7, r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
mov r8, r1
|
||||
lsls r2, 24
|
||||
lsrs r6, r2, 24
|
||||
lsls r4, 24
|
||||
lsrs r5, r4, 24
|
||||
ldr r4, =gStringVar1
|
||||
adds r0, r4, 0
|
||||
adds r1, r3, 0
|
||||
movs r2, 0
|
||||
movs r3, 0x6
|
||||
bl ConvertIntToDecimalStringN
|
||||
adds r0, r4, 0
|
||||
bl StringLength
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
movs r1, 0x6
|
||||
subs r1, r0
|
||||
ldr r2, =gStringVar4
|
||||
adds r0, r1, 0
|
||||
subs r1, 0x1
|
||||
cmp r0, 0
|
||||
ble _080E5264
|
||||
movs r3, 0x77
|
||||
_080E5258:
|
||||
strb r3, [r2]
|
||||
adds r2, 0x1
|
||||
adds r0, r1, 0
|
||||
subs r1, 0x1
|
||||
cmp r0, 0
|
||||
bgt _080E5258
|
||||
_080E5264:
|
||||
ldr r1, =gText_PokedollarVar1
|
||||
adds r0, r2, 0
|
||||
bl StringExpandPlaceholders
|
||||
ldr r2, =gStringVar4
|
||||
str r6, [sp]
|
||||
str r5, [sp, 0x4]
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x8]
|
||||
adds r0, r7, 0
|
||||
movs r1, 0x1
|
||||
mov r3, r8
|
||||
bl PrintTextOnWindow
|
||||
add sp, 0xC
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end PrintMoneyAmount
|
||||
|
||||
thumb_func_start set_window_border_style_and_print_money_box
|
||||
@ void set_window_border_style_and_print_money_box(u8 windowId, u16 tileStart, u8 palette, int amount)
|
||||
set_window_border_style_and_print_money_box: @ 80E5298
|
||||
push {r4-r6,lr}
|
||||
mov r6, r8
|
||||
push {r6}
|
||||
adds r6, r0, 0
|
||||
adds r4, r1, 0
|
||||
adds r5, r2, 0
|
||||
mov r8, r3
|
||||
lsls r6, 24
|
||||
lsrs r6, 24
|
||||
lsls r4, 16
|
||||
lsrs r4, 16
|
||||
lsls r5, 24
|
||||
lsrs r5, 24
|
||||
adds r0, r6, 0
|
||||
movs r1, 0
|
||||
adds r2, r4, 0
|
||||
adds r3, r5, 0
|
||||
bl SetWindowBorderStyle
|
||||
adds r0, r6, 0
|
||||
mov r1, r8
|
||||
movs r2, 0
|
||||
bl PrintMoneyAmountInMoneyBox
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end set_window_border_style_and_print_money_box
|
||||
|
||||
thumb_func_start sub_80E52D4
|
||||
sub_80E52D4: @ 80E52D4
|
||||
push {lr}
|
||||
adds r1, r0, 0
|
||||
ldr r0, =gUnknown_02039F98
|
||||
ldrb r0, [r0]
|
||||
movs r2, 0
|
||||
bl PrintMoneyAmountInMoneyBox
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80E52D4
|
||||
|
||||
thumb_func_start sub_80E52EC
|
||||
@ void sub_80E52EC(int money, int x, int y)
|
||||
sub_80E52EC: @ 80E52EC
|
||||
push {r4-r6,lr}
|
||||
mov r6, r8
|
||||
push {r6}
|
||||
sub sp, 0x18
|
||||
mov r8, r0
|
||||
adds r4, r1, 0
|
||||
adds r3, r2, 0
|
||||
lsls r4, 24
|
||||
lsls r3, 24
|
||||
lsrs r6, r4, 24
|
||||
movs r0, 0x80
|
||||
lsls r0, 17
|
||||
adds r4, r0
|
||||
lsrs r4, 24
|
||||
lsrs r5, r3, 24
|
||||
adds r3, r0
|
||||
lsrs r3, 24
|
||||
movs r0, 0xA
|
||||
str r0, [sp]
|
||||
movs r0, 0x2
|
||||
str r0, [sp, 0x4]
|
||||
movs r0, 0xF
|
||||
str r0, [sp, 0x8]
|
||||
movs r0, 0x8
|
||||
str r0, [sp, 0xC]
|
||||
add r0, sp, 0x10
|
||||
movs r1, 0
|
||||
adds r2, r4, 0
|
||||
bl SetWindowTemplateFields
|
||||
ldr r4, =gUnknown_02039F98
|
||||
add r0, sp, 0x10
|
||||
bl AddWindow
|
||||
strb r0, [r4]
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0
|
||||
bl FillWindowPixelBuffer
|
||||
ldrb r0, [r4]
|
||||
bl PutWindowTilemap
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x1
|
||||
bl CopyWindowToVram
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x85
|
||||
lsls r1, 2
|
||||
movs r2, 0xE
|
||||
mov r3, r8
|
||||
bl set_window_border_style_and_print_money_box
|
||||
lsls r6, 19
|
||||
movs r0, 0x98
|
||||
lsls r0, 13
|
||||
adds r6, r0
|
||||
lsrs r6, 16
|
||||
lsls r5, 19
|
||||
movs r0, 0xB0
|
||||
lsls r0, 12
|
||||
adds r5, r0
|
||||
lsrs r5, 16
|
||||
adds r0, r6, 0
|
||||
adds r1, r5, 0
|
||||
bl AddMoneyLabelObject
|
||||
add sp, 0x18
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80E52EC
|
||||
|
||||
thumb_func_start sub_80E5384
|
||||
sub_80E5384: @ 80E5384
|
||||
push {r4,lr}
|
||||
bl RemoveMoneyLabelObject
|
||||
ldr r4, =gUnknown_02039F98
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0
|
||||
bl sub_8198070
|
||||
ldrb r0, [r4]
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
ldrb r0, [r4]
|
||||
bl RemoveWindow
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_80E5384
|
||||
|
||||
thumb_func_start AddMoneyLabelObject
|
||||
AddMoneyLabelObject: @ 80E53AC
|
||||
push {r4,r5,lr}
|
||||
adds r4, r0, 0
|
||||
adds r5, r1, 0
|
||||
lsls r4, 16
|
||||
lsrs r4, 16
|
||||
lsls r5, 16
|
||||
lsrs r5, 16
|
||||
ldr r0, =gUnknown_0858C2A4
|
||||
bl LoadCompressedObjectPic
|
||||
ldr r0, =gUnknown_0858C2AC
|
||||
bl LoadCompressedObjectPalette
|
||||
ldr r0, =gUnknown_0858C28C
|
||||
lsls r4, 16
|
||||
asrs r4, 16
|
||||
lsls r5, 16
|
||||
asrs r5, 16
|
||||
adds r1, r4, 0
|
||||
adds r2, r5, 0
|
||||
movs r3, 0
|
||||
bl CreateSprite
|
||||
ldr r1, =gUnknown_02039F99
|
||||
strb r0, [r1]
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end AddMoneyLabelObject
|
||||
|
||||
thumb_func_start RemoveMoneyLabelObject
|
||||
RemoveMoneyLabelObject: @ 80E53F4
|
||||
push {lr}
|
||||
ldr r0, =gUnknown_02039F99
|
||||
ldrb r1, [r0]
|
||||
lsls r0, r1, 4
|
||||
adds r0, r1
|
||||
lsls r0, 2
|
||||
ldr r1, =gSprites
|
||||
adds r0, r1
|
||||
bl DestroySpriteAndFreeResources
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end RemoveMoneyLabelObject
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
@ -4468,7 +4468,7 @@ s93_display_money: @ 809B500
|
||||
bl GetMoney
|
||||
adds r1, r5, 0
|
||||
adds r2, r4, 0
|
||||
bl sub_80E52EC
|
||||
bl DrawMoneyBox
|
||||
_0809B530:
|
||||
movs r0, 0
|
||||
pop {r4,r5}
|
||||
@ -4480,7 +4480,7 @@ _0809B530:
|
||||
thumb_func_start s94_hide_money
|
||||
s94_hide_money: @ 809B53C
|
||||
push {lr}
|
||||
bl sub_80E5384
|
||||
bl HideMoneyBox
|
||||
movs r0, 0
|
||||
pop {r1}
|
||||
bx r1
|
||||
@ -4505,7 +4505,7 @@ s95_update_money: @ 809B548
|
||||
lsls r1, 3
|
||||
adds r0, r1
|
||||
bl GetMoney
|
||||
bl sub_80E52D4
|
||||
bl ChangeAmountInMoneyBox
|
||||
_0809B56E:
|
||||
movs r0, 0
|
||||
pop {r1}
|
||||
|
@ -1125,7 +1125,7 @@ BuyMenuInitBgs: @ 80E036C
|
||||
BuyMenuDecompressBgGraphics: @ 80E0424
|
||||
push {lr}
|
||||
sub sp, 0x4
|
||||
ldr r1, =gUnknown_08D9AFBC
|
||||
ldr r1, =gBuyMenuFrame_Gfx
|
||||
movs r2, 0xE8
|
||||
lsls r2, 2
|
||||
ldr r3, =0x000003e3
|
||||
@ -1133,11 +1133,11 @@ BuyMenuDecompressBgGraphics: @ 80E0424
|
||||
str r0, [sp]
|
||||
movs r0, 0x1
|
||||
bl decompress_and_copy_tile_data_to_vram
|
||||
ldr r0, =gUnknown_08D9B0F0
|
||||
ldr r0, =gBuyMenuFrame_Tilemap
|
||||
ldr r1, =gUnknown_02039F70
|
||||
ldr r1, [r1]
|
||||
bl LZDecompressWram
|
||||
ldr r0, =gUnknown_08D9B0C8
|
||||
ldr r0, =gMenuMoneyPal
|
||||
movs r1, 0xC0
|
||||
movs r2, 0x20
|
||||
bl LoadCompressedPalette
|
||||
@ -1259,7 +1259,7 @@ BuyMenuDrawGraphics: @ 80E0524
|
||||
movs r0, 0
|
||||
movs r1, 0x1
|
||||
movs r2, 0xD
|
||||
bl set_window_border_style_and_print_money_box
|
||||
bl PrintMoneyAmountInMoneyBoxWithBorder
|
||||
movs r0, 0
|
||||
bl schedule_bg_copy_tilemap_to_vram
|
||||
movs r0, 0x1
|
||||
|
@ -512,14 +512,17 @@ gUnknown_08D9AE04:: @ 8D9AE04
|
||||
gUnknown_08D9AF44:: @ 8D9AF44
|
||||
.incbin "baserom.gba", 0xd9af44, 0x78
|
||||
|
||||
gUnknown_08D9AFBC:: @ 8D9AFBC
|
||||
gBuyMenuFrame_Gfx:: @ 8D9AFBC
|
||||
.incbin "baserom.gba", 0xd9afbc, 0x10c
|
||||
|
||||
gUnknown_08D9B0C8:: @ 8D9B0C8
|
||||
gMenuMoneyPal:: @ 8D9B0C8
|
||||
.incbin "baserom.gba", 0xd9b0c8, 0x28
|
||||
|
||||
gUnknown_08D9B0F0:: @ 8D9B0F0
|
||||
.incbin "baserom.gba", 0xd9b0f0, 0x1c4
|
||||
gBuyMenuFrame_Tilemap:: @ 8D9B0F0
|
||||
.incbin "baserom.gba", 0xd9b0f0, 0x140
|
||||
|
||||
gMenuMoneyGfx:: @ 8D9B230
|
||||
.incbin "baserom.gba", 0xd9b230, 0x84
|
||||
|
||||
gUnknown_08D9B2B4:: @ 8D9B2B4
|
||||
.incbin "baserom.gba", 0xd9b2b4, 0x1bc
|
||||
|
13
data/money.s
13
data/money.s
@ -1,13 +0,0 @@
|
||||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.section .rodata
|
||||
|
||||
gUnknown_0858C28C:: @ 858C28C
|
||||
.incbin "baserom.gba", 0x58c28c, 0x18
|
||||
|
||||
gUnknown_0858C2A4:: @ 858C2A4
|
||||
.incbin "baserom.gba", 0x58c2a4, 0x8
|
||||
|
||||
gUnknown_0858C2AC:: @ 858C2AC
|
||||
.incbin "baserom.gba", 0x58c2ac, 0x8
|
@ -148,4 +148,4 @@ gUnknown_0858C1C8:: @ 858C1C8
|
||||
.incbin "baserom.gba", 0x58c1c8, 0x68
|
||||
|
||||
gUnknown_0858C230:: @ 858C230
|
||||
.incbin "baserom.gba", 0x58c230, 0x5c
|
||||
.incbin "baserom.gba", 0x58c230, 0x48
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef GUARD_MENU_H
|
||||
#define GUARD_MENU_H
|
||||
|
||||
#include "text.h"
|
||||
#include "window.h"
|
||||
|
||||
struct MenuAction
|
||||
{
|
||||
@ -16,5 +16,8 @@ struct MenuAction2
|
||||
};
|
||||
|
||||
void box_print(u8, u8, u8, u8, const void *, s8, const u8 *);
|
||||
void sub_8198070(u8 windowId, bool8 copyToVram);
|
||||
void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock);
|
||||
void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palette);
|
||||
|
||||
#endif // GUARD_MENU_H
|
||||
|
@ -6,5 +6,15 @@ void SetMoney(u32* moneyPtr, u32 newValue);
|
||||
bool8 IsEnoughMoney(u32* moneyPtr, u32 cost);
|
||||
void AddMoney(u32* moneyPtr, u32 toAdd);
|
||||
void SubtractMoney(u32* moneyPtr, u32 toSub);
|
||||
bool8 IsEnoughForCostInVar0x8005(void);
|
||||
void SubtractMoneyFromVar0x8005(void);
|
||||
void PrintMoneyAmountInMoneyBox(u8 windowId, int amount, u8 speed);
|
||||
void PrintMoneyAmount(u8 windowId, u8 x, u8 y, int amount, u8 speed);
|
||||
void PrintMoneyAmountInMoneyBoxWithBorder(u8 windowId, u16 tileStart, u8 pallete, int amount);
|
||||
void ChangeAmountInMoneyBox(int amount);
|
||||
void DrawMoneyBox(int amount, u8 x, u8 y);
|
||||
void HideMoneyBox(void);
|
||||
void AddMoneyLabelObject(u16 x, u16 y);
|
||||
void RemoveMoneyLabelObject(void);
|
||||
|
||||
#endif // GUARD_MONEY_H
|
||||
|
@ -148,7 +148,6 @@ SECTIONS {
|
||||
asm/script_menu.o(.text);
|
||||
asm/naming_screen.o(.text);
|
||||
src/money.o(.text);
|
||||
asm/money.o(.text);
|
||||
asm/contest_effect.o(.text);
|
||||
asm/record_mixing.o(.text);
|
||||
asm/secret_base.o(.text);
|
||||
@ -386,7 +385,7 @@ SECTIONS {
|
||||
src/berry.o(.rodata);
|
||||
data/script_menu.o(.rodata);
|
||||
data/naming_screen.o(.rodata);
|
||||
data/money.o(.rodata);
|
||||
src/money.o(.rodata);
|
||||
data/contest_effect.o(.rodata);
|
||||
data/record_mixing.o(.rodata);
|
||||
data/secret_base.o(.rodata);
|
||||
|
@ -4,14 +4,13 @@
|
||||
#include "window.h"
|
||||
#include "text_window.h"
|
||||
#include "string_util.h"
|
||||
#include "menu.h"
|
||||
|
||||
#define MAX_COINS 9999
|
||||
|
||||
EWRAM_DATA u8 sCoinsWindowId = 0;
|
||||
|
||||
extern s32 GetStringRightAlignXOffset(u8 fontId, u8 *str, s32 totalWidth);
|
||||
extern void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock);
|
||||
extern void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, s16 tileStart, s8 palette);
|
||||
extern void sub_819746C(u8 windowId, bool8 copyToVram);
|
||||
|
||||
extern const u8 gText_Coins[];
|
||||
|
145
src/money.c
145
src/money.c
@ -1,8 +1,77 @@
|
||||
#include "global.h"
|
||||
#include "money.h"
|
||||
#include "event_data.h"
|
||||
#include "string_util.h"
|
||||
#include "text.h"
|
||||
#include "menu.h"
|
||||
#include "window.h"
|
||||
#include "sprite.h"
|
||||
#include "decompress.h"
|
||||
|
||||
extern const u8 gText_PokedollarVar1[];
|
||||
|
||||
extern const u8 gMenuMoneyGfx[];
|
||||
extern const u8 gMenuMoneyPal[];
|
||||
|
||||
#define MAX_MONEY 999999
|
||||
|
||||
EWRAM_DATA static u8 sMoneyBoxWindowId = 0;
|
||||
EWRAM_DATA static u8 sMoneyLabelSpriteId = 0;
|
||||
|
||||
#define MONEY_LABEL_TAG 0x2722
|
||||
|
||||
static const struct OamData sOamData_MoneyLabel =
|
||||
{
|
||||
.y = 0,
|
||||
.affineMode = 0,
|
||||
.objMode = 0,
|
||||
.mosaic = 0,
|
||||
.bpp = 0,
|
||||
.shape = 1,
|
||||
.x = 0,
|
||||
.matrixNum = 0,
|
||||
.size = 2,
|
||||
.tileNum = 0,
|
||||
.priority = 0,
|
||||
.paletteNum = 0,
|
||||
.affineParam = 0,
|
||||
};
|
||||
|
||||
static const union AnimCmd sSpriteAnim_MoneyLabel[] =
|
||||
{
|
||||
ANIMCMD_FRAME(0, 0),
|
||||
ANIMCMD_END
|
||||
};
|
||||
|
||||
static const union AnimCmd *const sSpriteAnimTable_MoneyLabel[] =
|
||||
{
|
||||
sSpriteAnim_MoneyLabel,
|
||||
};
|
||||
|
||||
static const struct SpriteTemplate sSpriteTemplate_MoneyLabel =
|
||||
{
|
||||
.tileTag = MONEY_LABEL_TAG,
|
||||
.paletteTag = MONEY_LABEL_TAG,
|
||||
.oam = &sOamData_MoneyLabel,
|
||||
.anims = sSpriteAnimTable_MoneyLabel,
|
||||
.images = NULL,
|
||||
.affineAnims = gDummySpriteAffineAnimTable,
|
||||
.callback = SpriteCallbackDummy
|
||||
};
|
||||
|
||||
static const struct CompressedSpriteSheet sSpriteSheet_MoneyLabel =
|
||||
{
|
||||
.data = gMenuMoneyGfx,
|
||||
.size = 256,
|
||||
.tag = MONEY_LABEL_TAG,
|
||||
};
|
||||
|
||||
static const struct CompressedSpritePalette sSpritePalette_MoneyLabel =
|
||||
{
|
||||
.data = gMenuMoneyPal,
|
||||
.tag = MONEY_LABEL_TAG
|
||||
};
|
||||
|
||||
u32 GetMoney(u32* moneyPtr)
|
||||
{
|
||||
return *moneyPtr ^ gSaveBlock2Ptr->encryptionKey;
|
||||
@ -53,3 +122,79 @@ void SubtractMoney(u32* moneyPtr, u32 toSub)
|
||||
|
||||
SetMoney(moneyPtr, toSet);
|
||||
}
|
||||
|
||||
bool8 IsEnoughForCostInVar0x8005(void)
|
||||
{
|
||||
return IsEnoughMoney(&gSaveBlock1Ptr->money, gSpecialVar_0x8005);
|
||||
}
|
||||
|
||||
void SubtractMoneyFromVar0x8005(void)
|
||||
{
|
||||
SubtractMoney(&gSaveBlock1Ptr->money, gSpecialVar_0x8005);
|
||||
}
|
||||
|
||||
void PrintMoneyAmountInMoneyBox(u8 windowId, int amount, u8 speed)
|
||||
{
|
||||
PrintMoneyAmount(windowId, 0x26, 1, amount, speed);
|
||||
}
|
||||
|
||||
void PrintMoneyAmount(u8 windowId, u8 x, u8 y, int amount, u8 speed)
|
||||
{
|
||||
u8 *txtPtr;
|
||||
s32 strLength;
|
||||
|
||||
ConvertIntToDecimalStringN(gStringVar1, amount, STR_CONV_MODE_LEFT_ALIGN, 6);
|
||||
|
||||
strLength = 6 - StringLength(gStringVar1);
|
||||
txtPtr = gStringVar4;
|
||||
|
||||
while (strLength-- > 0)
|
||||
*(txtPtr++) = 0x77;
|
||||
|
||||
StringExpandPlaceholders(txtPtr, gText_PokedollarVar1);
|
||||
PrintTextOnWindow(windowId, 1, gStringVar4, x, y, speed, NULL);
|
||||
}
|
||||
|
||||
void PrintMoneyAmountInMoneyBoxWithBorder(u8 windowId, u16 tileStart, u8 pallete, int amount)
|
||||
{
|
||||
SetWindowBorderStyle(windowId, FALSE, tileStart, pallete);
|
||||
PrintMoneyAmountInMoneyBox(windowId, amount, 0);
|
||||
}
|
||||
|
||||
void ChangeAmountInMoneyBox(int amount)
|
||||
{
|
||||
PrintMoneyAmountInMoneyBox(sMoneyBoxWindowId, amount, 0);
|
||||
}
|
||||
|
||||
void DrawMoneyBox(int amount, u8 x, u8 y)
|
||||
{
|
||||
struct WindowTemplate template;
|
||||
|
||||
SetWindowTemplateFields(&template, 0, x + 1, y + 1, 10, 2, 15, 8);
|
||||
sMoneyBoxWindowId = AddWindow(&template);
|
||||
FillWindowPixelBuffer(sMoneyBoxWindowId, 0);
|
||||
PutWindowTilemap(sMoneyBoxWindowId);
|
||||
CopyWindowToVram(sMoneyBoxWindowId, 1);
|
||||
PrintMoneyAmountInMoneyBoxWithBorder(sMoneyBoxWindowId, 0x214, 14, amount);
|
||||
AddMoneyLabelObject((8 * x) + 19, (8 * y) + 11);
|
||||
}
|
||||
|
||||
void HideMoneyBox(void)
|
||||
{
|
||||
RemoveMoneyLabelObject();
|
||||
sub_8198070(sMoneyBoxWindowId, FALSE);
|
||||
CopyWindowToVram(sMoneyBoxWindowId, 2);
|
||||
RemoveWindow(sMoneyBoxWindowId);
|
||||
}
|
||||
|
||||
void AddMoneyLabelObject(u16 x, u16 y)
|
||||
{
|
||||
LoadCompressedObjectPic(&sSpriteSheet_MoneyLabel);
|
||||
LoadCompressedObjectPalette(&sSpritePalette_MoneyLabel);
|
||||
sMoneyLabelSpriteId = CreateSprite(&sSpriteTemplate_MoneyLabel, x, y, 0);
|
||||
}
|
||||
|
||||
void RemoveMoneyLabelObject(void)
|
||||
{
|
||||
DestroySpriteAndFreeResources(&gSprites[sMoneyLabelSpriteId]);
|
||||
}
|
||||
|
@ -1148,12 +1148,9 @@ gUnknown_02039F90: @ 2039F90
|
||||
gUnknown_02039F94: @ 2039F94
|
||||
.space 0x4
|
||||
|
||||
gUnknown_02039F98: @ 2039F98
|
||||
.space 0x1
|
||||
|
||||
gUnknown_02039F99: @ 2039F99
|
||||
.space 0x3
|
||||
.include "src/money.o"
|
||||
|
||||
.align 2
|
||||
gUnknown_02039F9C: @ 2039F9C
|
||||
.space 0x78
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user