mirror of https://github.com/pret/pokeemerald.git
commit
de00b4aeec
74
asm/coins.s
74
asm/coins.s
|
@ -1,74 +0,0 @@
|
|||
.include "asm/macros.inc"
|
||||
.include "constants/constants.inc"
|
||||
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start GiveCoins
|
||||
@ bool8 GiveCoins(u16 toAdd)
|
||||
GiveCoins: @ 8145C80
|
||||
push {r4,lr}
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
bl GetCoins
|
||||
lsls r0, 16
|
||||
lsrs r1, r0, 16
|
||||
ldr r0, =0x0000270e
|
||||
cmp r1, r0
|
||||
bls _08145C9C
|
||||
movs r0, 0
|
||||
b _08145CC0
|
||||
.pool
|
||||
_08145C9C:
|
||||
adds r0, r1, r4
|
||||
cmp r1, r0
|
||||
ble _08145CAC
|
||||
ldr r0, =0x0000270f
|
||||
b _08145CBA
|
||||
.pool
|
||||
_08145CAC:
|
||||
lsls r0, 16
|
||||
lsrs r1, r0, 16
|
||||
ldr r0, =0x0000270f
|
||||
cmp r1, r0
|
||||
bls _08145CB8
|
||||
adds r1, r0, 0
|
||||
_08145CB8:
|
||||
adds r0, r1, 0
|
||||
_08145CBA:
|
||||
bl SetCoins
|
||||
movs r0, 0x1
|
||||
_08145CC0:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end GiveCoins
|
||||
|
||||
thumb_func_start TakeCoins
|
||||
@ bool8 TakeCoins(u16 toSub)
|
||||
TakeCoins: @ 8145CCC
|
||||
push {r4,lr}
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
bl GetCoins
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
cmp r0, r4
|
||||
bcs _08145CE2
|
||||
movs r0, 0
|
||||
b _08145CEE
|
||||
_08145CE2:
|
||||
subs r0, r4
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
bl SetCoins
|
||||
movs r0, 0x1
|
||||
_08145CEE:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end TakeCoins
|
||||
|
||||
.align 2, 0 @ Don't pad with nop.
|
|
@ -82,5 +82,6 @@ extern const u8 gText_NoRegistry[];
|
|||
extern const u8 gText_OkayToDeleteFromRegistry[];
|
||||
extern const u8 gText_RegisteredDataDeleted[];
|
||||
extern const u8 gUnknown_085EA79D[];
|
||||
extern const u8 gText_Coins[];
|
||||
|
||||
#endif //GUARD_STRINGS_H
|
||||
|
|
|
@ -184,7 +184,6 @@ SECTIONS {
|
|||
asm/roulette.o(.text);
|
||||
asm/pokedex_cry_screen.o(.text);
|
||||
src/coins.o(.text);
|
||||
asm/coins.o(.text);
|
||||
asm/landmark.o(.text);
|
||||
asm/fldeff_strength.o(.text);
|
||||
asm/battle_transition.o(.text);
|
||||
|
|
28
src/coins.c
28
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue