Much better aiming for Cyborg, Spoiler and Chooser

This commit is contained in:
Pecusx
2022-08-25 09:35:30 +02:00
parent 1a19d3069d
commit 07a2585147
3 changed files with 34 additions and 21 deletions
+31 -20
View File
@@ -455,25 +455,19 @@ loop01
lda eXistenZ,y lda eXistenZ,y
beq skipThisPlayer beq skipThisPlayer
lda LowResDistances,x
cmp LowResDistances,y
bcs EnemyOnTheLeft
;enemy on the right ;enemy on the right
lda Energy,y lda Energy,y
cmp temp2 ; lowest cmp temp2 ; lowest
bcs lowestIsLower bcs lowestIsLower
sta temp2 sta temp2
sty temp2+1 ; number of the closest tank sty temp2+1 ; number of the closest tank
mva #0 tempor2
lda LowResDistances,x
cmp LowResDistances,y
bcs EnemyOnTheLeft
inc tempor2 ; set direction to right inc tempor2 ; set direction to right
bne lowestIsLower
EnemyOnTheLeft
lda Energy,y
cmp temp2 ; lowest
bcs lowestIsLower
sta temp2
sty temp2+1 ; number of the closest tank
EnemyOnTheLeft
lowestIsLower lowestIsLower
skipThisPlayer skipThisPlayer
dey dey
@@ -607,14 +601,8 @@ 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
; set initial Angle and Force values ; set initial Angle and Force values
; wind correction 90+(wind/8)
mwa Wind temp2
:7 lsrw temp2
clc
lda #90
adc temp2
sta NewAngle
lda OptionsTable+2 ; selected gravity lda OptionsTable+2 ; selected gravity
asl asl
tay tay
@@ -633,10 +621,19 @@ skipThisPlayer
adc #0 adc #0
sta RandBoundaryHigh+1 sta RandBoundaryHigh+1
jsr RandomizeForce jsr RandomizeForce
RepeatAim
lda ForceTableL,x lda ForceTableL,x
sta Force sta Force
lda ForceTableH,x lda ForceTableH,x
sta Force+1 sta Force+1
; wind correction 90+(wind/8)
mwa Wind temp2
:7 lsrw temp2
clc
lda #90
adc temp2
sta NewAngle
; set virtual weapon :)
lda #ind_Baby_Missile___ lda #ind_Baby_Missile___
sta ActiveWeapon,x sta ActiveWeapon,x
; now we have initial valuses ; now we have initial valuses
@@ -673,7 +670,8 @@ GroundHitInFirstLoopR
lda NewAngle lda NewAngle
adc #5 ; 5 deg to right adc #5 ; 5 deg to right
cmp #(180-20) cmp #(180-20)
bcs EndOfFirstLoopR ; if angle 180-20 or higher ; bcs EndOfFirstLoopR ; if angle 180-20 or higher
bcs AimSecondTry
sta NewAngle sta NewAngle
jmp AimingRight jmp AimingRight
NoHitInFirstLoopR NoHitInFirstLoopR
@@ -721,8 +719,20 @@ NoHitInSecondLoopR
; Angle 1 deg to right and end loop ; Angle 1 deg to right and end loop
inc NewAngle inc NewAngle
EndOfSecondLoopR EndOfSecondLoopR
EndOfAim
rts rts
AimSecondTry
bit SecondTryFlag
bpl EndOfAim ; closest RTS
inc SecondTryFlag
lda #<1000
sta ForceTableL,x
lda #>1000
sta ForceTableH,x
jsr RandomizeForce.LimitForce
jmp RepeatAim
AimingLeft AimingLeft
; make test Shoot (Flight) ; make test Shoot (Flight)
jsr SetStartAndFlight jsr SetStartAndFlight
@@ -752,7 +762,8 @@ GroundHitInFirstLoopL
lda NewAngle lda NewAngle
sbc #5 ; 5 deg to left sbc #5 ; 5 deg to left
cmp #21 cmp #21
bcc EndOfFirstLoopL ; if angle 180-20 or higher ; bcc EndOfFirstLoopL ; if angle 20 or lower
bcc AimSecondTry
sta NewAngle sta NewAngle
jmp AimingLeft jmp AimingLeft
NoHitInFirstLoopL NoHitInFirstLoopL
BIN
View File
Binary file not shown.
+3 -1
View File
@@ -151,7 +151,9 @@ LowResDistances ; coarse tank positions divided by 4 (to be in just one byte)
.DS [MaxPlayers] .DS [MaxPlayers]
;---------------------------------------------------- ;----------------------------------------------------
TargetTankNr ; Target tank index (for AI routines) TargetTankNr ; Target tank index (for AI routines)
.DS 1 .DS 1
SecondTryFlag ; For precize aiming AI
.DS 1
;---------------------------------------------------- ;----------------------------------------------------
;Erase .DS 1 ; if 1 only mask of the character is printed ;Erase .DS 1 ; if 1 only mask of the character is printed
; on the graphics screen. if 0 character is printed normally ; on the graphics screen. if 0 character is printed normally