Chooser, Spoiler and Cyborg better calculate the distance from the explosion.

This commit is contained in:
Pecusx
2023-08-23 08:54:08 +02:00
parent 8fc08f2746
commit cf3314e0e5
3 changed files with 21 additions and 13 deletions
+21 -13
View File
@@ -34,13 +34,12 @@
; by dividing positions by 4
ldy #MaxPlayers-1
loop
lda xtankstableL,y
sta temp
lda xtankstableH,y
sta temp+1
;= /4
:2 lsrw temp
lda temp
lda xtankstableH,y
lsr
lda xtankstableL,y
ror ;just one bit over 256. Max screenwidth = 512!!!
lsr
sta LowResDistances,y
dey
bpl loop
@@ -1084,18 +1083,27 @@ loop
.endp
;----------------------------------------------
.proc GetDistance
; calculates lores ( /4 ) distance from tank X to TargetTankNr(Y)
; calculates lores ( /4 ) distance from tank X to last plot
; (explosion position after Flight proc)
; This procedure must be called immediately after targeting.
; xdraw value should remain unchanged from the end of the Flight procedure.
;
; result in A
;----------------------------------------------
ldy TargetTankNr
;xdraw/4
lda xdraw+1
lsr
lda xdraw
ror ;just one bit over 256. Max screenwidth = 512!!!
lsr
;
sec
lda LowResDistances,x
sbc LowResDistances,y
bcs YisLower
XisLower
sbc LowResDistances,x
bcs XisLower
YisLower
eor #$ff
adc #1
YisLower
XisLower
rts
.endp