wip: inventory shows active weapon #26

This commit is contained in:
2022-06-11 18:08:25 -04:00
parent cb270be865
commit cd4275226a
3 changed files with 40 additions and 32 deletions
BIN
View File
Binary file not shown.
+35 -25
View File
@@ -245,6 +245,10 @@ AfterManualPurchase
lda TankStatusColoursTable,x lda TankStatusColoursTable,x
sta colpf2s sta colpf2s
; ldy PositionOnTheList
; lda IndexesOfWeaponsL1,y
; we are clearing list of the weapons ; we are clearing list of the weapons
mva #$ff LastWeapon mva #$ff LastWeapon
mva #$00 WhichList mva #$00 WhichList
@@ -291,8 +295,8 @@ AfterPurchase
; in 'Xbyte' address of the first char in filled screen line ; in 'Xbyte' address of the first char in filled screen line
CreateList CreateList
stx temp ; number of weapon will be necessary later stx temp ; index of a weapon will be necessary later
; checking if the weapon of the given number is present ; checking if the weapon of the given index is present
lda WeaponUnits,x lda WeaponUnits,x
jeq NoWeapon jeq NoWeapon
@@ -310,7 +314,7 @@ CreateList
cmp WeaponPriceL,x cmp WeaponPriceL,x
@ @
jcc TooLittleCash jcc TooLittleCash
bcs notInventory bcs notInventory ; jmp
itIsInventory itIsInventory
lda TanksWeaponsTableL,y lda TanksWeaponsTableL,y
@@ -321,12 +325,6 @@ itIsInventory
lda (temp2),y lda (temp2),y
jeq noWeapon jeq noWeapon
txa ; lda weapon index
cmp activeWeapon,y
sne:sta PositionOnTheList
notInventory notInventory
; we have enough cash and the weapon can be ; we have enough cash and the weapon can be
; added to the list ; added to the list
@@ -409,11 +407,11 @@ notInventory
cpx LastWeapon cpx LastWeapon
bne NotTheSameAsLastTime bne NotTheSameAsLastTime
lda WhichList lda WhichList
bne ominx06 bne @+
lda HowManyOnTheList1 lda HowManyOnTheList1
sta PositionOnTheList sta PositionOnTheList
jmp NotTheSameAsLastTime jmp NotTheSameAsLastTime
ominx06 @
lda HowManyOnTheList2 lda HowManyOnTheList2
sta PositionOnTheList sta PositionOnTheList
NotTheSameAsLastTime NotTheSameAsLastTime
@@ -422,12 +420,12 @@ NotTheSameAsLastTime
cpx #$30 cpx #$30
bcs SecondList bcs SecondList
ldy HowManyOnTheList1 ldy HowManyOnTheList1
sta NubersOfWeaponsL1,y sta IndexesOfWeaponsL1,y
inc HowManyOnTheList1 inc HowManyOnTheList1
bne NextLineOfTheList bne NextLineOfTheList
SecondList SecondList
ldy HowManyOnTheList2 ldy HowManyOnTheList2
sta NubersOfWeaponsL2,y sta IndexesOfWeaponsL2,y
inc HowManyOnTheList2 inc HowManyOnTheList2
; If everything is copied then next line ; If everything is copied then next line
NextLineOfTheList NextLineOfTheList
@@ -551,18 +549,32 @@ DoNotIncHigher2
; (it was very ugly - I checked it :) ; (it was very ugly - I checked it :)
; calculate positionOnTheList
ldx tankNr
lda activeWeapon,x
ldy #0
@
cmp IndexesOfWeaponsL1,y
beq weaponfound
iny
cpy #40 ; maxOffensiveWeapons
bne @-
; not found apparently?
; TODO: check border case (the last weapon)
ldy #0
weaponFound
; weapon index in Y
sty positionOnTheList
; Here we have all we need ; Here we have all we need
; So choose the weapon for purchase ...... ; So choose the weapon for purchase ......
;-------------------------------------------------- ;--------------------------------------------------
ChoosingItemForPurchase ChoosingItemForPurchase
;-------------------------------------------------- ;--------------------------------------------------
jsr PutLitteChar ; Places pointer at the right position jsr PutLitteChar ; Places pointer at the right position
jsr getkey jsr getkey
ldx escFlag ldx escFlag
beq @+ seq:jmp WaitForKeyRelease ; like jsr ... : rts
jsr WaitForKeyRelease
rts
@
cmp #$2c ; Tab cmp #$2c ; Tab
jeq ListChange jeq ListChange
cmp #$0c ; Return cmp #$0c ; Return
@@ -603,8 +615,7 @@ EndUpX
PurchaseKeyDown PurchaseKeyDown
lda WhichList lda WhichList
beq GoDown1 beq GoDown1
inc PositionOnTheList inc:lda PositionOnTheList
lda PositionOnTheList
cmp HowManyOnTheList2 cmp HowManyOnTheList2
bne EndGoDownX bne EndGoDownX
ldy HowManyOnTheList2 ldy HowManyOnTheList2
@@ -612,8 +623,7 @@ PurchaseKeyDown
sty PositionOnTheList sty PositionOnTheList
jmp ChoosingItemForPurchase jmp ChoosingItemForPurchase
GoDown1 GoDown1
inc PositionOnTheList inc:lda PositionOnTheList
lda PositionOnTheList
cmp HowManyOnTheList1 cmp HowManyOnTheList1
bne MakeOffsetDown bne MakeOffsetDown
ldy HowManyOnTheList1 ldy HowManyOnTheList1
@@ -665,15 +675,15 @@ isPriceZero = tempXRoller
; here we purchase the offensive weapon ; here we purchase the offensive weapon
ldy PositionOnTheList ldy PositionOnTheList
lda NubersOfWeaponsL1,y lda IndexesOfWeaponsL1,y
jmp PurchaseAll jmp PurchaseAll
PurchaseDeffensive PurchaseDeffensive
ldy PositionOnTheList ldy PositionOnTheList
lda NubersOfWeaponsL2,y lda IndexesOfWeaponsL2,y
PurchaseAll PurchaseAll
; after getting weapon number the routine is common for all ; after getting weapon index the routine is common for all
ldx tanknr ldx tanknr
tay ; weapon number is in Y tay ; weapon index is in Y
beq @+ ; baby missile skips all beq @+ ; baby missile skips all
sec sec
lda moneyL,x ; substracting from posessed money lda moneyL,x ; substracting from posessed money
+5 -7
View File
@@ -245,14 +245,12 @@ temptankNr .DS 1
;---------------------------------------------------- ;----------------------------------------------------
;Variables from textproc.s65 ;Variables from textproc.s65
; tables with numbers of weapons on the right lists ; tables with indexes of weapons on the right lists
; to be honest - I do not know at the moment what the above
; comment was supposed to mean...
; OK (2022) so, L1 is list of offensive weapons, L2 - defensive ; OK (2022) so, L1 is list of offensive weapons, L2 - defensive
NubersOfWeaponsL1 IndexesOfWeaponsL1
.ds 8*5 ; :(8*5) .by $ff .ds 8*5 ; max 40 offensive weapons. this is wrong, should be 48, still only 32 defined.
NubersOfWeaponsL2 IndexesOfWeaponsL2
.ds 8*2 ; :(8*2) .by $ff .ds 8*2 ; max 16 defensive weapons.
;---------------------------------------------------- ;----------------------------------------------------
; variables storing amount of weapons on the first and second ; variables storing amount of weapons on the first and second