New weapon - Auto Defense! And AI bugfixes
This commit is contained in:
@@ -44,6 +44,7 @@ loop
|
|||||||
|
|
||||||
; common values used in AI routines
|
; common values used in AI routines
|
||||||
; address of weapons table (for future use)
|
; address of weapons table (for future use)
|
||||||
|
WepTableToTemp
|
||||||
lda TanksWeaponsTableL,x
|
lda TanksWeaponsTableL,x
|
||||||
sta temp
|
sta temp
|
||||||
lda TanksWeaponsTableH,x
|
lda TanksWeaponsTableH,x
|
||||||
@@ -210,6 +211,19 @@ AngleTable ; 16 bytes ;ba w $348b L$3350
|
|||||||
.endp
|
.endp
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
.proc UseBatteryOrFlag
|
.proc UseBatteryOrFlag
|
||||||
|
jsr UseBattery ; as subroutine for reuse in AutoDefense
|
||||||
|
; if very low energy and no battery then use White Flag
|
||||||
|
lda Energy,x
|
||||||
|
cmp #5
|
||||||
|
bcs EnoughEnergy
|
||||||
|
; lower than 5 units - white flag
|
||||||
|
lda #ind_White_Flag_____
|
||||||
|
sta ActiveDefenceWeapon,x
|
||||||
|
EnoughEnergy
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
;
|
||||||
|
.proc UseBattery
|
||||||
; if low energy ten use battery
|
; if low energy ten use battery
|
||||||
lda Energy,x
|
lda Energy,x
|
||||||
cmp #30
|
cmp #30
|
||||||
@@ -219,20 +233,13 @@ AngleTable ; 16 bytes ;ba w $348b L$3350
|
|||||||
lda (temp),y ; has address of TanksWeaponsTable
|
lda (temp),y ; has address of TanksWeaponsTable
|
||||||
beq NoBatteries
|
beq NoBatteries
|
||||||
; we have batteries - use one
|
; we have batteries - use one
|
||||||
clc
|
sec
|
||||||
sbc #1
|
sbc #1
|
||||||
sta (temp),y
|
sta (temp),y
|
||||||
lda #99
|
lda #99
|
||||||
sta Energy,x
|
sta Energy,x
|
||||||
NoBatteries
|
|
||||||
; if very low energy and no battery then use White Flag
|
|
||||||
lda Energy,x
|
|
||||||
cmp #5
|
|
||||||
bcs EnoughEnergy
|
|
||||||
; lower than 5 units - white flag
|
|
||||||
lda #ind_White_Flag_____
|
|
||||||
sta ActiveDefenceWeapon,x
|
|
||||||
EnoughEnergy
|
EnoughEnergy
|
||||||
|
NoBatteries
|
||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
@@ -245,7 +252,7 @@ EnoughEnergy
|
|||||||
; first check check if any is in use
|
; first check check if any is in use
|
||||||
lda ActiveDefenceWeapon,x
|
lda ActiveDefenceWeapon,x
|
||||||
bne DefensiveInUse
|
bne DefensiveInUse
|
||||||
ldy #last_defensive_____+1 ;the last defensive weapon
|
ldy #last_real_defensive+1 ;the last defensive weapon
|
||||||
@
|
@
|
||||||
dey
|
dey
|
||||||
cpy #ind_Battery________ ;first defensive weapon (White Flag and Battery - never use)
|
cpy #ind_Battery________ ;first defensive weapon (White Flag and Battery - never use)
|
||||||
@@ -253,7 +260,7 @@ EnoughEnergy
|
|||||||
lda (temp),y ; has address of TanksWeaponsTable
|
lda (temp),y ; has address of TanksWeaponsTable
|
||||||
beq @-
|
beq @-
|
||||||
; decrease in inventory
|
; decrease in inventory
|
||||||
clc
|
sec
|
||||||
sbc #1
|
sbc #1
|
||||||
sta (temp),y ; has address of TanksWeaponsTable
|
sta (temp),y ; has address of TanksWeaponsTable
|
||||||
; activate defensive weapon
|
; activate defensive weapon
|
||||||
@@ -280,7 +287,7 @@ DefensiveInUse
|
|||||||
; first check check if any is in use
|
; first check check if any is in use
|
||||||
lda ActiveDefenceWeapon,x
|
lda ActiveDefenceWeapon,x
|
||||||
bne DefensiveInUse
|
bne DefensiveInUse
|
||||||
ldy #last_defensive_____+1 ;the last defensive weapon
|
ldy #last_real_defensive+1 ;the last defensive weapon
|
||||||
@
|
@
|
||||||
dey
|
dey
|
||||||
cpy #ind_Battery________ ;first defensive weapon (White Flag and Battery - never use)
|
cpy #ind_Battery________ ;first defensive weapon (White Flag and Battery - never use)
|
||||||
@@ -288,7 +295,7 @@ DefensiveInUse
|
|||||||
lda (temp),y ; has address of TanksWeaponsTable
|
lda (temp),y ; has address of TanksWeaponsTable
|
||||||
beq @-
|
beq @-
|
||||||
; decrease in inventory
|
; decrease in inventory
|
||||||
clc
|
sec
|
||||||
sbc #1
|
sbc #1
|
||||||
sta (temp),y ; has address of TanksWeaponsTable
|
sta (temp),y ; has address of TanksWeaponsTable
|
||||||
; activate defensive weapon
|
; activate defensive weapon
|
||||||
@@ -575,7 +582,7 @@ skipThisPlayer
|
|||||||
asl
|
asl
|
||||||
tay
|
tay
|
||||||
; force correction - lower tank Y position - higher possible force
|
; force correction - lower tank Y position - higher possible force
|
||||||
clc
|
sec
|
||||||
lda #screenheight
|
lda #screenheight
|
||||||
sbc Ytankstable,x
|
sbc Ytankstable,x
|
||||||
sta temp2
|
sta temp2
|
||||||
|
|||||||
+8
-2
@@ -276,6 +276,7 @@ WeaponPriceH ; weapons prices (tables with prices of weapons)
|
|||||||
.by >price_Nuclear_Winter_
|
.by >price_Nuclear_Winter_
|
||||||
.by >price_Lazy_Boy_______
|
.by >price_Lazy_Boy_______
|
||||||
.by >price_Lazy_Darwin____
|
.by >price_Lazy_Darwin____
|
||||||
|
.by >price_Auto_Defense___
|
||||||
WeaponPriceL
|
WeaponPriceL
|
||||||
.by <price_Baby_Missile___
|
.by <price_Baby_Missile___
|
||||||
.by <price_Missile________
|
.by <price_Missile________
|
||||||
@@ -323,6 +324,7 @@ WeaponPriceL
|
|||||||
.by <price_Nuclear_Winter_
|
.by <price_Nuclear_Winter_
|
||||||
.by <price_Lazy_Boy_______
|
.by <price_Lazy_Boy_______
|
||||||
.by <price_Lazy_Darwin____
|
.by <price_Lazy_Darwin____
|
||||||
|
.by <price_Auto_Defense___
|
||||||
|
|
||||||
;-------------------------------------------------
|
;-------------------------------------------------
|
||||||
; how many units (bulletd) of a given weapon we get for a given price
|
; how many units (bulletd) of a given weapon we get for a given price
|
||||||
@@ -377,6 +379,7 @@ WeaponUnits
|
|||||||
.by 1 ;Nuclear_Winter_;_43
|
.by 1 ;Nuclear_Winter_;_43
|
||||||
.by 2 ;Lazy_Boy_______;_44
|
.by 2 ;Lazy_Boy_______;_44
|
||||||
.by 2 ;Lazy_Darwin____;_45
|
.by 2 ;Lazy_Darwin____;_45
|
||||||
|
.by 2 ;Auto_Defense___;_46
|
||||||
|
|
||||||
PurchaseMeTable ;weapons good to be purchased by the robot
|
PurchaseMeTable ;weapons good to be purchased by the robot
|
||||||
;the comment is an index in the tables
|
;the comment is an index in the tables
|
||||||
@@ -396,7 +399,7 @@ PurchaseMeTable ;weapons good to be purchased by the robot
|
|||||||
; "Strong Parachute","Mag Deflector ","Shield ","Heavy Shield "
|
; "Strong Parachute","Mag Deflector ","Shield ","Heavy Shield "
|
||||||
.by %01011111
|
.by %01011111
|
||||||
; "Force Shield ","Bouncy Castle ","Long Barrel ","Nuclear Winter "
|
; "Force Shield ","Bouncy Castle ","Long Barrel ","Nuclear Winter "
|
||||||
; "Lazy Boy ","Lazy Darwin "
|
; "Lazy Boy ","Lazy Darwin ","Auto Defense "
|
||||||
.by %11000000
|
.by %11000000
|
||||||
|
|
||||||
PurchaseMeTable2 ;weapons good to be purchased by the robot (Cyborg)
|
PurchaseMeTable2 ;weapons good to be purchased by the robot (Cyborg)
|
||||||
@@ -417,7 +420,7 @@ PurchaseMeTable2 ;weapons good to be purchased by the robot (Cyborg)
|
|||||||
; "Strong Parachute","Mag Deflector ","Shield ","Heavy Shield "
|
; "Strong Parachute","Mag Deflector ","Shield ","Heavy Shield "
|
||||||
.by %01001101
|
.by %01001101
|
||||||
; "Force Shield ","Bouncy Castle ","Long Barrel ","Nuclear Winter "
|
; "Force Shield ","Bouncy Castle ","Long Barrel ","Nuclear Winter "
|
||||||
; "Lazy Boy ","Lazy Darwin "
|
; "Lazy Boy ","Lazy Darwin ","Auto Defense "
|
||||||
.by %11000000
|
.by %11000000
|
||||||
|
|
||||||
;-------------------------------------------------
|
;-------------------------------------------------
|
||||||
@@ -469,6 +472,7 @@ WeaponSymbols
|
|||||||
.by $7d ;ind_Nuclear_Winter_ ;_43
|
.by $7d ;ind_Nuclear_Winter_ ;_43
|
||||||
.by $02 ;ind_Lazy_Boy_______ ;_44
|
.by $02 ;ind_Lazy_Boy_______ ;_44
|
||||||
.by $03 ;ind_Lazy_Darwin____ ;_45
|
.by $03 ;ind_Lazy_Darwin____ ;_45
|
||||||
|
.by $5e ;ind_Auto_Defense___ ;_46
|
||||||
|
|
||||||
; Names of weapons (16 chars long)
|
; Names of weapons (16 chars long)
|
||||||
NamesOfWeapons ;the comment is an index in the tables
|
NamesOfWeapons ;the comment is an index in the tables
|
||||||
@@ -519,6 +523,7 @@ NamesOfWeapons ;the comment is an index in the tables
|
|||||||
dta d"Nuclear Winter " ; 43
|
dta d"Nuclear Winter " ; 43
|
||||||
dta d"Lazy Boy " ; 44
|
dta d"Lazy Boy " ; 44
|
||||||
dta d"Lazy Darwin " ; 45
|
dta d"Lazy Darwin " ; 45
|
||||||
|
dta d"Auto Defense " ; 46
|
||||||
|
|
||||||
DefensiveEnergy = *-(last_offensive_____ - first_offensive____ +1) ; to fake the table for ALL weapons
|
DefensiveEnergy = *-(last_offensive_____ - first_offensive____ +1) ; to fake the table for ALL weapons
|
||||||
.by 00 ; White Flag
|
.by 00 ; White Flag
|
||||||
@@ -535,6 +540,7 @@ DefensiveEnergy = *-(last_offensive_____ - first_offensive____ +1) ; to fake th
|
|||||||
.by 00 ; Nuclear Winter
|
.by 00 ; Nuclear Winter
|
||||||
.by 00 ; Lazy Boy
|
.by 00 ; Lazy Boy
|
||||||
.by 00 ; Lazy Darwin
|
.by 00 ; Lazy Darwin
|
||||||
|
.by 00 ; Auto Defense
|
||||||
weaponsOfDeath ; weapons used in tank death animations
|
weaponsOfDeath ; weapons used in tank death animations
|
||||||
dta 1,2,3,7,17,18,19,20,21,22,23,24,25,26,27
|
dta 1,2,3,7,17,18,19,20,21,22,23,24,25,26,27
|
||||||
weaponsOfDeathEnd
|
weaponsOfDeathEnd
|
||||||
|
|||||||
+4
-1
@@ -86,6 +86,7 @@ price_Long_Barrel____ = 2100 ;_42
|
|||||||
price_Nuclear_Winter_ = 1000 ;_43
|
price_Nuclear_Winter_ = 1000 ;_43
|
||||||
price_Lazy_Boy_______ = 500 ;_44
|
price_Lazy_Boy_______ = 500 ;_44
|
||||||
price_Lazy_Darwin____ = 500 ;_45
|
price_Lazy_Darwin____ = 500 ;_45
|
||||||
|
price_Auto_Defense___ = 150 ;_46
|
||||||
;Weapon indexes (numbers)
|
;Weapon indexes (numbers)
|
||||||
ind_Baby_Missile___ = 0
|
ind_Baby_Missile___ = 0
|
||||||
first_offensive____ = ind_Baby_Missile___
|
first_offensive____ = ind_Baby_Missile___
|
||||||
@@ -136,7 +137,9 @@ ind_Long_Barrel____ = 42
|
|||||||
ind_Nuclear_Winter_ = 43
|
ind_Nuclear_Winter_ = 43
|
||||||
ind_Lazy_Boy_______ = 44
|
ind_Lazy_Boy_______ = 44
|
||||||
ind_Lazy_Darwin____ = 45
|
ind_Lazy_Darwin____ = 45
|
||||||
last_defensive_____ = ind_Lazy_Darwin____
|
ind_Auto_Defense___ = 46
|
||||||
|
last_defensive_____ = ind_Auto_Defense___
|
||||||
|
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)
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
|
|||||||
+18
-2
@@ -324,6 +324,7 @@ MainGameLoop
|
|||||||
jsr SetWallsType
|
jsr SetWallsType
|
||||||
; first set default barrel lengths (fix for Long Schlong activation :) )
|
; first set default barrel lengths (fix for Long Schlong activation :) )
|
||||||
; we must do it before purchase/activate
|
; we must do it before purchase/activate
|
||||||
|
; and set Auto Defense to off
|
||||||
jsr SetStandardBarrels
|
jsr SetStandardBarrels
|
||||||
|
|
||||||
jsr CallPurchaseForEveryTank
|
jsr CallPurchaseForEveryTank
|
||||||
@@ -612,6 +613,19 @@ DoNotFinishTheRound
|
|||||||
jmp Seppuku
|
jmp Seppuku
|
||||||
|
|
||||||
@
|
@
|
||||||
|
; Auto Defense - activates defensives
|
||||||
|
ldx NumberOfPlayers
|
||||||
|
dex
|
||||||
|
CheckNextTankAD
|
||||||
|
lda Energy,x
|
||||||
|
beq @+
|
||||||
|
lda AutoDefenseFlag,x
|
||||||
|
beq @+
|
||||||
|
; run auto defense for tank in X
|
||||||
|
jsr AutoDefense
|
||||||
|
@ dex
|
||||||
|
bpl CheckNextTankAD
|
||||||
|
;
|
||||||
ldx TankSequencePointer
|
ldx TankSequencePointer
|
||||||
lda TankSequence,x
|
lda TankSequence,x
|
||||||
sta TankNr
|
sta TankNr
|
||||||
@@ -1129,8 +1143,10 @@ MakeTanksVisible
|
|||||||
;--------------------------------------------------
|
;--------------------------------------------------
|
||||||
.proc SetStandardBarrels
|
.proc SetStandardBarrels
|
||||||
ldx #maxPlayers-1
|
ldx #maxPlayers-1
|
||||||
lda #StandardBarrel ; standard barrel length
|
@ lda #StandardBarrel ; standard barrel length
|
||||||
@ sta BarrelLength,x
|
sta BarrelLength,x
|
||||||
|
lda #$00 ; deactivate Auto Defense
|
||||||
|
sta AutoDefenseFlag,x
|
||||||
dex
|
dex
|
||||||
bpl @-
|
bpl @-
|
||||||
rts
|
rts
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -848,6 +848,13 @@ invSelectDef
|
|||||||
ply
|
ply
|
||||||
jmp DecreaseDefensive ; bypass activation
|
jmp DecreaseDefensive ; bypass activation
|
||||||
NotBattery
|
NotBattery
|
||||||
|
cmp #ind_Auto_Defense___
|
||||||
|
bne NoAutoDefense
|
||||||
|
; Auto Defense - do it like battery
|
||||||
|
mva #sfx_battery sfx_effect
|
||||||
|
mva #$A1 AutoDefenseFlag,x ; this is "A" in inverse - for status line :)
|
||||||
|
jmp DecreaseDefensive ; bypass activation
|
||||||
|
NoAutoDefense
|
||||||
cmp #ind_Lazy_Boy_______
|
cmp #ind_Lazy_Boy_______
|
||||||
bne NoLazyBoy
|
bne NoLazyBoy
|
||||||
; Lazy Boy - do it like battery
|
; Lazy Boy - do it like battery
|
||||||
@@ -2343,6 +2350,8 @@ EndOfCredits
|
|||||||
;---------------------
|
;---------------------
|
||||||
;displaying name of the defence weapon (if active)
|
;displaying name of the defence weapon (if active)
|
||||||
;---------------------
|
;---------------------
|
||||||
|
lda AutoDefenseFlag,x ; Auto Defense symbol (space or "A" in inverse)
|
||||||
|
sta statusBuffer+80+21
|
||||||
lda #$08 ; (
|
lda #$08 ; (
|
||||||
sta statusBuffer+80+22
|
sta statusBuffer+80+22
|
||||||
lda #$09 ; )
|
lda #$09 ; )
|
||||||
|
|||||||
+3
-1
@@ -126,7 +126,9 @@ BarrelLength ;length of the tank barrel - dont forget to set it to 6 at round st
|
|||||||
ActiveWeapon ;number of the selected weapon
|
ActiveWeapon ;number of the selected weapon
|
||||||
.DS MaxPlayers
|
.DS MaxPlayers
|
||||||
ActiveDefenceWeapon ;number of the activated defence weapon - 0
|
ActiveDefenceWeapon ;number of the activated defence weapon - 0
|
||||||
.DS MaxPlayers
|
.DS MaxPlayers
|
||||||
|
AutoDefenseFlag ; 0 - not activated, >$7f - activated
|
||||||
|
.DS MaxPlayers
|
||||||
WeaponDepleted .DS 1 ; if 0 deactivate the weapon and switch to Baby Missile
|
WeaponDepleted .DS 1 ; if 0 deactivate the weapon and switch to Baby Missile
|
||||||
;----------------------------------------------------
|
;----------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
+11
-1
@@ -2418,7 +2418,17 @@ InverseScreenByte
|
|||||||
sta (temp),y
|
sta (temp),y
|
||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
|
; -------------------------------------------------
|
||||||
|
.proc AutoDefense
|
||||||
|
; -------------------------------------------------
|
||||||
|
; This routine is run from inside of the main loop
|
||||||
|
; X - index of tank
|
||||||
|
; -------------------------------------------------
|
||||||
|
jsr PrepareAIShoot.WepTableToTemp
|
||||||
|
jsr UseBattery
|
||||||
|
jsr TosserDefensives
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
; -------------------------------------------------
|
; -------------------------------------------------
|
||||||
.proc TankFlying
|
.proc TankFlying
|
||||||
; -------------------------------------------------
|
; -------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user