aboutsummaryrefslogtreecommitdiffstats
path: root/engine/subtract_paid_money.asm
diff options
context:
space:
mode:
authorluckytyphlosion <alan.rj.huang@gmail.com>2016-03-17 17:37:20 -0400
committerluckytyphlosion <alan.rj.huang@gmail.com>2016-03-17 18:00:54 -0400
commitbd5a5f70d44a0fef041027be12d439588f863507 (patch)
tree2d0394e028908d087dc2aef3bd4202f55a486e64 /engine/subtract_paid_money.asm
parentRemove misleading (unreferenced) labels. (diff)
downloadpokeyellow-bd5a5f70d44a0fef041027be12d439588f863507.tar.gz
pokeyellow-bd5a5f70d44a0fef041027be12d439588f863507.tar.xz
pokeyellow-bd5a5f70d44a0fef041027be12d439588f863507.zip
Split bank1 up.
Diffstat (limited to 'engine/subtract_paid_money.asm')
-rw-r--r--engine/subtract_paid_money.asm17
1 files changed, 17 insertions, 0 deletions
diff --git a/engine/subtract_paid_money.asm b/engine/subtract_paid_money.asm
new file mode 100644
index 00000000..45df93a7
--- /dev/null
+++ b/engine/subtract_paid_money.asm
@@ -0,0 +1,17 @@
+; subtracts the amount the player paid from their money
+; sets carry flag if there is enough money and unsets carry flag if not
+SubtractAmountPaidFromMoney_: ; 68a6 (1:68a6)
+ ld de, wPlayerMoney
+ ld hl, hMoney ; total price of items
+ ld c, 3 ; length of money in bytes
+ call StringCmp
+ ret c
+ ld de, wPlayerMoney + 2
+ ld hl, hMoney + 2 ; total price of items
+ ld c, 3 ; length of money in bytes
+ predef SubBCDPredef ; subtract total price from money
+ ld a, MONEY_BOX
+ ld [wTextBoxID], a
+ call DisplayTextBoxID ; redraw money text box
+ and a
+ ret \ No newline at end of file