summaryrefslogtreecommitdiff
path: root/engine/subtract_paid_money.asm
blob: 45df93a767c396a5a66b8abc6598578cda03f443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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