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