diff --git a/scorch.xex b/scorch.xex index 6b17b9e..fde382b 100644 Binary files a/scorch.xex and b/scorch.xex differ diff --git a/variables.asm b/variables.asm index 4247ef3..1d3e229 100644 --- a/variables.asm +++ b/variables.asm @@ -193,6 +193,8 @@ vx03 .DS [5] MirvDown .DS [5] ; is given missile down? MirvMissileCounter .DS 1 ; missile Counter (mainly for X) 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 vx .ds 4 ; 0,0,0,0 ;two decimal bytes, two whole bytes (DC.BA) diff --git a/weapons.asm b/weapons.asm index ceb299d..b8dbeb6 100644 --- a/weapons.asm +++ b/weapons.asm @@ -2086,36 +2086,63 @@ mrLWindToRight sta vx03,x mrskip08 - ; isn't it over the screen???? - lda ytraj+2 ;attention! this checks getting out of the screen through bottom - bmi MIRVcheckX ;but not that accurately.... - lda ytraj+1 - cmp #screenheight - jcs MIRVcheckCollision ; if smaller than screenheight then continue (and it will always hit...) -MIRVcheckX - lda xtraj02,x + ; rules for a falling MIRV bulets. + ; if Y is negative and any X (bullet over the screen) - continue flying + ; if (Y>=0 and Y<=screenhight) and X>screenwidth (bullet off-screen on the left or right side) - continue flying + ; if (Y>=0 and Y<=screenhight) and X<=screenwidth (bullet on the screen) - check collision + ; if Y>screenhight and X>screenwidth (bullet under the screen on the left or right side) - stop flying without hit + ; if Y>screenhight and X<=screenwidth (bullet under the screen) - check collision (allways hit) + + ; 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 - beq MIRVcheckLowerX - bcc MIRVcheckCollision - ; 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 + bne @+ + lda xtraj01,x ; X low byte cmp #