diff --git a/ai.asm b/ai.asm index c47413f..d6c0828 100644 --- a/ai.asm +++ b/ai.asm @@ -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 diff --git a/constants.asm b/constants.asm index ee47917..1892553 100644 --- a/constants.asm +++ b/constants.asm @@ -20,6 +20,7 @@ CashOptionH GravityTable .by 10,20,25,30,40 MaxWindTable .by 5,20,40,70,99 RoundsTable .by 10,20,30,40,50 +AIForceTable .wo 400,500,650,750,850 ; starting shoot forces for different gravity flyDelayTable .by 255,150,75,35,1 seppukuTable .by 255, 45,25,15,9 mountainsDeltaTableH .by 0,1,3,5,7 diff --git a/scorch.xex b/scorch.xex index 24b6428..7225e6e 100644 Binary files a/scorch.xex and b/scorch.xex differ