mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-20 22:33:43 +02:00
Cyborg & Spoiler aims better
This commit is contained in:
@@ -212,21 +212,6 @@ AngleTable ; 16 bytes ;ba w $348b L$3350
|
|||||||
.by 18,26,34,43,50,58,66,74
|
.by 18,26,34,43,50,58,66,74
|
||||||
.endp
|
.endp
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
.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
|
|
||||||
jsr ClearTankNr ; we must hide tank to erase shields (issue #138)
|
|
||||||
lda #ind_White_Flag
|
|
||||||
sta ActiveDefenceWeapon,x
|
|
||||||
jsr PutTankNr ; and draw tank witch Flag
|
|
||||||
EnoughEnergy
|
|
||||||
rts
|
|
||||||
.endp
|
|
||||||
;
|
|
||||||
.proc CyborgBattery
|
.proc CyborgBattery
|
||||||
; cyborg is smarter :)
|
; cyborg is smarter :)
|
||||||
; if have more than 2 batteries and less than 60 of energy
|
; if have more than 2 batteries and less than 60 of energy
|
||||||
@@ -251,6 +236,22 @@ LowBatteries
|
|||||||
; if low energy ten use battery (no RTS :) )
|
; if low energy ten use battery (no RTS :) )
|
||||||
.endp
|
.endp
|
||||||
;
|
;
|
||||||
|
.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
|
||||||
|
jsr ClearTankNr ; we must hide tank to erase shields (issue #138)
|
||||||
|
lda #ind_White_Flag
|
||||||
|
sta ActiveDefenceWeapon,x
|
||||||
|
jsr PutTankNr ; and draw tank witch Flag
|
||||||
|
clc
|
||||||
|
EnoughEnergy
|
||||||
|
rts ; Carry = 0 - White Flag , Carry = 1 - We don't give up :)
|
||||||
|
.endp
|
||||||
|
;
|
||||||
.proc UseBattery
|
.proc UseBattery
|
||||||
; if low energy ten use battery
|
; if low energy ten use battery
|
||||||
lda Energy,x
|
lda Energy,x
|
||||||
@@ -379,7 +380,7 @@ HighForce
|
|||||||
jsr FindBestTarget3
|
jsr FindBestTarget3
|
||||||
sty TargetTankNr
|
sty TargetTankNr
|
||||||
; aiming
|
; aiming
|
||||||
jsr TakeAim ; direction still in A (0 - left, >0 - right)
|
jsr TakeAimExtra ; direction still in A (0 - left, >0 - right)
|
||||||
|
|
||||||
; choose the best weapon
|
; choose the best weapon
|
||||||
jsr ChooseBestOffensive
|
jsr ChooseBestOffensive
|
||||||
@@ -411,8 +412,7 @@ HighForce
|
|||||||
jsr FindBestTarget3
|
jsr FindBestTarget3
|
||||||
sty TargetTankNr
|
sty TargetTankNr
|
||||||
; aiming
|
; aiming
|
||||||
jsr TakeAim ; direction still in A (0 - left, >0 - right)
|
jsr TakeAimExtra ; direction still in A (0 - left, >0 - right)
|
||||||
|
|
||||||
; choose the best weapon
|
; choose the best weapon
|
||||||
ldy #ind_Nuke +1
|
ldy #ind_Nuke +1
|
||||||
jsr ChooseBestOffensive.NotFromAll
|
jsr ChooseBestOffensive.NotFromAll
|
||||||
@@ -549,9 +549,10 @@ skipThisPlayer
|
|||||||
; returns angle and power of shoot tank X (TankNr)
|
; returns angle and power of shoot tank X (TankNr)
|
||||||
; in the appropriate variables (Angle and Force)
|
; in the appropriate variables (Angle and Force)
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
|
mva #$ff SecondTryFlag
|
||||||
|
NoSecondTry
|
||||||
lda ActiveWeapon,x
|
lda ActiveWeapon,x
|
||||||
pha ; store active weapon
|
pha ; store active weapon
|
||||||
mva #$ff SecondTryFlag
|
|
||||||
; set initial Angle and Force values
|
; set initial Angle and Force values
|
||||||
lda OptionsTable+2 ; selected gravity
|
lda OptionsTable+2 ; selected gravity
|
||||||
asl
|
asl
|
||||||
@@ -784,6 +785,46 @@ SetStartAndFlight ; set start point (virtual barrel end :) ) and make test fl
|
|||||||
rts
|
rts
|
||||||
.endp
|
.endp
|
||||||
;----------------------------------------------
|
;----------------------------------------------
|
||||||
|
.proc TakeAimExtra
|
||||||
|
; It triggers aiming and if it misses the target,
|
||||||
|
; repeats the targeting by aiming at other tanks.
|
||||||
|
;----------------------------------------------
|
||||||
|
jsr TakeAim ; standard aiming first
|
||||||
|
ldy HitFlag
|
||||||
|
bpl TankHit
|
||||||
|
; Target missed - repeat aiming
|
||||||
|
mva TargetTankNr FirstTargetTankNr
|
||||||
|
ldy NumberOfPlayers
|
||||||
|
dey
|
||||||
|
SetNextTarget
|
||||||
|
cpy TankNr ; Don't aim at yourself
|
||||||
|
beq skipThisPlayer
|
||||||
|
cpy FirstTargetTankNr ; Don't aim at the original target
|
||||||
|
beq skipThisPlayer
|
||||||
|
lda eXistenZ,y
|
||||||
|
beq skipThisPlayer
|
||||||
|
; check target direction
|
||||||
|
mva #0 tempor2 ; check target direction
|
||||||
|
lda LowResDistances,x
|
||||||
|
cmp LowResDistances,y
|
||||||
|
bcs EnemyOnTheLeft
|
||||||
|
; enemy on right
|
||||||
|
inc tempor2 ; set direction to right
|
||||||
|
sty TargetTankNr ; new target for aiming
|
||||||
|
EnemyOnTheLeft
|
||||||
|
; Go Aiming!
|
||||||
|
phy
|
||||||
|
jsr TakeAim.NoSecondTry ; standard aiming first (only first try)
|
||||||
|
ply
|
||||||
|
lda HitFlag
|
||||||
|
bpl TankHit
|
||||||
|
skipThisPlayer
|
||||||
|
dey
|
||||||
|
bpl SetNextTarget
|
||||||
|
TankHit
|
||||||
|
rts
|
||||||
|
.endp
|
||||||
|
;----------------------------------------------
|
||||||
.proc PurchaseAI ;
|
.proc PurchaseAI ;
|
||||||
; A - skill of the TankNr
|
; A - skill of the TankNr
|
||||||
; makes purchase for AI opponents
|
; makes purchase for AI opponents
|
||||||
|
|||||||
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -164,6 +164,8 @@ TankShape ; Tank shape number (from 0 to 2)
|
|||||||
;----------------------------------------------------
|
;----------------------------------------------------
|
||||||
TargetTankNr ; Target tank index (for AI routines)
|
TargetTankNr ; Target tank index (for AI routines)
|
||||||
.DS 1
|
.DS 1
|
||||||
|
FirstTargetTankNr ; Target tank index (for AI routines)
|
||||||
|
.DS 1
|
||||||
SecondTryFlag ; For precise AI aiming
|
SecondTryFlag ; For precise AI aiming
|
||||||
.DS 1
|
.DS 1
|
||||||
;----------------------------------------------------
|
;----------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user