Optimizations - 69 bytes saved!

This commit is contained in:
Pecusx
2023-01-12 21:53:42 +01:00
parent 066e248350
commit ed126c454a
5 changed files with 20 additions and 32 deletions
+3 -2
View File
@@ -26,7 +26,7 @@
;---------------------------------------------------
icl 'definitions.asm'
;---------------------------------------------------
FirstZpageVariable = $5C
FirstZpageVariable = $5B
.zpvar DliColorBack .byte = FirstZpageVariable
.zpvar GradientNr .byte
.zpvar GradientColors .word
@@ -92,6 +92,7 @@ FirstZpageVariable = $5C
.zpvar NumberOfPlayers .byte ;current number of players (counted from 1)
.zpvar Counter .byte ;temporary Counter for outside loops
.zpvar ExplosionRadius .byte
.zpvar FunkyBombCounter .byte
.zpvar ResultY .byte
.zpvar xcircle .word
.zpvar ycircle .word
@@ -129,7 +130,7 @@ FirstZpageVariable = $5C
.zpvar goleft .byte
.zpvar OffsetDL1 .byte
.zpvar L1 .byte
HotNapalmFlag = FunkyBombCounter ; reuse variable!
;* RMT ZeroPage addresses in artwork/sfx/rmtplayr.a65
displayposition = modify
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
-1
View File
@@ -261,7 +261,6 @@ oldplotL .DS [5]
oldora .DS [5]
oldply .DS [5]
OldOraTemp .DS 1
FunkyBombCounter .DS 1
xtrajfb .DS 2
ytrajfb .DS 2
;
+17 -29
View File
@@ -239,22 +239,20 @@ GoXmissileWithSaveXYdraw
.endp
; ------------------------
.proc napalm
mva #sfx_napalm sfx_effect
mva #(napalmRadius+4) ExplosionRadius ; real radius + 4 pixels (half characrer width)
jsr CalculateExplosionRange
mva #0 ExplosionRadius ; in this weapon - flag: 0 - napalm, 1 - hotnapalm
mva #0 HotNapalmFlag ; in this weapon - flag: 0 - napalm, 1 - hotnapalm
beq xnapalm
.endp
; ------------------------
.proc hotnapalm
mva #sfx_napalm sfx_effect
mva #(napalmRadius+4) ExplosionRadius ; real radius + 4 pixels (half characrer width)
jsr CalculateExplosionRange
mva #1 ExplosionRadius ; in this weapon - flag: 0 - napalm, 1 - hotnapalm
mva #1 HotNapalmFlag ; in this weapon - flag: 0 - napalm, 1 - hotnapalm
; jmp xnapalm
.endp
; ------------------------
.proc xnapalm
mva #sfx_napalm sfx_effect
mva #(napalmRadius+4) ExplosionRadius ; real radius + 4 pixels (half characrer width)
jsr CalculateExplosionRange
;
mwa xdraw xcircle ; store hitpoint for future repeats
ldy #30 ; repeat 30 times
sty magic
@@ -272,7 +270,7 @@ RepeatFlame ; internal loop (draw flames)
sbc #1 ; over ground
sta ydraw
lda xdraw
and ExplosionRadius ; if hotnapalm and x is odd:
and HotNapalmFlag ; if hotnapalm and x is odd:
:2 asl ; modify y position 4 pixels up
ldy ydraw
sta ydraw
@@ -344,7 +342,7 @@ BurnedCheckLoop
bcc TankOutOfFire
ldy #40 ; energy decrease (napalm) - but if hotnapalm:
lda ExplosionRadius
lda HotNapalmFlag
beq NotHot
ldy #80 ; energy decrease (hotnapalm)
NotHot
@@ -386,50 +384,40 @@ EndNurnedCheckLoop
.endp
; ------------------------
.proc babydigger
mva #sfx_digger sfx_effect
mva #1 diggery ; how many branches (-1)
GoBabydiggerSFX
mva #sfx_digger sfx_effect
mva #0 sandhogflag
mva #13 DigLong
mva #1 diggery ; how many branches (-1)
bne xdigger
.endp
; ------------------------
.proc digger ;
mva #sfx_digger sfx_effect
mva #0 sandhogflag
mva #13 DigLong
mva #3 diggery ; how many branches (-1)
bne xdigger
bne babydigger.GoBabydiggerSFX
.endp
; ------------------------
.proc heavydigger
mva #sfx_digger sfx_effect
mva #0 sandhogflag
mva #13 DigLong
mva #7 diggery ; how many branches (-1)
bne xdigger
bne babydigger.GoBabydiggerSFX
.endp
; ------------------------
.proc babysandhog
mva #sfx_sandhog sfx_effect
mva #char_sandhog_offset sandhogflag
mva #13 DigLong
mva #1 diggery ; how many branches (-1)
bne xdigger
bne heavysandhog.GoHeavysandhogSFX
.endp
; ------------------------
.proc sandhog
mva #sfx_sandhog sfx_effect
mva #char_sandhog_offset sandhogflag
mva #13 DigLong
mva #3 diggery ; how many branches (-1)
bne xdigger
bne heavysandhog.GoHeavysandhogSFX
.endp
; ------------------------
.proc heavysandhog
mva #5 diggery ; how many branches (-1)
GoHeavysandhogSFX
mva #sfx_sandhog sfx_effect
mva #char_sandhog_offset sandhogflag
mva #13 DigLong
mva #5 diggery ; how many branches (-1)
; jmp xdigger
.endp
; ------------------------