MIRV hit procedure completely rewritten.
Now wthout bugs :) and much clearer.
This commit is contained in:
BIN
Binary file not shown.
@@ -193,6 +193,8 @@ vx03 .DS [5]
|
|||||||
MirvDown .DS [5] ; is given missile down?
|
MirvDown .DS [5] ; is given missile down?
|
||||||
MirvMissileCounter .DS 1 ; missile Counter (mainly for X)
|
MirvMissileCounter .DS 1 ; missile Counter (mainly for X)
|
||||||
SmokeTracerFlag .DS 1 ; if Smoketracer
|
SmokeTracerFlag .DS 1 ; if Smoketracer
|
||||||
|
XposFlag .DS 1 ; bullet positon X (0 - on screen , %1000000 - off-screen)
|
||||||
|
YposFlag .DS 1 ; bullet positon Y (0 - on screen , %1000000 - over the screen , %0100000 - under the screen)
|
||||||
; -------------------------------------------------
|
; -------------------------------------------------
|
||||||
;CheckCollisionWithTank
|
;CheckCollisionWithTank
|
||||||
vx .ds 4 ; 0,0,0,0 ;two decimal bytes, two whole bytes (DC.BA)
|
vx .ds 4 ; 0,0,0,0 ;two decimal bytes, two whole bytes (DC.BA)
|
||||||
|
|||||||
+50
-25
@@ -2086,36 +2086,63 @@ mrLWindToRight
|
|||||||
sta vx03,x
|
sta vx03,x
|
||||||
mrskip08
|
mrskip08
|
||||||
|
|
||||||
; isn't it over the screen????
|
; rules for a falling MIRV bulets.
|
||||||
lda ytraj+2 ;attention! this checks getting out of the screen through bottom
|
; if Y is negative and any X (bullet over the screen) - continue flying
|
||||||
bmi MIRVcheckX ;but not that accurately....
|
; if (Y>=0 and Y<=screenhight) and X>screenwidth (bullet off-screen on the left or right side) - continue flying
|
||||||
lda ytraj+1
|
; if (Y>=0 and Y<=screenhight) and X<=screenwidth (bullet on the screen) - check collision
|
||||||
cmp #screenheight
|
; if Y>screenhight and X>screenwidth (bullet under the screen on the left or right side) - stop flying without hit
|
||||||
jcs MIRVcheckCollision ; if smaller than screenheight then continue (and it will always hit...)
|
; if Y>screenhight and X<=screenwidth (bullet under the screen) - check collision (allways hit)
|
||||||
MIRVcheckX
|
|
||||||
lda xtraj02,x
|
; check bullet position and set flags:
|
||||||
|
; XposFlag - bullet positon X (0 - on screen , %1000000 - off-screen)
|
||||||
|
; YposFlag - bullet positon Y (0 - on screen , %1000000 - over the screen , %0100000 - under the screen)
|
||||||
|
lda #$00
|
||||||
|
sta XposFlag
|
||||||
|
sta YposFlag
|
||||||
|
lda ytraj+2 ; Y high byte
|
||||||
|
bpl @+
|
||||||
|
mva #%10000000 YposFlag ; bullet over the screen (Y)
|
||||||
|
bmi MIRVsetXflag
|
||||||
|
@
|
||||||
|
lda ytraj+1 ; Y low byte
|
||||||
|
cmp #screenheight
|
||||||
|
bcc MIRVsetXflag ; bullet on screen (Y)
|
||||||
|
mva #%01000000 YposFlag ; bullet under the screen (Y)
|
||||||
|
MIRVsetXflag
|
||||||
|
lda xtraj02,x ; X high byte
|
||||||
cmp #>screenwidth
|
cmp #>screenwidth
|
||||||
beq MIRVcheckLowerX
|
bne @+
|
||||||
bcc MIRVcheckCollision
|
lda xtraj01,x ; X low byte
|
||||||
; it's over the screen horizontally (to the left or right)
|
|
||||||
mwa #0 xdraw
|
|
||||||
mva #screenheight-1 ydraw
|
|
||||||
jsr unPlot.unPlotAfterX
|
|
||||||
jmp mrLoopi
|
|
||||||
MIRVcheckLowerX
|
|
||||||
lda xtraj01,x
|
|
||||||
cmp #<screenwidth
|
cmp #<screenwidth
|
||||||
bcc MIRVcheckCollision
|
@
|
||||||
; it's over the screen horizontally (to the left or right)
|
bcc MIRVXonscreen
|
||||||
|
mva #%10000000 XposFlag ; bullet off-screen (X)
|
||||||
|
MIRVXonscreen
|
||||||
|
|
||||||
|
; X and Y position flags sets
|
||||||
|
; then realize rules
|
||||||
|
|
||||||
|
lda YposFlag
|
||||||
|
jmi MIRVcontinueFly ; Y over the screen
|
||||||
|
bne MIRVYunderscreen ; Y under the screen
|
||||||
|
; Y on screen
|
||||||
|
bit XposFlag
|
||||||
|
jmi MIRVcontinueFly ; Y on screen and X off-screen
|
||||||
|
jpl MIRVcheckCollision ; X and Y on screen
|
||||||
|
MIRVYunderscreen
|
||||||
|
bit XposFlag
|
||||||
|
jpl MIRVcheckCollision ; X on screen and Y under screen
|
||||||
|
; Y under screen and X off-screen
|
||||||
|
; stop flying
|
||||||
|
jmi mrEndOfFlight
|
||||||
|
|
||||||
|
MIRVcontinueFly
|
||||||
mwa #0 xdraw
|
mwa #0 xdraw
|
||||||
mva #screenheight-1 ydraw
|
mva #screenheight-1 ydraw
|
||||||
jsr unPlot.unPlotAfterX
|
jsr unPlot.unPlotAfterX
|
||||||
jmp mrLoopi
|
jmp mrLoopi
|
||||||
|
|
||||||
MIRVcheckCollision
|
MIRVcheckCollision
|
||||||
; checking the collision!
|
|
||||||
lda ytraj+2
|
|
||||||
bne mrSkipCollisionCheck
|
|
||||||
|
|
||||||
; checking works only with xtraj so copy there all we need
|
; checking works only with xtraj so copy there all we need
|
||||||
lda xtraj01,x
|
lda xtraj01,x
|
||||||
@@ -2142,10 +2169,7 @@ MIRVcheckCollision
|
|||||||
cmp (temp),y
|
cmp (temp),y
|
||||||
bcs mrHit
|
bcs mrHit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mrSkipCollisionCheck
|
mrSkipCollisionCheck
|
||||||
|
|
||||||
;mwa xtraj01 xdraw
|
;mwa xtraj01 xdraw
|
||||||
lda xtraj01,x
|
lda xtraj01,x
|
||||||
sta xdraw
|
sta xdraw
|
||||||
@@ -2183,6 +2207,7 @@ mrHit
|
|||||||
sta ydraw
|
sta ydraw
|
||||||
sty ydraw+1 ;we know that y=0
|
sty ydraw+1 ;we know that y=0
|
||||||
jsr missile ; explode ....
|
jsr missile ; explode ....
|
||||||
|
|
||||||
mrEndOfFlight
|
mrEndOfFlight
|
||||||
ldx MirvMissileCounter
|
ldx MirvMissileCounter
|
||||||
mwa #0 xdraw
|
mwa #0 xdraw
|
||||||
|
|||||||
Reference in New Issue
Block a user