diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b9bd87 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +*.bak diff --git a/LICENSE b/LICENSE old mode 100755 new mode 100644 diff --git a/README.md b/README.md old mode 100755 new mode 100644 index fb7e927..2806055 --- a/README.md +++ b/README.md @@ -47,6 +47,15 @@ With the advent of fujinet (https://fujinet.online/) we are thinking about makin ## Changes: +###### Build 142 +2022-05-30 +Late build. The bugs we tried to squelch turned out to be more difficult than usual. Some progress has been made though even if it is not yet visible. +- 4x4 font rewritten by @Pecusx as a prep for Y standarization. It makes the messages to appear faster. This is a good change. +- https://github.com/pkali/scorch_src/issues/5 and #80 fixed (again) - no funkybomb traces staying on the screen +- https://github.com/pkali/scorch_src/issues/70 too strong Shooters fixed +- https://github.com/pkali/scorch_src/issues/63 - tank say goodbye when (mostly) visible +- several other small changes and improvements that will pay off in the following releases. + ###### Build 141 2022-05-22 Debug build. Thanks to all testers for finding numerous bugs. We tried to fix some of them and we have introduced some new for your enjoyment. diff --git a/ai.asm b/ai.asm old mode 100755 new mode 100644 index 1ce7645..74db4ea --- a/ai.asm +++ b/ai.asm @@ -33,7 +33,7 @@ loop ArtificialIntelligence .proc ; ; A - skill of the TankNr ; returns shoot energy and angle in -; EnergyTable/L/H and AngleTable +; ForceTable/L/H and AngleTable ;---------------------------------------------- asl tax @@ -77,24 +77,22 @@ Shooter .proc lda PreviousAngle,x clc adc #5 - bmi leftQuadrant + bmi @+ cmp #90 - bcc continue + bcc @+ lda #(-90) - bne continue -leftQuadrant - - - -continue +@ sta NewAngle - + + sec lda PreviousEnergyL,x - sta EnergyTableL,x - lda PreviousEnergyH,x - sta EnergyTableH,x - + sbc #5 + sta ForceTableL,x + lda PreviousEnergyH,x + sbc #0 + sta ForceTableH,x jmp endo + firstShoot ; compare the x position with the middle of the screen lda xTanksTableL,x @@ -108,7 +106,6 @@ firstShoot and #$1F clc adc #5 - ;lda #45 sta NewAngle jmp forceNow @@ -123,15 +120,17 @@ tankIsOnTheRight forceNow mwa #100 RandBoundaryLow mwa #800 RandBoundaryHigh + 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 - lda EnergyTableL,x + lda ForceTableL,x sta PreviousEnergyL,x - lda EnergyTableH,x + lda ForceTableH,x sta PreviousEnergyH,x ; choose the best weapon diff --git a/artwork/TALK1.txt b/artwork/TALK1.txt old mode 100755 new mode 100644 diff --git a/artwork/TALK2.txt b/artwork/TALK2.txt old mode 100755 new mode 100644 diff --git a/artwork/font4x4s.bmp b/artwork/font4x4s.bmp old mode 100755 new mode 100644 diff --git a/artwork/talk.asm b/artwork/talk.asm old mode 100755 new mode 100644 diff --git a/artwork/tanks.fnt b/artwork/tanks.fnt old mode 100755 new mode 100644 diff --git a/artwork/textconv.py b/artwork/textconv.py old mode 100755 new mode 100644 diff --git a/artwork/weapons.fnt b/artwork/weapons.fnt old mode 100755 new mode 100644 diff --git a/constants.asm b/constants.asm index 752fecf..859ceb6 100644 --- a/constants.asm +++ b/constants.asm @@ -18,7 +18,7 @@ CashOptionL ;(one zero less than on the screen) CashOptionH .by 0,>200,>500,>800,>1000 GravityTable .by 10,20,25,30,40 -MaxWindTable .by 5,20,40,60,80 +MaxWindTable .by 5,20,40,70,99 RoundsTable .by 10,20,30,40,50 flyDelayTable .by 255,150,75,35,1 seppukuTable .by 255, 45,25,15,9 @@ -483,6 +483,7 @@ WhereToSlideTable .BY %000 ; 11111111 EndOfTheBarrelX + ; right angles from 0 (vertically up) to 90 (horizontally to the right) .by 4,4,4,4,4,4,4,4,4,4,4 .by 5,5,5,5,5,5,5,5,5,5 .by 6,6,6,6,6,6,6,6,6 @@ -492,15 +493,16 @@ EndOfTheBarrelX .by 7,7,7,7,7,7,7,7,7,7,7,7,7 .by 7,7,7,7,7,7,7,7,7,7,7,7,7,7 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0 + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0 ; not used + ; left angles from 90 (horizontally to the left) to 1 (vertically up) .by 0,0,0,0,0,0,0,0,0,0,0,0,0,0 .by 0,0,0,0,0,0,0,0,0,0,0,0,0 .by 0,0,0,0,0,0,0,0,0,0 @@ -511,6 +513,7 @@ EndOfTheBarrelX .by 3,3,3,3,3,3,3,3,3,3,3 EndOfTheBarrelY + ; right angles from 0 (vertically up) to 90 (horizontally to the right) .by 7,7,7,7,7,7,7,7,7,7,7 .by 7,7,7,7,7,7,7,7,7,7 .by 7,7,7,7,7,7,7,7,7 @@ -520,15 +523,16 @@ EndOfTheBarrelY .by 4,4,4,4,4,4,4,4,4,4,4,4,4 .by 3,3,3,3,3,3,3,3,3,3,3,3,3,3 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0,0,0,0,0,0,0 - .by 0,0,0,0 + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0,0,0,0,0,0,0 ; not used + .by 0,0,0,0 ; not used + ; left angles from 90 (horizontally to the left) to 1 (vertically up) .by 3,3,3,3,3,3,3,3,3,3,3,3,3,3 .by 4,4,4,4,4,4,4,4,4,4,4,4,4 .by 5,5,5,5,5,5,5,5,5,5 @@ -884,7 +888,8 @@ NamesOfWeapons ;the comment is an index in the tables dta d"Contact Trigger " ; 62 dta d"White Flag " ; 63 weaponsOfDeath - dta 0,1,2,3,7,8,9,15,16,17,18,19,20,21,22,23,24,25,26,27 + dta 1,2,3,7,15,16,17,18,19,20,21,22,23,24,25,26,27 +weaponsOfDeathEnd joyToKeyTable ; .by 00, 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12, 13, 14, 15 .by $ff,$ff,$ff,$ff,$ff,$ff,$ff,$07,$ff,$ff,$ff,$06,$ff,$0f,$0e,$ff diff --git a/display.asm b/display.asm old mode 100755 new mode 100644 diff --git a/grafproc.asm b/grafproc.asm old mode 100755 new mode 100644 index ed75e20..6144171 --- a/grafproc.asm +++ b/grafproc.asm @@ -214,37 +214,20 @@ LineGoesLeft ; line goes left - we are reversing X sbw xtempDRAW temp xdraw ; XI PutPixelinDraw - jsr DrawJumpPad -; end of the special PLOT for DRAW - - ; XI=XI+1 - ; UNTIL XI=XK - inw XI - cpw XI XK - jne DrawLoop - -EndOfDraw - mwa xtempDRAW xdraw - mva ytempDRAW ydraw - rts -.endp - -;-------------JumpPad------------- -DrawJumpPad - jmp (DrawJumpAddr) -Drawplot - jmp plot -DrawLen - inw LineLength - rts -;-------------JumpPad------------- -DrawCheck .proc - lda tracerflag - ora SmokeTracerFlag + ; 0 - plot, %10000000 - LineLength (N), %01000000 - DrawCheck (V) + bit drawFunction + bpl @+ + inw LineLength + bne ContinueDraw ; ==jmp +@ + bvc @+ +DrawCheck + lda tracerflag + ora SmokeTracerFlag yestrace - beq notrace - jsr plot + beq notrace + jsr plot notrace ;aftertrace lda HitFlag @@ -267,17 +250,34 @@ CheckCollisionDraw cmp (temp),y bcc StopHitChecking - mva #1 HitFlag mwa xdraw XHit - mwa ydraw YHit - - + lda (temp),y + sec + sbc #1 + sta YHit + mva #0 YHit+1 + ;mwa ydraw YHit + mva #1 HitFlag StopHitChecking + jmp ContinueDraw +@ + jsr plot + +ContinueDraw + ; XI=XI+1 + ; UNTIL XI=XK + inw XI + cpw XI XK + jne DrawLoop + +EndOfDraw + mwa xtempDRAW xdraw + mva ytempDRAW ydraw rts -.endp +.endp ;-------------------------------------------------- -circle .proc ;fxxxing good circle drawing :) +.proc circle ;fxxxing good circle drawing :) ;-------------------------------------------------- ;Turbo Basic source ; R=30 @@ -560,11 +560,10 @@ UnequalTanks bpl CheckNextTank rts .endp -;------------------------------------------------- -drawtanks -;------------------------------------------------- - +;------------------------------------------------- +.proc drawtanks +;------------------------------------------------- lda tanknr pha ldx #$00 @@ -581,8 +580,9 @@ DrawNextTank sta tankNr rts +.endp ;--------- -drawtanknr +.proc DrawTankNr ldx tanknr ; let's check the energy lda eXistenZ,x @@ -670,11 +670,11 @@ ZeroesToGo NoPlayerMissile DoNotDrawTankNr rts +.endp ;-------------------------------------------------- -drawmountains .proc +.proc drawmountains ;-------------------------------------------------- - mwa #0 xdraw mwa #mountaintable modify mva #1 color @@ -691,7 +691,6 @@ NoMountain inw xdraw cpw xdraw #screenwidth bne drawmountainsloop - rts ;-------------------------------------------------- drawmountainspixel @@ -713,7 +712,7 @@ drawmountainspixelloop rts .endp ;-------------------------------------------------- -SoilDown2 .proc +.proc SoilDown2 ;-------------------------------------------------- ; how it is supposed to work: @@ -841,8 +840,9 @@ ColumnIsReady mva #sfx_silencer sfx_effect rts .endp + ;-------------------------------------------------- -calculatemountains .proc +.proc calculatemountains ;-------------------------------------------------- mwa #0 xdraw @@ -944,7 +944,7 @@ EndDrawing .endp ; **************************************************** ;-------------------------------------------------- -calculatemountains0 .proc +.proc calculatemountains0 ; Only for testing - makes ground flat (0 pixels) ; and places tanks on it ; remember to remove in final compilation :) @@ -968,8 +968,9 @@ SetYofNextTank rts .endp ; **************************************************** + ; ----------------------------------------- -unPlot .proc +.proc unPlot ; plots a point and saves the plotted byte, reverts the previous plot. ; ----------------------------------------- ldx #0 ; only one pixel @@ -1072,8 +1073,9 @@ SkipThisPlot EndOfUnPlot rts .endp + ; ----------------------------------------- -plot .proc ;plot (xdraw, ydraw, color) +.proc plot ;plot (xdraw, ydraw, color) ; color == 1 --> put pixel ; color == 0 --> erase pixel ; this is one of the most important routines in the whole @@ -1106,11 +1108,7 @@ MakePlot lsr lsr tay ;save -;--- - - - - + ;--- ldx ydraw lda linetableL,x sta xbyte @@ -1132,17 +1130,16 @@ ClearPlot sta (xbyte),y rts .endp + ; ----------------------------------------- -point .proc +.proc point ; ----------------------------------------- ; checks state of the pixel (coordinates in xdraw and ydraw) ; result is in A (zero or appropriate bit is set) - ; let's calculate coordinates from xdraw and ydraw mwa xdraw xbyte - lda xbyte and #$7 sta ybit @@ -1154,9 +1151,7 @@ point .proc lsr lsr tay ;save - -;--- - + ;--- ldx ydraw lda linetableL,x sta xbyte @@ -1172,7 +1167,7 @@ point .proc .endp ;-------------------------------------------------- -DrawLine .proc +.proc DrawLine ;-------------------------------------------------- mva #0 ydraw+1 lda #screenheight @@ -1182,23 +1177,21 @@ DrawLine .proc jsr plot.MakePlot ;rts jmp IntoDraw ; jumps inside Draw routine - ; because one pixel is already plotted + ; because one pixel is already plotted - -loopdraw - - lda (xbyte),y - and bittable2,x - sta (xbyte),y -IntoDraw adw xbyte #screenBytes - - dec tempbyte01 - bne loopdraw +@ + lda (xbyte),y + and bittable2,x + sta (xbyte),y +IntoDraw + adw xbyte #screenBytes + dec tempbyte01 + bne @- rts .endp -; + ; ------------------------------------------ -TypeChar .proc +.proc TypeChar ; puts char on the graphics screen ; in: CharCode ; in: left LOWER corner of the char coordinates (xdraw, ydraw) @@ -1247,7 +1240,6 @@ CopyMask lsrw xbyte ; div 8 rorw xbyte rorw xbyte - ;--- ldy xbyte @@ -1264,46 +1256,15 @@ CopyMask ldx ybit beq MaskOK00 MakeMask00 - lsr mask1 - ror mask2 - lsr mask1+1 - ror mask2+1 - lsr mask1+2 - ror mask2+2 - lsr mask1+3 - ror mask2+3 - lsr mask1+4 - ror mask2+4 - lsr mask1+5 - ror mask2+5 - lsr mask1+6 - ror mask2+6 - lsr mask1+7 - ror mask2+7 - sec - ror char1 - ror char2 - sec - ror char1+1 - ror char2+1 - sec - ror char1+2 - ror char2+2 - sec - ror char1+3 - ror char2+3 - sec - ror char1+4 - ror char2+4 - sec - ror char1+5 - ror char2+5 - sec - ror char1+6 - ror char2+6 - sec - ror char1+7 - ror char2+7 + .rept 8 + lsr mask1+# + ror mask2+# + .endr + .rept 8 + sec + ror char1+# + ror char2+# + .endr dex bne MakeMask00 MaskOK00 @@ -1333,132 +1294,126 @@ CharLoopi inx cpx #8 bne CharLoopi +EndPutChar rts .endp + ; ------------------------------------------ -PutChar4x4 .proc ;puts 4x4 pixels char on the graphics screen -; in: xdraw, ydraw (upper left corner of the char) +.proc PutChar4x4 +; puts 4x4 pixels char on the graphics screen +; in: xdraw, ydraw (LOWER left corner of the char) ; in: CharCode4x4 (.sbyte) +; in: plot4x4color (0/1) +; all pixels are being drawn +; (empty and not empty) ;-------------------------------------------------- - lda plot4x4color - sta color - - -; calculating address of the first byte - mva #4 LoopCounter4x4 + ; cpw ydraw #(screenheight-4) + ; jcs TypeChar.EndPutChar ;nearest RTS + ; cpw xdraw #(screenwidth-4) + ; jcs TypeChar.EndPutChar ;nearest RTS + ; checks ommited. + lda plot4x4color + beq FontColor0 + lda #$ff ; better option to check (plot4x4color = $00 or $ff) + sta plot4x4color +FontColor0 + ; char to the table lda CharCode4x4 and #1 + beq Upper4bits + lda #$ff ; better option to check (nibbler4x4 = $00 or $ff) +Upper4bits sta nibbler4x4 lda CharCode4x4 - ror - ; in carry there is which nibble of the byte is to be taken - clc - adc #(3*32) - sta y4x4 -nextline4x4 - mva #4 Xcounter4x4 - ldy y4x4 - lda font4x4,y ;there was a problem with OMC here, but it works now + lsr + sta fontind + lda #$00 + sta fontind+1 + + adw fontind #font4x4 - ldx nibbler4x4 - beq uppernibble + ; and 4 bytes to the table + ldy #0 + ldx #3 +CopyChar + lda (fontind),y ; Y must be 0 !!!! + bit nibbler4x4 + bpl GetUpper4bits + :4 rol +GetUpper4bits + ora #$0f + sta char1,x + lda #$ff + sta char2,x + ; and 4 bytes as a mask + lda #$f0 + sta mask1,x + lda #$00 + sta mask2,x + adw fontind #32 ; next byte of 4x4 font + dex + bpl CopyChar - asl - asl - asl - asl -uppernibble - rol - sta StoreA4x4 - bcs EmptyPixel ; the font I drawn is in inverse ... - ;lda plot4x4color ;these lines are not necessary - ;sta color ;if a plots are one color only - jsr plot - ;jmp Loop4x4Continued -EmptyPixel - ;lda #1 ;reverse color (color==1-color) - ;sec - ;sbc plot4x4color - ;sta color - ;jsr plot - ;this is turned off for speed - ;anyway we assume the text is being drawn - ;over an empty space -Loop4x4Continued - inw xdraw - lda StoreA4x4 - dec Xcounter4x4 - ldx Xcounter4x4 - bne uppernibble - ; here we have on screen one line of the char - inw ydraw - sbw xdraw #4 - sbw y4x4 #32 - dec:lda LoopCounter4x4 - bne nextline4x4 + ; calculating coordinates from xdraw and ydraw + mwa xdraw xbyte - rts -.endp -; ------------------------------------------ -PutChar4x4FULL .proc; -;this routine works just like PutChar4x4, -;but this time all pixels are being drawn -;(empty and not empty) -;-------------------------------------------------- + lda xbyte + and #$7 + sta ybit -; calculating address of the first byte - mva #4 LoopCounter4x4 - lda CharCode4x4 - and #1 - sta nibbler4x4 - lda CharCode4x4 - ror - ; in carry there is which nibble of the byte is to be taken clc - clc - adc #(3*32) - sta y4x4 -nextline4x4FULL - mva #4 Xcounter4x4 - ldy y4x4 - lda font4x4,y - - ldx nibbler4x4 - beq uppernibbleFULL - - asl - asl - asl - asl -uppernibbleFULL - rol - sta StoreA4x4 - bcs EmptyPixelFULL - lda plot4x4color ;these lines are not necessary - sta color ;if a plots are one color only - jsr plot - jmp Loop4x4ContinuedFULL -EmptyPixelFULL - lda #1 ;reverse color (color==1-color) + lsrw xbyte ; div 8 + rorw xbyte + rorw xbyte +;--- + ldy xbyte + lda ydraw ; y = y - 3 because left lower. sec - sbc plot4x4color - sta color - jsr plot - ;this is turned on now - ;of course it is slower - -Loop4x4ContinuedFULL - inw xdraw - lda StoreA4x4 - dec Xcounter4x4 - ldx Xcounter4x4 - bne uppernibbleFULL - ; here we have on screen one line of the char - inw ydraw - sbw xdraw #4 - sbw y4x4 #32 ; why? possibly because of width of the 4x4 font - dec:lda LoopCounter4x4 - bne nextline4x4FULL + sbc #3 + tax + lda linetableL,x + sta xbyte + lda linetableH,x + sta xbyte+1 + ; mask preparation and character shifting + ldx ybit + beq MaskOK01 +MakeMask01 + .rept 4 + lsr mask1+# + ror mask2+# + .endr + .rept 4 + sec + ror char1+# + ror char2+# + .endr + dex + bne MakeMask01 +MaskOK01 + ldx #0 +CharLoopi4x4 + lda (xbyte),y + ora mask1,x + bit plot4x4color + bpl PutInColor0_1 ; only mask - no char + and char1,x +PutInColor0_1 + sta (xbyte),y + iny + lda (xbyte),y + ora mask2,x + bit plot4x4color + bpl PutInColor0_2 ; only mask - no char + and char2,x +PutInColor0_2 + sta (xbyte),y + dey + adw xbyte #screenBytes + inx + cpx #4 + bne CharLoopi4x4 +EndPut4x4 rts .endp diff --git a/scorch.asm b/scorch.asm index 371e832..d35a891 100644 --- a/scorch.asm +++ b/scorch.asm @@ -36,7 +36,7 @@ ;we decided it must go in 'English' to let other people work on it .macro build - dta d"141" ; number of this build (3 bytes) + dta d"142" ; number of this build (3 bytes) .endm icl 'definitions.asm' @@ -252,12 +252,12 @@ skipzeroing lda #0 tax @ - sta previousAngle,x + sta singleRoundVars,x inx - cpx #(singleRoundVarsEnd-PreviousAngle) + cpx #(singleRoundVarsEnd-singleRoundVars) bne @- - ldx #5 + ldx #(MaxPlayers-1) SettingEnergies lda #$00 sta gainL,x @@ -271,13 +271,13 @@ SettingEnergies ; anything in eXistenZ table means that this tank exist ; in the given round lda #<1000 - sta MaxEnergyTableL,x + sta MaxForceTableL,x lda #>1000 - sta MaxEnergyTableH,x + sta MaxForceTableH,x lda #<350 - sta EnergyTableL,x + sta ForceTableL,x lda #>350 - sta EnergyTableH,x + sta ForceTableH,x ;lda #(255-45) ;it does not look good when all tanks have @@ -474,13 +474,13 @@ missed jsr DisplayOffensiveTextNr NextPlayerShoots - mva #1 Erase - jsr drawtanks + ;mva #1 Erase + ;jsr drawtanks ;before it shoots, the eXistenZ table must be ;updated accordingly to actual energy (was forgotten, sorry to ourselves) - ldx #5 + ldx #(MaxPlayers-1) SeteXistenZ lda Energy,x sta eXistenZ,x @@ -500,25 +500,23 @@ LP0 ROR L1 BCC B0 CLC - ADC #10 ; multiplication by 10 (L2) + ADC #10 ; (L2) multiplication by 10 B0 DEY BNE LP0 ror ROR L1 - STA MaxEnergyTableH,x + STA MaxForceTableH,x lda L1 - sta MaxEnergyTableL,x + sta MaxForceTableL,x dex bpl SeteXistenZ ;was setup of maximum energy for players - mva #0 Erase - jsr drawtanks + ;mva #0 Erase + ;jsr drawtanks - ;inc TankNr - ;lda TankNr inc:lda TankSequencePointer cmp NumberOfPlayers bne PlayersAgain @@ -562,12 +560,21 @@ NoPlayerNoDeath lda #0 sta FallDown1 sta FallDown2 + sta ydraw+1 + ; get position of the tank + ldx TankNr + lda xtankstableL,x + sta xdraw + lda xtankstableH,x + sta xdraw+1 + lda yTanksTable,x + sta ydraw lda #1 ; Missile jsr ExplosionDirect jmp MainRoundLoop.continueMainRoundLoopAfterSeppuku .endp ;--------------------------------- -PlayerXdeath +.proc PlayerXdeath ; this tank should not explode anymore: ; there is 0 in A, and Tank Number in X, so... @@ -591,7 +598,6 @@ PlayerXdeath sta ResultsTable,x inc CurrentResult - mva #sfx_death_begin sfx_effect ;RandomizeDeffensiveText randomize talk.NumberOfOffensiveTexts (talk.NumberOfDeffensiveTexts+talk.NumberOfOffensiveTexts-1) @@ -607,8 +613,6 @@ PlayerXdeath mva #0 plot4x4color jsr DisplayOffensiveTextNr - - ; calculate position of the explosion (the post-death one) ldx TankTempY clc @@ -641,7 +645,7 @@ PlayerXdeath MetodOfDeath lda random and #%00011111 ; range 0-31 - cmp #20 ; we have 20 weapons in table (from 0 to 19) + cmp #(weaponsOfDeathEnd-weaponsOfDeath) ; we have 20 weapons in table (from 0 to 19) bcs MetodOfDeath tay lda weaponsOfDeath,y @@ -656,6 +660,7 @@ MetodOfDeath jmp MainRoundLoop.AfterExplode +.endp ;-------------------------------------------------- .proc DecreaseEnergyX @@ -808,20 +813,20 @@ SetunPlots sta gtictls jsr PMoutofScreen lda TankColoursTable ; temporary colours of sprites under tanks - sta $2c0 + sta COLPM0S lda TankColoursTable+1 - sta $2c1 + sta COLPM1S lda TankColoursTable+2 - sta $2c2 + sta COLPM2S lda TankColoursTable+3 - sta $2c3 + sta COLPM3S LDA TankColoursTable+4 STA COLPF3S ; joined missiles (5th tank) mva #0 hscrol ;let the tanks be visible! - ldx #5 + ldx #(maxPlayers-1) lda #1 ; tank is visible MakeTanksVisible sta eXistenZ,x @@ -909,7 +914,19 @@ lab2 jmp SYSVBV .endp ;---------------------------------------------- -RandomizeSequence .proc +.proc RandomizeSequence0 + ldx #0 +@ txa + sta TankSequence,x + inx + cpx #MaxPlayers + bne @- + rts +.endp + + + +.proc RandomizeSequence ; in: NumberOfPlayers ; out: TankSequence ; how: get random number lower than NumberOfPlayers @@ -982,7 +999,7 @@ RandomizeAngle .proc ; .endp ;---------------------------------------------- RandomizeForce .proc -; routine returns in EnergyTable/L/H +; routine returns in ForceTable/L/H ; valid force of shooting for TankNr ; in X must be TankNr ; low and high randomize boundary passed as word value @@ -990,36 +1007,41 @@ RandomizeForce .proc ; RandBoundaryHigh ;---------------------------------------------- - lda MaxEnergyTableL,x - sta temp - lda MaxEnergyTableH,x - sta temp+1 -GetRandomAgain lda RANDOM - ; gets values in range(256,765) sta temp2 - lda RANDOM ; :) + lda RANDOM and #%00000011 ;(0..1023) sta temp2+1 cpw RandBoundaryLow temp2 - bcs GetRandomAgain + bcs RandomizeForce cpw RandBoundaryHigh temp2 - bcc GetRandomAgain + bcc RandomizeForce - cpw temp temp2 - bcs EnergyInRange - - mwa temp temp2 - -EnergyInRange lda temp2 - sta EnergyTableL,x + sta ForceTableL,x lda temp2+1 - sta EnergyTableH,x - + sta ForceTableH,x + +;--------- +LimitForce +; in X must be TankNr +; cuts force to MaxForceTable + lda MaxForceTableH,x + cmp ForceTableH,x + bne @+ + lda MaxForceTableL,x + cmp ForceTableL,x +@ bcs @+ + + lda MaxForceTableL,x + sta ForceTableL,x + lda MaxForceTableH,x + sta ForceTableH,x +@ rts + .endp ;---------------------------------------------- @@ -1041,14 +1063,14 @@ rotateRight;older is lower bne MoveBarrelToNewPosition mva #$30 CharCode ; if angle goes through 0 we clear the barrel - jsr drawtankNrX + jsr DrawTankNr.drawtankNrX jmp MoveBarrelToNewPosition rotateLeft dec angleTable,x bpl MoveBarrelToNewPosition mva #$2e CharCode - jsr drawtankNrX + jsr DrawTankNr.drawtankNrX jmp MoveBarrelToNewPosition diff --git a/scorch.xex b/scorch.xex index 7335a42..a172763 100644 Binary files a/scorch.xex and b/scorch.xex differ diff --git a/textproc.asm b/textproc.asm old mode 100755 new mode 100644 index b03107d..46d8ae3 --- a/textproc.asm +++ b/textproc.asm @@ -1355,7 +1355,8 @@ TypeLine4x4Loop sta CharCode4x4 mwa LineXdraw Xdraw mva LineYdraw Ydraw - jsr PutChar4x4FULL ;type empty pixels as well! + mva #1 plot4x4color + jsr PutChar4x4 ;type empty pixels as well! adw LineXdraw #4 inc LineCharNr jmp TypeLine4x4Loop @@ -1373,11 +1374,12 @@ EndOfTypeLine4x4 mwa Xdraw xk mva Ydraw yc - mva #15 fs ; temp, how many times blink the billboard -@ - lda fs - and #$01 - sta plot4x4color + mva #20 fs ; temp, how many times blink the billboard +seppuku_loop + lda CONSOL ; turbo mode + cmp #6 ; START + sne:mva #1 fs ; finish it + mva #4 ResultY ; where seppuku text starts Y-wise on the screen ;top frame @@ -1399,12 +1401,10 @@ EndOfTypeLine4x4 mwa #((ScreenWidth/2)-(8*4)) LineXdraw ; centering mva ResultY LineYdraw jsr TypeLine4x4 - - dec fs - bne @- - + ;clean seppuku - mva #3 fs + + mva #3 dx mva #4 ResultY @ mva #1 plot4x4color @@ -1414,9 +1414,13 @@ EndOfTypeLine4x4 jsr TypeLine4x4 adb ResultY #4 ;next line - dec fs - bne @- + dec dx + bne @- + dec fs + jne seppuku_loop + +quit_seppuku ;restore vars mva yc Ydraw mwa xk Xdraw @@ -1664,9 +1668,9 @@ FinishResultDisplay ;display Force ;========================= ldx TankNr - lda EnergyTableL,x + lda ForceTableL,x sta decimal - lda EnergyTableH,x + lda ForceTableH,x sta decimal+1 mwa #textbuffer+40+34 displayposition jsr displaydec diff --git a/variables.asm b/variables.asm old mode 100755 new mode 100644 index 2f570b9..4247ef3 --- a/variables.asm +++ b/variables.asm @@ -33,6 +33,8 @@ RoundNrDisplay .byte $ff variablesStart ; zeroing starts here +drawFunction .ds 1 ; 0 - plot, %10000000 - LineLength (N), %01000000 - DrawCheck (V) +;-------------- escFlag .ds 1 ;-------------- sfx_effect .ds 1 @@ -82,14 +84,14 @@ TempResults CurrentResult .DS 1 ;----------------------------------- -EnergyTableL ;shooting Force of the tank during the round +ForceTableL ;shooting Force of the tank during the round .DS [MaxPlayers] -EnergyTableH +ForceTableH .DS [MaxPlayers] ;maxplayers=6 -MaxEnergyTableL ;Energy of the tank during the round +MaxForceTableL ;Energy of the tank during the round ;(limes superior force of the Shoot) .DS [MaxPlayers] ;1000 is the default -MaxEnergyTableH +MaxForceTableH .DS [MaxPlayers] ;----------------------------------- @@ -126,11 +128,11 @@ xtankstableH .DS [MaxPlayers] ytankstable ;Y positions of tanks (lower left point) .DS [MaxPlayers] -LowResDistances ; coarse stank positions divided by 4 (to be in just one byte) +LowResDistances ; coarse tank positions divided by 4 (to be in just one byte) .DS [MaxPlayers] ;----------------------------------- Erase .DS 1 ; if 1 only mask of the character is printed - ; on the graphics screen. if 0 character is printed normally + ; on the graphics screen. if 0 character is printed normally ;----------------------------------- RangeLeft .DS 2 ;range of the soil to be fallen down @@ -159,7 +161,6 @@ sandhogflag .DS 1 ; (0 digger, 8 sandhog) ;ofdirt magic .DS 2 ; was tempor2, but it was not compiling!!! (bug in OMC65) ;draw -DrawJumpAddr .DS 2 HowToDraw .DS 1 ; bits here mean ; 0 - negative X (go up) @@ -333,6 +334,7 @@ TextNumberOff .DS 1 TankTempY .DS 1 ;-------------- single round variables -------------- +singleRoundVars previousAngle .DS [MaxPlayers] previousEnergyL diff --git a/weapons.asm b/weapons.asm old mode 100755 new mode 100644 index 64d7f19..fa3bcbd --- a/weapons.asm +++ b/weapons.asm @@ -13,7 +13,7 @@ ldx TankNr lda ActiveWeapon,x .endp -ExplosionDirect .proc +.proc ExplosionDirect asl tax lda ExplosionRoutines+1,x @@ -214,9 +214,7 @@ FunkyBombLoop lda random lsr and #%00011111 - bcc DoNotEor - eor #$ff -DoNotEor + scc:eor #$ff sta Angle lda #0 @@ -231,6 +229,7 @@ DoNotEor lda HitFlag beq NoExplosionInFunkyBomb mva #sfx_baby_missile sfx_effect + mva #11 ExplosionRadius jsr xmissile NoExplosionInFunkyBomb dec FunkyBombCounter @@ -545,7 +544,7 @@ DiggerCharacter sbc EndOfTheBarrelY,y sta ybyte mva #0 ybyte+1 - mwa #Drawplot DrawJumpAddr + mva #0 drawFunction mwa xdraw LaserCoordinate mwa ydraw LaserCoordinate+2 mwa xbyte LaserCoordinate+4 @@ -616,7 +615,7 @@ ExplosionLoop2 ;check tanks' distance from the centre of the explosion - mwa #DrawLen DrawJumpAddr + mva #%10000000 drawFunction ;the above switches Draw to measuring length ;trick is easy - how many pixels does it take to draw ;a line from one point to another @@ -658,9 +657,7 @@ DistanceCheckLoop ;multiply difference by 8 clc adc #1 - asl - asl - asl + :3 asl tay jsr DecreaseEnergyX @@ -978,17 +975,17 @@ ToHighFill ldx TankNr ;Checking the maximal force - lda MaxEnergyTableH,x - cmp EnergyTableH,x + lda MaxForceTableH,x + cmp ForceTableH,x bne ContinueToCheckMaxForce2 - lda MaxEnergyTableL,x - cmp EnergyTableL,x + lda MaxForceTableL,x + cmp ForceTableL,x ContinueToCheckMaxForce2 bcs @+ - lda MaxEnergyTableH,x - sta EnergyTableH,x - lda MaxEnergyTableL,x - sta EnergyTableL,x + lda MaxForceTableH,x + sta ForceTableH,x + lda MaxForceTableL,x + sta ForceTableL,x @ jsr StatusDisplay ;all digital values like force, angle, wind, etc. jsr PutTankNameOnScreen @@ -1059,36 +1056,36 @@ notpressedJoy pressedUp ;force increaseeee! ldx TankNr - inc EnergyTableL,x + inc ForceTableL,x bne CheckingMaxForce - inc EnergyTableH,x + inc ForceTableH,x CheckingMaxForce mva #sfx_set_power_1 sfx_effect - lda MaxEnergyTableH,x - cmp EnergyTableH,x + lda MaxForceTableH,x + cmp ForceTableH,x bne FurtherCheckMaxForce - lda MaxEnergyTableL,x - cmp EnergyTableL,x + lda MaxForceTableL,x + cmp ForceTableL,x FurtherCheckMaxForce jcs BeforeFire - lda MaxEnergyTableH,x - sta EnergyTableH,x - lda MaxEnergyTableL,x - sta EnergyTableL,x + lda MaxForceTableH,x + sta ForceTableH,x + lda MaxForceTableL,x + sta ForceTableL,x jmp BeforeFire CTRLPressedUp ldx TankNr - lda EnergyTableL,x + lda ForceTableL,x clc adc #10 - sta EnergyTableL,x + sta ForceTableL,x bcc CheckingMaxForce - inc EnergyTableH,x + inc ForceTableH,x jmp CheckingMaxForce @@ -1096,16 +1093,16 @@ pressedDown mva #sfx_set_power_1 sfx_effect ldx TankNr - dec EnergyTableL,x - lda EnergyTableL,x + dec ForceTableL,x + lda ForceTableL,x cmp #$ff bne @+ - dec EnergyTableH,x + dec ForceTableH,x bpl @+ ForceGoesZero lda #0 - sta EnergyTableH,x - sta EnergyTableL,x + sta ForceTableH,x + sta ForceTableL,x @ jmp BeforeFire @@ -1114,11 +1111,11 @@ CTRLPressedDown ldx TankNr sec - lda EnergyTableL,x + lda ForceTableL,x sbc #10 - sta EnergyTableL,x + sta ForceTableL,x jcs BeforeFire - dec EnergyTableH,x + dec ForceTableH,x bmi ForceGoesZero jmp BeforeFire @@ -1130,7 +1127,7 @@ pressedLeft cmp #$ff ; if angle goes through 0 we clear the barrel bne NotThrough90DegreesLeft mva #$2e CharCode - jsr drawtankNrX + jsr DrawTankNr.drawtankNrX NotThrough90DegreesLeft cmp #(255-91) jne BeforeFire @@ -1145,7 +1142,7 @@ pressedRight lda AngleTable,x bne NotThrough90DegreesRight mva #$30 CharCode ; if angle goes through 0 we clear the barrel - jsr drawtankNrX + jsr DrawTankNr.drawtankNrX NotThrough90DegreesRight cmp #91 jne BeforeFire @@ -1222,9 +1219,9 @@ RandomizeOffensiveText sta Force+1 bne AfterStrongShoot NotStrongShoot - lda EnergyTableL,x + lda ForceTableL,x sta Force - lda EnergyTableH,x + lda ForceTableH,x sta Force+1 AfterStrongShoot lda #$0 @@ -1536,7 +1533,7 @@ noSmokeTracer RepeatIfSmokeTracer mwa ytraj+1 Ytrajold+1 mwa xtraj+1 Xtrajold+1 - mwa #DrawCheck DrawJumpAddr + mva #%01000000 drawFunction lda #0 sta Result @@ -1556,7 +1553,7 @@ RepeatIfSmokeTracer stx LeapFrogAngle ; we will need it later ;Angle works like this: - ;0 'degrees' is sraight up + ;0 'degrees' is straight up ;90 'degrees' is horizontally right ;255 is straight up (same as 0) ;255-90 (165) horizontally left @@ -1734,13 +1731,13 @@ FlightLeft lda goleft bne FlightsLeft ;blow on bullet flighting left lda WindOrientation - bne WindToLeft + bne LWindToRight beq LWindToLeft FlightsLeft lda WindOrientation beq LWindToRight -LWindToLeft +LWindToLeft ; here Wind to right, bullet goes right as well, so vx=vx+Wind ; here Wind to left, bullet goes left as well, so vx=vx+Wind clc @@ -1757,23 +1754,23 @@ LWindToLeft adc #0 sta vx+3 jmp @+ -WindToLeft + LWindToRight - ;Wind to left, bullet right, so vx=vx-Wind - ;Wind to right, bullet left, so vx=vx-Wind - sec - lda vx - sbc Wind - sta vx - lda vx+1 - sbc Wind+1 - sta vx+1 - lda vx+2 - sbc #0 - sta vx+2 - lda vx+3 - sbc #0 - sta vx+3 + ;Wind to left, bullet right, so vx=vx-Wind + ;Wind to right, bullet left, so vx=vx-Wind + sec + lda vx + sbc Wind + sta vx + lda vx+1 + sbc Wind+1 + sta vx+1 + lda vx+2 + sbc #0 + sta vx+2 + lda vx+3 + sbc #0 + sta vx+3 @ mwa xtrajold+1 xdraw mwa ytrajold+1 ydraw @@ -1813,25 +1810,24 @@ SkipCollisionCheck jsr UnPlot NoUnPlot - ; jsr PlotPointer - + jmp Loopi Hit mwa XHit xdraw - mva YHit ydraw ; one byte now + mwa YHit ydraw jsr unPlot EndOfFlight -; mwa xdraw xcircle ; we must store for a little while -; mva ydraw ycircle ; xdraw and ydraw .... but this values are in YHit and XHit !!! + mwa xdraw xcircle ; we must store for a little while + mva ydraw ycircle ; xdraw and ydraw .... but this values are in YHit and XHit !!! mwa #0 xdraw mva #screenheight-1 ydraw jsr unPlot -; mwa xcircle xdraw -; mva ycircle ydraw - mwa XHit xdraw - mva YHit ydraw + mwa xcircle xdraw + mva ycircle ydraw +; mwa XHit xdraw +; mva YHit ydraw ldy SmokeTracerFlag beq EndOfFlight2 @@ -1847,9 +1843,9 @@ SecondFlight .proc ; ---------------- copied code fragment from before firing. not too elegant. ; ---------------- get fire parameters again ldx TankNr - lda EnergyTableL,x + lda ForceTableL,x sta Force - lda EnergyTableH,x + lda ForceTableH,x sta Force+1 lda #$0 sta Force+2 @@ -1886,7 +1882,7 @@ SecondFlight .proc sbc #0 sta ytraj+2 - ldy #100 + ldy #100 ; ??? mva #1 tracerflag ; I do not know (I mean I think I know ;) ) ; 10 years later - I do not know!!! ; 20 years later - still do not know :] @@ -1975,12 +1971,10 @@ MIRVcopyParameters ldx #$FF ; it will turn 0 in a moment anyway stx MirvMissileCounter mrLoopi - inc MirvMissileCounter - lda MirvMissileCounter + inc:lda MirvMissileCounter cmp #5 - bne mrLoopix - mva #0 MirvMissileCounter -mrLoopix + sne:mva #0 MirvMissileCounter + ldx MirvMissileCounter ; Y changes only for bullet number 0 ; because rest of the bullets have the same Y (height) @@ -2142,7 +2136,7 @@ MIRVcheckCollision lda xtraj02,x adc #>mountaintable sta temp+1 - ; adw mountaintable --- it does not work!!!!!!!! and should! (OMC bug?) #temp + ldy #0 lda ytraj+1 cmp (temp),y @@ -2169,7 +2163,7 @@ mrHit ; we have to make unPlot over the screen (to initialise it) ; before actual explosion mwa #0 xdraw - mva #screenheight-1 ydraw + mwa #screenheight-1 ydraw jsr unPlot.unPlotAfterX ldx MirvMissileCounter ldy #0 @@ -2184,6 +2178,8 @@ mrHit adc #>mountaintable sta temp+1 lda (temp),y + sec + sbc #1 sta ydraw sty ydraw+1 ;we know that y=0 jsr missile ; explode .... @@ -2290,9 +2286,9 @@ CalculateExplosionRange0 lda #0 sta RangeRight sta RangeRight+1 - mva #11 ExplosionRadius + mva #11 ExplosionRadius ; what is this magic value? ;-------------------------------------------------- -CalculateExplosionRange .proc +.proc CalculateExplosionRange ;-------------------------------------------------- ;calculates total horizontal range of explosion by ;"summing up" ranges of all separate explosions