Faster AI (and fixed)

Correcion for barrel wider tjan tank (2 pixels)
This commit is contained in:
Pecusx
2022-08-01 21:54:41 +02:00
parent 2f1f016ce0
commit 9eb0f8adff
3 changed files with 35 additions and 28 deletions
+31 -25
View File
@@ -605,7 +605,13 @@ skipThisPlayer
; in the appropriate variables (Angle and Force)
;----------------------------------------------
; set initial Angle and Force values
mva #90 NewAngle
; wind correction 90+(wind/8)
mwa Wind temp2
:7 lsrw temp2
clc
lda #90
adc temp2
sta NewAngle
lda OptionsTable+2 ; selected gravity
asl
tay
@@ -653,24 +659,24 @@ GroundHitInFirstLoopR
lda xTanksTableL,y
cmp XHit
@
bcc HitOnRightSideOfTargetR
bcs HitOnRightSideOfTargetR
; continue targeting
sec
clc
lda NewAngle
sbc #5 ; 5 deg to right
cmp #15
beq EndOfFirstLoopR
adc #5 ; 5 deg to right
cmp #(180-20)
bcs EndOfFirstLoopR ; if angle 180-20 or higher
sta NewAngle
jmp AimingRight
NoHitInFirstLoopR
; Angle 5 deg to left and end loop
clc
sec
lda NewAngle
adc #5
sbc #5
sta NewAngle
HitOnRightSideOfTargetR
EndOfFirstLoopR
mva #5 temp2 ; set counter (5 turns)
mva #5 modify ; set counter (5 turns)
SecondLoopR
; make test Shoot (Flight)
jsr SetStartAndFlight
@@ -694,10 +700,10 @@ GroundHitInSecondLoopR
lda xTanksTableL,y
cmp XHit
@
bcs HitOnLeftSideOfTargetR
bcc HitOnLeftSideOfTargetR
; continue targeting
inc NewAngle ; 1 deg to left
dec temp2 ; max 5 turns
dec NewAngle ; 1 deg to left
dec modify ; max 5 turns
beq EndOfSecondLoopR
jmp SecondLoopR
HitOnLeftSideOfTargetR
@@ -705,7 +711,7 @@ HitOnLeftSideOfTargetR
sbw Force #5
NoHitInSecondLoopR
; Angle 1 deg to right and end loop
dec NewAngle
inc NewAngle
EndOfSecondLoopR
rts
@@ -732,24 +738,24 @@ GroundHitInFirstLoopL
lda xTanksTableL,y
cmp XHit
@
bcs HitOnLeftSideOfTargetL
bcc HitOnLeftSideOfTargetL
; continue targeting
clc
sec
lda NewAngle
adc #5 ; 5 deg to left
cmp #(180-15)
beq EndOfFirstLoopL
sbc #5 ; 5 deg to left
cmp #21
bcc EndOfFirstLoopL ; if angle 180-20 or higher
sta NewAngle
jmp AimingLeft
NoHitInFirstLoopL
; Angle 5 deg to right and end loop
sec
clc
lda NewAngle
sbc #5
adc #5
sta NewAngle
HitOnLeftSideOfTargetL
EndOfFirstLoopL
mva #5 temp2 ; set counter (5 turns)
mva #5 modify ; set counter (5 turns)
SecondLoopL
; make test Shoot (Flight)
jsr SetStartAndFlight
@@ -773,10 +779,10 @@ GroundHitInSecondLoopL
lda xTanksTableL,y
cmp XHit
@
bcc HitOnRightSideOfTargetL
bcs HitOnRightSideOfTargetL
; continue targeting
dec NewAngle ; 1 deg to right
dec temp2 ; max 5 turns
inc NewAngle ; 1 deg to right
dec modify ; max 5 turns
beq EndOfSecondLoopL
jmp SecondLoopL
HitOnRightSideOfTargetL
@@ -784,7 +790,7 @@ HitOnRightSideOfTargetL
sbw Force #5
NoHitInSecondLoopL
; Angle 1 deg to left and end loop
inc NewAngle
dec NewAngle
EndOfSecondLoopL
rts
+4 -3
View File
@@ -1028,9 +1028,10 @@ FallingLeft
bit PreviousFall ; bit 6 - right
bvs EndLeftFall
; we finish falling left if the tank reached the edge of the screen
lda XtanksTableL,x
bne NotLeftEdge
lda XtanksTableH,x
bne NotLeftEdge
lda XtanksTableL,x
cmp #2 ; 2 pixels correction due to a barrel wider than tank
beq EndLeftFall
NotLeftEdge
; tank is falling left - modify coorinates
@@ -1055,7 +1056,7 @@ FallingRight
lda XtanksTableH,x
adc #0
sta temp+1
cpw temp #screenwidth
cpw temp #screenwidth-2 ; 2 pixels correction due to a barrel wider than tank
beq EndRightFall
; tank is falling right - modify coorinates
sec
BIN
View File
Binary file not shown.