mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-20 22:33:43 +02:00
weapons optimization
This commit is contained in:
+79
-79
@@ -263,21 +263,21 @@ WeaponPriceH ; weapons prices (tables with prices of weapons)
|
||||
.by >price_Buy_me_________
|
||||
.by >price_Plasma_Blast___
|
||||
.by >price_Laser__________
|
||||
.by >price______________33
|
||||
.by >price______________34
|
||||
.by >price______________35
|
||||
.by >price______________36
|
||||
.by >price______________37
|
||||
.by >price______________38
|
||||
.by >price______________39
|
||||
.by >price______________40
|
||||
.by >price______________41
|
||||
.by >price______________42
|
||||
.by >price______________43
|
||||
.by >price______________44
|
||||
.by >price______________45
|
||||
.by >price______________46
|
||||
.by >price______________47
|
||||
; .by >price______________33
|
||||
; .by >price______________34
|
||||
; .by >price______________35
|
||||
; .by >price______________36
|
||||
; .by >price______________37
|
||||
; .by >price______________38
|
||||
; .by >price______________39
|
||||
; .by >price______________40
|
||||
; .by >price______________41
|
||||
; .by >price______________42
|
||||
; .by >price______________43
|
||||
; .by >price______________44
|
||||
; .by >price______________45
|
||||
; .by >price______________46
|
||||
; .by >price______________47
|
||||
.by >price_White_Flag_____
|
||||
.by >price_Battery________
|
||||
.by >price_Bal_Guidance___
|
||||
@@ -329,21 +329,21 @@ WeaponPriceL
|
||||
.by <price_Buy_me_________
|
||||
.by <price_Plasma_Blast___
|
||||
.by <price_Laser__________
|
||||
.by <price______________33
|
||||
.by <price______________34
|
||||
.by <price______________35
|
||||
.by <price______________36
|
||||
.by <price______________37
|
||||
.by <price______________38
|
||||
.by <price______________39
|
||||
.by <price______________40
|
||||
.by <price______________41
|
||||
.by <price______________42
|
||||
.by <price______________43
|
||||
.by <price______________44
|
||||
.by <price______________45
|
||||
.by <price______________46
|
||||
.by <price______________47
|
||||
; .by <price______________33
|
||||
; .by <price______________34
|
||||
; .by <price______________35
|
||||
; .by <price______________36
|
||||
; .by <price______________37
|
||||
; .by <price______________38
|
||||
; .by <price______________39
|
||||
; .by <price______________40
|
||||
; .by <price______________41
|
||||
; .by <price______________42
|
||||
; .by <price______________43
|
||||
; .by <price______________44
|
||||
; .by <price______________45
|
||||
; .by <price______________46
|
||||
; .by <price______________47
|
||||
.by <price_White_Flag_____
|
||||
.by <price_Battery________
|
||||
.by <price_Bal_Guidance___
|
||||
@@ -401,21 +401,21 @@ WeaponUnits
|
||||
.by 1 ;Buy_me_________
|
||||
.by 0 ;Plasma_Blast___
|
||||
.by 5 ;Laser__________
|
||||
.by 0 ;_____________33
|
||||
.by 0 ;_____________34
|
||||
.by 0 ;_____________35
|
||||
.by 0 ;_____________36
|
||||
.by 0 ;_____________37
|
||||
.by 0 ;_____________38
|
||||
.by 0 ;_____________39
|
||||
.by 0 ;_____________40
|
||||
.by 0 ;_____________41
|
||||
.by 0 ;_____________42
|
||||
.by 0 ;_____________43
|
||||
.by 0 ;_____________44
|
||||
.by 0 ;_____________45
|
||||
.by 0 ;_____________46
|
||||
.by 0 ;_____________47
|
||||
; .by 0 ;_____________33
|
||||
; .by 0 ;_____________34
|
||||
; .by 0 ;_____________35
|
||||
; .by 0 ;_____________36
|
||||
; .by 0 ;_____________37
|
||||
; .by 0 ;_____________38
|
||||
; .by 0 ;_____________39
|
||||
; .by 0 ;_____________40
|
||||
; .by 0 ;_____________41
|
||||
; .by 0 ;_____________42
|
||||
; .by 0 ;_____________43
|
||||
; .by 0 ;_____________44
|
||||
; .by 0 ;_____________45
|
||||
; .by 0 ;_____________46
|
||||
; .by 0 ;_____________47
|
||||
.by 1 ;White_Flag___48
|
||||
.by 3 ;Battery________
|
||||
.by 0 ;Bal_Guidance___
|
||||
@@ -488,8 +488,8 @@ WeaponSymbols
|
||||
.by $48,$49,$4a,$4b,$4c,$4d,$4e,$4f
|
||||
.by $50,$51,$52,$53,$54,$55,$56,$57
|
||||
.by $58,$59,$5a,$5b,$60,$7b,$1f,$7d
|
||||
.by $20,$00,$00,$00,$00,$00,$00,$00
|
||||
.by $00,$00,$00,$00,$00,$00,$00,$00
|
||||
.by $20 ;,$00,$00,$00,$00,$00,$00,$00
|
||||
;.by $00,$00,$00,$00,$00,$00,$00,$00
|
||||
.by $5f,$1c,$03,$06,$06,$0a,$1b,$1b ; defensives
|
||||
.by $1e,$3b,$3d,$3c,$3e,$3f,$1d,$7d
|
||||
|
||||
@@ -528,38 +528,38 @@ NamesOfWeapons ;the comment is an index in the tables
|
||||
dta d"Buy me! " ; 30
|
||||
dta d"Plasma Blast " ; 31
|
||||
dta d"Laser " ; 32
|
||||
dta d"----------------" ; 33
|
||||
dta d"----------------" ; 34
|
||||
dta d"----------------" ; 35
|
||||
dta d"----------------" ; 36
|
||||
dta d"----------------" ; 37
|
||||
dta d"----------------" ; 38
|
||||
dta d"----------------" ; 39
|
||||
dta d"----------------" ; 40
|
||||
dta d"----------------" ; 41
|
||||
dta d"----------------" ; 42
|
||||
dta d"----------------" ; 43
|
||||
dta d"----------------" ; 44
|
||||
dta d"----------------" ; 45
|
||||
dta d"----------------" ; 46
|
||||
dta d" " ; 47 ; special (no weapon) name to simplify display
|
||||
; dta d"----------------" ; 33
|
||||
; dta d"----------------" ; 34
|
||||
; dta d"----------------" ; 35
|
||||
; dta d"----------------" ; 36
|
||||
; dta d"----------------" ; 37
|
||||
; dta d"----------------" ; 38
|
||||
; dta d"----------------" ; 39
|
||||
; dta d"----------------" ; 40
|
||||
; dta d"----------------" ; 41
|
||||
; dta d"----------------" ; 42
|
||||
; dta d"----------------" ; 43
|
||||
; dta d"----------------" ; 44
|
||||
; dta d"----------------" ; 45
|
||||
; dta d"----------------" ; 46
|
||||
; dta d" " ; 47 ; special (no weapon) name to simplify display
|
||||
|
||||
dta d"White Flag " ; 48 ($30)
|
||||
dta d"Battery " ; 49
|
||||
dta d"Bal Guidance " ; 50
|
||||
dta d"Horz Guidance " ; 51
|
||||
dta d"Hovercraft " ; 52
|
||||
dta d"Lazy Boy " ; 53
|
||||
dta d"Parachute " ; 54 - no energy
|
||||
dta d"Strong Parachute" ; 55 - with energy (earlier Battery)
|
||||
dta d"Mag Deflector " ; 56 - with shield and energy
|
||||
dta d"Shield " ; 57 - shield for one shot - no energy
|
||||
dta d"Heavy Shield " ; 58 - shield with energy
|
||||
dta d"Force Shield " ; 59 - shield with energy and parachute
|
||||
dta d"Super Mag " ; 60
|
||||
dta d"Bouncy Castle " ; 61 - with shield and energy
|
||||
dta d"Long Schlong " ; 62
|
||||
dta d"Nuclear Winter " ; 63
|
||||
dta d"White Flag " ; 33
|
||||
dta d"Battery " ; 34
|
||||
dta d"Bal Guidance " ; 35
|
||||
dta d"Horz Guidance " ; 36
|
||||
dta d"Hovercraft " ; 37
|
||||
dta d"Lazy Boy " ; 38
|
||||
dta d"Parachute " ; 39 - no energy
|
||||
dta d"Strong Parachute" ; 40 - with energy (earlier Battery)
|
||||
dta d"Mag Deflector " ; 41 - with shield and energy
|
||||
dta d"Shield " ; 42 - shield for one shot - no energy
|
||||
dta d"Heavy Shield " ; 43 - shield with energy
|
||||
dta d"Force Shield " ; 44 - shield with energy and parachute
|
||||
dta d"Super Mag " ; 45
|
||||
dta d"Bouncy Castle " ; 46 - with shield and energy
|
||||
dta d"Long Schlong " ; 47
|
||||
dta d"Nuclear Winter " ; 48
|
||||
DefensiveEnergy = * - 48
|
||||
.by 00 ; White Flag
|
||||
.by 00 ; Heat Guidance
|
||||
@@ -577,7 +577,7 @@ DefensiveEnergy = * - 48
|
||||
.by 99 ; Bouncy Castle
|
||||
.by 00 ; Long Barrel
|
||||
.by 00 ; Nuclear Winter
|
||||
weaponsOfDeath
|
||||
weaponsOfDeath ; weapons used in tank death animations
|
||||
dta 1,2,3,7,17,18,19,20,21,22,23,24,25,26,27
|
||||
weaponsOfDeathEnd
|
||||
joyToKeyTable
|
||||
|
||||
+67
-64
@@ -13,7 +13,7 @@ PMGraph = $0800 ; real PM start = $0b00
|
||||
linetableL = $0b00 - (screenHeight+1)*2
|
||||
linetableH = $0b00 - (screenHeight+1)
|
||||
|
||||
display = $1010 ;screen takes $2K due to clearing routine
|
||||
display = $1010 ;screen takes $1f68 because it has screenHeight+1 lines because of out of screen tracer(?)
|
||||
|
||||
margin = 40 ;mountain drawing Y variable margin
|
||||
MaxPlayers = 6
|
||||
@@ -35,7 +35,6 @@ char_clear_flame_____ = $1c
|
||||
char_digger__________ = $04
|
||||
char_sandhog_________ = $0c
|
||||
char_sandhog_offset = char_sandhog_________ - char_digger__________
|
||||
|
||||
char_tank1___________ = $20
|
||||
char_tank2___________ = $24
|
||||
char_tank3___________ = $28
|
||||
@@ -74,39 +73,40 @@ price_Dirt_Charge____ = 343 ;_29
|
||||
price_Buy_me_________ = 170 ;430 ;_30
|
||||
price_Plasma_Blast___ = $ffff ;274 ;_31
|
||||
price_Laser__________ = 277 ;_32
|
||||
price______________33 = 0
|
||||
price______________34 = 0
|
||||
price______________35 = 0
|
||||
price______________36 = 0
|
||||
price______________37 = 0
|
||||
price______________38 = 0
|
||||
price______________39 = 0
|
||||
price______________40 = 0
|
||||
price______________41 = 0
|
||||
price______________42 = 0
|
||||
price______________43 = 0
|
||||
price______________44 = 0
|
||||
price______________45 = 0
|
||||
price______________46 = 0
|
||||
price______________47 = 0
|
||||
price_White_Flag_____ = $0 ;_48_($30)
|
||||
price_Battery________ = 300 ;_49
|
||||
price_Bal_Guidance___ = $ffff ;_50
|
||||
price_Horz_Guidance__ = $ffff ;_51
|
||||
price_Floating_Tank__ = 352 ;_52
|
||||
price_Lazy_Boy_______ = $ffff ;_53
|
||||
price_Parachute______ = 234 ;_54
|
||||
price_StrongParachute = 1000 ;_55
|
||||
price_Mag_Deflector__ = 745 ;_56
|
||||
price_Shield_________ = 224 ;_57
|
||||
price_Heavy_Shield___ = 628 ;_58
|
||||
price_Force_Shield___ = 1100 ;_59
|
||||
price_Super_Mag______ = $ffff ;_60
|
||||
price_Bouncy_Castle__ = 512 ;_61
|
||||
price_Long_Barrel____ = 2100 ;_62
|
||||
price_Nuclear_Winter_ = 1000 ;_63
|
||||
;price______________33 = 0
|
||||
;price______________34 = 0
|
||||
;price______________35 = 0
|
||||
;price______________36 = 0
|
||||
;price______________37 = 0
|
||||
;price______________38 = 0
|
||||
;price______________39 = 0
|
||||
;price______________40 = 0
|
||||
;price______________41 = 0
|
||||
;price______________42 = 0
|
||||
;price______________43 = 0
|
||||
;price______________44 = 0
|
||||
;price______________45 = 0
|
||||
;price______________46 = 0
|
||||
;price______________47 = 0
|
||||
price_White_Flag_____ = $0 ;_33
|
||||
price_Battery________ = 300 ;_34
|
||||
price_Bal_Guidance___ = $ffff ;_35
|
||||
price_Horz_Guidance__ = $ffff ;_36
|
||||
price_Floating_Tank__ = 352 ;_37
|
||||
price_Lazy_Boy_______ = $ffff ;_38
|
||||
price_Parachute______ = 234 ;_39
|
||||
price_StrongParachute = 1000 ;_40
|
||||
price_Mag_Deflector__ = 745 ;_41
|
||||
price_Shield_________ = 224 ;_42
|
||||
price_Heavy_Shield___ = 628 ;_43
|
||||
price_Force_Shield___ = 1100 ;_44
|
||||
price_Super_Mag______ = $ffff ;_45
|
||||
price_Bouncy_Castle__ = 512 ;_46
|
||||
price_Long_Barrel____ = 2100 ;_47
|
||||
price_Nuclear_Winter_ = 1000 ;_48
|
||||
;Weapon indexes (numbers)
|
||||
ind_Baby_Missile___ = 0
|
||||
first_offensive____ = ind_Baby_Missile___
|
||||
ind_Missile________ = 1
|
||||
ind_Baby_Nuke______ = 2
|
||||
ind_Nuke___________ = 3
|
||||
@@ -139,37 +139,40 @@ ind_Dirt_Charge____ = 29
|
||||
ind_Buy_me_________ = 30
|
||||
ind_Plasma_Blast___ = 31
|
||||
ind_Laser__________ = 32
|
||||
ind______________33 = 0
|
||||
ind______________34 = 0
|
||||
ind______________35 = 0
|
||||
ind______________36 = 0
|
||||
ind______________37 = 0
|
||||
ind______________38 = 0
|
||||
ind______________39 = 0
|
||||
ind______________40 = 0
|
||||
ind______________41 = 0
|
||||
ind______________42 = 0
|
||||
ind______________43 = 0
|
||||
ind______________44 = 0
|
||||
ind______________45 = 0
|
||||
ind______________46 = 0
|
||||
ind______________47 = 0
|
||||
ind_White_Flag_____ = 48
|
||||
ind_Battery________ = 49
|
||||
ind_Bal_Guidance___ = 50
|
||||
ind_Horz_Guidance__ = 51
|
||||
ind_Floating_Tank__ = 52
|
||||
ind_Lazy_Boy_______ = 53
|
||||
ind_Parachute______ = 54
|
||||
ind_StrongParachute = 55
|
||||
ind_Mag_Deflector__ = 56
|
||||
ind_Shield_________ = 57
|
||||
ind_Heavy_Shield___ = 58
|
||||
ind_Force_Shield___ = 59
|
||||
ind_Super_Mag______ = 60
|
||||
ind_Bouncy_Castle__ = 61
|
||||
ind_Long_Barrel____ = 62
|
||||
ind_Nuclear_Winter_ = 63
|
||||
last_offensive_____ = ind_Laser__________
|
||||
;ind______________33 = 0
|
||||
;ind______________34 = 0
|
||||
;ind______________35 = 0
|
||||
;ind______________36 = 0
|
||||
;ind______________37 = 0
|
||||
;ind______________38 = 0
|
||||
;ind______________39 = 0
|
||||
;ind______________40 = 0
|
||||
;ind______________41 = 0
|
||||
;ind______________42 = 0
|
||||
;ind______________43 = 0
|
||||
;ind______________44 = 0
|
||||
;ind______________45 = 0
|
||||
;ind______________46 = 0
|
||||
;ind______________47 = 0
|
||||
ind_White_Flag_____ = 33
|
||||
first_defensive____ = ind_White_Flag_____
|
||||
ind_Battery________ = 34
|
||||
ind_Bal_Guidance___ = 35
|
||||
ind_Horz_Guidance__ = 36
|
||||
ind_Floating_Tank__ = 37
|
||||
ind_Lazy_Boy_______ = 38
|
||||
ind_Parachute______ = 39
|
||||
ind_StrongParachute = 40
|
||||
ind_Mag_Deflector__ = 41
|
||||
ind_Shield_________ = 42
|
||||
ind_Heavy_Shield___ = 43
|
||||
ind_Force_Shield___ = 44
|
||||
ind_Super_Mag______ = 45
|
||||
ind_Bouncy_Castle__ = 46
|
||||
ind_Long_Barrel____ = 47
|
||||
ind_Nuclear_Winter_ = 48
|
||||
last_defensive_____ = ind_Nuclear_Winter_
|
||||
;--------------------------------
|
||||
; names of RMT instruments (sfx)
|
||||
;--------------------------------
|
||||
|
||||
+7
-10
@@ -154,7 +154,7 @@
|
||||
icl 'lib/macro.hea'
|
||||
|
||||
;splash screen and musix
|
||||
icl 'artwork/Scorch50.asm'
|
||||
;icl 'artwork/Scorch50.asm'
|
||||
|
||||
|
||||
;Game loading address
|
||||
@@ -1694,9 +1694,6 @@ noingame
|
||||
;----------------------------------------------
|
||||
icl 'artwork/talk.asm'
|
||||
;----------------------------------------------
|
||||
font4x4
|
||||
ins 'artwork/font4x4s.bmp',+62
|
||||
;----------------------------------------------
|
||||
TankFont
|
||||
ins 'artwork/tanksv3.fnt',+0,352 ; 44 characters only
|
||||
;----------------------------------------------
|
||||
@@ -1715,12 +1712,12 @@ MODUL equ $b000 ;address of RMT module
|
||||
ins "artwork/sfx/scorch_str4.rmt" ;include music RMT module
|
||||
opt h+
|
||||
;
|
||||
;
|
||||
TheEnd
|
||||
.ECHO 'TheEnd: ',TheEnd
|
||||
;.if TheEnd > PMGraph + $300
|
||||
; .error "memory conflict"
|
||||
;.endif
|
||||
;----------------------------------------------
|
||||
org $bf80
|
||||
font4x4
|
||||
ins 'artwork/font4x4s.bmp',+62
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
Binary file not shown.
+175
-171
@@ -272,8 +272,8 @@ AfterManualPurchase
|
||||
|
||||
mwa #ListOfDefensiveWeapons WeaponsListDL ;switch to the list of offensive weapons
|
||||
mva #$ff IsInventory
|
||||
mva #$01 WhichList
|
||||
; offensive weapon - 0, deffensive - 1
|
||||
mva #%10000000 WhichList
|
||||
; offensive weapon - 0, defensive - %10000000
|
||||
jmp Purchase.GoToActivation
|
||||
.endp
|
||||
;--------------------------------------------------
|
||||
@@ -288,15 +288,14 @@ AfterManualPurchase
|
||||
|
||||
; we are clearing list of the weapons
|
||||
mva #$00 WhichList
|
||||
; offensive weapon - 0, deffensive - 1
|
||||
; offensive weapon - 0, deffensive - %10000000
|
||||
GoToActivation
|
||||
mva #$ff LastWeapon
|
||||
|
||||
; mva #0 dmactl
|
||||
VDLI DLIinterruptText ; jsr SetDLI for text (purchase) screen
|
||||
jsr PMoutofScreen
|
||||
mwa #PurchaseDL dlptrs
|
||||
lda #@dmactl(narrow|dma) ; narro screen width, DL on, P/M off
|
||||
lda #@dmactl(narrow|dma) ; narrow screen width, DL on, P/M off
|
||||
sta dmactls
|
||||
|
||||
lda #song_supermarket
|
||||
@@ -346,6 +345,152 @@ AfterPurchase
|
||||
stx HowManyOnTheListOff ; amounts of weapons (shells, bullets) in both lists
|
||||
stx HowManyOnTheListDef
|
||||
|
||||
jsr CreateList
|
||||
|
||||
bit isInventory ;
|
||||
bpl ChoosingItemForPurchase
|
||||
|
||||
lda whichList
|
||||
bne PositionDefensive
|
||||
|
||||
; calculate positionOnTheList from the activeWeapon (offensives)
|
||||
ldx tankNr
|
||||
lda activeWeapon,x
|
||||
ldy #0
|
||||
@
|
||||
cmp IndexesOfWeaponsL1,y
|
||||
beq ?weaponfound
|
||||
iny
|
||||
cpy #(last_offensive_____ - first_offensive____) ; maxOffensiveWeapons
|
||||
bne @-
|
||||
; not found apparently?
|
||||
; TODO: check border case (the last weapon)
|
||||
ldy #0
|
||||
beq ?weaponFound ; jmp
|
||||
PositionDefensive
|
||||
jsr calcPosDefensive
|
||||
|
||||
|
||||
?weaponFound
|
||||
; weapon index in Y
|
||||
sty positionOnTheList
|
||||
|
||||
; Here we have all we need
|
||||
; So choose the weapon for purchase ......
|
||||
;--------------------------------------------------
|
||||
ChoosingItemForPurchase
|
||||
;--------------------------------------------------
|
||||
|
||||
jsr PutLitteChar ; Places pointer at the right position
|
||||
jsr getkey
|
||||
bit escFlag
|
||||
spl:jmp WaitForKeyRelease ; like jsr ... : rts
|
||||
cmp #$2c ; Tab
|
||||
jeq ListChange
|
||||
cmp #$06 ; cursor left
|
||||
jeq ListChange
|
||||
cmp #$0c ; Return
|
||||
sne:rts
|
||||
cmp #$e
|
||||
beq PurchaseKeyUp
|
||||
cmp #$f
|
||||
beq PurchaseKeyDown
|
||||
cmp #$21 ; Space
|
||||
jeq PurchaseWeaponNow
|
||||
cmp #$07 ; cursor right
|
||||
jeq PurchaseWeaponNow
|
||||
bne ChoosingItemForPurchase
|
||||
|
||||
PurchaseKeyUp
|
||||
lda WhichList
|
||||
bpl GoUpOffensive
|
||||
dec PositionOnTheList
|
||||
bpl EndUpX
|
||||
ldy #0 ;HowManyOnTheListDef
|
||||
;dey
|
||||
sty PositionOnTheList
|
||||
jmp ChoosingItemForPurchase
|
||||
GoUpOffensive
|
||||
dec PositionOnTheList
|
||||
bpl MakeOffsetUp
|
||||
ldy #0 ;HowManyOnTheListOff
|
||||
;dey
|
||||
sty PositionOnTheList
|
||||
|
||||
MakeOffsetUp
|
||||
; If offset is larger than pointer position,
|
||||
; it must be equal then.
|
||||
lda PositionOnTheList
|
||||
cmp OffsetDL1
|
||||
bcs EndUpX ; do not modify the offset
|
||||
sta OffsetDL1
|
||||
EndUpX
|
||||
jmp ChoosingItemForPurchase
|
||||
PurchaseKeyDown
|
||||
lda WhichList
|
||||
bpl GoDownOffensive
|
||||
inc:lda PositionOnTheList
|
||||
cmp HowManyOnTheListDef
|
||||
bne EndGoDownX
|
||||
ldy HowManyOnTheListDef
|
||||
dey
|
||||
sty PositionOnTheList
|
||||
jmp ChoosingItemForPurchase
|
||||
GoDownOffensive
|
||||
inc:lda PositionOnTheList
|
||||
cmp HowManyOnTheListOff
|
||||
bne MakeOffsetDown
|
||||
ldy HowManyOnTheListOff
|
||||
dey
|
||||
sty PositionOnTheList
|
||||
MakeOffsetDown
|
||||
lda OffsetDL1
|
||||
clc
|
||||
adc #15
|
||||
;if offset+16 is lower than the position then it must =16
|
||||
cmp PositionOnTheList
|
||||
bcs EndGoDownX
|
||||
sec
|
||||
lda PositionOnTheList
|
||||
sbc #15
|
||||
sta OffsetDL1
|
||||
EndGoDownX
|
||||
jmp ChoosingItemForPurchase
|
||||
|
||||
; swapping the displayed list and setting pointer to position 0
|
||||
ListChange
|
||||
mva #0 OffsetDL1
|
||||
|
||||
lda WhichList
|
||||
eor #%10000000 ; flip WhichList
|
||||
sta WhichList
|
||||
bne DeffensiveSelected
|
||||
|
||||
mwa #ListOfWeapons WeaponsListDL
|
||||
lda isInventory
|
||||
beq @+
|
||||
; inventory
|
||||
jsr calcPosOffensive
|
||||
jmp ChoosingItemForPurchase
|
||||
@
|
||||
mva #0 PositionOnTheList
|
||||
jmp ChoosingItemForPurchase
|
||||
|
||||
DeffensiveSelected
|
||||
mwa #ListOfDefensiveWeapons WeaponsListDL
|
||||
lda isInventory
|
||||
beq @+
|
||||
jsr calcPosDefensive
|
||||
jmp ChoosingItemForPurchase
|
||||
@
|
||||
mva #0 positionOnTheList
|
||||
jmp ChoosingItemForPurchase
|
||||
|
||||
.endp
|
||||
;
|
||||
;--------------------------------------------------
|
||||
.proc CreateList
|
||||
;--------------------------------------------------
|
||||
; Creating full list of the available weapons for displaying
|
||||
; in X there is an index of the weapon to be checked,
|
||||
; in 'Xbyte' address of the first char in filled screen line
|
||||
@@ -487,8 +632,8 @@ notInventory
|
||||
@
|
||||
cpx LastWeapon
|
||||
bne NotTheSameAsLastTime
|
||||
lda WhichList
|
||||
bne @+
|
||||
bit WhichList
|
||||
bmi @+
|
||||
lda HowManyOnTheListOff
|
||||
sta PositionOnTheList
|
||||
jmp NotTheSameAsLastTime
|
||||
@@ -498,7 +643,7 @@ notInventory
|
||||
NotTheSameAsLastTime
|
||||
; increase appropriate counter
|
||||
txa
|
||||
cpx #$30
|
||||
cpx #last_offensive_____+1
|
||||
bcs DefenceList
|
||||
ldy HowManyOnTheListOff
|
||||
sta IndexesOfWeaponsL1,y
|
||||
@@ -516,14 +661,15 @@ NoWeapon
|
||||
|
||||
; next weapon. If no more weapons then finish!
|
||||
inx
|
||||
cpx #$30
|
||||
cpx #last_offensive_____+1
|
||||
bne NoDefense
|
||||
|
||||
; if we got to the defense weapons,
|
||||
; we switch address to the second table.
|
||||
mwa #ListOfDefensiveWeapons xbyte
|
||||
NoDefense
|
||||
cpx #$40
|
||||
cpx #last_defensive_____+1
|
||||
|
||||
jne CreateList
|
||||
|
||||
; offset may be only too big
|
||||
@@ -541,7 +687,6 @@ WeHaveOffset
|
||||
|
||||
; Multiply number on list 1 by 32 and set address
|
||||
; of the first erased char.
|
||||
; (multiplying taken from book of Ruszczyc 'Assembler 6502'
|
||||
|
||||
lda HowManyOnTheListOff
|
||||
sta xbyte ; multiplier (temporarily here, it will be erased anyway)
|
||||
@@ -577,7 +722,7 @@ DoNotIncHigher1
|
||||
|
||||
; And the same we do with the second list
|
||||
|
||||
; Multiply number on list 1 by 40 and set address
|
||||
; Multiply number on list 1 by 32 and set address
|
||||
; of the first erased char.
|
||||
lda HowManyOnTheListDef
|
||||
sta xbyte ; multiplier (temporarily here, it will be erased anyway)
|
||||
@@ -614,157 +759,19 @@ DoNotIncHigher2
|
||||
; here we have pretty cool lists and there is no brute force
|
||||
; screen clearing at each list refresh
|
||||
; (it was very ugly - I checked it :)
|
||||
|
||||
bit isInventory ;
|
||||
bpl ChoosingItemForPurchase
|
||||
|
||||
lda whichList
|
||||
bne PositionDefensive
|
||||
|
||||
; calculate positionOnTheList from the activeWeapon (offensives)
|
||||
ldx tankNr
|
||||
lda activeWeapon,x
|
||||
ldy #0
|
||||
@
|
||||
cmp IndexesOfWeaponsL1,y
|
||||
beq ?weaponfound
|
||||
iny
|
||||
cpy #48 ; maxOffensiveWeapons
|
||||
bne @-
|
||||
; not found apparently?
|
||||
; TODO: check border case (the last weapon)
|
||||
ldy #0
|
||||
beq ?weaponFound ; jmp
|
||||
PositionDefensive
|
||||
jsr calcPosDefensive
|
||||
|
||||
|
||||
?weaponFound
|
||||
; weapon index in Y
|
||||
sty positionOnTheList
|
||||
|
||||
; Here we have all we need
|
||||
; So choose the weapon for purchase ......
|
||||
;--------------------------------------------------
|
||||
ChoosingItemForPurchase
|
||||
;--------------------------------------------------
|
||||
|
||||
jsr PutLitteChar ; Places pointer at the right position
|
||||
jsr getkey
|
||||
bit escFlag
|
||||
spl:jmp WaitForKeyRelease ; like jsr ... : rts
|
||||
cmp #$2c ; Tab
|
||||
jeq ListChange
|
||||
cmp #$06 ; cursor left
|
||||
jeq ListChange
|
||||
cmp #$0c ; Return
|
||||
sne:rts
|
||||
cmp #$e
|
||||
beq PurchaseKeyUp
|
||||
cmp #$f
|
||||
beq PurchaseKeyDown
|
||||
cmp #$21 ; Space
|
||||
jeq PurchaseWeaponNow
|
||||
cmp #$07 ; cursor right
|
||||
jeq PurchaseWeaponNow
|
||||
bne ChoosingItemForPurchase
|
||||
|
||||
PurchaseKeyUp
|
||||
lda WhichList
|
||||
beq GoUpOffensive
|
||||
dec PositionOnTheList
|
||||
bpl EndUpX
|
||||
ldy #0 ;HowManyOnTheListDef
|
||||
;dey
|
||||
sty PositionOnTheList
|
||||
jmp ChoosingItemForPurchase
|
||||
GoUpOffensive
|
||||
dec PositionOnTheList
|
||||
bpl MakeOffsetUp
|
||||
ldy #0 ;HowManyOnTheListOff
|
||||
;dey
|
||||
sty PositionOnTheList
|
||||
|
||||
MakeOffsetUp
|
||||
; If offset is larger than pointer position,
|
||||
; it must be equal then.
|
||||
lda PositionOnTheList
|
||||
cmp OffsetDL1
|
||||
bcs EndUpX ; do not modify the offset
|
||||
sta OffsetDL1
|
||||
EndUpX
|
||||
jmp ChoosingItemForPurchase
|
||||
PurchaseKeyDown
|
||||
lda WhichList
|
||||
beq GoDownOffensive
|
||||
inc:lda PositionOnTheList
|
||||
cmp HowManyOnTheListDef
|
||||
bne EndGoDownX
|
||||
ldy HowManyOnTheListDef
|
||||
dey
|
||||
sty PositionOnTheList
|
||||
jmp ChoosingItemForPurchase
|
||||
GoDownOffensive
|
||||
inc:lda PositionOnTheList
|
||||
cmp HowManyOnTheListOff
|
||||
bne MakeOffsetDown
|
||||
ldy HowManyOnTheListOff
|
||||
dey
|
||||
sty PositionOnTheList
|
||||
MakeOffsetDown
|
||||
lda OffsetDL1
|
||||
clc
|
||||
adc #15
|
||||
;if offset+16 is lower than the position then it must =16
|
||||
cmp PositionOnTheList
|
||||
bcs EndGoDownX
|
||||
sec
|
||||
lda PositionOnTheList
|
||||
sbc #15
|
||||
sta OffsetDL1
|
||||
EndGoDownX
|
||||
jmp ChoosingItemForPurchase
|
||||
|
||||
; swapping the displayed list and setting pointer to position 0
|
||||
ListChange
|
||||
mva #0 OffsetDL1
|
||||
|
||||
lda WhichList
|
||||
eor #$01
|
||||
sta WhichList
|
||||
bne DeffensiveSelected
|
||||
|
||||
mwa #ListOfWeapons WeaponsListDL
|
||||
lda isInventory
|
||||
beq @+
|
||||
; inventory
|
||||
jsr calcPosOffensive
|
||||
jmp ChoosingItemForPurchase
|
||||
@
|
||||
mva #0 PositionOnTheList
|
||||
jmp ChoosingItemForPurchase
|
||||
|
||||
DeffensiveSelected
|
||||
mwa #ListOfDefensiveWeapons WeaponsListDL
|
||||
lda isInventory
|
||||
beq @+
|
||||
jsr calcPosDefensive
|
||||
jmp ChoosingItemForPurchase
|
||||
@
|
||||
mva #0 positionOnTheList
|
||||
jmp ChoosingItemForPurchase
|
||||
|
||||
rts
|
||||
.endp
|
||||
; weapon purchase routne increases number of possessed bullets
|
||||
; decreases cash and jumps to screen refresh
|
||||
|
||||
;--------------------------------------------------
|
||||
.proc PurchaseWeaponNow
|
||||
; weapon purchase routne increases number of possessed bullets
|
||||
; decreases cash and jumps to screen refresh
|
||||
;--------------------------------------------------
|
||||
bit isInventory
|
||||
bmi inventorySelect
|
||||
|
||||
lda WhichList
|
||||
bne PurchaseDeffensive
|
||||
bit WhichList
|
||||
bmi PurchaseDeffensive
|
||||
|
||||
; here we purchase the offensive weapon
|
||||
ldy PositionOnTheList
|
||||
@@ -836,8 +843,8 @@ LessThan100
|
||||
jmp Purchase.AfterPurchase
|
||||
|
||||
inventorySelect
|
||||
lda whichList
|
||||
bne invSelectDef
|
||||
bit whichList
|
||||
bmi invSelectDef
|
||||
|
||||
ldy PositionOnTheList
|
||||
lda IndexesOfWeaponsL1,y
|
||||
@@ -909,7 +916,7 @@ DefActivationEnd
|
||||
cmp IndexesOfWeaponsL2,y
|
||||
beq ?weaponfound
|
||||
iny
|
||||
cpy #8*2 ; maxDefensiveWeapon
|
||||
cpy #(last_defensive_____ - first_defensive____) ; maxDefensiveWeapon
|
||||
bne @-
|
||||
; not found apparently?
|
||||
; TODO: check border case (the last weapon)
|
||||
@@ -932,7 +939,7 @@ DefActivationEnd
|
||||
cmp IndexesOfWeaponsL1,y
|
||||
beq ?weaponfound
|
||||
iny
|
||||
cpy #8*5 ; maxOffensiveWeapon
|
||||
cpy #(last_offensive_____ - first_offensive____) ; maxOffensiveWeapon
|
||||
bne @-
|
||||
; not found apparently?
|
||||
; TODO: check border case (the last weapon)
|
||||
@@ -948,25 +955,25 @@ DefActivationEnd
|
||||
.proc PutLitteChar
|
||||
; first let's clear both lists from little chars
|
||||
mwa #ListOfWeapons xbyte
|
||||
ldx #52 ; there are 52 lines total
|
||||
ldx #last_defensive_____ ; there are 52 lines total
|
||||
ldy #$00
|
||||
EraseLoop
|
||||
tya ; lda #$00
|
||||
sta (xbyte),y
|
||||
adw xbyte #32
|
||||
adw xbyte #32 ; narrow screen
|
||||
dex
|
||||
bpl EraseLoop
|
||||
|
||||
; now let's check which list is active now
|
||||
lda WhichList
|
||||
beq CharToList1
|
||||
bit WhichList
|
||||
bpl CharToList1
|
||||
; we are on the second list (deffensive)
|
||||
; so there is no problem with scrolling
|
||||
mwa #ListOfDefensiveWeapons xbyte
|
||||
ldx PositionOnTheList
|
||||
beq SelectList2 ; if there is 0 we add nothing
|
||||
AddLoop2
|
||||
adw xbyte #32
|
||||
adw xbyte #32 ; narrow screen
|
||||
dex
|
||||
bne AddLoop2
|
||||
SelectList2
|
||||
@@ -988,7 +995,7 @@ CharToList1
|
||||
ldx PositionOnTheList
|
||||
beq SelectList1 ; if there is 0 we add nothing
|
||||
AddLoop1
|
||||
adw xbyte #32
|
||||
adw xbyte #32 ; narrow screen
|
||||
dex
|
||||
bne AddLoop1
|
||||
SelectList1
|
||||
@@ -999,7 +1006,7 @@ SelectList1
|
||||
ldx OffsetDL1
|
||||
beq SetWindowList1 ; if zero then add nothing
|
||||
LoopWindow1
|
||||
adw xbyte #32
|
||||
adw xbyte #32 ; narrow screen
|
||||
dex
|
||||
bne LoopWindow1
|
||||
SetWindowList1
|
||||
@@ -1021,7 +1028,7 @@ NoArrowUp
|
||||
ldx #<EmptyLine
|
||||
ldy #>EmptyLine
|
||||
sec
|
||||
sbc #17
|
||||
sbc #17 ; ????
|
||||
bmi NoArrowDown
|
||||
cmp OffsetDL1
|
||||
bcc NoArrowDown
|
||||
@@ -1036,9 +1043,6 @@ NoArrowDown
|
||||
.proc EnterPlayerNames
|
||||
;entering names of players
|
||||
mwa #NameDL dlptrs
|
||||
; lda dmactls
|
||||
; and #$fc
|
||||
; ora #$01 ; narrow screen (32 chars)
|
||||
lda #%00110001 ; narrow screen width, DL on, P/M off
|
||||
sta dmactls
|
||||
VDLI DLIinterruptText ; jsr SetDLI for text (names) screen
|
||||
|
||||
+4
-4
@@ -152,7 +152,7 @@ LowResDistances ; coarse tank positions divided by 4 (to be in just one byte)
|
||||
;----------------------------------------------------
|
||||
TargetTankNr ; Target tank index (for AI routines)
|
||||
.DS 1
|
||||
SecondTryFlag ; For precize aiming AI
|
||||
SecondTryFlag ; For precise AI aiming
|
||||
.DS 1
|
||||
;----------------------------------------------------
|
||||
;Erase .DS 1 ; if 1 only mask of the character is printed
|
||||
@@ -273,9 +273,9 @@ temptankNr .DS 1
|
||||
; tables with indexes of weapons on the right lists
|
||||
; OK (2022) so, L1 is list of offensive weapons, L2 - defensive
|
||||
IndexesOfWeaponsL1
|
||||
.ds 8*5 ; max 40 offensive weapons. this is wrong, should be 48, still only 32 defined.
|
||||
.ds (last_offensive_____ - first_offensive____)
|
||||
IndexesOfWeaponsL2
|
||||
.ds 8*2 ; max 16 defensive weapons.
|
||||
.ds (last_defensive_____ - first_defensive____)
|
||||
;----------------------------------------------------
|
||||
|
||||
; variables storing amount of weapons on the first and second
|
||||
@@ -294,7 +294,7 @@ LastWeapon
|
||||
; and the cursor must be placed elsewhere
|
||||
.DS 1
|
||||
WhichList ; list currently on the screen
|
||||
; (0-offensive, 1-defensive)
|
||||
; (0-offensive, %10000000 - defensive (check with bit:bmi for defensives)
|
||||
.DS 1
|
||||
;OffsetDL1 .DS 1 ; offset of the list screen (how many lines)....
|
||||
|
||||
|
||||
Reference in New Issue
Block a user