give/take coins action of blue/red space (#22)

This commit is contained in:
xCrystal
2023-12-24 18:42:07 +01:00
parent 4859b524b3
commit 28bd777632
9 changed files with 98 additions and 23 deletions

View File

@@ -1,12 +1,12 @@
GiveCoins::
ld a, 3
call AddCoins
ld bc, MaxCoins
call LoadMaxCoins_bc
ld a, 3
call CompareCoins
jr z, .not_maxed_out
jr c, .not_maxed_out
ld hl, MaxCoins
call LoadMaxCoins_hl
ld a, [hli]
ld [de], a
inc de
@@ -22,9 +22,26 @@ GiveCoins::
and a
ret
LoadMaxCoins_bc:
ld a, d
cp HIGH(wCurLevelCoins)
ld bc, MaxCurLevelCoins ; CUR_LEVEL_COINS
ret z
ld bc, MaxCoins ; YOUR_COINS or MOMS_COINS
ret
LoadMaxCoins_hl:
call LoadMaxCoins_bc
ld h, b
ld l, c
ret
MaxCoins:
dt MAX_COINS
MaxCurLevelCoins:
dt MAX_LEVEL_COINS
TakeCoins::
ld a, 3
call SubtractCoins