More optimizations (158b saved) - please test!

This commit is contained in:
Pecusx
2022-09-02 13:54:57 +02:00
parent aa02b10bda
commit a441357948
4 changed files with 24 additions and 78 deletions
+12 -4
View File
@@ -584,6 +584,11 @@ UnequalTanks
.endp .endp
;------------------------------------------------- ;-------------------------------------------------
.proc ClearTanks
jsr PMoutofScreen
mva #1 Erase ; erase tanks flag
.endp
;--
.proc drawtanks .proc drawtanks
;------------------------------------------------- ;-------------------------------------------------
lda TankNr lda TankNr
@@ -601,6 +606,7 @@ DrawNextTank
pla pla
sta TankNr sta TankNr
mva #1 Erase ; no erase tanks flag
rts rts
.endp .endp
;--------- ;---------
@@ -645,7 +651,8 @@ DrawTankNrX
jsr SetupXYdraw jsr SetupXYdraw
jsr TypeChar jsr TypeChar
lda Erase
jne noTankNoPM
; now P/M graphics on the screen (only for 5 tanks) ; now P/M graphics on the screen (only for 5 tanks)
; horizontal position ; horizontal position
ldx TankNr ldx TankNr
@@ -729,7 +736,7 @@ ZeroesToGo6
bne ClearPM6 bne ClearPM6
NoPlayerMissile NoPlayerMissile
noTankNoPM
ldy #$01 ldy #$01
lda Erase lda Erase
beq @+ beq @+
@@ -1334,8 +1341,8 @@ drawmountainspixelloop
; how it works. I have just translated Polish comment ; how it works. I have just translated Polish comment
; but I do not understand a word of it :) ; but I do not understand a word of it :)
; If you know how it works, please write here :)))) ; If you know how it works, please write here :))))
jsr ClearTanks
jsr PMoutofscreen NoClearTanks
; First we look for highest pixels and fill with their coordinates ; First we look for highest pixels and fill with their coordinates
; both tables ; both tables
@@ -1433,6 +1440,7 @@ ColumnIsReady
; now correct heights are in the mountaintable ; now correct heights are in the mountaintable
sta color ; Pozor! :) we know - now A=1 sta color ; Pozor! :) we know - now A=1
mva #sfx_silencer sfx_effect mva #sfx_silencer sfx_effect
jsr DrawTanks
rts rts
.endp .endp
+2 -11
View File
@@ -271,11 +271,8 @@ SettingBarrel
jsr SortSequence jsr SortSequence
; Hide all (easier than hide last ;) ) tanks ; Hide all (easier than hide last ;) ) tanks
mva #1 Erase jsr cleartanks
jsr drawtanks
mva #0 Erase
sta COLBAKS ; set background color to black sta COLBAKS ; set background color to black
jsr PMoutofScreen ;let P/M disappear
; here gains and losses should be displayed (dollars) ; here gains and losses should be displayed (dollars)
; finally we have changed our minds and money of players ; finally we have changed our minds and money of players
@@ -410,6 +407,7 @@ NoGameOverYet
jsr SetPMWidth jsr SetPMWidth
lda #0 lda #0
sta Erase
sta COLOR2 ; status line "off" sta COLOR2 ; status line "off"
sta COLOR1 sta COLOR1
@@ -647,14 +645,7 @@ continueMainRoundLoopAfterSeppuku
AfterExplode AfterExplode
;temporary tanks removal (would fall down with soil)
mva #1 Erase
jsr drawtanks
mva #0 Erase
; lda FallDown2
; beq NoFallDown2
jsr SoilDown2 ; allways jsr SoilDown2 ; allways
NoFallDown2 NoFallDown2
;here tanks are falling down ;here tanks are falling down
mva tankNr tempor2 mva tankNr tempor2
BIN
View File
Binary file not shown.
+10 -63
View File
@@ -64,7 +64,6 @@ tracer
mva #sfx_baby_missile sfx_effect mva #sfx_baby_missile sfx_effect
; inc FallDown2 ; inc FallDown2
mva #11 ExplosionRadius mva #11 ExplosionRadius
jsr CalculateExplosionRange
jmp xmissile jmp xmissile
.endp .endp
; ------------------------ ; ------------------------
@@ -72,7 +71,6 @@ tracer
mva #sfx_baby_missile sfx_effect mva #sfx_baby_missile sfx_effect
; inc FallDown2 ; inc FallDown2
mva #17 ExplosionRadius mva #17 ExplosionRadius
jsr CalculateExplosionRange
jmp xmissile jmp xmissile
.endp .endp
; ------------------------ ; ------------------------
@@ -80,7 +78,6 @@ tracer
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
; inc FallDown2 ; inc FallDown2
mva #25 ExplosionRadius mva #25 ExplosionRadius
jsr CalculateExplosionRange
jmp xmissile jmp xmissile
.endp .endp
; ------------------------ ; ------------------------
@@ -88,7 +85,6 @@ tracer
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
; inc FallDown2 ; inc FallDown2
mva #30 ExplosionRadius mva #30 ExplosionRadius
jsr CalculateExplosionRange
jmp xmissile jmp xmissile
.endp .endp
; ------------------------ ; ------------------------
@@ -96,20 +92,11 @@ tracer
mva #sfx_baby_missile sfx_effect mva #sfx_baby_missile sfx_effect
; inc FallDown2 ; inc FallDown2
mva #17 ExplosionRadius mva #17 ExplosionRadius
jsr CalculateExplosionRange
jsr xmissile jsr xmissile
; soil must fall down now! there is no other way... ; soil must fall down now! there is no other way...
; hide tanks or they fall down with soil ; hide tanks or they fall down with soil
lda TankNr
pha
mva #1 Erase
jsr drawtanks
mva #0 Erase
jsr SoilDown2 jsr SoilDown2
jsr drawtanks
pla
sta TankNr
; it looks like force is divided by 4 here BUT" ; it looks like force is divided by 4 here BUT"
; in Flight routine force is multiplied by 2 and left ; in Flight routine force is multiplied by 2 and left
@@ -128,19 +115,11 @@ tracer
mva #15 ExplosionRadius mva #15 ExplosionRadius
jsr CalculateExplosionRange0 jsr CalculateExplosionRange0
mva #sfx_baby_missile sfx_effect mva #sfx_baby_missile sfx_effect
jsr xmissile jsr xmissile.NoRangeCalc
; soil must fall down now! there is no other way... ; soil must fall down now! there is no other way...
; hide tanks or they fall down with soil ; hide tanks or they fall down with soil
lda TankNr
pha
mva #1 Erase
jsr drawtanks
mva #0 Erase
jsr SoilDown2 jsr SoilDown2
jsr drawtanks
pla
sta TankNr
; it looks like force is divided by 4 here BUT" ; it looks like force is divided by 4 here BUT"
; in Flight routine force is multiplied by 2 and left ; in Flight routine force is multiplied by 2 and left
@@ -158,7 +137,7 @@ tracer
mva #13 ExplosionRadius mva #13 ExplosionRadius
jsr CalculateExplosionRange0 jsr CalculateExplosionRange0
mva #sfx_baby_missile sfx_effect mva #sfx_baby_missile sfx_effect
jmp xmissile jmp xmissile.NoRangeCalc
EndOfLeapping EndOfLeapping
rts rts
.endp .endp
@@ -176,22 +155,12 @@ EndOfLeapping
;central Explosion ;central Explosion
mva #21 ExplosionRadius mva #21 ExplosionRadius
jsr CalculateExplosionRange0 jsr CalculateExplosionRange0
jsr xmissile jsr xmissile.NoRangeCalc
lda TankNr
pha
mva #1 Erase
jsr drawtanks
mva #0 Erase
jsr SoilDown2 jsr SoilDown2
; ;
mva #1 Erase jsr cleartanks ; maybe not?
jsr drawtanks
mva #0 Erase
sta FunkyWallFlag sta FunkyWallFlag
pla
sta TankNr
mva #1 color mva #1 color
mva #5 FunkyBombCounter mva #5 FunkyBombCounter
FunkyBombLoop FunkyBombLoop
@@ -212,7 +181,6 @@ FunkyBombLoop
mva #sfx_funky_hit sfx_effect mva #sfx_funky_hit sfx_effect
jsr Flight jsr Flight
jsr CalculateExplosionRange
lda HitFlag lda HitFlag
beq NoExplosionInFunkyBomb beq NoExplosionInFunkyBomb
mva #sfx_baby_missile sfx_effect mva #sfx_baby_missile sfx_effect
@@ -232,20 +200,16 @@ NoWallsInFunky
.proc deathshead .proc deathshead
; inc FallDown2 ; inc FallDown2
mva #30 ExplosionRadius mva #30 ExplosionRadius
jsr CalculateExplosionRange
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
SaveDrawXY SaveDrawXY
jsr xmissile jsr xmissile
UnSaveDrawXY UnSaveDrawXY
sbw xdraw #34 sbw xdraw #34
jsr CalculateExplosionRange
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
SaveDrawXY SaveDrawXY
jsr xmissile jsr xmissile
UnSaveDrawXY UnSaveDrawXY
adw xdraw #68 adw xdraw #68
jsr CalculateExplosionRange
mva #sfx_nuke sfx_effect mva #sfx_nuke sfx_effect
SaveDrawXY SaveDrawXY
jsr xmissile jsr xmissile
@@ -720,6 +684,8 @@ LaserMisses
; ----------------- ; -----------------
.proc xmissile ; .proc xmissile ;
; ----------------- ; -----------------
jsr CalculateExplosionRange
NoRangeCalc
lda #1 lda #1
sta radius sta radius
sta color sta color
@@ -931,7 +897,6 @@ ExplodeNow
mwa ycircle ydraw ;(bad) mwa ycircle ydraw ;(bad)
; finally a little explosion ; finally a little explosion
jsr CalculateExplosionRange
mva #sfx_baby_missile sfx_effect mva #sfx_baby_missile sfx_effect
jmp xmissile jmp xmissile
rts rts
@@ -1212,9 +1177,7 @@ QuitToGameover
bne @+ bne @+
callActivation callActivation
; Hide all tanks - after inventory they may have other shapes ; Hide all tanks - after inventory they may have other shapes
mva #1 Erase jsr ClearTanks
jsr DrawTanks
mva #0 Erase
jsr DefensivesActivate jsr DefensivesActivate
jmp afterInventory jmp afterInventory
@@ -1223,9 +1186,7 @@ callActivation
bne @+ bne @+
callInventory callInventory
; Hide all tanks - after inventory they may have other shapes ; Hide all tanks - after inventory they may have other shapes
mva #1 Erase jsr ClearTanks
jsr DrawTanks
mva #0 Erase
; ;
mva #$ff isInventory mva #$ff isInventory
jsr Purchase jsr Purchase
@@ -1234,6 +1195,7 @@ afterInventory
lda #song_ingame lda #song_ingame
jsr RmtSongSelect jsr RmtSongSelect
mva #0 escFlag mva #0 escFlag
sta Erase ; why?
jsr DisplayStatus jsr DisplayStatus
jsr SetMainScreen jsr SetMainScreen
jsr WaitOneFrame jsr WaitOneFrame
@@ -2331,14 +2293,8 @@ MIRValreadyAll
jsr DisplayOffensiveTextNr jsr DisplayOffensiveTextNr
; temporary removing tanks from the screen (otherwise they will fall down with soil) ; temporary removing tanks from the screen (otherwise they will fall down with soil)
mva TankNr tempor2
mva #1 Erase
jsr drawtanks
mva tempor2 TankNr
mva #0 Erase
jsr SoilDown2 jsr SoilDown2
mva #$ff HitFlag ; but why ?? mva #$ff HitFlag ; but why ??
;jsr drawtanks
rts rts
.endp .endp
; ------------------------------------------------- ; -------------------------------------------------
@@ -2460,8 +2416,7 @@ NextLine2
ldx TankNr ldx TankNr
sta ActiveDefenceWeapon,x ; deactivate Nuclear Winter sta ActiveDefenceWeapon,x ; deactivate Nuclear Winter
jsr SetFullScreenSoilRange jsr SetFullScreenSoilRange
jsr SoilDown2 jsr SoilDown2.NoClearTanks
jsr drawtanks ; for restore PM
rts rts
; in order to optimize the fragment repeated in both internal loops ; in order to optimize the fragment repeated in both internal loops
@@ -2572,11 +2527,7 @@ ReachSky
adc #0 adc #0
sta RangeRight+1 sta RangeRight+1
; hide tanks and ... ; hide tanks and ...
mva #1 Erase
jsr DrawTanks
jsr SoilDown2 jsr SoilDown2
mva #0 Erase
jsr DrawTanks
ldx TankNr ldx TankNr
; check keyboard/joy and move tank left/right - code copied from BeforeFire ; check keyboard/joy and move tank left/right - code copied from BeforeFire
@@ -2868,11 +2819,7 @@ OnGround
adc #0 adc #0
sta RangeRight+1 sta RangeRight+1
; hide tanks and ... ; hide tanks and ...
mva #1 Erase
jsr DrawTanks
jsr SoilDown2 jsr SoilDown2
mva #0 Erase
jsr DrawTanks
ldx TankNr ldx TankNr
rts rts
.endp .endp