ExplosionRange variable is now really one byte long. :)

This commit is contained in:
Pecusx
2022-11-21 20:37:00 +01:00
parent 7d9e6d2045
commit ba780df597
4 changed files with 27 additions and 7 deletions
+2 -2
View File
@@ -26,7 +26,7 @@
;---------------------------------------------------
icl 'definitions.asm'
;---------------------------------------------------
FirstZpageVariable = $60
FirstZpageVariable = $61
.zpvar DliColorBack .byte = FirstZpageVariable
.zpvar JoystickNumber .byte
.zpvar xdraw .word ;= $64 ;variable X for plot
@@ -87,7 +87,7 @@ FirstZpageVariable = $60
.zpvar decimal .word
.zpvar NumberOfPlayers .byte ;current number of players (counted from 1)
.zpvar Counter .byte ;temporary Counter for outside loops
.zpvar ExplosionRadius .word ;because when adding in xdraw it is double byte
.zpvar ExplosionRadius .byte
.zpvar ResultY .byte
.zpvar xcircle .word
.zpvar ycircle .word
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+25 -5
View File
@@ -3008,14 +3008,34 @@ CalculateExplosionRange0
;calculates total horizontal range of explosion by
;"summing up" ranges of all separate explosions
adw xdraw ExplosionRadius WeaponRangeRight
cpw WeaponRangeRight #screenwidth-1
bcc NotOutOfTheScreenRight
; WeaponRangeRight = xdraw + ExplosionRadius
clc
lda xdraw
adc ExplosionRadius
sta WeaponRangeRight
lda xdraw+1
adc #$00
sta WeaponRangeRight+1
; adw xdraw ExplosionRadius WeaponRangeRight ; Pozor! ExplosionRadius is one byte now
; cpw WeaponRangeRight #screenwidth-1
cmp #>(screenwidth-1)
bne @+
lda WeaponRangeRight
cmp #<(screenwidth-1)
@ bcc NotOutOfTheScreenRight
mwa #screenwidth-1 WeaponRangeRight
NotOutOfTheScreenRight
sbw xdraw ExplosionRadius WeaponRangeLeft
lda WeaponRangeLeft+1
; WeaponRangeLeft = xdraw - ExplosionRadius
sec
lda xdraw
sbc ExplosionRadius
sta WeaponRangeLeft
lda xdraw+1
sbc #$00
sta WeaponRangeLeft+1
; sbw xdraw ExplosionRadius WeaponRangeLeft ; Pozor! ExplosionRadius is one byte now
; lda WeaponRangeLeft+1
bpl NotOutOfTheScreenLeft
lda #0
sta WeaponRangeLeft