Index of hit tank in HitFlag

For future use.
Easier to check whether the hit tank or ground.
This commit is contained in:
Pecusx
2022-06-09 18:06:31 +02:00
parent 53e9f89012
commit 1b983b8d92
4 changed files with 11 additions and 10 deletions
+3 -4
View File
@@ -262,8 +262,7 @@ CheckCollisionDraw
sbc #1
sta YHit
sty YHit+1
;mwa ydraw YHit
mva #1 HitFlag
mva #$ff HitFlag
StopHitChecking
jmp ContinueDraw
@
@@ -798,10 +797,10 @@ ShieldVisible
; this proc draws a little "horns" on shield.
; Symbol of defensive but aggressive :) weapon
;--------------------------------------------------
dew xdraw ; 1 pixel left
.nowarn dew xdraw ; 1 pixel left
sbw ydraw #$0a ; 10 pixels up
jsr plot
dew ydraw
.nowarn dew ydraw
inw xdraw
jsr plot
sbw xdraw #$0d ; 13 pixels left
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -118,7 +118,7 @@ MaxWind .ds 1 ;
WindOrientation .DS 1 ;(0-right,1-left)
;----------------------------------------------------
Counter .DS 1 ;temporary Counter for outside loops
HitFlag .DS 1 ;1 when missile hit anything
HitFlag .DS 1 ;$ff when missile hit ground, $00 when no hit, $01-$06 tank index+1 when hit tank
;----------------------------------------------------
xtankstableL ;X positions of tanks (lower left point)
.DS [MaxPlayers]
+7 -5
View File
@@ -765,7 +765,7 @@ UpNotYet
sbc #1
sta ydraw
;check tank collision prior to PLOT
sty HitFlag
sty HitFlag ; set to 0
jsr CheckCollisionWithTank
@@ -1306,7 +1306,7 @@ AfterStrongShoot
ShotUnderGround
mwa xtraj+1 xdraw ; but why not XHit and YHit !!!???
mwa ytraj+1 ydraw
mva #1 HitFlag
mva #$ff HitFlag
rts
.endp
@@ -2200,7 +2200,7 @@ MIRValreadyAll
mva tempor2 TankNr
mva #0 Erase
jsr SoilDown2
mva #1 HitFlag
mva #$ff HitFlag ; but why ??
;jsr drawtanks
rts
.endp
@@ -2211,7 +2211,7 @@ MIRValreadyAll
; Check collision with Tank :)
; xdraw , ydraw - coordinates of the checked point
; results:
; HitFlag - 1 - hit, 0 - no hit
; HitFlag - $ff - hit ground, 0 - no hit, 1-6 - hit tank (index+1)
; XHit , YHit - coordinates of hit
; X - index of the hit tank
@@ -2243,7 +2243,9 @@ Condition02
sbc #4
cmp ydraw
bcs OverTheTank
mva #1 HitFlag
inx
stx HitFlag ; index of hit tank+1
dex
mwa xdraw XHit
mwa ydraw YHit
rts ; in X there is an index of the hit tank