Weapon lists code optimization

This commit is contained in:
Pecusx
2023-05-31 14:20:28 +02:00
parent 15f66500b8
commit 9201497d29
3 changed files with 6 additions and 20 deletions
+6 -20
View File
@@ -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
View File
Binary file not shown.
BIN
View File
Binary file not shown.