Added option for weapon deployment delay

This commit is contained in:
blondie7575 2021-07-24 14:41:48 -07:00
parent 1deb78eb84
commit 7d3ae38f8f
5 changed files with 36 additions and 3 deletions

View File

@ -70,6 +70,7 @@ JD_OWNER = 146
JD_FACING = 148
JD_SCRATCH = 150
JD_AGE = 152
JD_DEPLOYDELAY = 154
MAXPROJECTILES = 3

14
fan.s
View File

@ -8,7 +8,7 @@
FANRANGE = 100 ; In pixels
FANMAGNITUDE = $20 ; 12.4 fixed point speed delta, in pixels
FAN_AGE = 4
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; deployFan
;
@ -27,6 +27,9 @@ deployFan:
sta projectileData+JD_VX,y
sta projectileData+JD_VY,y
lda #1
sta projectileData+JD_DEPLOYDELAY,y ; Let player admire new fan
RESTORE_AY
rts
@ -81,7 +84,7 @@ updateFan:
sec
sbc #GAMEOBJECTHEIGHT
sta gameObjectPool+GO_POSY,x
updateFanDone:
RESTORE_AXY
rts
@ -148,6 +151,13 @@ renderFan:
lda #14
jsr renderGameObject
; Do deployment delay after first render
lda projectileData+JD_DEPLOYDELAY,y
beq renderFanDone
jsr delayLong
lda #0
sta projectileData+JD_DEPLOYDELAY,y
renderFanDone:
RESTORE_AXY
rts

Binary file not shown.

View File

@ -26,8 +26,9 @@ projectileData:
.word 0 ; Facing (0,1) = (+X,-X)
.word 0 ; Scratch space for subclasses
.word 0 ; Age (in turns)
.word 0 ; Deployment delay needed?
.repeat 102
.repeat 100
.byte 0 ; Padding to 256-byte boundary
.endrepeat

View File

@ -180,3 +180,24 @@ delayShortInner:
RESTORE_AXY
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; delayLong
; Sleeps for long time (about 1.5 sec, but not calculated as such)
;
delayLong:
SAVE_AXY
ldy #$03 ; Loop a bit
delayLongOuter:
ldx #$ff
delayLongInner:
jsr delayShort
dex
bne delayLongInner
dey
bne delayLongOuter
RESTORE_AXY
rts