diff --git a/README.md b/README.md index 82cc387..b69ae15 100755 --- a/README.md +++ b/README.md @@ -40,6 +40,13 @@ with the advent of fujinet (https://fujinet.online/) we are thinking about makin ## Changes: +###### Build 131 +2022-03-20 +- fixed bug: https://github.com/pkali/scorch_src/issues/4 It was really hard one, because I had to unspaghetti our own lousy code :] +- it is now impossible to purchase non-existing weapons. +- numerous edits / optimizations during debugging process +- bug tracker moved to https://github.com/pkali/scorch_src/issues + ###### Build 130 2022-03-13 - fixed bug: Decreasing of number of bullets after a shoot does not work correctly. It does look like it is fixed, although all I did was moving decreasing before shooting. Displaying number of bullets immediately after shoot. diff --git a/TODO.txt b/TODO.txt index cfb6ebc..705dedd 100755 --- a/TODO.txt +++ b/TODO.txt @@ -1,5 +1,6 @@ +MOVED TO: https://github.com/pkali/scorch_src/issues + TODO and BUGS file -rev. 2013-11-17 --------------------------------------------------------- Known bugs (+ means bug is fixed) @@ -11,11 +12,13 @@ Known bugs (+ means bug is fixed) 017: Observed MIRV loops - it shoots and shoots MIRV all over the screen. Very rare. 020: sometimes leftmost or rightmost remains of the funkybomb smoke do not get cleared I think it happens when one of the bombs goes out of the screen +023: NEW BUG. After the last change (bug 007) now the last shell of any weapon gets removed and + the game switches to Baby missile. Fixed: +001. when bullet goes straight down very fast it misses the tank it happens only when tank is standing on the bottom of - the screen (no groud below) + the screen (no ground below) +002. points after the round are not calculated correctly +003. if death's head explodes low, the lowest explosion wraps and appears on the top of the screen @@ -56,17 +59,15 @@ To do 006. Add sound effects (maybe sampled? or mp0 (sound based on fft)) 007. There is no defensive weapon handling (only parachute works, but also provisionally -009. Make AI in the existing frame +009. Make AI in the existing framework (ongoing) 010. It is impossible to look up a number of parachutes left. -012. Decreased number of bullets should be displayed just after the shoot. -013. Check LineTable - possibly it is unnecessarily long 018. Speed up soil down after soil eating weapons - correctly calculate ranges as now range is very broad even when very little soil is eaten. 019. Purchase impossible with joystick only. Add buy on e.g. joystick right. 020. Not a bug per se, but ydraw variable is word, possibly it can be switched to byte 021. Add player colors to purchase screen 022. Make colors more contrasting -023. Make not implemented weapons raise NotImplementedError :] +024. no visual indication of using defensive weapons Done: @@ -77,10 +78,13 @@ Done: E.g. when a given tank is shooting it's colour could be behind tank name on the text screen +005. Add number of rounds to the options menu -+008. No computer operated opponents - make a frame for AI!!! ++008. No computer operated opponents - make a framework for AI!!! +011. Colouring the top status lines in a colour of the active tank. +014. Demo mode - when all tanks are CPUs let them play non-stop! (replace waiting for a key-press after a round with a small delay) +015. Switch to mads for easier development (mads speeds it up, no doubt) +016. Speed up death's head (e.g.: draw each second circle) -017. Wide screen mode (with scroll?) ++012. Decreased number of bullets should be displayed just after the shoot. ++013. Check LineTable - possibly it is unnecessarily long. Checked. It is OK ++023. Make not implemented weapons raise NotImplementedError :] Done by making it impossible to purchase free weapons (price == $0) \ No newline at end of file diff --git a/display.asm b/display.asm index a192585..13d8edb 100755 --- a/display.asm +++ b/display.asm @@ -77,7 +77,7 @@ PlotLine = display + screenHeight*screenBytes ; the last line is plot pointer ;Screen displays go first to avoid crossing 4kb barrier ;----------------------------------------------- OptionsScreen - dta d"Welcome to Scorch ver. 130 (un)2000-2022" + dta d"Welcome to Scorch ver. 131 (un)2000-2022" dta d" Please select option with cursor keys " dta d" and press (Return) to proceed " OptionsHere diff --git a/grafproc.asm b/grafproc.asm index 40a2acd..875d278 100755 --- a/grafproc.asm +++ b/grafproc.asm @@ -229,6 +229,7 @@ EndOfDraw rts .endp +;-------------JumpPad------------- DrawJumpPad jmp (DrawJumpAddr) Drawplot @@ -236,10 +237,9 @@ Drawplot DrawLen inw LineLength rts +;-------------JumpPad------------- DrawCheck .proc -; lda SmokeTracerFlag -; bne yestrace ; jakie to g�upie.... lda tracerflag ora SmokeTracerFlag yestrace @@ -260,14 +260,7 @@ CheckCollisionDraw bne StopHitChecking mwa xdraw temp - ;adw temp --- it does not work!!!!!!!! and should? OMC ??? #mountaintable - clc - lda temp - adc #mountaintable - sta temp+1 + adw temp #mountaintable ldy #0 lda ydraw @@ -504,20 +497,20 @@ placetanks .proc ;-------------------------------------------------- ldx #(MaxPlayers-1) ;maxNumberOfPlayers-1 lda #0 -skip09 - ; clearing the tables with coordinates of the tank - ; it is necessary, because randomizing checks - ; if the given tank is already placed - ; after check if its position is not (0,0) - - ; I will be honest with you - I have no idea - ; what the above comment was intending to mean :) - - sta XtankstableL,x - sta XtankstableH,x - sta Ytankstable,x - dex - bpl skip09 +@ + ; clearing the tables with coordinates of the tank + ; it is necessary, because randomizing checks + ; if the given tank is already placed + ; after check if its position is not (0,0) + + ; I will be honest with you - I have no idea + ; what the above comment was intending to mean :) + + sta XtankstableL,x + sta XtankstableH,x + sta Ytankstable,x + dex + bpl @- mwa #0 temptankX @@ -635,10 +628,10 @@ drawtanknr lda eXistenZ,x bne SkipRemovigPM ; if energy=0 then no tank - ; hide P/M - lda #0 - sta hposp0,x - jmp DoNotDrawTankNr + ; hide P/M + lda #0 + sta hposp0,x + jmp DoNotDrawTankNr SkipRemovigPM @@ -964,21 +957,21 @@ ToTop ;it means substracting sbw yfloat delta lda yfloat+1 cmp #margin - bcs Skip01 - ; if smaller than 10 - ldx #$00 - stx UpNdown - jmp Skip01 + bcs @+ + ; if smaller than 10 + ldx #$00 + stx UpNdown + jmp @+ ToBottom - adw yfloat delta - lda yfloat+1 - cmp #screenheight-margin - bcc Skip01 - ; if higher than screen - ldx #$01 - stx UpNdown -Skip01 + adw yfloat delta + lda yfloat+1 + cmp #screenheight-margin + bcc @+ + ; if higher than screen + ldx #$01 + stx UpNdown +@ sta ydraw inw xdraw @@ -1096,7 +1089,9 @@ EndOfUnPlot rts .endp ; ----------------------------------------- -plot .proc ;plot (xdraw, ydraw) +plot .proc ;plot (xdraw, ydraw, color) +; color == 1 --> put pixel +; color == 0 --> erase pixel ; this is one of the most important routines in the whole ; game. If you are going to speed up the game, start with ; plot - it is used by every single effect starting from explosions @@ -1123,7 +1118,7 @@ MakePlot ;xbyte = xbyte/8 lda xbyte lsr xbyte+1 - ror ;just one bit over 256. Max screenwidht = 512!!! + ror ;just one bit over 256. Max screenwidth = 512!!! lsr lsr tay ;save diff --git a/scorch.asm b/scorch.asm index 6e067f9..5d7063f 100644 --- a/scorch.asm +++ b/scorch.asm @@ -53,7 +53,7 @@ .zpvar ytempDRAW .word ;same as above for XDRAW routine ;--------------temps used in circle routine .zpvar xi .word ;X (word) in draw routine - .zpvar fx .byte ;circle drawing variables + .zpvar fx .byte ;circle drawing variables .zpvar yi .word ;Y (word) in draw routine .zpvar fy .byte .zpvar xk .word @@ -75,7 +75,7 @@ displayposition = modify FlyDelay = 150 screenheight = 200 screenBytes = 40 -screenwidth = screenBytes*8 +screenwidth = screenBytes*8 ; Max screenwidth = 512!!! margin = 48 ;mountain drawing Y variable margin display = $1010 ;kill dos with the casette recorder! MaxPlayers = 6 @@ -272,7 +272,6 @@ loop inx cpx #(clearEnd-PreviousAngle) bne loop - .endp ldx #5 SettingEnergies @@ -318,6 +317,8 @@ SettingEnergies jsr drawmountains ;draw them jsr drawtanks ;finally draw tanks +.endp ; not really end of the procedure, but just for now. revisit. + ;--------------------round screen is ready--------- ;mva #0 TankNr @@ -408,12 +409,12 @@ AfterManualShooting jsr DecreaseWeaponBeforeShoot jsr DisplayingSymbols - ; lower energy to eventually let tanks commit suicide ldx TankNr - dec Energy,x + dec Energy,x ; lower energy to eventually let tanks commit suicide lda ActiveWeapon,x jsr Shoot + lda HitFlag ;0 if missed beq missed lda #0 @@ -428,6 +429,13 @@ AfterManualShooting AfterExplode + ldy WeaponDepleted + bne @+ + ldx TankNr + tya + sta ActiveWeapon,x +@ + ;temporary tanks removal (would fall down with soil) mva TankNr tempor2 mva #1 Erase @@ -773,10 +781,10 @@ loop05 sta TanksWeapon5,x sta TanksWeapon6,x dex - bne skip13 - lda #99 - bne loop05 -skip13 bpl loop05 + bne @+ + lda #99 + bne loop05 +@ bpl loop05 rts .endp diff --git a/scorch.xex b/scorch.xex index 4193d2e..784c843 100644 Binary files a/scorch.xex and b/scorch.xex differ diff --git a/textproc.asm b/textproc.asm index 1cfea00..5fdde65 100755 --- a/textproc.asm +++ b/textproc.asm @@ -134,14 +134,14 @@ OptionsFinished ldy OptionsTable+1 ldx #0 -skip10 - lda CashOptionL,y - sta moneyL,x - lda CashOptionH,y - sta moneyH,x - inx - cpx NumberOfPlayers - bne skip10 +@ + lda CashOptionL,y + sta moneyL,x + lda CashOptionH,y + sta moneyH,x + inx + cpx NumberOfPlayers + bne @- ;third option (gravity) ldy OptionsTable+2 @@ -234,7 +234,7 @@ OptionsYLoop ;------------------------------------------- ; call of the purchase screens for each tank -CallPurchaseForEveryTank +.proc CallPurchaseForEveryTank mva #$2 colpf2s ; set normal color mwa #PurchaseDL dlptrs lda dmactls @@ -259,9 +259,10 @@ AfterManualPurchase cmp NumberOfPlayers bne loop03 rts +.endp ;-------------------------------------------------- -Purchase ; +.proc Purchase ; ;-------------------------------------------------- ; In tanknr there is a number of the tank (player) ; that is buying weapons now (from 0). @@ -359,7 +360,7 @@ CheckWeapon01 ldy #$4 ; 4 chars from the beginning of the line sta (xbyte),y - ;now number of purchased units (bullets) + ;now number of purchased units (shells) clc lda xbyte adc #23 ; 23 chars from the beginning of the line @@ -409,24 +410,22 @@ CheckWeapon01 mva #0 temp+1 ; this number is only in X ; times 16 (it's length of the names of weapons) ldy #3 ; Rotate 4 times -Rotate02 +@ asl temp rol temp+1 dey - bpl Rotate02 - ; Hmmm..... Interesting why there is no CLC here? + bpl @- - adw temp #NamesOfWeapons modify - sbw modify #6 ; from 6th char + adw temp #NamesOfWeapons-6 modify ldy #6 ; from 6th char -modyf1 +@ lda (modify),y sta (xbyte),y iny cpy #(16+6) - bne modyf1 + bne @- ; in X there is what we need @@ -506,8 +505,8 @@ WeHaveOffset Rotate04 lsr xbyte+1 bcc DoNotAddX01 - clc - adc #40 + clc + adc #40 DoNotAddX01 ror ror xbyte @@ -668,20 +667,23 @@ ListChange sta WhichList bne SecondSelected mwa #ListOfWeapons WeaponsListDL - jmp dalejx01 + jmp @+ SecondSelected mwa #ListOfDefensiveWeapons WeaponsListDL -dalejx01 +@ lda #$00 sta PositionOnTheList sta OffsetDL1 jmp ChoosingItemForPurchase +.endp ; weapon purchase routne increases number of possessed bullets ; decreases cash and jumps to screen refresh ;-------------------------------------------------- -PurchaseWeaponNow +.proc PurchaseWeaponNow ;-------------------------------------------------- +isPriceZero = tempXRoller + lda WhichList bne PurchaseDeffensive @@ -696,6 +698,7 @@ PurchaseAll ; after getting weapon number the routine is common for all ldx tanknr tay ; weapon number is in Y + beq @+ sec lda moneyL,x ; substracting from posessed money sbc WeaponPriceL,y ; of price of the given weapon @@ -703,25 +706,20 @@ PurchaseAll lda moneyH,x sbc WeaponPriceH,y sta moneyH,x - ; now we have get address of + + ; save info about price == 0 + lda WeaponPriceL,y + ora WeaponPriceH,y + sta isPriceZero + + + ; now we have to get address of ; the table of the weapon of the tank - ; and add appropriate number of bullets - stx temp ;we will multiply by 64 - mva #0 temp+1 - ; times 64 - ; (because it is the lenght of one record in weapon table) - ldx #5 ; Rotate 6 times - ; (in Y there is a weapon number, we do not touch it!!!) -Rotate03 - asl temp - rol temp+1 - dex - bpl Rotate03 - lda #TanksWeapon1 - adc temp+1 + lda TanksWeaponsTableH,x sta temp+1 lda (temp),y ; and we have number of posessed bullets of the weapon @@ -729,15 +727,24 @@ Rotate03 sta (temp),y ; and we added appropriate number of bullets cmp #100 ; but there should be no more than 99 bullets bcc LessThan100 - lda #99 - sta (temp),y + lda #99 + sta (temp),y LessThan100 sty LastWeapon ; store last purchased weapon ; because we must put screen pointer next to it - jmp AfterPurchase + ; additional check for unfinished game + ; if weapon was free (price == $0) + ; then have nothing... + lda isPriceZero + bne @+ + lda #0 + sta (temp),y +@ + jmp Purchase.AfterPurchase +.endp -PutLitteChar +.proc PutLitteChar ; first let's cleat both lists from little chars mwa #ListOfWeapons xbyte ldx #52 ; there are 52 lines total @@ -846,9 +853,9 @@ NoArrowDown stx MoreDowndl sty MoreDowndl+1 rts - +.endp ; ----------------------------------------------------- -EnterPlayerName +.proc EnterPlayerName ; in: TankNr ; Out: TanksNames, SkillTable @@ -1008,11 +1015,10 @@ nextchar05 cpy #$08 bne nextchar05 rts +.endp - - -SelectLevel +.proc SelectLevel ; this routine highlights the choosen ; level of the computer opponent ldx #$9 ; 9 possible levels @@ -1042,8 +1048,10 @@ CheckNextLevel dex bpl CheckNextLevel01 rts +.endp + ;-------------------------------------------------- -displaydec ;decimal (word), displayposition (word) +.proc displaydec ;decimal (word), displayposition (word) ;-------------------------------------------------- ; displays decimal number as in parameters (in text mode) ; leading zeores are removed @@ -1104,10 +1112,10 @@ displayloop bpl displayloop rts - +.endp ;-------------------------------------------------- -displaybyte ;decimal (byte), displayposition (word) +.proc displaybyte ;decimal (byte), displayposition (word) ;-------------------------------------------------- ; displays decimal number as in parameters (in text mode) ; leading zeores are removed @@ -1153,6 +1161,7 @@ displayloop1 bpl displayloop1 rts +.endp ;-------decimal constans zero digits dta d"0123456789" @@ -1160,7 +1169,7 @@ nineplus dta d"9"+1 space dta d" " ;-------------------------------------------------------- -DisplayOffensiveTextNr ; +.proc DisplayOffensiveTextNr ; ;This routine displays texts using PutChar4x4 ;pretty cool, eh ;parameters are: @@ -1306,9 +1315,9 @@ DOTNcharloop bne DOTNcharloop rts - +.endp ;------------------------------- -TypeLine4x4 ; +.proc TypeLine4x4 ; ;------------------------------- ;this routine prints line ending with $ff ;address in LineAddress4x4 @@ -1337,6 +1346,7 @@ TypeLine4x4Loop EndOfTypeLine4x4 rts +.endp ;-------------------------------- .proc DisplayResults ; diff --git a/variables.asm b/variables.asm index 8e7d350..1961d77 100755 --- a/variables.asm +++ b/variables.asm @@ -68,10 +68,11 @@ NewAngle ActiveWeapon ;number of the selected weapon :MaxPlayers .by 0 +WeaponDepleted .by 0 ; if 0 deactivate the weapon and switch to Baby Missile ;----------------------------------- -;format of the static point number used in the game -; 20203.5 = 128 : <20203 : >20203 +;format of the 3-byte static point number used in the game +; 20203.5 => 128 : <20203 : >20203 ;----------------------------------- L1 .by 0 ; variable used in multiplications (by 10:) @@ -772,20 +773,204 @@ TanksNamesDefault dta d"5th Tank" dta d"6th Tank" +;Weapon prices (*10 on screen) +price_Baby_Missile___ = 0 ;_0 +price_Missile________ = 96 ;_1 +price_Baby_Nuke______ = 111 ;_2 +price_Nuke___________ = 144 ;_3 +price_LeapFrog_______ = 192 ;_4 +price_Funky_Bomb_____ = 293 ;_5 +price_MIRV___________ = 456 ;_6 +price_Death_s_Head___ = 337 ;_7 +price_Napalm_________ = 0 ;496 ;_8 +price_Hot_Napalm_____ = 0 ;511 ;_9 +price_Tracer_________ = 102 ;_10 +price_Smoke_Tracer___ = 291 ;_11 +price_Baby_Roller____ = 689 ;_12 +price_Roller_________ = 600 ;_13 +price_Heavy_Roller___ = 592 ;_14 +price_Riot_Charge____ = 0 ;330 ;_15 +price_Riot_Blast_____ = 0 ;341 ;_16 +price_Riot_Bomb______ = 369 ;_17 +price_Heavy_Riot_Bomb = 322 ;_18 +price_Baby_Digger____ = 336 ;_19 +price_Digger_________ = 276 ;_20 +price_Heavy_Digger___ = 253 ;_21 +price_Baby_Sandhog___ = 218 ;_22 +price_Sandhog________ = 191 ;_23 +price_Heavy_Sandhog__ = 305 ;_24 +price_Dirt_Clod______ = 104 ;_25 +price_Dirt_Ball______ = 130 ;_26 +price_Ton_of_Dirt____ = 171 ;_27 +price_Liquid_Dirt____ = 0 ;530 ;_28 +price_Dirt_Charge____ = 581 ;_29 +price_Earth_Disrupter = 0 ;430 ;_30 +price_Plasma_Blast___ = 0 ;274 ;_31 +price_Laser__________ = 577 ;_32 +price______________33 = 0 +price______________34 = 0 +price______________35 = 0 +price______________36 = 0 +price______________37 = 0 +price______________38 = 0 +price______________39 = 0 +price______________40 = 0 +price______________41 = 0 +price______________42 = 0 +price______________43 = 0 +price______________44 = 0 +price______________45 = 0 +price______________46 = 0 +price______________47 = 0 +price_Heat_Guidance__ = 0 ;_48_($30) +price_Bal_Guidance___ = 0 ;_49 +price_Horz_Guidance__ = 0 ;_50 +price_Vert_Guidance__ = 0 ;_51 +price_Lazy_Boy_______ = 0 ;_52 +price_Parachute______ = 1100 ;_53 +price_Battery________ = 0 ;_54 +price_Mag_Deflector__ = 0 ;_55 +price_Shield_________ = 0 ;_56 +price_Force_Shield___ = 0 ;_57 +price_Heavy_Shield___ = 0 ;_58 +price_Super_Mag______ = 0 ;_59 +price_Auto_Defense___ = 0 ;_60 +price_Fuel_Tank______ = 0 ;_61 +price_Contact_Trigger = 0 ;_62 +price______________63 = 0 + WeaponPriceH ; weapons prices (tables with prices of weapons) - .byte $00,$00,$00,$00,$00,$01,$01,$01 - .byte $01,$01,$00,$01,$02,$02,$02,$01 - .byte $01,$01,$01,$01,$01,$00,$00,$00 - .byte $01,$00,$00,$00,$02,$02,$01,$01 - .byte $02,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .byte 0,0,0,0,0,$04,0,0,0,0,0,0,0,0,0,0 + .by >price_Baby_Missile___ + .by >price_Missile________ + .by >price_Baby_Nuke______ + .by >price_Nuke___________ + .by >price_LeapFrog_______ + .by >price_Funky_Bomb_____ + .by >price_MIRV___________ + .by >price_Death_s_Head___ + .by >price_Napalm_________ + .by >price_Hot_Napalm_____ + .by >price_Tracer_________ + .by >price_Smoke_Tracer___ + .by >price_Baby_Roller____ + .by >price_Roller_________ + .by >price_Heavy_Roller___ + .by >price_Riot_Charge____ + .by >price_Riot_Blast_____ + .by >price_Riot_Bomb______ + .by >price_Heavy_Riot_Bomb + .by >price_Baby_Digger____ + .by >price_Digger_________ + .by >price_Heavy_Digger___ + .by >price_Baby_Sandhog___ + .by >price_Sandhog________ + .by >price_Heavy_Sandhog__ + .by >price_Dirt_Clod______ + .by >price_Dirt_Ball______ + .by >price_Ton_of_Dirt____ + .by >price_Liquid_Dirt____ + .by >price_Dirt_Charge____ + .by >price_Earth_Disrupter + .by >price_Plasma_Blast___ + .by >price_Laser__________ + .by >price______________33 + .by >price______________34 + .by >price______________35 + .by >price______________36 + .by >price______________37 + .by >price______________38 + .by >price______________39 + .by >price______________40 + .by >price______________41 + .by >price______________42 + .by >price______________43 + .by >price______________44 + .by >price______________45 + .by >price______________46 + .by >price______________47 + .by >price_Heat_Guidance__ + .by >price_Bal_Guidance___ + .by >price_Horz_Guidance__ + .by >price_Vert_Guidance__ + .by >price_Lazy_Boy_______ + .by >price_Parachute______ + .by >price_Battery________ + .by >price_Mag_Deflector__ + .by >price_Shield_________ + .by >price_Force_Shield___ + .by >price_Heavy_Shield___ + .by >price_Super_Mag______ + .by >price_Auto_Defense___ + .by >price_Fuel_Tank______ + .by >price_Contact_Trigger + .by >price______________63 + WeaponPriceL - .byte $00,$60,$6F,$90,$c0,$25,$c8,$51 - .byte $f0,$ff,$66,$23,$b1,$58,$50,$4A - .byte $55,$71,$42,$50,$14,$fd,$da,$bf - .byte $31,$68,$82,$ab,$12,$45,$ae,$12 - .byte $41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - .byte 0,0,0,0,0,$4c,0,0,0,0,0,0,0,0,0,0 + .by