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' icl 'definitions.asm'
;--------------------------------------------------- ;---------------------------------------------------
FirstZpageVariable = $60 FirstZpageVariable = $61
.zpvar DliColorBack .byte = FirstZpageVariable .zpvar DliColorBack .byte = FirstZpageVariable
.zpvar JoystickNumber .byte .zpvar JoystickNumber .byte
.zpvar xdraw .word ;= $64 ;variable X for plot .zpvar xdraw .word ;= $64 ;variable X for plot
@@ -87,7 +87,7 @@ FirstZpageVariable = $60
.zpvar decimal .word .zpvar decimal .word
.zpvar NumberOfPlayers .byte ;current number of players (counted from 1) .zpvar NumberOfPlayers .byte ;current number of players (counted from 1)
.zpvar Counter .byte ;temporary Counter for outside loops .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 ResultY .byte
.zpvar xcircle .word .zpvar xcircle .word
.zpvar ycircle .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 ;calculates total horizontal range of explosion by
;"summing up" ranges of all separate explosions ;"summing up" ranges of all separate explosions
adw xdraw ExplosionRadius WeaponRangeRight ; WeaponRangeRight = xdraw + ExplosionRadius
cpw WeaponRangeRight #screenwidth-1 clc
bcc NotOutOfTheScreenRight 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 mwa #screenwidth-1 WeaponRangeRight
NotOutOfTheScreenRight NotOutOfTheScreenRight
sbw xdraw ExplosionRadius WeaponRangeLeft ; WeaponRangeLeft = xdraw - ExplosionRadius
lda WeaponRangeLeft+1 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 bpl NotOutOfTheScreenLeft
lda #0 lda #0
sta WeaponRangeLeft sta WeaponRangeLeft