Code optimization for more than 6 tanks.

This commit is contained in:
Pecusx
2023-05-15 21:58:04 +02:00
parent fc3fe9ef19
commit 2577b71e01
6 changed files with 20 additions and 26 deletions
+12 -7
View File
@@ -32,9 +32,13 @@ LevelNameBeginH
.by >(NamesOfLevels+64),>(NamesOfLevels+74),>(NamesOfLevels+84) .by >(NamesOfLevels+64),>(NamesOfLevels+74),>(NamesOfLevels+84)
;-------------- ;--------------
TanksWeaponsTableL TanksWeaponsTableL
.by <TanksWeapon1,<TanksWeapon2,<TanksWeapon3,<TanksWeapon4,<TanksWeapon5,<TanksWeapon6 .REPT MaxPlayers, #+1
.by <TanksWeapon:1
.ENDR
TanksWeaponsTableH TanksWeaponsTableH
.by >TanksWeapon1,>TanksWeapon2,>TanksWeapon3,>TanksWeapon4,>TanksWeapon5,>TanksWeapon6 .REPT MaxPlayers, #+1
.by >TanksWeapon:1
.ENDR
;-------------- ;--------------
XtankOffsetGO_L XtankOffsetGO_L
.by 6,56,106,156,206,0 .by 6,56,106,156,206,0
@@ -202,7 +206,9 @@ disktance ;tanks distance
.by screenwidth/5 .by screenwidth/5
.by screenwidth/6 .by screenwidth/6
.by screenwidth/7 .by screenwidth/7
;max number of players=6 .by screenwidth/8
.by screenwidth/9
;max number of players=8 :)
; this table is for deciding where a tank should slide ; this table is for deciding where a tank should slide
; accordingly to what is below the tank ; accordingly to what is below the tank
@@ -221,10 +227,9 @@ SlideLeftTableLen = *-SlideLeftTable
TanksNamesDefault TanksNamesDefault
dta d"1st.Tank" dta d"1st.Tank"
dta d"2nd.Tank" dta d"2nd.Tank"
dta d"3rd.Tank" .REPT MaxPlayers-2, #+3
dta d"4th.Tank" dta d":1rd.Tank"
dta d"5th.Tank" .ENDR
dta d"6th.Tank"
;------------------------------------------------- ;-------------------------------------------------
TankShapesTable .BYTE char_tank1___________ TankShapesTable .BYTE char_tank1___________
.BYTE char_tank2___________ .BYTE char_tank2___________
+4 -6
View File
@@ -783,12 +783,10 @@ B0 dey
cpx #ind_White_Flag_____ ; White Flag cpx #ind_White_Flag_____ ; White Flag
bne no99 bne no99
set99 lda #99 set99 lda #99
no99 sta TanksWeapon1,x no99
sta TanksWeapon2,x .REPT MaxPlayers, #+1
sta TanksWeapon3,x sta TanksWeapon:1,x
sta TanksWeapon4,x .ENDR
sta TanksWeapon5,x
sta TanksWeapon6,x
dex dex
beq set99 ; Baby Missile (index=0) beq set99 ; Baby Missile (index=0)
bpl @- bpl @-
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+4 -13
View File
@@ -23,7 +23,7 @@ GameOverColoursTable .ds MaxPlayers; .BYTE $80,$40,$c4,$20,$c0,$e4
;---------------------------------------------------- ;----------------------------------------------------
TanksNames ; DO NOT ZERO ON GAME RESTART - ticket #24 TanksNames ; DO NOT ZERO ON GAME RESTART - ticket #24
;:6 dta d" " ;:6 dta d" "
.ds 6*8 .ds MaxPlayers*8
;---------------------------------------------------- ;----------------------------------------------------
skilltable ; computer controlled players' skills (1-8), 0 - human (no cleaning, ticket #30) skilltable ; computer controlled players' skills (1-8), 0 - human (no cleaning, ticket #30)
.DS MaxPlayers .DS MaxPlayers
@@ -341,19 +341,10 @@ LaserCoordinate .DS 8 ; 2,2,2,2
; Let 0 be "baby missile" ; Let 0 be "baby missile"
; from $30 the defensive weapons begin ; from $30 the defensive weapons begin
TanksWeapons TanksWeapons
TanksWeapon1 .REPT MaxPlayers, #+1
TanksWeapon:1
.DS number_of_weapons .DS number_of_weapons
TanksWeapon2 .ENDR
.DS number_of_weapons
TanksWeapon3
.DS number_of_weapons
TanksWeapon4
.DS number_of_weapons
TanksWeapon5
.DS number_of_weapons
TanksWeapon6
.DS number_of_weapons
mountaintable ;table of mountains (size=screenwidth) mountaintable ;table of mountains (size=screenwidth)
.DS [screenwidth] .DS [screenwidth]
.DS 1 ; additional byte for fallout (sometimes 1 pixel) .DS 1 ; additional byte for fallout (sometimes 1 pixel)