diff --git a/ai.asm b/ai.asm index 1c0cdba..883e3d4 100644 --- a/ai.asm +++ b/ai.asm @@ -42,6 +42,13 @@ loop pha lda AIRoutines,x pha + + ldx TankNr ; common values used in AI routines + ; address of weapons table (for future use) + lda TanksWeaponsTableL,x + sta temp + lda TanksWeaponsTableH,x + sta temp+1 rts .endp ;---------------- @@ -57,7 +64,6 @@ AIRoutines ;---------------------------------------------- .proc Moron - ldx TankNr jsr RandomizeAngle sta NewAngle mwa #80 RandBoundaryLow @@ -68,7 +74,6 @@ AIRoutines ;---------------------------------------------- .proc Shooter - ldx TankNr lda PreviousAngle,x ora PreviousEnergyL,x ora PreviousEnergyH,x @@ -94,36 +99,30 @@ AIRoutines firstShoot ; compare the x position with the middle of the screen + lda xTanksTableH,x + cmp #>(screenwidth/2) + bne @+ lda xTanksTableL,x - sta temp - lda xTanksTableH,x - sta temp+1 - cpw temp #(screenwidth/2) - bcs tankIsOnTheRight - - lda RANDOM - and #$1F - clc - adc #5 + cmp #<(screenwidth/2) +@ bcc tankIsOnTheRight + ; enemy tank is on the left + randomize 95 125 sta NewAngle - jmp forceNow + bne forceNow + tankIsOnTheRight - lda RANDOM - and #$1F - clc - adc #(-85) - ;lda #-45 - sta NewAngle + randomize 55 85 + sta NewAngle forceNow mwa #100 RandBoundaryLow mwa #800 RandBoundaryHigh - ldx TankNr ;this is possibly not necessary + ;ldx TankNr ;this is possibly not necessary jsr RandomizeForce endo - ldx TankNr ;this is possibly not necessary + ;ldx TankNr ;this is possibly not necessary jsr RandomizeForce.LimitForce lda NewAngle sta PreviousAngle,x @@ -134,14 +133,10 @@ endo ; choose the best weapon - lda TanksWeaponsTableL,x - sta temp - lda TanksWeaponsTableH,x - sta temp+1 ldy #32 ;the last weapon loop dey - lda (temp),y + lda (temp),y ; this is set up before calling the routine, has address of TanksWeaponsTable beq loop tya sta ActiveWeapon,x @@ -150,19 +145,13 @@ loop ;---------------------------------------------- .proc Poolshark ; defensives - ldx TankNr - ; address of weapons table (for future use) - lda TanksWeaponsTableL,x - sta temp - lda TanksWeaponsTableH,x - sta temp+1 ; if low energy ten use battery lda Energy,x cmp #30 bcs EnoughEnergy ; lower than 30 units - check battery ldy #ind_Battery________ - lda (temp),y + lda (temp),y ; has address of TanksWeaponsTable beq NoBatteries ; we have batteries - use one clc @@ -180,12 +169,12 @@ EnoughEnergy ; first check check if any is in use lda ActiveDefenceWeapon,x bne DefensiveInUse - ldy #64 ;the last defensive weapon + ldy #ind_Nuclear_Winter_+1 ;the last defensive weapon @ dey cpy #ind_Battery________ ;first defensive weapon (White Flag nad Battery - never use) beq NoUseDefensive - lda (temp),y + lda (temp),y ; has address of TanksWeaponsTable beq @- tya ; activate defensive weapon @@ -195,7 +184,7 @@ EnoughEnergy ; decrease in inventory clc sbc #1 - sta (temp),y + sta (temp),y ; has address of TanksWeaponsTable NoUseDefensive DefensiveInUse firstShoot @@ -203,7 +192,7 @@ firstShoot jsr MakeLowResDistances mva #$ff temp2 ; min possible distance - ldx TankNr + ;ldx TankNr ldy NumberOfPlayers dey @@ -264,7 +253,7 @@ forceNow jsr RandomizeForce endo - ldx TankNr ;this is possibly not necessary + ;ldx TankNr ;this is possibly not necessary ; choose the best weapon @@ -288,12 +277,6 @@ AngleTable ; 16 bytes ;ba w $348b L$3350 .endp ;---------------------------------------------- .proc Toosser - ldx TankNr - ; address of weapons table - lda TanksWeaponsTableL,x - sta temp - lda TanksWeaponsTableH,x - sta temp+1 ; use best defensive :) ; allways ; first check check if any is in use @@ -304,7 +287,7 @@ AngleTable ; 16 bytes ;ba w $348b L$3350 dey cpy #ind_Battery________ ;first defensive weapon (White Flag nad Battery - never use) beq NoUseDefensive - lda (temp),y + lda (temp),y ; has address of TanksWeaponsTable beq @- tya ; activate defensive weapon diff --git a/grafproc.asm b/grafproc.asm index 1a55c8b..e974b02 100644 --- a/grafproc.asm +++ b/grafproc.asm @@ -609,13 +609,13 @@ DrawNextTank ldx tankNr ; let's check the energy lda eXistenZ,x - bne SkipRemovigPM ; if energy=0 then no tank + bne SkipHidingPM ; if energy=0 then no tank ; hide P/M lda #0 sta hposp0,x jmp DoNotDrawTankNr -SkipRemovigPM +SkipHidingPM lda AngleTable,x @@ -731,11 +731,11 @@ tankflash_loop sne:mva #1 fs ; finish it mva #1 Erase ldx TankNr - jsr DrawTankNr.SkipRemovigPM ; it's necessary becouse DrawTankNr skips tanks with no energy ! + jsr DrawTankNr.SkipHidingPM ; it's necessary becouse DrawTankNr skips tanks with no energy ! PAUSE 2 mva #0 Erase ldx TankNr - jsr DrawTankNr.SkipRemovigPM + jsr DrawTankNr.SkipHidingPM PAUSE 2 dec fs jne tankflash_loop diff --git a/scorch.asm b/scorch.asm index 8a2807f..3715f18 100644 --- a/scorch.asm +++ b/scorch.asm @@ -380,6 +380,7 @@ DoNotFinishTheRound mva #0 noDeathCounter mva #sfx_seppuku sfx_effect + jsr DisplaySeppuku jmp Seppuku @@ -751,6 +752,9 @@ NotNegativeShieldEnergy sta ydraw+1 ; get position of the tank ldx TankNr + lda #0 ; turn off defense weapons when hara-kiring + sta ActiveDefenceWeapon,x + sta ShieldEnergy,x lda xtankstableL,x sta xdraw lda xtankstableH,x @@ -1148,20 +1152,10 @@ LimitForce bcc rotateLeft ; older is bigger rotateRight;older is lower inc angleTable,x - bne MoveBarrelToNewPosition - - mva #$30 CharCode ; if angle goes through 0 we clear the barrel - jsr DrawTankNr.drawtankNrX - jmp MoveBarrelToNewPosition rotateLeft dec angleTable,x - bpl MoveBarrelToNewPosition - mva #$2e CharCode - jsr DrawTankNr.drawtankNrX - jmp MoveBarrelToNewPosition - BarrelPositionIsFine rts diff --git a/scorch.xex b/scorch.xex index 0f017cc..d23d267 100644 Binary files a/scorch.xex and b/scorch.xex differ