mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-21 21:34:20 +02:00
Weapon lists code optimization
This commit is contained in:
+6
-20
@@ -339,28 +339,12 @@ AfterPurchase
|
|||||||
|
|
||||||
lda whichList
|
lda whichList
|
||||||
bne PositionDefensive
|
bne PositionDefensive
|
||||||
|
jsr calcPosOffensive
|
||||||
; calculate positionOnTheList from the activeWeapon (offensives)
|
jmp ?weaponFound
|
||||||
ldx tankNr
|
|
||||||
lda activeWeapon,x
|
|
||||||
ldy #0
|
|
||||||
@
|
|
||||||
cmp IndexesOfWeaponsL1,y
|
|
||||||
beq ?weaponfound
|
|
||||||
iny
|
|
||||||
cpy #(last_offensive - first_offensive )+1 ; maxOffensiveWeapons
|
|
||||||
bne @-
|
|
||||||
; not found apparently?
|
|
||||||
; TODO: check border case (the last weapon)
|
|
||||||
ldy #0
|
|
||||||
beq ?weaponFound ; jmp
|
|
||||||
PositionDefensive
|
PositionDefensive
|
||||||
jsr calcPosDefensive
|
jsr calcPosDefensive
|
||||||
|
|
||||||
|
|
||||||
?weaponFound
|
?weaponFound
|
||||||
; weapon index in Y
|
|
||||||
sty positionOnTheList
|
|
||||||
jsr _MakeOffsetDown ; set list screen offset
|
jsr _MakeOffsetDown ; set list screen offset
|
||||||
|
|
||||||
; Here we have all we need
|
; Here we have all we need
|
||||||
@@ -914,7 +898,7 @@ DefActivationEnd
|
|||||||
cmp IndexesOfWeaponsL2,y
|
cmp IndexesOfWeaponsL2,y
|
||||||
beq ?weaponfound
|
beq ?weaponfound
|
||||||
iny
|
iny
|
||||||
cpy #(last_defensive - first_defensive )+1 ; maxDefensiveWeapon
|
cpy #number_of_defensives ; maxDefensiveWeapon
|
||||||
bne @-
|
bne @-
|
||||||
; not found apparently?
|
; not found apparently?
|
||||||
; TODO: check border case (the last weapon)
|
; TODO: check border case (the last weapon)
|
||||||
@@ -927,8 +911,10 @@ DefActivationEnd
|
|||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
|
|
||||||
|
;--------------------------------------------------
|
||||||
.proc calcPosOffensive
|
.proc calcPosOffensive
|
||||||
; calculate positionOnTheList from the activeWeapon (defensives)
|
; calculate positionOnTheList from the activeWeapon (defensives)
|
||||||
|
;--------------------------------------------------
|
||||||
ldx tankNr
|
ldx tankNr
|
||||||
lda ActiveWeapon,x
|
lda ActiveWeapon,x
|
||||||
beq ?noWeaponActive
|
beq ?noWeaponActive
|
||||||
@@ -937,7 +923,7 @@ DefActivationEnd
|
|||||||
cmp IndexesOfWeaponsL1,y
|
cmp IndexesOfWeaponsL1,y
|
||||||
beq ?weaponfound
|
beq ?weaponfound
|
||||||
iny
|
iny
|
||||||
cpy #(last_offensive - first_offensive ) ; maxOffensiveWeapon
|
cpy #number_of_offensives ; maxOffensiveWeapon
|
||||||
bne @-
|
bne @-
|
||||||
; not found apparently?
|
; not found apparently?
|
||||||
; TODO: check border case (the last weapon)
|
; TODO: check border case (the last weapon)
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
Reference in New Issue
Block a user