mirror of
https://github.com/pkali/scorch_src.git
synced 2026-05-20 22:34:21 +02:00
AI internals
This commit is contained in:
@@ -320,6 +320,62 @@ NoUseDefensive
|
||||
; Toosser is like Poolshark but allways uses defensives
|
||||
jmp Poolshark
|
||||
.endp
|
||||
|
||||
;----------------------------------------------
|
||||
.proc FindBestTarget1
|
||||
; find farthest tank neighbour
|
||||
; X - shooting tank number
|
||||
; returns target tank number in Y and
|
||||
; direcion of shoot in A (0 - left, >0 - right)
|
||||
;----------------------------------------------
|
||||
jsr MakeLowResDistances
|
||||
lda #$00
|
||||
sta temp2 ; max possible distance
|
||||
sta tempor2 ; direction of shoot
|
||||
;ldx TankNr
|
||||
ldy NumberOfPlayers
|
||||
dey
|
||||
|
||||
loop01
|
||||
cpy TankNr
|
||||
beq skipThisPlayer
|
||||
lda eXistenZ,y
|
||||
beq skipThisPlayer
|
||||
|
||||
lda LowResDistances,x
|
||||
cmp LowResDistances,y
|
||||
bcs EnemyOnTheLeft
|
||||
;enemy on the right
|
||||
sec
|
||||
lda LowResDistances,y
|
||||
sbc LowResDistances,x
|
||||
cmp temp2 ; bigest
|
||||
bcc bigestIsBigger
|
||||
sta temp2
|
||||
sty temp2+1 ; number of the farthest tank
|
||||
inc tempor2 ; set direction to right
|
||||
bne bigestIsBigger
|
||||
|
||||
EnemyOnTheLeft
|
||||
sec
|
||||
lda LowResDistances,x
|
||||
sbc LowResDistances,y
|
||||
cmp temp2 ; lowest
|
||||
bcc bigestIsBigger
|
||||
sta temp2
|
||||
sty temp2+1 ; number of the farthest tank
|
||||
|
||||
bigestIsBigger
|
||||
skipThisPlayer
|
||||
dey
|
||||
bpl loop01
|
||||
; now we have number of the farthest tank in temp2+1
|
||||
; and direction (0 - left, >0 - right) in tempor2
|
||||
; let's move them to registers
|
||||
ldy temp2+1
|
||||
lda tempor2
|
||||
rts
|
||||
.endp
|
||||
;----------------------------------------------
|
||||
.proc PurchaseAI ;
|
||||
; A - skill of the TankNr
|
||||
|
||||
Reference in New Issue
Block a user