Ammo consumption

This commit is contained in:
blondie7575 2018-06-11 17:22:34 -06:00
parent c29ddd74c1
commit a5e4c3e143
3 changed files with 25 additions and 5 deletions

Binary file not shown.

View File

@ -160,9 +160,26 @@ playerDeltaPowerClampHigh:
; Y = Player index ; Y = Player index
; ;
playerFire: playerFire:
pha SAVE_AX
PLAYERPTR_Y PLAYERPTR_Y
; Check for inventory
lda playerData+PD_CURRWEAPON,y
pha
asl
tax
beq playerFire_infiniteAmmo
lda playerData+PD_INVENTORY,x
beq playerFire_abort
dec ; Consume ammo
sta playerData+PD_INVENTORY,x
dec inventoryDirty
playerFire_infiniteAmmo:
; Prepare projectile parameters
pla
sta projectileParams+8
lda playerData+GO_POSX,y lda playerData+GO_POSX,y
sta projectileParams sta projectileParams
lda playerData+GO_POSY,y lda playerData+GO_POSY,y
@ -173,13 +190,16 @@ playerFire:
sta projectileParams+4 sta projectileParams+4
lda playerData+PD_POWER,y lda playerData+PD_POWER,y
sta projectileParams+6 sta projectileParams+6
lda playerData+PD_CURRWEAPON,y
sta projectileParams+8
jsr fireProjectile jsr fireProjectile
pla playerFire_done:
RESTORE_AX
rts rts
playerFire_abort:
pla ; Balance stack
bra playerFire_done
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; playerIntersectRect ; playerIntersectRect

View File

@ -39,7 +39,7 @@ GRAVITY = $ffff ; 8.8 fixed point
projectileTypes: projectileTypes:
; Spit ; Spit
.word 3 ; Damage .word 3 ; Damage
.word 1 ; Crater radius .word 9 ; Crater radius
.word 4 ; Frame 0 .word 4 ; Frame 0
.word 5 ; Frame 1 .word 5 ; Frame 1
.word 6 ; Frame 2 .word 6 ; Frame 2