diff --git a/MANUAL_EN.md b/MANUAL_EN.md index eb13bf7..98d2207 100644 --- a/MANUAL_EN.md +++ b/MANUAL_EN.md @@ -24,7 +24,7 @@ On the first screen, you can configure gameplay options: Select options with cursor keys or a joystick. -The [TAB] or [SELECT] key, and on the Atari 5200 console the [5] controller key change the color of the mountains. +The [TAB] or [SELECT] key, and on the Atari 5200 console the [5] controller key change the color of the mountains (3 versions to choose). The [RETURN] key or a joystick button moves to the next screen. @@ -178,7 +178,7 @@ Only these points determine the order in the summary * **Nuclear Winter** - adds nothing, takes nothing away :) - in fact, it is not so much a defensive weapon as a double-edged one. It floods the area with "radioactive" fallout, which is ordinary soil. If you do not have at hand any weapon that digs up the terrain, and for that a shield (preferably disposable), then after such "fallout" you will have to shoot yourself - because being underground is otherwise impossible. Alternatively, **White Flag** always remains. * **Long Schlong** - a special weapon :) - Costs a lot, doesn't really help with anything (except possibly digging yourself out but only when slightly buried but it has a cool name and looks cool :) - It can be activated independently of other defensive weapons and remains active until the end of the round (it cannot be deactivated). * **Lazy Boy** - it is not actually a defensive weapon. It is an aiming aid. When it is activated, the tank tries to aim at the nearest enemy and automatically adjusts the power of the shot and angle. If it has too little energy, it can sometimes aim wrong (it uses a method like **Cyborg** to aim). Like **Battery**, it does not deactivate other defensive weapons when used. Note: There is no point in activating this weapon before the round, targeting will not take place because there is nothing to target yet. -* **Lazy Darwin** - works exactly like **Lazy Boy** but targets the weakest opponent. +* **Lazy Darwin** - works just like **Lazy Boy** but targets the weakest opponent. In this weapon, after automatic targeting, "visual targeting" remains active, so you can easily change the target and independently select another opponent by seeing if you hit him. * **Auto Defense** - activates the mode of automatic activation of defensive weapons. After its activation, the tank automatically activates the strongest shield it has (consuming it, of course) at any time when there is no shield (also between shots of other players). At the same time, if the tank's energy level drops below 30 units, it automatically activates **Battery** if it has it. This weapon remains active until the end of the round and is indicated by the "computer" symbol before the name of the active defensive weapon in the status line. It is the second defensive weapon that does not deactivate other defensive weapons when used. * **Spy Hard** - Help for the forgetful :) . When activated, it shows a preview of information about the next opponents one by one. Left/Right - changes the "spied" tank. Fire/Space/Return/Esc - ends the "spying". This is the last defensive weapon, which does not deactivate other defensive weapons when used. diff --git a/MANUAL_PL.md b/MANUAL_PL.md index a5fc4db..9a7398b 100644 --- a/MANUAL_PL.md +++ b/MANUAL_PL.md @@ -23,7 +23,7 @@ Na pierwszym ekranie możemy skonfigurować opcje rozgrywki: Wybór opcji klawiszami kursora lub joystickiem. -Klawisz [TAB] lub [SELECT], a na konsoli Atari 5200 klawisz [5] kontrolera zmieniają kolor gór. +Klawisz [TAB] lub [SELECT], a na konsoli Atari 5200 klawisz [5] kontrolera zmieniają kolor gór (3 wersje do wyboru). Klawisz [RETURN] lub przycisk Joysticka przechodzi do następnego ekranu. @@ -178,7 +178,7 @@ Tylko te punkty decydują o kolejności w podsumowaniu * **Nuclear Winter** - nic nie dodaje, nic nie zabiera :) - w zasadzie to broń nie tyle defensywna co obosieczna. Zasypuje teren opadem "radioaktywnym", który jest zwyczajną glebą. Jeśli nie mamy pod ręką żadnej broni odkopującej teren i do tego osłony (najlepiej jednorazowej), to po takim "opadzie" będzie trzeba strzelić do siebie - bo będąc pod ziemią inaczej się nie da. Ewentualnie pozostaje zawsze White Flag. * **Long Schlong** - broń specjalna :) - kosztuje dużo, nie bardzo w czymkolwiek pomaga (poza ewentualnym odkopaniem się ale tylko przy niewielkim przysypaniu ale fajnie się nazywa i wygląda :) - Można ją aktywować niezależnie od innych broni defensywnych i pozostaje aktywna do końca rundy (nie da się jej dezaktywować). * **Lazy Boy** - nie jest to właściwie broń defensywna. Jest to wspomaganie celowania. Po jej aktywacji czołg stara się wycelować w najbliższego przeciwnika i automatycznie ustawia siłę strzału oraz kąt. W przypadku posiadania zbyt małej ilości energii może czasem wycelować źle (do celowania stosuje metodę taką jak **Cyborg**). Tak jak **Battery** nie dezaktywuje innych broni defensywnych w przypadku jej użycia. Uwaga! Nie ma sensu aktywacja tej broni przed rundą, celowanie nie odbędzie się bo nie ma jeszcze do czego celować. -* **Lazy Darwin** - działa dokładnie jak **Lazy Boy** ale celuje w najsłabszego przeciwnika. +* **Lazy Darwin** - działa tak jak **Lazy Boy** ale celuje w najsłabszego przeciwnika. W tej broni po automatycznym celowaniu pozostaje aktywne "celowanie wizualne" można więc łątwo zmienić cel i samodzielnie wybrać innego przeciwnika widząc czy w niego trafimy. * **Auto Defense** - włącza tryb automatycznej aktywacji broni defensywnych. Po jej aktywowaniu czołg automatycznie aktywuje najmocniejszą posiadaną osłonę (zużywając ją oczywiście) w każdej chwili, kiedy nie ma żadnej osłony (także pomiędzy strzałami innych graczy). Jednocześnie jeżeli poziom energii czołgu spadnie poniżej 30 jednostek, automatycznie aktywuje **Battery** jeżeli ją posiada. Ta broń pozostaje aktywna do końca rundy i jest sygnalizowana symbolem "komputera" przed nazwą aktywnej broni defensywnej w linii statusowej. Jest to druga broń defensywna, która nie dezaktywuje innych broni defensywnych w przypadku jej użycia. * **Spy Hard** - Pomoc dla zapominalskich :) . Po aktywacji pokazuje kolejno podgląd informacji o kolejnych przeciwnikach. Lewo/Prawo - zmienia "szpiegowany" czołg. Fire/Space/Return/Esc - kończy "szpiegowanie". Jest to ostatnia broń defensywna, która nie dezaktywuje innych broni defensywnych w przypadku jej użycia. diff --git a/README.md b/README.md index cdfe005..2a03807 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,22 @@ With the advent of [fujinet](https://fujinet.online/) we are thinking about maki ## Changelog: +###### Version 1.22 +2022-12-24 + +Christmas colors edition! Can you carve a quarter of a page of memory from two decades old code? Sure @Pecusx can! So finally we have the most requested feature - C0L0RS on the game screen, adjusted with Adam's help. +Press [TAB] twice in the main menu to switch to a screen with colors. +Other (dubious) improvements: +- New Lazy Darwin, it is spectacular, check it out!!! +- Smoke Tracer does not smoke when targeting with Lazy Darwin +- Lazy Boy works well with joystick +- Another fix for self-destructing tanks shooting low angles (0-4 degrees) +- New, better tank shapes by Adam +- Barrel start point correction fixes very rare aiming issues +- Soil slide after Hovercraft usage optimized + + + ###### Version 1.21 2022-12-10 diff --git a/ai.asm b/ai.asm index 27f2671..430bf31 100644 --- a/ai.asm +++ b/ai.asm @@ -514,64 +514,7 @@ skipThisPlayer lda tempor2 rts .endp -/* -;---------------------------------------------- -.proc FindBestTarget1 -; find farthest tank neighbour -; X - shooting tank number -; returns target tank number in Y and -; direcion of shoot in A (0 - left, >0 - right) -;---------------------------------------------- - jsr MakeLowResDistances - lda #$00 - sta temp2 ; max possible distance - sta tempor2 ; direction of shoot - ;ldx TankNr - ldy NumberOfPlayers - dey - -loop01 - cpy TankNr - beq skipThisPlayer - lda eXistenZ,y - beq skipThisPlayer - - lda LowResDistances,x - cmp LowResDistances,y - bcs EnemyOnTheLeft - ;enemy on the right - sec - lda LowResDistances,y - sbc LowResDistances,x - cmp temp2 ; bigest - bcc bigestIsBigger - sta temp2 - sty temp2+1 ; number of the farthest tank - inc tempor2 ; set direction to right - bne bigestIsBigger -EnemyOnTheLeft - sec - lda LowResDistances,x - sbc LowResDistances,y - cmp temp2 ; lowest - bcc bigestIsBigger - sta temp2 - sty temp2+1 ; number of the farthest tank - -bigestIsBigger -skipThisPlayer - dey - bpl loop01 - ; now we have number of the farthest tank in temp2+1 - ; and direction (0 - left, >0 - right) in tempor2 - ; let's move them to registers - ; in temp2 we have x distance divided by 8 - ldy temp2+1 - lda tempor2 - rts -.endp -*/ ;---------------------------------------------- .proc TakeAim ; targeting the tank number TargetTankNr (and Y) @@ -617,7 +560,7 @@ RepeatAim lda #ind_Baby_Missile___ sta ActiveWeapon,x ; now we have initial valuses - mva #$ff TestFlightFlag + mva #%11000000 TestFlightFlag ; check targeting direction lda tempor2 jne AimingLeft diff --git a/artwork/tanksv4.fnt b/artwork/tanksv4.fnt new file mode 100644 index 0000000..2efa689 Binary files /dev/null and b/artwork/tanksv4.fnt differ diff --git a/constants.asm b/constants.asm index d438c99..e9546d0 100644 --- a/constants.asm +++ b/constants.asm @@ -62,6 +62,16 @@ lineClear TankColoursTable .BYTE $58,$2a,$96,$ca,$7a,$ed ;TankStatusColoursTable .BYTE $54,$24,$92,$c4,$74,$e4 ; standard order TankStatusColoursTable .BYTE $74,$c4,$24,$e4,$54,$94 ; Adam's order +;----------- +GradientAddrL + .by dliColorsFore, >dliColorsFore, >dliColorsFore2 +dliColorsFore2 + .by $0a ; one mountains color + .by $7e,$7a,$7c,$6a,$6c,$58,$5a,$48,$4a,$38 + .by $3a,$16,$18,$e6,$e8,$d4,$d6,$b4,$b6,$b6 + ;----------- pmtableL ; addressess of the P/M memory for 6 tanks .by <(pmgraph+$400) diff --git a/definitions.asm b/definitions.asm index a8bf33c..3bc3872 100644 --- a/definitions.asm +++ b/definitions.asm @@ -86,7 +86,7 @@ price_Bouncy_Castle__ = 512 ;_41 price_Long_Barrel____ = 2100 ;_42 price_Nuclear_Winter_ = 1000 ;_43 price_Lazy_Boy_______ = 500 ;_44 -price_Lazy_Darwin____ = 500 ;_45 +price_Lazy_Darwin____ = 730 ;_45 price_Auto_Defense___ = 250 ;_46 price_Spy_Hard_______ = 83 ;_47 ;Weapon indexes (numbers) diff --git a/grafproc.asm b/grafproc.asm index 154aac6..dc7b807 100644 --- a/grafproc.asm +++ b/grafproc.asm @@ -2088,7 +2088,7 @@ X lda XtanksTableL,x sbc #90 tax ; barrel start offset over 90deg - adw xdraw #5 xdraw + adw xdraw #4 xdraw mva #1 goleft bpl @+ ; jmp @+ diff --git a/scorch.asm b/scorch.asm index 68b3235..1d9656e 100644 --- a/scorch.asm +++ b/scorch.asm @@ -15,7 +15,7 @@ ;--------------------------------------------------- .macro build - dta d"1.21" ; number of this build (4 bytes) + dta d"1.22" ; number of this build (4 bytes) .endm .macro RMTSong @@ -26,9 +26,11 @@ ;--------------------------------------------------- icl 'definitions.asm' ;--------------------------------------------------- -FirstZpageVariable = $60 +FirstZpageVariable = $5B .zpvar DliColorBack .byte = FirstZpageVariable .zpvar Gradient .byte + .zpvar GradientNr .byte + .zpvar GradientColors .word .zpvar JoystickNumber .byte .zpvar xdraw .word ;= $64 ;variable X for plot .zpvar ydraw .word ;variable Y for plot (like in Atari Basic - Y=0 in upper right corner of the screen) @@ -71,10 +73,12 @@ FirstZpageVariable = $60 .zpvar pressTimer .byte .zpvar NTSCcounter .byte .zpvar IsEndOfTheFallFlag .byte ; for small speedup ground falling - .zpvar sfx_effect .byte - .zpvar RMT_blocked .byte - .zpvar ScrollFlag .byte + .zpvar sfx_effect .byte + .zpvar RMT_blocked .byte + .zpvar ScrollFlag .byte .zpvar SkStatSimulator .byte + .zpvar FloatingAlt .byte ; floating tank altitude + .zpvar OverTankDir .byte ; (0 go right, $ff go left) direction of bypassing tanks on screen ; --------------OPTIMIZATION VARIABLES-------------- .zpvar Force .word @@ -248,6 +252,11 @@ FirstSTART dey bpl @- + ; initialize one Variable in zero page :) + lda #dliColorsFore + sta GradientColors+1 ; generate linetables mwa #display temp @@ -281,6 +290,12 @@ FirstSTART mva #$10 MODUL-6+$a69 ; $12 > $10 mva #$04 MODUL-6+$bf8 ; $05 > $04 mva #$08 MODUL-6+$e3d ; $0a > $08 + ; and colors - sorry no memory! +; mva #$c4 dliColorsFore2+16 +; mva #$c6 dliColorsFore2+17 +; mva #$a4 dliColorsFore2+18 +; mva #$a6 dliColorsFore2+19 +; sta dliColorsFore2+20 NoRMT_PALchange .ELSE mva #$7f SkStatSimulator @@ -314,6 +329,7 @@ START RMTSong song_main_menu jsr Options ;startup screen + jsr SetVariablesFromOptions jsr MakeDarkScreen bit escFlag bmi START @@ -675,6 +691,8 @@ ManualShooting lda JoyNumber,x sta JoystickNumber ; set joystick port for player jsr WaitForKeyRelease + lda #%00000000 + sta TestFlightFlag ; set "Test Fight" off jsr BeforeFire lda escFlag seq:rts ; keys Esc or O @@ -1191,7 +1209,7 @@ GoGradient ; nop .ENDIF sta COLPF1 - lda dliColorsFore,y ; mountains colors array + lda (GradientColors),y ; mountains colors array ; lda dliColorsFore ; one mauntain color sta COLPF2 inc dliCounter @@ -1977,7 +1995,7 @@ noingame icl 'artwork/talk.asm' ;---------------------------------------------- TankFont - ins 'artwork/tanksv3.fnt',+0,384 ; 48 characters only + ins 'artwork/tanksv4.fnt',+0,384 ; 48 characters only ;---------------------------------------------- font4x4 ins 'artwork/font4x4s.bmp',+62 diff --git a/scorch.bin b/scorch.bin index 8ffb1ec..205e22f 100644 Binary files a/scorch.bin and b/scorch.bin differ diff --git a/scorch.xex b/scorch.xex index d98b310..b2056fc 100644 Binary files a/scorch.xex and b/scorch.xex differ diff --git a/textproc.asm b/textproc.asm index 33f08d1..d8866b8 100644 --- a/textproc.asm +++ b/textproc.asm @@ -109,73 +109,32 @@ OptionsNoLeft OptionsNoRight cmp #@kbcode._ret ; $c ;Return key bne OptionsNoReturn - jmp OptionsFinished + rts ; options selected OptionsNoReturn cmp #@kbcode._tab ; Tab key bne OptionsNoTab + bit Gradient + bmi NextGradientNr lda Gradient - eor #$80 +@ eor #$80 sta Gradient +NextGradientNr + ldy GradientNr + iny + cpy #$03 + bne NoGradientLoop + mva #$ff GradientNr + bne @- +NoGradientLoop + sty GradientNr + lda GradientAddrL,y + sta GradientColors + lda GradientAddrH,y + sta GradientColors+1 OptionsNoTab jmp OptionsMainLoop - -OptionsFinished - ;first option - ldy OptionsTable - iny - iny - sty NumberOfPlayers ;1=1 player (but minimum is 2) - - ;second option (cash) - - - ldy OptionsTable+1 - ldx #0 -@ - lda CashOptionL,y - sta moneyL,x - lda CashOptionH,y - sta moneyH,x - inx - cpx NumberOfPlayers - bne @- - - ;third option (gravity) - ldy OptionsTable+2 - lda GravityTable,y - sta gravity - - ;fourth option (wind) - ldy OptionsTable+3 - lda MaxWindTable,y - sta MaxWind - - ;fifth option (no of rounds) - ldy OptionsTable+4 - lda RoundsTable,y - sta RoundsInTheGame - - ;6th option (shell speed) - ldy OptionsTable+5 - lda flyDelayTable,y - sta flyDelay - - ;7th option (Airstrike after how many missess) - ldy OptionsTable+6 - lda seppukuTable,y - sta seppukuVal - - ;8th option (how aggressive are mountains) - ldy OptionsTable+7 - lda mountainsDeltaTableH,y - sta mountainDeltaH - lda mountainsDeltaTableL,y - sta mountainDeltaL - - - rts - .endp +.endp ;-------- ; inversing selected option (cursor) ;-------- @@ -236,6 +195,66 @@ invertme rts .endp +; -------------------------------------- +; Sets the appropriate variables based on the options table +; +.proc SetVariablesFromOptions + ;first option + ldy OptionsTable + iny + iny + sty NumberOfPlayers ;1=1 player (but minimum is 2) + + ;second option (cash) + + + ldy OptionsTable+1 + ldx #0 +@ + lda CashOptionL,y + sta moneyL,x + lda CashOptionH,y + sta moneyH,x + inx + cpx NumberOfPlayers + bne @- + + ;third option (gravity) + ldy OptionsTable+2 + lda GravityTable,y + sta gravity + + ;fourth option (wind) + ldy OptionsTable+3 + lda MaxWindTable,y + sta MaxWind + + ;fifth option (no of rounds) + ldy OptionsTable+4 + lda RoundsTable,y + sta RoundsInTheGame + + ;6th option (shell speed) + ldy OptionsTable+5 + lda flyDelayTable,y + sta flyDelay + + ;7th option (Airstrike after how many missess) + ldy OptionsTable+6 + lda seppukuTable,y + sta seppukuVal + + ;8th option (how aggressive are mountains) + ldy OptionsTable+7 + lda mountainsDeltaTableH,y + sta mountainDeltaH + lda mountainsDeltaTableL,y + sta mountainDeltaL + + + rts +.endp + ;------------------------------------------- ; call of the purchase (and activate) screens for each tank .proc CallPurchaseForEveryTank @@ -886,6 +905,8 @@ NoAutoDefense jsr FindBestTarget2 ; find nearest tank neighbour jsr LazyAim ply + lda #%00000000 + sta TestFlightFlag ; set "visual aiming" off jmp DecreaseDefensive ; bypass activation NoLazyBoy cmp #ind_Lazy_Darwin____ @@ -897,6 +918,8 @@ NoLazyBoy jsr FindBestTarget3 ; find target with lowest energy jsr LazyAim ply + lda #%10000000 + sta TestFlightFlag ; set "visual aiming" on jmp DecreaseDefensive ; bypass activation NoLazyDarwin cmp #ind_Spy_Hard_______ diff --git a/variables.asm b/variables.asm index 4abdf3c..a3922f5 100644 --- a/variables.asm +++ b/variables.asm @@ -220,7 +220,7 @@ FallingSoundBit .DS 1 PreviousFall .DS 1 EndOfTheFallFlag .DS 1 ; in case of the infinite fall ;Parachute .DS 1 ; are you insured with parachute? -FloatingAlt .DS 1 ; floating tank altitude +;FloatingAlt .DS 1 ; floating tank altitude FunkyWallFlag = FloatingAlt ; reuse this variable in different weapon (Funky Bomb)! PreferHumansFlag = FloatingAlt ; second reuse in AI Aim proc ;---------------------------------------------------- diff --git a/weapons.asm b/weapons.asm index c1289c5..c60ac07 100644 --- a/weapons.asm +++ b/weapons.asm @@ -76,25 +76,29 @@ CheckNextTankBFG .proc babymissile mva #sfx_baby_missile sfx_effect mva #11 ExplosionRadius +GoXmissile jmp xmissile .endp ; ------------------------ .proc missile ; mva #sfx_baby_missile sfx_effect mva #17 ExplosionRadius - jmp xmissile + bne babymissile.GoXmissile +; jmp xmissile .endp ; ------------------------ .proc babynuke mva #sfx_nuke sfx_effect mva #25 ExplosionRadius - jmp xmissile + bne babymissile.GoXmissile +; jmp xmissile .endp ; ------------------------ .proc nuke mva #sfx_nuke sfx_effect mva #30 ExplosionRadius - jmp xmissile + bne babymissile.GoXmissile +; jmp xmissile .endp ; ------------------------ .proc leapfrog @@ -104,29 +108,6 @@ CheckNextTankBFG jsr SecondRepeat -/* ; soil must fall down now! there is no other way... - ; hide tanks or they fall down with soil - jsr SoilDown2 - - ; it looks like force is divided by 4 here BUT" - ; in Flight routine force is multiplied by 2 and left - ; so, we have Force divided by 2 here (not accurately) - lsr Force+1 - ror Force - ;lsr Force+1 - ;ror Force - mva LeapFrogAngle Angle - - mva #sfx_funky_hit sfx_effect - sbw ytraj+1 #$05 ; next missiles start point goes 5 pixel UP to prevent multiple explosion at one point if tank is hit (4 pixels tank height + 1) - jsr Flight - lda HitFlag - beq EndOfLeapping - mva #15 ExplosionRadius - jsr CalculateExplosionRange0 - mva #sfx_baby_missile sfx_effect - jsr xmissile.NoRangeCalc */ - SecondRepeat ; soil must fall down now! there is no other way... ; hide tanks or they fall down with soil @@ -221,19 +202,13 @@ NoWallsInFunky .proc deathshead mva #30 ExplosionRadius mva #sfx_nuke sfx_effect - SaveDrawXY - jsr xmissile - UnSaveDrawXY + jsr GoXmissileWithSaveXYdraw sbw xdraw #34 mva #sfx_nuke sfx_effect - SaveDrawXY - jsr xmissile - UnSaveDrawXY + jsr GoXmissileWithSaveXYdraw adw xdraw #68 mva #sfx_nuke sfx_effect - SaveDrawXY - jsr xmissile - UnSaveDrawXY + jsr GoXmissileWithSaveXYdraw sbw xdraw #34 ; sbw ydraw #34 @@ -241,28 +216,22 @@ NoWallsInFunky cpw ydraw #screenHeight bcs NoUpperCircle mva #sfx_nuke sfx_effect - SaveDrawXY - jsr xmissile - UnSaveDrawXY + jsr GoXmissileWithSaveXYdraw NoUpperCircle adw ydraw #68 ;jsr CalculateExplosionRange cpw ydraw #screenHeight bcs NoLowerCircle mva #sfx_nuke sfx_effect - SaveDrawXY - jsr xmissile - UnSaveDrawXY + jsr GoXmissileWithSaveXYdraw NoLowerCircle mva #sfx_silencer sfx_effect rts -.endp -.proc SaveDrawXY + +GoXmissileWithSaveXYdraw mwa xdraw tempXROLLER mwa ydraw modify - rts -.endp -.proc UnSaveDrawXY + jsr xmissile mwa tempXROLLER xdraw mwa modify ydraw rts @@ -273,7 +242,7 @@ NoLowerCircle mva #(napalmRadius+4) ExplosionRadius ; real radius + 4 pixels (half characrer width) jsr CalculateExplosionRange mva #0 ExplosionRadius ; in this weapon - flag: 0 - napalm, 1 - hotnapalm - jmp xnapalm + beq xnapalm .endp ; ------------------------ .proc hotnapalm @@ -281,7 +250,7 @@ NoLowerCircle mva #(napalmRadius+4) ExplosionRadius ; real radius + 4 pixels (half characrer width) jsr CalculateExplosionRange mva #1 ExplosionRadius ; in this weapon - flag: 0 - napalm, 1 - hotnapalm - jmp xnapalm +; jmp xnapalm .endp ; ------------------------ .proc xnapalm @@ -420,7 +389,7 @@ EndNurnedCheckLoop mva #0 sandhogflag mva #13 DigLong mva #1 diggery ; how many branches (-1) - jmp xdigger + bne xdigger .endp ; ------------------------ .proc digger ; @@ -428,7 +397,7 @@ EndNurnedCheckLoop mva #0 sandhogflag mva #13 DigLong mva #3 diggery ; how many branches (-1) - jmp xdigger + bne xdigger .endp ; ------------------------ .proc heavydigger @@ -436,7 +405,31 @@ EndNurnedCheckLoop mva #0 sandhogflag mva #13 DigLong mva #7 diggery ; how many branches (-1) - jmp xdigger + bne xdigger +.endp +; ------------------------ +.proc babysandhog + mva #sfx_sandhog sfx_effect + mva #char_sandhog_offset sandhogflag + mva #13 DigLong + mva #1 diggery ; how many branches (-1) + bne xdigger +.endp +; ------------------------ +.proc sandhog + mva #sfx_sandhog sfx_effect + mva #char_sandhog_offset sandhogflag + mva #13 DigLong + mva #3 diggery ; how many branches (-1) + bne xdigger +.endp +; ------------------------ +.proc heavysandhog + mva #sfx_sandhog sfx_effect + mva #char_sandhog_offset sandhogflag + mva #13 DigLong + mva #5 diggery ; how many branches (-1) +; jmp xdigger .endp ; ------------------------ .proc xdigger @@ -554,46 +547,39 @@ DiggerCharacter jmp TypeChar .endp ; ------------------------ -.proc babysandhog - mva #sfx_sandhog sfx_effect - mva #char_sandhog_offset sandhogflag - mva #13 DigLong - mva #1 diggery ; how many branches (-1) - jmp xdigger -.endp -; ------------------------ -.proc sandhog - mva #sfx_sandhog sfx_effect - mva #char_sandhog_offset sandhogflag - mva #13 DigLong - mva #3 diggery ; how many branches (-1) - jmp xdigger -.endp -; ------------------------ -.proc heavysandhog - mva #sfx_sandhog sfx_effect - mva #char_sandhog_offset sandhogflag - mva #13 DigLong - mva #5 diggery ; how many branches (-1) - jmp xdigger -.endp -; ------------------------ .proc dirtclod mva #12 ExplosionRadius - jsr CalculateExplosionRange - jmp xdirt + bne xdirt .endp ; ------------------------ .proc dirtball mva #22 ExplosionRadius - jsr CalculateExplosionRange - jmp xdirt + bne xdirt .endp ; ------------------------ .proc tonofdirt mva #31 ExplosionRadius +; jmp xdirt +.endp +; ----------------- +.proc xdirt ; +; ----------------- jsr CalculateExplosionRange - jmp xdirt + mva #sfx_dirt_charge sfx_effect + lda #1 + sta radius + sta color +dirtLoop + jsr circle + inw ydraw + jsr circle +.nowarn dew ydraw + inc radius + lda radius + cmp ExplosionRadius + bne dirtLoop + mva #sfx_silencer sfx_effect + rts .endp ; ------------------------ .proc dirtcharge @@ -605,21 +591,93 @@ DiggerCharacter .proc riotcharge mva #sfx_riot_blast sfx_effect mva #31 ExplosionRadius - jsr CalculateExplosionRange - jmp cleanDirt + bne cleanDirt .endp ; ------------------------ .proc riotblast mva #sfx_riot_blast sfx_effect mva #61 ExplosionRadius +; jmp cleanDirt +.endp +; ----------------- +.proc cleanDirt +; ----------------- jsr CalculateExplosionRange - jmp cleanDirt + mva #0 color + jmp ofdirt.NoColor .endp ; ------------------------ .proc liquiddirt mva #sfx_liquid_dirt sfx_effect mwa #510 FillCounter - jmp xliquiddirt +; ----- + mwa xdraw TempXfill +RepeatFill + mwa TempXfill xdraw + jsr checkRollDirection + ; HowMuchToFall - direction + ; $FF - we are in a hole (flying in missile direction) + ; 1 - right, 2 - left + adw xdraw #mountaintable tempXROLLER + ldy #0 + lda (tempXROLLER),y + sta HeightRol ; relative point + +RollinContinuesLiquid + ; new point is set + adw xdraw #mountaintable tempXROLLER + ldy #0 + lda (tempXROLLER),y + sta ydraw + cmp HeightRol + beq UpNotYet2 + bcc FillNow +UpNotYet2 + sec ;clc + sta HeightRol + sbc #1 + sta ydraw + lda HowMuchToFall + cmp #1 + beq HowMuchToFallRight3 +.NOWARN dew xdraw + lda xdraw + and xdraw+1 + cmp #$ff ; like cpw xdraw #$ffff + ;ora xdraw+1 ; like cpw xdraw #$0000 + jne RollinContinuesLiquid + beq FillNow +HowMuchToFallRight3 + inw xdraw + cpw xdraw #screenwidth + jne RollinContinuesLiquid +FillNow + ; finally one pixel more + ldy #0 + lda HowMuchToFall + bmi FillHole + cmp #1 + beq FillLeft + inw xdraw + inw xdraw ; tricky but we must rollback xdraw in proper direction +FillLeft +.nowarn dew xdraw +FillHole + adw xdraw #mountaintable tempXROLLER + lda (tempXROLLER),y + sta ydraw + beq ToHighFill ; if we filled all playfield (very rare but possible) + dec ydraw ; one pixel up + lda ydraw + sta (tempXROLLER),y ;mountaintable update + mva #1 color + jsr plot.MakePlot +ToHighFill +.nowarn dew FillCounter + lda FillCounter + ora FillCounter+1 + jne RepeatFill + rts .endp ; ------------------------ .proc laser @@ -799,25 +857,6 @@ EndOfDistanceCheckLoop rts .endp ; ----------------- -.proc xdirt ; -; ----------------- - mva #sfx_dirt_charge sfx_effect - lda #1 - sta radius - sta color -dirtLoop - jsr circle - inw ydraw - jsr circle -.nowarn dew ydraw - inc radius - lda radius - cmp ExplosionRadius - bne dirtLoop - mva #sfx_silencer sfx_effect - rts -.endp -; ----------------- .proc xriotbomb ; ; ----------------- mva #sfx_riot_blast sfx_effect @@ -964,11 +1003,6 @@ DirectionChecked rts .endp -; -------------------------------------------------- -.proc cleanDirt - mva #0 color - jmp ofdirt.NoColor -.endp ; -------------------------------------------------- .proc ofdirt ; ; -------------------------------------------------- @@ -1019,76 +1053,6 @@ EndOfTheDirt mwa ycircle ydraw rts .endp -; ---------------- -.proc xliquiddirt ; - mwa xdraw TempXfill -RepeatFill - mwa TempXfill xdraw - jsr checkRollDirection - ; HowMuchToFall - direction - ; $FF - we are in a hole (flying in missile direction) - ; 1 - right, 2 - left - adw xdraw #mountaintable tempXROLLER - ldy #0 - lda (tempXROLLER),y - sta HeightRol ; relative point - -RollinContinuesLiquid - ; new point is set - adw xdraw #mountaintable tempXROLLER - ldy #0 - lda (tempXROLLER),y - sta ydraw - cmp HeightRol - beq UpNotYet2 - bcc FillNow -UpNotYet2 - sec ;clc - sta HeightRol - sbc #1 - sta ydraw - lda HowMuchToFall - cmp #1 - beq HowMuchToFallRight3 -.NOWARN dew xdraw - lda xdraw - and xdraw+1 - cmp #$ff ; like cpw xdraw #$ffff - ;ora xdraw+1 ; like cpw xdraw #$0000 - jne RollinContinuesLiquid - beq FillNow -HowMuchToFallRight3 - inw xdraw - cpw xdraw #screenwidth - jne RollinContinuesLiquid -FillNow - ; finally one pixel more - ldy #0 - lda HowMuchToFall - bmi FillHole - cmp #1 - beq FillLeft - inw xdraw - inw xdraw ; tricky but we must rollback xdraw in proper direction -FillLeft -.nowarn dew xdraw -FillHole - adw xdraw #mountaintable tempXROLLER - lda (tempXROLLER),y - sta ydraw - beq ToHighFill ; if we filled all playfield (very rare but possible) - dec ydraw ; one pixel up - lda ydraw - sta (tempXROLLER),y ;mountaintable update - mva #1 color - jsr plot.MakePlot -ToHighFill -.nowarn dew FillCounter - lda FillCounter - ora FillCounter+1 - jne RepeatFill - rts -.endp ;-------------------------------------------------- .proc BeforeFire ;TankNr (byte) ;-------------------------------------------------- @@ -1124,8 +1088,10 @@ ContinueToCheckMaxForce2 jsr WaitOneFrame ; best after drawing a tank - - + bit TestFlightFlag + bpl @+ + jsr Shoot.AfterOffensiveText ; Lazy Darwin - aiming visualisation +@ ;keyboard reading ; KBCODE keeps code of last keybi ; SKSTAT $ff - nothing pressed @@ -1134,6 +1100,7 @@ ContinueToCheckMaxForce2 ; $f3 - shift+key notpressed + ldx TankNr ; for optimize ; Select and Option lda CONSOL tay @@ -1258,10 +1225,11 @@ pressedUp ;force increaseeee! - ldx TankNr + ;ldx TankNr ; optimized inc ForceTableL,x bne CheckingMaxForce inc ForceTableH,x + CheckingMaxForce mva #sfx_set_power_1 sfx_effect @@ -1282,7 +1250,7 @@ FurtherCheckMaxForce jmp BeforeFire CTRLPressedUp - ldx TankNr + ;ldx TankNr ; optimized lda ForceTableL,x clc adc #10 @@ -1300,7 +1268,7 @@ pressedDown mva #sfx_set_power_1 sfx_effect - ldx TankNr + ;ldx TankNr ; optimized dec ForceTableL,x lda ForceTableL,x cmp #$ff @@ -1317,7 +1285,7 @@ ForceGoesZero CTRLPressedDown mva #sfx_set_power_1 sfx_effect - ldx TankNr + ;ldx TankNr ; optimized sec lda ForceTableL,x sbc #10 @@ -1328,7 +1296,7 @@ CTRLPressedDown jmp BeforeFire pressedRight - ldx TankNr + ;ldx TankNr ; optimized lda pressTimer spl:mva #0 pressTimer ; if >128 then reset to 0 cmp #25 ; 1/2s @@ -1345,7 +1313,7 @@ pressedRight jmp BeforeFire CTRLPressedRight - ldx TankNr + ;ldx TankNr ; optimized mva #sfx_set_power_2 sfx_effect mva #1 Erase jsr DrawTankNr.BarrelChange @@ -1361,7 +1329,7 @@ CTRLPressedRight pressedLeft - ldx TankNr + ;ldx TankNr ; optimized lda pressTimer spl:mva #0 pressTimer ; if >128 then reset to 0 cmp #25 ; 1/2s @@ -1379,7 +1347,7 @@ pressedLeft jmp BeforeFire CTRLPressedLeft - ldx TankNr + ;ldx TankNr ; optimized mva #sfx_set_power_2 sfx_effect mva #1 Erase jsr DrawTankNr.BarrelChange @@ -1395,7 +1363,7 @@ CTRLPressedLeft pressedTAB mva #sfx_purchase sfx_effect - ldx TankNr + ;ldx TankNr ; optimized lda ActiveWeapon,x cmp #last_offensive_____ ; the last possible offensive weapon bne ?notlasttofirst @@ -1413,7 +1381,7 @@ pressedTAB CTRLpressedTAB mva #sfx_purchase sfx_effect - ldx TankNr + ;ldx TankNr ; optimized lda ActiveWeapon,x cmp #first_offensive____ ; #0 bne ?notfirsttolast @@ -1444,7 +1412,6 @@ pressedS jsr WaitForKeyRelease jmp BeforeFire - pressedSpace ;================================= ;we shoot here!!! @@ -1469,6 +1436,8 @@ fire ;with much more separate blocks, but you know - ;- do not touch it if it works... + mva #0 TestFlightFlag + ;the latest addition to this routine is ;displaying offensive texts! @@ -1481,7 +1450,8 @@ RandomizeOffensiveText ldy TankNr mva #$ff plot4x4color jsr DisplayOffensiveTextNr - + +AfterOffensiveText mva #0 LaserFlag ; $ff - Laser ldx TankNr lda ActiveWeapon,x @@ -1499,6 +1469,8 @@ NotStrongShoot sta Force lda ForceTableH,x sta Force+1 + bit TestFlightFlag + bmi AfterStrongShoot mva #sfx_shoot sfx_effect AfterStrongShoot lda AngleTable,x @@ -1517,7 +1489,6 @@ AfterStrongShoot sta ytraj+2 sta xtraj sta ytraj - sta TestFlightFlag ; checking if the shot is underground (no Flight but Hit :) ) tay ; A=0 ! @@ -1538,7 +1509,9 @@ ShotUnderGround ;-------------------------------------------------- .proc Flight ; Force(byte.byte), Wind(0.word) ; Angle(byte) 128=0, 255=maxright, 0=maxleft -; if TestFlightFlag is set ($ff) ne real flight - hit test only (for AI) +; if 7bit and 6bit of TestFlightFlag is set no real flight - hit test only (for AI) +; 7bit - fast, test flight +; 6bit - invisible bullet ;-------------------------------------------------- ;g=-0.1 ;vx=Force*cos(Angle) @@ -1553,10 +1526,10 @@ ShotUnderGround ;goto begin- - - ; smoke tracer :) ldy #0 + bit TestFlightFlag ; if test flight for AI or Lazy Darwin + bmi noSmokeTracer ; no Smoke Tracer display ldx TankNr lda ActiveWeapon,x cmp #ind_Smoke_Tracer___ ; Smoke tracer @@ -1734,10 +1707,13 @@ Loopi bpl StillUp ; where we know that the bullet starts to fall down ; we check if it is MIRV and if so, jump to MIRV routine + bit TestFlightFlag + bmi NoTestForMIRV ldx TankNr lda ActiveWeapon,x cmp #ind_MIRV___________ ; MIRV jeq MIRVdownLoop +NoTestForMIRV NoGravity StillUp @@ -1820,7 +1796,7 @@ SkipCollisionCheck mwa ytraj+1 ydraw bit TestFlightFlag - bmi NoUnPlot + bvs NoUnPlot lda tracerflag bne NoUnPlot @@ -1834,7 +1810,7 @@ Hit mwa XHit xdraw mwa YHit ydraw bit TestFlightFlag - bmi EndOfFlight + bvs EndOfFlight jsr unPlot EndOfFlight mwa xdraw xcircle ; we must store for a little while @@ -2085,11 +2061,13 @@ MIRVcopyParameters ldx #$FF ; it will turn 0 in a moment anyway stx MirvMissileCounter mrLoopi - inc:lda MirvMissileCounter - cmp #5 - sne:mva #0 MirvMissileCounter - - ldx MirvMissileCounter + ldx MirvMissileCounter + inx + cpx #5 + bne @+ + ldx #0 +@ stx MirvMissileCounter + ; Y changes only for bullet number 0 ; because rest of the bullets have the same Y (height) @@ -2615,6 +2593,7 @@ ReachSky sta RangeRight+1 ; hide tanks and ... jsr SoilDown2 + jsr ClearScreenSoilRange ldx TankNr ; check keyboard/joy and move tank left/right - code copied from BeforeFire @@ -2713,11 +2692,7 @@ RightScreenEdge mva #sfx_dunno sfx_effect NoREdge mva #18 AngleTable,x - ; then draw tank on new position - jsr DrawTankNr - jsr DisplayStatus - jsr WaitOneFrame - jmp KeyboardAndJoyCheck + bne DrawFloatingTank ; then draw tank on new position pressedLeft lda ShieldEnergy,x @@ -2744,9 +2719,11 @@ LeftScreenEdge NoLEdge mva #162 AngleTable,x ; then draw tank on new position +DrawFloatingTank jsr DrawTankNr jsr DisplayStatus jsr WaitOneFrame + jsr CalculateSoildown jmp KeyboardAndJoyCheck pressedSpace @@ -2773,7 +2750,7 @@ pressedSpace TankOnRightSide dey TankOnLeftSide - sty FloatingAlt ; I know, not elegant byt this variable it's free now (0 go right, $ff go left) + sty OverTankDir ; (0 go right, $ff go left) ; now we have direction of bypassing tanks on screen ; clear "engine pixels" under tank @@ -2824,7 +2801,7 @@ TankBelow mva #1 Erase jsr DrawTankNr mva #0 Erase - bit FloatingAlt + bit OverTankDir bmi PassLeft PassRight inc XtankstableL,x @@ -2868,10 +2845,10 @@ GoDown adw temp #4 ; center of the tank ldy #0 lda (temp),y - sta FloatingAlt + sta OverTankDir ; not elegant!!! Reuse as height of tank flight FloatDown lda ytankstable,x - cmp FloatingAlt + cmp OverTankDir bcs OnGround ; first erase old tank position mva #1 Erase @@ -2891,25 +2868,31 @@ OnGround mva #0 Erase jsr WaitForKeyRelease ; and Soildown at the end (for correct mountaintable) + ; If tank did not fly at maximum altitude there is no need to soildown to much + lda FloatingAlt + cmp #18 + beq NotHighest + jsr ClearScreenSoilRange +NotHighest ; calculate range - sec - lda XtankstableL,x - sbc #2 - sta RangeLeft - lda XtankstableH,x - sbc #0 - sta RangeLeft+1 - clc - lda XtankstableL,x - adc #10 - sta RangeRight - lda XtankstableH,x - adc #0 - sta RangeRight+1 + jsr CalculateSoildown ; hide tanks and ... jsr SoilDown2 ldx TankNr rts + +CalculateSoildown + ldx TankNr + clc + lda XtankstableL,x + adc #4 + sta xdraw + lda XtankstableH,x + adc #0 + sta xdraw+1 + mva #$04 ExplosionRadius + jsr CalculateExplosionRange + rts .endp ; ------------------------------------------------- @@ -2931,7 +2914,7 @@ CheckCollisionWithTankLoop lda ytankstable,x cmp ydraw ; check range bcc BelowTheTank ;(ytankstable,ytankstable+3) - sbc #4 ; we must rewrite EndOfTheBarrelY table or remove Y correction completely to "bold" tank !!! + sbc #3 ; hitbox height cmp ydraw bcs OverTheTank ; with or without shield ?