mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-20 22:33:43 +02:00
Code cleanup and optimization
This commit is contained in:
@@ -145,6 +145,7 @@ last_defensive_____ = ind_Spy_Hard_______
|
|||||||
last_real_defensive = ind_Bouncy_Castle__
|
last_real_defensive = ind_Bouncy_Castle__
|
||||||
number_of_offensives = last_offensive_____ - first_offensive____+1
|
number_of_offensives = last_offensive_____ - first_offensive____+1
|
||||||
number_of_defensives = (last_defensive_____ - first_defensive____+1)
|
number_of_defensives = (last_defensive_____ - first_defensive____+1)
|
||||||
|
number_of_weapons = number_of_offensives + number_of_defensives
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
; names of RMT instruments (sfx)
|
; names of RMT instruments (sfx)
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|||||||
+10
-20
@@ -1152,13 +1152,13 @@ B0 DEY
|
|||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
.proc WeaponCleanup;
|
.proc WeaponCleanup;
|
||||||
; cleaning of the weapon possesion tables
|
; cleaning of the weapon possesion tables
|
||||||
; 99 of Baby Missles(index==0), all other weapons=0)
|
; 99 of Baby Missles and White Flags, all other weapons=0)
|
||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
ldx #$3f ; TODO: maxweapons
|
ldx #(number_of_weapons - 1)
|
||||||
@ lda #$0
|
@ lda #$0
|
||||||
cpx #ind_White_Flag_____ ; White Flag
|
cpx #ind_White_Flag_____ ; White Flag
|
||||||
bne @+
|
bne @+
|
||||||
lda #99
|
lda #99
|
||||||
@ sta TanksWeapon1,x
|
@ sta TanksWeapon1,x
|
||||||
sta TanksWeapon2,x
|
sta TanksWeapon2,x
|
||||||
sta TanksWeapon3,x
|
sta TanksWeapon3,x
|
||||||
@@ -1166,7 +1166,7 @@ B0 DEY
|
|||||||
sta TanksWeapon5,x
|
sta TanksWeapon5,x
|
||||||
sta TanksWeapon6,x
|
sta TanksWeapon6,x
|
||||||
dex
|
dex
|
||||||
beq setBmissile
|
beq setBmissile ; Baby Missile (index=0)
|
||||||
bpl @-1
|
bpl @-1
|
||||||
rts
|
rts
|
||||||
setBmissile
|
setBmissile
|
||||||
@@ -1261,7 +1261,7 @@ MakeTanksVisible
|
|||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
.proc RandomizeSequence0
|
/* .proc RandomizeSequence0
|
||||||
ldx #0
|
ldx #0
|
||||||
@ txa
|
@ txa
|
||||||
sta TankSequence,x
|
sta TankSequence,x
|
||||||
@@ -1269,7 +1269,7 @@ MakeTanksVisible
|
|||||||
cpx #MaxPlayers
|
cpx #MaxPlayers
|
||||||
bne @-
|
bne @-
|
||||||
rts
|
rts
|
||||||
.endp
|
.endp */
|
||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
.proc RandomizeSequence
|
.proc RandomizeSequence
|
||||||
; in: NumberOfPlayers
|
; in: NumberOfPlayers
|
||||||
@@ -1326,20 +1326,10 @@ UsageLoop
|
|||||||
; X is not changed
|
; X is not changed
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
|
|
||||||
;valid angle values are ((256-90)..255) and (0..90)
|
; lets randomize someting between 0 and 180
|
||||||
;it means that values 91..165 must be elliminated...
|
|
||||||
;so, lets randomize someting between 0 and 180
|
|
||||||
;and substract this value from 90
|
|
||||||
lda RANDOM
|
lda RANDOM
|
||||||
|
|
||||||
cmp #180
|
cmp #180
|
||||||
bcs RandomizeAngle
|
bcs RandomizeAngle
|
||||||
|
|
||||||
|
|
||||||
;sta temp
|
|
||||||
;lda #90 ; CARRY=0 here
|
|
||||||
;sbc temp
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
@@ -1437,10 +1427,10 @@ BarrelPositionIsFine
|
|||||||
; I think I will go for a stupid bubble sort...
|
; I think I will go for a stupid bubble sort...
|
||||||
; it is easy to test :)
|
; it is easy to test :)
|
||||||
;
|
;
|
||||||
; Results are in ResultsTable, in SortedTable we want to
|
; Results are in ResultsTable, in TankSequence (Sorted Table) we want to
|
||||||
; have numbers of tanks from the worst to the best.
|
; have numbers of tanks from the worst to the best.
|
||||||
; in other words, if ResultsTable=(5,4,65,23,3,6)
|
; in other words, if ResultsTable=(5,4,65,23,3,6)
|
||||||
; the SortedTable=(4,1,0,5,3,2)
|
; the TankSequence=(4,1,0,5,3,2)
|
||||||
; let's assume initially the TankSequence=(0,1,2,3,4,5)
|
; let's assume initially the TankSequence=(0,1,2,3,4,5)
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
@@ -1533,7 +1523,7 @@ SetRandomWalls
|
|||||||
.endp
|
.endp
|
||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
.proc GetKey ; waits for pressing a key and returns pressed value in A
|
.proc GetKey ; waits for pressing a key and returns pressed value in A
|
||||||
; when [ESC] is pressed, escFlag is set to 1
|
; when [ESC] is pressed, escFlag is set
|
||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
jsr WaitForKeyRelease
|
jsr WaitForKeyRelease
|
||||||
@
|
@
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
+6
-6
@@ -342,17 +342,17 @@ LaserCoordinate .DS 8 ; 2,2,2,2
|
|||||||
; from $30 the defensive weapons begin
|
; from $30 the defensive weapons begin
|
||||||
TanksWeapons
|
TanksWeapons
|
||||||
TanksWeapon1
|
TanksWeapon1
|
||||||
.DS [last_defensive_____ - first_offensive____ +1]
|
.DS number_of_weapons
|
||||||
TanksWeapon2
|
TanksWeapon2
|
||||||
.DS [last_defensive_____ - first_offensive____ +1]
|
.DS number_of_weapons
|
||||||
TanksWeapon3
|
TanksWeapon3
|
||||||
.DS [last_defensive_____ - first_offensive____ +1]
|
.DS number_of_weapons
|
||||||
TanksWeapon4
|
TanksWeapon4
|
||||||
.DS [last_defensive_____ - first_offensive____ +1]
|
.DS number_of_weapons
|
||||||
TanksWeapon5
|
TanksWeapon5
|
||||||
.DS [last_defensive_____ - first_offensive____ +1]
|
.DS number_of_weapons
|
||||||
TanksWeapon6
|
TanksWeapon6
|
||||||
.DS [last_defensive_____ - first_offensive____ +1]
|
.DS number_of_weapons
|
||||||
|
|
||||||
mountaintable ;table of mountains (size=screenwidth)
|
mountaintable ;table of mountains (size=screenwidth)
|
||||||
.DS [screenwidth]
|
.DS [screenwidth]
|
||||||
|
|||||||
Reference in New Issue
Block a user