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) ; in the appropriate variables (Angle and Force)
;---------------------------------------------- ;----------------------------------------------
; set initial Angle and Force values ; 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 lda OptionsTable+2 ; selected gravity
asl asl
tay tay
@@ -653,24 +659,24 @@ GroundHitInFirstLoopR
lda xTanksTableL,y lda xTanksTableL,y
cmp XHit cmp XHit
@ @
bcc HitOnRightSideOfTargetR bcs HitOnRightSideOfTargetR
; continue targeting ; continue targeting
sec clc
lda NewAngle lda NewAngle
sbc #5 ; 5 deg to right adc #5 ; 5 deg to right
cmp #15 cmp #(180-20)
beq EndOfFirstLoopR bcs EndOfFirstLoopR ; if angle 180-20 or higher
sta NewAngle sta NewAngle
jmp AimingRight jmp AimingRight
NoHitInFirstLoopR NoHitInFirstLoopR
; Angle 5 deg to left and end loop ; Angle 5 deg to left and end loop
clc sec
lda NewAngle lda NewAngle
adc #5 sbc #5
sta NewAngle sta NewAngle
HitOnRightSideOfTargetR HitOnRightSideOfTargetR
EndOfFirstLoopR EndOfFirstLoopR
mva #5 temp2 ; set counter (5 turns) mva #5 modify ; set counter (5 turns)
SecondLoopR SecondLoopR
; make test Shoot (Flight) ; make test Shoot (Flight)
jsr SetStartAndFlight jsr SetStartAndFlight
@@ -694,10 +700,10 @@ GroundHitInSecondLoopR
lda xTanksTableL,y lda xTanksTableL,y
cmp XHit cmp XHit
@ @
bcs HitOnLeftSideOfTargetR bcc HitOnLeftSideOfTargetR
; continue targeting ; continue targeting
inc NewAngle ; 1 deg to left dec NewAngle ; 1 deg to left
dec temp2 ; max 5 turns dec modify ; max 5 turns
beq EndOfSecondLoopR beq EndOfSecondLoopR
jmp SecondLoopR jmp SecondLoopR
HitOnLeftSideOfTargetR HitOnLeftSideOfTargetR
@@ -705,7 +711,7 @@ HitOnLeftSideOfTargetR
sbw Force #5 sbw Force #5
NoHitInSecondLoopR NoHitInSecondLoopR
; Angle 1 deg to right and end loop ; Angle 1 deg to right and end loop
dec NewAngle inc NewAngle
EndOfSecondLoopR EndOfSecondLoopR
rts rts
@@ -732,24 +738,24 @@ GroundHitInFirstLoopL
lda xTanksTableL,y lda xTanksTableL,y
cmp XHit cmp XHit
@ @
bcs HitOnLeftSideOfTargetL bcc HitOnLeftSideOfTargetL
; continue targeting ; continue targeting
clc sec
lda NewAngle lda NewAngle
adc #5 ; 5 deg to left sbc #5 ; 5 deg to left
cmp #(180-15) cmp #21
beq EndOfFirstLoopL bcc EndOfFirstLoopL ; if angle 180-20 or higher
sta NewAngle sta NewAngle
jmp AimingLeft jmp AimingLeft
NoHitInFirstLoopL NoHitInFirstLoopL
; Angle 5 deg to right and end loop ; Angle 5 deg to right and end loop
sec clc
lda NewAngle lda NewAngle
sbc #5 adc #5
sta NewAngle sta NewAngle
HitOnLeftSideOfTargetL HitOnLeftSideOfTargetL
EndOfFirstLoopL EndOfFirstLoopL
mva #5 temp2 ; set counter (5 turns) mva #5 modify ; set counter (5 turns)
SecondLoopL SecondLoopL
; make test Shoot (Flight) ; make test Shoot (Flight)
jsr SetStartAndFlight jsr SetStartAndFlight
@@ -773,10 +779,10 @@ GroundHitInSecondLoopL
lda xTanksTableL,y lda xTanksTableL,y
cmp XHit cmp XHit
@ @
bcc HitOnRightSideOfTargetL bcs HitOnRightSideOfTargetL
; continue targeting ; continue targeting
dec NewAngle ; 1 deg to right inc NewAngle ; 1 deg to right
dec temp2 ; max 5 turns dec modify ; max 5 turns
beq EndOfSecondLoopL beq EndOfSecondLoopL
jmp SecondLoopL jmp SecondLoopL
HitOnRightSideOfTargetL HitOnRightSideOfTargetL
@@ -784,7 +790,7 @@ HitOnRightSideOfTargetL
sbw Force #5 sbw Force #5
NoHitInSecondLoopL NoHitInSecondLoopL
; Angle 1 deg to left and end loop ; Angle 1 deg to left and end loop
inc NewAngle dec NewAngle
EndOfSecondLoopL EndOfSecondLoopL
rts rts
+4 -3
View File
@@ -1028,9 +1028,10 @@ FallingLeft
bit PreviousFall ; bit 6 - right bit PreviousFall ; bit 6 - right
bvs EndLeftFall bvs EndLeftFall
; we finish falling left if the tank reached the edge of the screen ; we finish falling left if the tank reached the edge of the screen
lda XtanksTableL,x
bne NotLeftEdge
lda XtanksTableH,x lda XtanksTableH,x
bne NotLeftEdge
lda XtanksTableL,x
cmp #2 ; 2 pixels correction due to a barrel wider than tank
beq EndLeftFall beq EndLeftFall
NotLeftEdge NotLeftEdge
; tank is falling left - modify coorinates ; tank is falling left - modify coorinates
@@ -1055,7 +1056,7 @@ FallingRight
lda XtanksTableH,x lda XtanksTableH,x
adc #0 adc #0
sta temp+1 sta temp+1
cpw temp #screenwidth cpw temp #screenwidth-2 ; 2 pixels correction due to a barrel wider than tank
beq EndRightFall beq EndRightFall
; tank is falling right - modify coorinates ; tank is falling right - modify coorinates
sec sec
BIN
View File
Binary file not shown.