diff --git a/.gitignore b/.gitignore index 272baa5..36161dd 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.bak scorch.lab scorch.lst +textproc.lab +textproc.lst diff --git a/MANUAL_EN.md b/MANUAL_EN.md index c8b24ad..137a0ab 100644 --- a/MANUAL_EN.md +++ b/MANUAL_EN.md @@ -14,13 +14,13 @@ On the first screen, you can configure gameplay options: * frequency of suicides :) - if for a number of turns the game has not recorded hits (tanks are constantly shooting inaccurately), after one of such misses a tank commits suicide - here you determine how long they can "shooting for the stars" :) - if only people play the optimal setting is "norm", in the case of computer-controlled players ... you choose. * The height (and undulation) of the mountains from almost flat (NL - Kingdom of the Netherlands), to soaring and high (NP - Federal Democratic Republic of Nepal) * the way the walls (edges of the screen) work: - * none - projectiles that flew off the screen do not return - * wrap - the screen "wraps" and projectiles that flew to the right appear on the left side (and vice versa) - * bump - the right and left walls deflect projectiles that want to fly through them - * boxy - just like bump, except that the "ceiling" also reflects projectiles - * rand - at the beginning of each round, one of the above 4 ways the walls work is drawn. - - During gameplay, the current mode of the walls is represented by the color of the screen frame: none - black, wrap - purple, bump - blue, boxy - green. + * none - projectiles that flew off the screen do not return + * wrap - the screen "wraps" and projectiles that flew to the right appear on the left side (and vice versa) + * bump - the right and left walls deflect projectiles that want to fly through them + * boxy - just like bump, except that the "ceiling" also reflects projectiles + * rand - at the beginning of each round, one of the above 4 ways the walls work is drawn. + + During gameplay, the current mode of the walls is represented by the color of the screen frame: none - black, wrap - purple, bump - blue, boxy - green. Select options with cursor keys or a joystick. @@ -29,9 +29,10 @@ The [RETURN] key or a joystick button moves to the next screen. ## 2. Entering the name of players and selecting the level of computer-controlled players The second screen is shown for each player. Here you can use the cursor keys or joystick to select whether the tank will be driven by a human (HUMAN option) or a computer (other options). At the same time, you can enter the name of the selected player from the keyboard. -When you press the [RETURN] key or the joystick button, the screen switches to the next player until the difficulty levels for each player are selected. +When the [RETURN] key is pressed or the Joystick button is pressed briefly, the screen switches to the next player until the difficulty levels for each player are selected. +The player's name can also be entered with the joystick. After pressing and holding the button for more than 1s. you can use up/down movements to change the letter being entered, and left/right movements to change its position in the name. Releasing the button ends the name entry and returns to the level selection. -If the name is not entered (because, for example, you use a joystick only), it will be supplemented with the default name. +If the name is not entered, it will be supplemented with the default name. ## 3. Shopping screen (before each round) @@ -195,3 +196,54 @@ And of course, activating a weapon when you already have some other weapon activ ## 7. "Other" weapons: * **Buy me!** - this is a 'loot box', not a weapon per se. Buying it draws one of the offensive or (rarely) defensive weapons and adds it to the player's arsenal. It is a lottery in which you can lose (if you draw a weapon cheaper than the **Buy Me!** price) but also gain. You can get a weapon otherwise not affordable at all! + +## 8. difficulty levels of computer-controlled opponents: + +The game has 8 difficulty levels of computer-controlled opponents. Or actually 7 different ones and one "surprise". Each has its own way of buying defensive and offensive weapons and a different method of target selection and targeting itself, as well as weapon selection. They are arranged in the list according to increasing "skills": + +* **Moron** - the dumbest of opponents (which does not mean the safest). Shoots completely at random using only one weapon - **Baby Missile**. He doesn't buy anything and doesn't know how to use defensive weapons. + +* **Shooter** - This opponent does not shoot blindly. He chooses one direction for himself. Based on his own position - he shoots in the direction from which there is more space assuming that this is where the other tanks are. He starts firing from a high angle and shot after shot changes this angle to a lower and lower angle trying to fire the entire area on the chosen side. He always fires with the best weapon he has (the highest on the list of weapons he has - that is, not necessarily the best). He does not use defensive weapons even though he buys them! At the beginning of the round, he makes 1 attempt to buy defensive weapons (only from the **Battery** - **Strong Parachute** range) and 4 offensive weapons (from the **Missile** - **Heavy Roller** range). + +* **Poolshark** - When attacking, he sets the nearest tank as his target, then selects the angle of the shot, and tries to select its strength by drawing it from the selected range. He always shoots with the best weapon he has. He uses defensive weapons. With a probability of 1:3, he activates the best defensive weapon he owns (the highest on the list of weapons he owns - that is, not necessarily the best) before firing. If his energy level drops below 30 units - he uses **Battery** (of course, if he bought it before), if the energy drops below 5 and he has no **Battery** he surrenders - **White Flag**. At the beginning of the round he makes 1 attemp to buy defensive weapons and 6 offensive weapons. + +** **Tosser** - When attacking, he acts exactly like **Poolshark** however, he may have a "better" weapon inventory due to a different purchase tactic. He always activates the best defensive weapon he has before shooting. And just like **Poolshark** he uses **Battery** and **White Flag**. At the beginning of the round, he assesses how much money he has and depending on that, he makes (money/5100) attempts to buy defensive weapons and then checks again how much money he has left and makes (money/1250) attempts to buy offensive weapons. + +** **Chooser** - Takes as a target the weakest opponent (with the least amount of energy) and aims very precisely, but before the shot the energy of the shot is modified by the parameter of luck :) , that is, despite the precise aiming it does not always hit. He shoots with the best weapon he has unless low energy is required (the target is close). Then he changes his weapon to **Baby Missile** to avoid hitting himself. He always activates the best defensive weapon he has before shooting and, like **Poolshark**, uses **Battery** and **White Flag**. He purchases just like **Tosser**. + +* **Spoiler** - He shoots exactly like **Chooser** except that he has more luck :) , which means that even if he doesn't hit the target of his choice, it can be a more precise shot than **Chooser**. He uses defensive weapons exactly like **Chooser**. At the beginning of the round, he assesses how much money he has and depending on that, he makes (money/5100) attempts to buy defensive weapons and then checks again how much money he has left and makes (money/320) attempts to buy offensive weapons. When buying defensive weapons, he buys only strong and precise weapons - that is, weapons that won't accidentally hurt him. + +** **Cyborg** - Takes aim at the weakest opponent (with the least amount of energy) but prefers human-controlled opponents. Aims very accurately and in the vast majority of cases hits on the first shot. He fires the shot with the best weapon he has unless low energy is required (the target is close). Then he changes his weapon to **Baby Missile** to avoid hitting himself. He uses defensive weapons exactly like **Chooser**. He shops exactly like **Spoiler**. + +* **Unknown** - Before firing each shot, he randomly chooses a course of action from **Poolshark** to **Cyborg** and applies his tactics. However, the tactics of weapon purchases are always identical to **Tosser**. + +Trying to buy a weapon (offensive or defensive) is as follows: +First, one of the weapons is drawn (among all possible offensive or defensive weapons). Then a check is performed to see if the drawn weapon is in the list of weapons possible for purchase by the tank. If not, no weapon is bought in this trial, and if so, its price is checked. If the tank has that much money, the weapon is bought, otherwise the trial ends without making a purchase. + +Table of weapons purchased by: **Shooter**, **Poolshark**, **Tosser** and **Chooser**. + +| Offensive weapons | Defensive weapons | +| --- | --- | +| Missile | Battery | +| Baby Nuke | Parachute | +| Nuke | Strong Parachute | +| LeapFrog | Mag Deflector | +| Funky Bomb | Shield | +| MIRV | Heavy Shield | +| Death's Head | Force Shield | +| Napalm | Bouncy Castle | +| Hot Napalm | | +| Baby Roller | | +| Roller | | +| Heavy Roller | | + +Table of weapons purchased by: **Spoiler** and **Cyborg**. + +| Offensive weapons | Defensive weapons | +| --- | --- | +| Baby Nuke | Battery | +| Nuke | Strong Parachute | +| Death's Head | Mag Deflector | +| Hot Napalm | Heavy Shield | +| | Force Shield | +| | Bouncy Castle | diff --git a/MANUAL_PL.md b/MANUAL_PL.md index b147a42..e66fe67 100644 --- a/MANUAL_PL.md +++ b/MANUAL_PL.md @@ -27,9 +27,10 @@ Klawisz [RETURN] lub przycisk Joysticka przechodzi do następnego ekranu. ## 2. Wprowadzanie nazwy graczy i wybór poziomu graczy sterowanych przez komputer Drugi ekran powtarza się dla każdego z graczy można na nim klawiszami kursora lub joysticjiem wybrać czy danym czołgiem będzie kierował człowiek (opcja HUMAN) czy też kompute (pozostałe opcje). Jednocześnie z klawiatury można wprowadzić nazwę wybranego gracza. -Po naciśnięciu klawisza [RETURN] lub przycisku Joysticka ekran przechodzi na następnego gracza aż zostaną wybrane poziomy trudności dla każdego z nich. +Po naciśnięciu klawisza [RETURN] lub krótkim naciśnięciu przycisku Joysticka ekran przechodzi na następnego gracza aż zostaną wybrane poziomy trudności dla każdego z nich. +Nazwę gracza można wprowadzać także przy pomocy joysticka. Po wciśnięciu i przytrzymaniu przycisku ponad 1s. za pomocą ruchów góra/dół można zmienić wprowadzaną literę, a lewo/prawo jej pozycję w nazwie. Puszczenie przycisku kończy wprowadzanie nazwy i wraca do wyboru poziomu. -Jeśli nazwa nie zostanie wpisana (bo np operujemy wyłącznie joystickiem), to zostanie uzupełniona nazwą domyślną. +Jeśli nazwa nie zostanie wpisana, to zostanie uzupełniona nazwą domyślną. ## 3. Ekran zakupów (przed każdą rundą) @@ -189,3 +190,55 @@ Oczywiście aktywacja broni w momencie kiedy mamy już aktywowaną jakąś inną ## 7. Bronie 'inne' :) : * **Buy me!** - tej 'broni' nie można używać w rozgrywce. Jej zakup powoduje wylosowanie jesdnej z broni ofensywnych lub (żadziej) defensywnych i dodanie jej do arsenału gracza. Jest to loteria w której można stracić (jeśli wylosuje się broń tańsza niż cena **Buy Me!** ale też zyskać. Jeśli wylosuje się broń dużo droższa możemy otrzymać do dyspozycji broń, na którą nie było nas stać! + + +## 8. Poziomy trudności przeciwników sterowanych przez komputer: + +Gra posiada 8 poziomów trudności przeciwników sterowanych przez komputer. A właściwie 7 różnych i jeden "niespodziankę". Każdy z nich ma swój sposób kupowania broni defensywnych i ofensywnych oraz inną metodę wyboru celu i samego celowania, oraz wyboru broni. Ułożone są one na liście według wzrastających "umiejętności": + +* **Moron** - najgłupszy z przeciwników (co nie znaczy że najbezpieczniejszy). Strzela całkowicie przypadkowo używając wyłącznie jednej broni - **Baby Missile**. Nie kupuje nic, nie umie stosować broni defensywnych. + +* **Shooter** - Ten przeciwnik nie strzela na oślep. Wybiera sobie jeden kierunek. Na podstawie własnej pozycji - strzela w stronę z której jest więcej przestrzeni zakładając, że to tam są inne czołgi. Ostrzeliwanie zaczyna od wysokiego kąta i strzał po strzale zmienia ten kąt na coraz niższy starając się ostrzelać cały obszar po wybranej stronie. Strzał oddaje zawsze najlepszą posiadaną bronią (najwyższą na liście posiadanych broni - czyli nie koniecznie najlepszą). Nie używa broni defensywnych mimo, że je kupuje! Na początku rundy podejmuje 1 próbę zakupu broni defensywnych (tylko z zakresu **Battery** - **Strong Parachute**) i 4 ofensywnych (z zakresu **Missile** - **Heavy Roller**). + +* **Poolshark** - Atakując wyznacza sobie za cel najbliższy czołg, następnie dobiera kąt strzału, a jego siłę stara się dobrać losując ją z wybranego przedziału. Strzał oddaje zawsze najlepszą posiadaną bronią. Używa broni defensywnych. Z prawdopodobieństwem 1:3 aktywuje przed oddaniem strzału najlepszą posiadaną broń defensywną (najwyższą na liście posiadanych broni - czyli nie koniecznie najlepszą). Jeżeli poziom jego energii spadnie poniżej 30 jednostek - używa **Battery** (oczywiście jeśli wcześniej ją kupił), jeżeli energia spadniej poniżej 5 i nie ma **Battery** poddaje się - **White Flag**. Na początku rundy podejmuje 1 próbę zakupu broni defensywnych i 6 ofensywnych. + +* **Tosser** - Atakując działa dokładnie tak jak **Poolshark** jednak może posiadać "lepszy" zasób broni dzięki innej taktyce zakupów. Zawsze przed strzałem aktywuje najlepszą posiadaną broń defensywną. i tak jak **Poolshark** stosuje **Battery** i **White Flag**. Na początku rundy ocenia ile ma pieniędzy i w zależności od tego podejmuje (pieniądze/5100) prób zakupu broni defensywnych a następnie jeszcze raz sprawdza ile pieniędzy mu zostało i podejmuje (pieniądze/1250) prób zakupu broni ofensywnych. + +* **Chooser** - Obiera sobie za cel najsłabszego przeciwnika (o najmniejszym zasobie energii) i celuje bardzo dokładnie, jednak przed samym strzałem energia strzału modyfikowana jest o parametr szczęścia :) , czyli mimo precyzyjnego wycelowania nie zawsze trafia. Strzał oddaje najlepszą posiadaną bronią chyba że wymagana jest małą energia (cel jest blisko). Wtedy zmienia broń na **Baby Missile** by unikać trafienia samego siebie. Zawsze przed strzałem aktywuje najlepszą posiadaną broń defensywną i tak jak **Poolshark** stosuje **Battery** i **White Flag**. Zakupów dokonuje tak samo jak **Tosser**. + +* **Spoiler** - Strzela dokładnie tak jak **Chooser** tyle, że ma więcej szczęścia :) , co oznacza że nawet jeśli nie trafi w wybrany cel, to może być to strzał precyzyjniejszy niż **Chooser**. Broni defensywnych używa dokładnie tak jak **Chooser**. Na początku rundy ocenia ile ma pieniędzy i w zależności od tego podejmuje (pieniądze/5100) prób zakupu broni defensywnych a następnie jeszcze raz sprawdza ile pieniędzy mu zostało i podejmuje (pieniądze/320) prób zakupu broni ofensywnych. Przy zakupie broni defensywnych kupuje tylko bronie silne i precyzyjne - czyli takie, które nie zrobią mu przypadkiem krzywdy. + +* **Cyborg** - Obiera sobie za cel najsłabszego przeciwnika (o najmniejszym zasobie energii) lecz preferuje przeciwników sterowanych przez człowieka. Celuje bardzo dokładnie i w zdecydowanej większości przypadków trafia za pierwszym strzałem. Strzał oddaje najlepszą posiadaną bronią chyba że wymagana jest małą energia (cel jest blisko). Wtedy zmienia broń na **Baby Missile** by unikać trafienia samego siebie. Broni defensywnych używa dokładnie tak jak **Chooser**. Zakupy robi dokładnie tak jak **Spoiler** + +* **Unknown** - Przed oddaniem każdego strzału losowo wybiera sposób działania od **Poolsharka** do **Cyborga** i stosuje jego taktykę. Taktyka zakupów broni jest jednak zawsze identyczna jak **Tosser** + +Próba zakupu broni (ofensywnej lub defensywnej) wygląda następująco: +Na początku losowana jest jedna z broni (wśród wszystkich możliwych ofensywnych lub defensywnych). Następnie wykonywane jest sprawdzenie czy wylosowana broń jest na liście broni możliwych do zakupu przez czołg. Jeśli nie to w tej próbie żadna broń nie jest kupowana, a jeśli tak, to sprawdzana jest jej cena. Jeśli czołg ma tyle pieniędzy, broń jest kupowana, w przeciwnym wypadku próba kończy się bez dokonania zakupu. + +Tabela broni kupowanych przez: **Shooter**, **Poolshark**, **Tosser** i **Chooser** + +| bronie ofensywne | bronie defensywne | +| --- | --- | +| Missile | Battery | +| Baby Nuke | Parachute | +| Nuke | Strong Parachute | +| LeapFrog | Mag Deflector | +| Funky Bomb | Shield | +| MIRV | Heavy Shield | +| Death's Head | Force Shield | +| Napalm | Bouncy Castle | +| Hot Napalm | | +| Baby Roller | | +| Roller | | +| Heavy Roller | | + +Tabela broni kupowanych przez: **Spoiler** i **Cyborg** + +| bronie ofensywne | bronie defensywne | +| --- | --- | +| Baby Nuke | Battery | +| Nuke | Strong Parachute | +| Death's Head | Mag Deflector | +| Hot Napalm | Heavy Shield | +| | Force Shield | +| | Bouncy Castle | diff --git a/README.md b/README.md index e449544..9c285a7 100644 --- a/README.md +++ b/README.md @@ -48,19 +48,36 @@ With the advent of [fujinet](https://fujinet.online/) we are thinking about maki ## Changes: +###### Version 1.13 +2022-08-30 + +Getting ready for porting the game! + +Several heavy optimizations and code cleanups in preparation for an unexpected port. + +Changes: +* Overhaul of AI - Cyborgs, Spoilers, and Choosers aim much better. +* Cyborgs prefer to kill humans. +* Fine tuning of AI purchases makes the difficulty level aligned with the robot level. +* Fixed a very difficult and elusive bug that was causing tanks to freeze when falling close to the right edge of the screen fixed. +* Updated music by @Miker +* It is now possible to enter tank names with a joystick - all essential game functions are available without touching the keyboard! +* Manuals updated with AI strategy information and more. + + ###### Version 1.12 2022-08-24 What is going on? Are we getting crazy or what? Changes: -* Background color indicates type of walls. This is very useful when `rand` option is selected. -* XEGS users requested that console keys are used when no keyboard attached! We delivered! [SELECT] to select an offensive weapon, [OPTION] to jump into inventory, defensive section, [START] + [OPTION] - immediate Game Over (no confirmation for you keyboardless folks) +* Background color indicates the type of walls. This is very useful when the rand option is selected. +* XEGS users requested that console keys are used when no keyboard is attached! We delivered! [SELECT] to select an offensive weapon, [OPTION] to jump into inventory, defensive section, [START] + [OPTION] - immediate Game Over (no confirmation for you keyboardless folks) * A very silly bug detected by our young testers fixed - the game crashed when you built a very high mountain using Dirt Balls :) * Boxy infinite bounce bug fixed. -* Funky bombs bouce off the walls! -* First letter entered for a tank name was inserted in a wrong spot. How did it work at all? Magic. -* [ESC] now correctly exits purchase screen. +* Funky bombs bounce off the walls! +* The first letter entered for a tank name was inserted in the wrong spot. How did it work at all? Magic. +[ESC] now correctly exits the purchase screen. ###### Version 1.11 diff --git a/ai.asm b/ai.asm index 7f90a97..ab9e339 100644 --- a/ai.asm +++ b/ai.asm @@ -155,7 +155,7 @@ endo ; choose the best weapon - ldy #32 ;the last weapon + ldy #last_offensive_____ ;the last weapon loop dey lda (temp),y ; this is set up before calling the routine, has address of TanksWeaponsTable @@ -262,10 +262,10 @@ EnoughEnergy ; first check check if any is in use lda ActiveDefenceWeapon,x bne DefensiveInUse - ldy #ind_Nuclear_Winter_+1 ;the last defensive weapon + ldy #last_defensive_____+1 ;the last defensive weapon @ dey - cpy #ind_Battery________ ;first defensive weapon (White Flag nad Battery - never use) + cpy #ind_Battery________ ;first defensive weapon (White Flag and Battery - never use) beq NoUseDefensive lda (temp),y ; has address of TanksWeaponsTable beq @- @@ -297,10 +297,10 @@ DefensiveInUse ; first check check if any is in use lda ActiveDefenceWeapon,x bne DefensiveInUse - ldy #ind_Nuclear_Winter_+1 ;the last defensive weapon + ldy #last_defensive_____+1 ;the last defensive weapon @ dey - cpy #ind_Battery________ ;first defensive weapon (White Flag nad Battery - never use) + cpy #ind_Battery________ ;first defensive weapon (White Flag and Battery - never use) beq NoUseDefensive lda (temp),y ; has address of TanksWeaponsTable beq @- @@ -324,6 +324,7 @@ NoUseDefensive ; use defensives like Tosser jsr TosserDefensives ; now select best target + lda #$00 ; no prefer humans jsr FindBestTarget3 sty TargetTankNr ; aiming @@ -364,6 +365,7 @@ HighForce ; use defensives like Tosser jsr TosserDefensives ; now select best target + lda #$00 ; no prefer humans jsr FindBestTarget3 sty TargetTankNr ; aiming @@ -403,6 +405,7 @@ HighForce ; use defensives like Tosser jsr TosserDefensives ; now select best target + lda #100 ; prefer humans jsr FindBestTarget3 sty TargetTankNr ; aiming @@ -437,11 +440,13 @@ HighForce .proc FindBestTarget3 ; find target with lowest energy ; X - shooting tank number +; A - 100 - prefer humans , 0 - equality :) ; returns target tank number in Y and ; direcion of shoot in A (0 - left, >0 - right) ;---------------------------------------------- + sta PreferHumansFlag jsr MakeLowResDistances - lda #101 + lda #202 sta temp2 ; max possible energy lda #0 sta tempor2 ; direction of shoot @@ -454,26 +459,25 @@ loop01 beq skipThisPlayer lda eXistenZ,y beq skipThisPlayer - + + lda skilltable,y + beq ItIsHuman + lda PreferHumansFlag +ItIsHuman + clc + adc Energy,y ; if robotank energy=energy+100 (100 or 0 from PreferHumansFlag) + cmp temp2 ; lowest + bcs lowestIsLower + sta temp2 + sty temp2+1 ; number of the closest tank + mva #0 tempor2 lda LowResDistances,x cmp LowResDistances,y bcs EnemyOnTheLeft - ;enemy on the right - lda Energy,y - cmp temp2 ; lowest - bcs lowestIsLower - sta temp2 - sty temp2+1 ; number of the closest tank + ; enemy on right inc tempor2 ; set direction to right - bne lowestIsLower - -EnemyOnTheLeft - lda Energy,y - cmp temp2 ; lowest - bcs lowestIsLower - sta temp2 - sty temp2+1 ; number of the closest tank +EnemyOnTheLeft lowestIsLower skipThisPlayer dey @@ -607,14 +611,8 @@ skipThisPlayer ; returns angle and power of shoot tank X (TankNr) ; in the appropriate variables (Angle and Force) ;---------------------------------------------- + mva #$ff SecondTryFlag ; set initial Angle and Force values - ; wind correction 90+(wind/8) - mwa Wind temp2 - :7 lsrw temp2 - clc - lda #90 - adc temp2 - sta NewAngle lda OptionsTable+2 ; selected gravity asl tay @@ -633,10 +631,19 @@ skipThisPlayer adc #0 sta RandBoundaryHigh+1 jsr RandomizeForce +RepeatAim lda ForceTableL,x sta Force lda ForceTableH,x sta Force+1 + ; wind correction 90+(wind/8) + mwa Wind temp2 + :7 lsrw temp2 + clc + lda #90 + adc temp2 + sta NewAngle + ; set virtual weapon :) lda #ind_Baby_Missile___ sta ActiveWeapon,x ; now we have initial valuses @@ -673,7 +680,8 @@ GroundHitInFirstLoopR lda NewAngle adc #5 ; 5 deg to right cmp #(180-20) - bcs EndOfFirstLoopR ; if angle 180-20 or higher +; bcs EndOfFirstLoopR ; if angle 180-20 or higher + bcs AimSecondTry sta NewAngle jmp AimingRight NoHitInFirstLoopR @@ -721,8 +729,20 @@ NoHitInSecondLoopR ; Angle 1 deg to right and end loop inc NewAngle EndOfSecondLoopR +EndOfAim rts +AimSecondTry + bit SecondTryFlag + bpl EndOfAim ; closest RTS + inc SecondTryFlag + lda #<1000 + sta ForceTableL,x + lda #>1000 + sta ForceTableH,x + jsr RandomizeForce.LimitForce + jmp RepeatAim + AimingLeft ; make test Shoot (Flight) jsr SetStartAndFlight @@ -752,7 +772,8 @@ GroundHitInFirstLoopL lda NewAngle sbc #5 ; 5 deg to left cmp #21 - bcc EndOfFirstLoopL ; if angle 180-20 or higher +; bcc EndOfFirstLoopL ; if angle 20 or lower + bcc AimSecondTry sta NewAngle jmp AimingLeft NoHitInFirstLoopL @@ -934,13 +955,13 @@ SorryNoPurchase ;---------------------------------------------- .proc ShooterPurchase ; first try to buy defensives - mva #2 tempXroller; number of offensive purchases to perform +; mva #2 tempXroller; number of offensive purchases to perform ldx TankNr @ randomize ind_Battery________ ind_StrongParachute jsr TryToPurchaseOnePiece - dec tempXroller - bne @- +; dec tempXroller +; bne @- ; and now offensives mva #4 tempXroller; number of offensive purchases to perform @@ -956,16 +977,16 @@ SorryNoPurchase ;---------------------------------------------- .proc PoolsharkPurchase ; first try to buy defensives - mva #3 tempXroller; number of offensive purchases to perform +; mva #2 tempXroller; number of offensive purchases to perform ldx TankNr @ randomize ind_Battery________ ind_Bouncy_Castle__ jsr TryToPurchaseOnePiece dec tempXroller - bne @- +; bpl @- ; and now offensives - mva #8 tempXroller; number of purchases to perform + mva #6 tempXroller; number of purchases to perform ;ldx TankNr @ randomize ind_Missile________ ind_Dirt_Charge____ @@ -980,15 +1001,16 @@ SorryNoPurchase ; what is my money level ldx TankNr -; lda MoneyH,x ; money / 256 -; sta tempXroller ; perform this many purchase attempts + lda MoneyH,x ; money / 256 + lsr ; /2 + sta tempXroller ; perform this many purchase attempts ; first try to buy defensives - mva #1 tempXroller; number of defensive purchases to perform +; mva #1 tempXroller; number of defensive purchases to perform @ randomize ind_Battery________ ind_Bouncy_Castle__ jsr TryToPurchaseOnePiece dec tempXroller - bne @- + bpl @- ; and now offensives lda MoneyH,x ; money / 256 @@ -998,7 +1020,7 @@ SorryNoPurchase randomize ind_Missile________ ind_Dirt_Charge____ jsr TryToPurchaseOnePiece dec tempXroller - bne @- + bpl @- rts .endp @@ -1007,25 +1029,26 @@ SorryNoPurchase ; what is my money level ldx TankNr - ;lda MoneyH,x ; money / 256 - ;sta tempXroller ; perform this many purchase attempts + lda MoneyH,x ; money / 256 + lsr ; /2 + sta tempXroller ; perform this many purchase attempts ; first try to buy defensives - mva #1 tempXroller; number of defensive purchases to perform +; mva #1 tempXroller; number of defensive purchases to perform @ randomize ind_Battery________ ind_Bouncy_Castle__ jsr TryToPurchaseOnePiece2 dec tempXroller - bne @- + bpl @- ; and now offensives lda MoneyH,x ; money / 256 - :4 asl ;*16 + :3 asl ;*8 sta tempXroller ; perform this many purchase attempts @ - randomize ind_Missile________ ind_Plasma_Blast___ + randomize first_offensive____ last_offensive_____ jsr TryToPurchaseOnePiece2 dec tempXroller - bne @- + bpl @- rts .endp diff --git a/artwork/sfx/feat.txt b/artwork/sfx/feat.txt index ca37a3f..d431fa9 100644 --- a/artwork/sfx/feat.txt +++ b/artwork/sfx/feat.txt @@ -1,6 +1,6 @@ STEREOMODE equ 0 ;* --------BEGIN-------- -;* C:\Atari\rmt\rmt128\scorch_str4.rmt +;* C:\Atari\rmt\rmt128\scorch_str6.rmt FEAT_SFX equ 1 FEAT_GLOBALVOLUMEFADE equ 0 ;RMTGLOBALVOLUMEFADE variable FEAT_NOSTARTINGSONGLINE equ 0 diff --git a/artwork/sfx/scorch_str4.rmt b/artwork/sfx/scorch_str6.rmt similarity index 91% rename from artwork/sfx/scorch_str4.rmt rename to artwork/sfx/scorch_str6.rmt index 8681c53..fcdc1a2 100644 Binary files a/artwork/sfx/scorch_str4.rmt and b/artwork/sfx/scorch_str6.rmt differ diff --git a/constants.asm b/constants.asm index c126067..7a4dd52 100644 --- a/constants.asm +++ b/constants.asm @@ -261,36 +261,16 @@ WeaponPriceH ; weapons prices (tables with prices of weapons) .by >price_Liquid_Dirt____ .by >price_Dirt_Charge____ .by >price_Buy_me_________ - .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_White_Flag_____ .by >price_Battery________ - .by >price_Bal_Guidance___ - .by >price_Horz_Guidance__ - .by >price_Floating_Tank__ - .by >price_Lazy_Boy_______ + .by >price_Hovercraft_____ .by >price_Parachute______ .by >price_StrongParachute .by >price_Mag_Deflector__ .by >price_Shield_________ .by >price_Heavy_Shield___ .by >price_Force_Shield___ - .by >price_Super_Mag______ .by >price_Bouncy_Castle__ .by >price_Long_Barrel____ .by >price_Nuclear_Winter_ @@ -327,36 +307,16 @@ WeaponPriceL .by (screenwidth-8-2) ; 2 pixels correction due to a barrel wider than tank + bne @+ + lda XtanksTableL,x + cmp #<(screenwidth-8-2) ; 2 pixels correction due to a barrel wider than tank +@ bcs EndRightFall +NotRightEdge ; tank is falling right - modify coorinates clc lda XtankstableL,x @@ -1158,6 +1156,7 @@ FallingLeft lda XtanksTableL,x cmp #3 ; 2 pixels correction due to a barrel wider than tank bcc EndLeftFall +NotLeftEdge ; tank is falling left - modify coorinates sec lda XtankstableL,x @@ -1205,7 +1204,7 @@ DoNotDrawParachute ForceFallLeft sta UnderTank1 sty UnderTank2 - jne TankFallsX + jmp TankFallsX EndOfFall mva #1 Erase ; ldx TankNr diff --git a/scorch.asm b/scorch.asm index 874a1f6..bced622 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"1.12" ; number of this build (3 bytes) + dta d"1.13" ; number of this build (3 bytes) .endm icl 'definitions.asm' @@ -278,6 +278,7 @@ SettingBarrel mva #1 Erase jsr drawtanks mva #0 Erase + sta COLBAKS ; set background color to black jsr PMoutofScreen ;let P/M disappear ; here gains and losses should be displayed (dollars) @@ -600,7 +601,7 @@ AfterManualShooting ; defensive weapons without flight handling ldx TankNr lda ActiveDefenceWeapon,x - cmp #ind_Floating_Tank__ ; Floating Tank + cmp #ind_Hovercraft_____ beq GoFloat cmp #ind_White_Flag_____ ; White Flag beq ShootWhiteFlag @@ -1191,9 +1192,9 @@ CreditsScroll sta COLPF2 inc CreditsVScrol lda CreditsVScrol - cmp #32 ;not to fast + cmp #32 ;not too fast beq nextlinedisplay - :2 lsr ;not to fast + :2 lsr ;not too fast sta VSCROL jmp EndOfDLI_GO nextlinedisplay @@ -1693,9 +1694,6 @@ noingame ;---------------------------------------------- icl 'artwork/talk.asm' ;---------------------------------------------- -font4x4 - ins 'artwork/font4x4s.bmp',+62 -;---------------------------------------------- TankFont ins 'artwork/tanksv3.fnt',+0,352 ; 44 characters only ;---------------------------------------------- @@ -1711,15 +1709,15 @@ PLAYER MODUL equ $b000 ;address of RMT module opt h- ;RMT module is standard Atari binary file already - ins "artwork/sfx/scorch_str4.rmt" ;include music RMT module + ins "artwork/sfx/scorch_str6.rmt" ;include music RMT module opt h+ ; -; -TheEnd - .ECHO 'TheEnd: ',TheEnd - ;.if TheEnd > PMGraph + $300 - ; .error "memory conflict" - ;.endif +;---------------------------------------------- + org $bf80 +font4x4 + ins 'artwork/font4x4s.bmp',+62 + + diff --git a/scorch.xex b/scorch.xex index f023c1c..06e314d 100644 Binary files a/scorch.xex and b/scorch.xex differ diff --git a/textproc.asm b/textproc.asm index d86f0d2..c58b447 100644 --- a/textproc.asm +++ b/textproc.asm @@ -272,8 +272,8 @@ AfterManualPurchase mwa #ListOfDefensiveWeapons WeaponsListDL ;switch to the list of offensive weapons mva #$ff IsInventory - mva #$01 WhichList - ; offensive weapon - 0, deffensive - 1 + mva #%10000000 WhichList + ; offensive weapon - 0, defensive - %10000000 jmp Purchase.GoToActivation .endp ;-------------------------------------------------- @@ -288,15 +288,14 @@ AfterManualPurchase ; we are clearing list of the weapons mva #$00 WhichList - ; offensive weapon - 0, deffensive - 1 + ; offensive weapon - 0, deffensive - %10000000 GoToActivation mva #$ff LastWeapon -; mva #0 dmactl VDLI DLIinterruptText ; jsr SetDLI for text (purchase) screen jsr PMoutofScreen mwa #PurchaseDL dlptrs - lda #@dmactl(narrow|dma) ; narro screen width, DL on, P/M off + lda #@dmactl(narrow|dma) ; narrow screen width, DL on, P/M off sta dmactls lda #song_supermarket @@ -345,7 +344,153 @@ AfterPurchase ldx #$00 ; index of the checked weapon stx HowManyOnTheListOff ; amounts of weapons (shells, bullets) in both lists stx HowManyOnTheListDef + + jsr CreateList + bit isInventory ; + bpl ChoosingItemForPurchase + + lda whichList + bne PositionDefensive + +; calculate positionOnTheList from the activeWeapon (offensives) + ldx tankNr + lda activeWeapon,x + ldy #0 +@ + cmp IndexesOfWeaponsL1,y + beq ?weaponfound + iny + cpy #(last_offensive_____ - first_offensive____) ; maxOffensiveWeapons + bne @- + ; not found apparently? + ; TODO: check border case (the last weapon) + ldy #0 + beq ?weaponFound ; jmp +PositionDefensive + jsr calcPosDefensive + + +?weaponFound + ; weapon index in Y + sty positionOnTheList + +; Here we have all we need +; So choose the weapon for purchase ...... +;-------------------------------------------------- +ChoosingItemForPurchase +;-------------------------------------------------- + + jsr PutLitteChar ; Places pointer at the right position + jsr getkey + bit escFlag + spl:jmp WaitForKeyRelease ; like jsr ... : rts + cmp #$2c ; Tab + jeq ListChange + cmp #$06 ; cursor left + jeq ListChange + cmp #$0c ; Return + sne:rts + cmp #$e + beq PurchaseKeyUp + cmp #$f + beq PurchaseKeyDown + cmp #$21 ; Space + jeq PurchaseWeaponNow + cmp #$07 ; cursor right + jeq PurchaseWeaponNow + bne ChoosingItemForPurchase + +PurchaseKeyUp + lda WhichList + bpl GoUpOffensive + dec PositionOnTheList + bpl EndUpX + ldy #0 ;HowManyOnTheListDef + ;dey + sty PositionOnTheList + jmp ChoosingItemForPurchase +GoUpOffensive + dec PositionOnTheList + bpl MakeOffsetUp + ldy #0 ;HowManyOnTheListOff + ;dey + sty PositionOnTheList + +MakeOffsetUp + ; If offset is larger than pointer position, + ; it must be equal then. + lda PositionOnTheList + cmp OffsetDL1 + bcs EndUpX ; do not modify the offset + sta OffsetDL1 +EndUpX + jmp ChoosingItemForPurchase +PurchaseKeyDown + lda WhichList + bpl GoDownOffensive + inc:lda PositionOnTheList + cmp HowManyOnTheListDef + bne EndGoDownX + ldy HowManyOnTheListDef + dey + sty PositionOnTheList + jmp ChoosingItemForPurchase +GoDownOffensive + inc:lda PositionOnTheList + cmp HowManyOnTheListOff + bne MakeOffsetDown + ldy HowManyOnTheListOff + dey + sty PositionOnTheList +MakeOffsetDown + lda OffsetDL1 + clc + adc #15 + ;if offset+16 is lower than the position then it must =16 + cmp PositionOnTheList + bcs EndGoDownX + sec + lda PositionOnTheList + sbc #15 + sta OffsetDL1 +EndGoDownX + jmp ChoosingItemForPurchase + +; swapping the displayed list and setting pointer to position 0 +ListChange + mva #0 OffsetDL1 + + lda WhichList + eor #%10000000 ; flip WhichList + sta WhichList + bne DeffensiveSelected + + mwa #ListOfWeapons WeaponsListDL + lda isInventory + beq @+ + ; inventory + jsr calcPosOffensive + jmp ChoosingItemForPurchase +@ + mva #0 PositionOnTheList + jmp ChoosingItemForPurchase + +DeffensiveSelected + mwa #ListOfDefensiveWeapons WeaponsListDL + lda isInventory + beq @+ + jsr calcPosDefensive + jmp ChoosingItemForPurchase +@ + mva #0 positionOnTheList + jmp ChoosingItemForPurchase + +.endp +; +;-------------------------------------------------- +.proc CreateList +;-------------------------------------------------- ; Creating full list of the available weapons for displaying ; in X there is an index of the weapon to be checked, ; in 'Xbyte' address of the first char in filled screen line @@ -362,9 +507,9 @@ CreateList jmi itIsInventory ; put "Purchase" on the screen - mwa #PurchaseDescription PurActDescAddr - ; and Title - mwa #PurchaseTitle DLPurTitleAddr + mwa #PurchaseDescription PurActDescAddr + ; and Title + mwa #PurchaseTitle DLPurTitleAddr ; checking if we can afford buying this weapon ldx temp @@ -408,7 +553,7 @@ CreateList lda WeaponPriceH,x sta decimal+1 jsr displaydec5 - ldy #25 ; overwrite first digit (allways space - no digit :) ) + ldy #25 ; overwrite first digit (allways space - no digit :) ) lda #04 ; "$" sta (xbyte),y @@ -416,9 +561,9 @@ CreateList itIsInventory ; put "Activate" on the screen - mwa #ActivateDescription PurActDescAddr - ; and Title - mwa #InventoryTitle DLPurTitleAddr + mwa #ActivateDescription PurActDescAddr + ; and Title + mwa #InventoryTitle DLPurTitleAddr ldx temp lda TanksWeaponsTableL,y @@ -487,8 +632,8 @@ notInventory @ cpx LastWeapon bne NotTheSameAsLastTime - lda WhichList - bne @+ + bit WhichList + bmi @+ lda HowManyOnTheListOff sta PositionOnTheList jmp NotTheSameAsLastTime @@ -498,7 +643,7 @@ notInventory NotTheSameAsLastTime ; increase appropriate counter txa - cpx #$30 + cpx #last_offensive_____+1 bcs DefenceList ldy HowManyOnTheListOff sta IndexesOfWeaponsL1,y @@ -516,14 +661,15 @@ NoWeapon ; next weapon. If no more weapons then finish! inx - cpx #$30 + cpx #last_offensive_____+1 bne NoDefense ; if we got to the defense weapons, ; we switch address to the second table. mwa #ListOfDefensiveWeapons xbyte NoDefense - cpx #$40 + cpx #last_defensive_____+1 + jne CreateList ; offset may be only too big @@ -541,7 +687,6 @@ WeHaveOffset ; Multiply number on list 1 by 32 and set address ; of the first erased char. - ; (multiplying taken from book of Ruszczyc 'Assembler 6502' lda HowManyOnTheListOff sta xbyte ; multiplier (temporarily here, it will be erased anyway) @@ -554,30 +699,19 @@ WeHaveOffset bne @- ; add to the address of the list - clc - lda xbyte - adc #ListOfWeapons - sta xbyte+1 - stx xbyte - txa ; now there is zero here + adw xbyte #ListOfWeapons + ldy #0 ClearList1 + cpw xbyte #ListOfWeapons1End + beq ListCleared1 + tya ; now there is zero here sta (xbyte),y - iny - bne DoNotIncHigher1 - inc xbyte+1 -DoNotIncHigher1 - cpy #ListOfWeapons1End - bne ClearList1 - + inw xbyte + jmp ClearList1 +ListCleared1 ; And the same we do with the second list - ; Multiply number on list 1 by 40 and set address + ; Multiply number on list 1 by 32 and set address ; of the first erased char. lda HowManyOnTheListDef sta xbyte ; multiplier (temporarily here, it will be erased anyway) @@ -590,181 +724,33 @@ DoNotIncHigher1 bne @- ; add to the address of the list - clc - lda xbyte - adc #ListOfDefensiveWeapons - sta xbyte+1 - stx xbyte - txa ; now there is zero here + adw xbyte #ListOfDefensiveWeapons + ldy #0 ClearList2 + cpw xbyte #ListOfDefensiveWeaponsEnd + beq ListCleared2 + tya ; now there is zero here sta (xbyte),y - iny - bne DoNotIncHigher2 - inc xbyte+1 -DoNotIncHigher2 - cpy #ListOfDefensiveWeaponsEnd - bne ClearList2 + inw xbyte + jmp ClearList2 +ListCleared2 ; here we have pretty cool lists and there is no brute force ; screen clearing at each list refresh ; (it was very ugly - I checked it :) - - bit isInventory ; - bpl ChoosingItemForPurchase - - lda whichList - bne PositionDefensive - -; calculate positionOnTheList from the activeWeapon (offensives) - ldx tankNr - lda activeWeapon,x - ldy #0 -@ - cmp IndexesOfWeaponsL1,y - beq ?weaponfound - iny - cpy #48 ; maxOffensiveWeapons - bne @- - ; not found apparently? - ; TODO: check border case (the last weapon) - ldy #0 - beq ?weaponFound ; jmp -PositionDefensive - jsr calcPosDefensive - - -?weaponFound - ; weapon index in Y - sty positionOnTheList - -; Here we have all we need -; So choose the weapon for purchase ...... -;-------------------------------------------------- -ChoosingItemForPurchase -;-------------------------------------------------- - - jsr PutLitteChar ; Places pointer at the right position - jsr getkey - bit escFlag - spl:jmp WaitForKeyRelease ; like jsr ... : rts - cmp #$2c ; Tab - jeq ListChange - cmp #$06 ; cursor left - jeq ListChange - cmp #$0c ; Return - sne:rts - cmp #$e - beq PurchaseKeyUp - cmp #$f - beq PurchaseKeyDown - cmp #$21 ; Space - jeq PurchaseWeaponNow - cmp #$07 ; cursor right - jeq PurchaseWeaponNow - bne ChoosingItemForPurchase - -PurchaseKeyUp - lda WhichList - beq GoUpOffensive - dec PositionOnTheList - bpl EndUpX - ldy #0 ;HowManyOnTheListDef - ;dey - sty PositionOnTheList - jmp ChoosingItemForPurchase -GoUpOffensive - dec PositionOnTheList - bpl MakeOffsetUp - ldy #0 ;HowManyOnTheListOff - ;dey - sty PositionOnTheList - -MakeOffsetUp - ; If offset is larger than pointer position, - ; it must be equal then. - lda PositionOnTheList - cmp OffsetDL1 - bcs EndUpX ; do not modify the offset - sta OffsetDL1 -EndUpX - jmp ChoosingItemForPurchase -PurchaseKeyDown - lda WhichList - beq GoDownOffensive - inc:lda PositionOnTheList - cmp HowManyOnTheListDef - bne EndGoDownX - ldy HowManyOnTheListDef - dey - sty PositionOnTheList - jmp ChoosingItemForPurchase -GoDownOffensive - inc:lda PositionOnTheList - cmp HowManyOnTheListOff - bne MakeOffsetDown - ldy HowManyOnTheListOff - dey - sty PositionOnTheList -MakeOffsetDown - lda OffsetDL1 - clc - adc #15 - ;if offset+16 is lower than the position then it must =16 - cmp PositionOnTheList - bcs EndGoDownX - sec - lda PositionOnTheList - sbc #15 - sta OffsetDL1 -EndGoDownX - jmp ChoosingItemForPurchase - -; swapping the displayed list and setting pointer to position 0 -ListChange - mva #0 OffsetDL1 - - lda WhichList - eor #$01 - sta WhichList - bne DeffensiveSelected - - mwa #ListOfWeapons WeaponsListDL - lda isInventory - beq @+ - ; inventory - jsr calcPosOffensive - jmp ChoosingItemForPurchase -@ - mva #0 PositionOnTheList - jmp ChoosingItemForPurchase - -DeffensiveSelected - mwa #ListOfDefensiveWeapons WeaponsListDL - lda isInventory - beq @+ - jsr calcPosDefensive - jmp ChoosingItemForPurchase -@ - mva #0 positionOnTheList - jmp ChoosingItemForPurchase - + rts .endp -; weapon purchase routne increases number of possessed bullets -; decreases cash and jumps to screen refresh + ;-------------------------------------------------- .proc PurchaseWeaponNow +; weapon purchase routne increases number of possessed bullets +; decreases cash and jumps to screen refresh ;-------------------------------------------------- bit isInventory bmi inventorySelect - lda WhichList - bne PurchaseDeffensive + bit WhichList + bmi PurchaseDeffensive ; here we purchase the offensive weapon ldy PositionOnTheList @@ -836,8 +822,8 @@ LessThan100 jmp Purchase.AfterPurchase inventorySelect - lda whichList - bne invSelectDef + bit whichList + bmi invSelectDef ldy PositionOnTheList lda IndexesOfWeaponsL1,y @@ -909,7 +895,7 @@ DefActivationEnd cmp IndexesOfWeaponsL2,y beq ?weaponfound iny - cpy #8*2 ; maxDefensiveWeapon + cpy #(last_defensive_____ - first_defensive____) ; maxDefensiveWeapon bne @- ; not found apparently? ; TODO: check border case (the last weapon) @@ -932,7 +918,7 @@ DefActivationEnd cmp IndexesOfWeaponsL1,y beq ?weaponfound iny - cpy #8*5 ; maxOffensiveWeapon + cpy #(last_offensive_____ - first_offensive____) ; maxOffensiveWeapon bne @- ; not found apparently? ; TODO: check border case (the last weapon) @@ -948,32 +934,31 @@ DefActivationEnd .proc PutLitteChar ; first let's clear both lists from little chars mwa #ListOfWeapons xbyte - ldx #52 ; there are 52 lines total + ldx #last_defensive_____ ; there are xx lines total ldy #$00 EraseLoop tya ; lda #$00 sta (xbyte),y - adw xbyte #32 + adw xbyte #32 ; narrow screen dex bpl EraseLoop ; now let's check which list is active now - lda WhichList - beq CharToList1 + bit WhichList + bpl CharToList1 ; we are on the second list (deffensive) ; so there is no problem with scrolling mwa #ListOfDefensiveWeapons xbyte ldx PositionOnTheList beq SelectList2 ; if there is 0 we add nothing AddLoop2 - adw xbyte #32 + adw xbyte #32 ; narrow screen dex bne AddLoop2 SelectList2 lda #$7f ; little char (tab) - this is the pointer sta (xbyte),y - ; now we clear flags of presence of list "out of screen" - ; unfortunately I am now sure what it means... :( + ; now we clear up and down arrows indicating more content below or above screen ldx #EmptyLine stx MoreUpdl @@ -988,7 +973,7 @@ CharToList1 ldx PositionOnTheList beq SelectList1 ; if there is 0 we add nothing AddLoop1 - adw xbyte #32 + adw xbyte #32 ; narrow screen dex bne AddLoop1 SelectList1 @@ -999,7 +984,7 @@ SelectList1 ldx OffsetDL1 beq SetWindowList1 ; if zero then add nothing LoopWindow1 - adw xbyte #32 + adw xbyte #32 ; narrow screen dex bne LoopWindow1 SetWindowList1 @@ -1021,7 +1006,7 @@ NoArrowUp ldx #EmptyLine sec - sbc #17 + sbc #17 ; ???? bmi NoArrowDown cmp OffsetDL1 bcc NoArrowDown @@ -1036,9 +1021,6 @@ NoArrowDown .proc EnterPlayerNames ;entering names of players mwa #NameDL dlptrs -; lda dmactls -; and #$fc -; ora #$01 ; narrow screen (32 chars) lda #%00110001 ; narrow screen width, DL on, P/M off sta dmactls VDLI DLIinterruptText ; jsr SetDLI for text (names) screen @@ -1079,12 +1061,12 @@ NoArrowDown jsr displaybyte jsr HighlightLevel ; setting choosen level of the opponent (Moron, etc) - ; clear tank name editor field - ldx #8 - lda #0 -@ sta NameAdr,x - dex - bpl @- + ; clear tank name editor field - not necessary +; ldx #8 +; lda #0 +;@ sta NameAdr,x +; dex +; bpl @- ; copy existing name and place cursor at end lda TankNr @@ -1102,21 +1084,22 @@ NoArrowDown endOfTankName @ lda NameAdr,y + and #$7f bne LastNameChar dey bpl @- LastNameChar + cpy #7 + beq @+ iny - - lda #$80 ; place cursor on the end - sta NameAdr,y - dey - bpl @+ - iny ; if old name is empty or first time entering -@ sty PositionInName +@ sty PositionInName +; lda NameAdr,y +; ora #$80 ; place cursor on the end +; sta NameAdr,y CheckKeys + jsr CursorDisplay jsr getkey bit escFlag spl:rts @@ -1133,19 +1116,12 @@ IsLetter YesLetter lda scrcodes,x ; we have screen code of the char ldx PositionInName - bne NotFirstLetter - and #$3f ; First letter should be Capital letter - ; (nice trick does not affect digits) -NotFirstLetter sta NameAdr,x inx - lda #$80 ; cursor behind the char - sta NameAdr,x cpx #$08 ; is there 8 characters? - beq CheckKeys ; if so, nothing increased - stx PositionInName ; if not, we store - ; position incremented by 1 - + bne @+ + dex +@ stx PositionInName ; if not, we store jmp CheckKeys CheckFurtherX01 ; here we check Tab, Return and Del cmp #$0c ; Return @@ -1165,15 +1141,19 @@ CheckFurtherX01 ; here we check Tab, Return and Del bne CheckKeys ; handling backing one char ldx PositionInName - beq FirstChar + beq FirstChar ; ferst char - no go back + cpx #7 + bne NotLastChar + lda NameAdr,x + and #$7f + bne LastIsNotSpace ; last char not empty - first clear last char (no go back) +NotLastChar dex +LastIsNotSpace FirstChar - lda #$80 - sta NameAdr,x - lda #$00 - sta NameAdr+1,x - sta NameAdr+2,x stx PositionInName + lda #0 + sta NameAdr,x jmp CheckKeys ChangeOfLevelUp ; change difficulty level of computer opponent inc:lda DifficultyLevel @@ -1213,6 +1193,17 @@ ChangeOfLevel3Down jmp CheckKeys ;---- EndOfNick + ; now check long press joy button (or Return...) + mva #0 pressTimer ; reset +WaitForLongPress + lda STRIG0 ; wait only for joy long press + bne ShortJoyPress + lda pressTimer + cmp #25 ; 1/2s + bcc WaitForLongPress + jsr EnterNameByJoy + jmp CheckKeys +ShortJoyPress ; storing name of the player and its level ; level of the computer opponent goes to @@ -1262,8 +1253,113 @@ nextchar05 bne nextchar05 rts .endp +;-------------------------------------------------- +.proc CursorDisplay + ldy #7 +CursorLoop + lda NameAdr,y + and #$7f + cpy #0 + bne NotFirstLetter + and #$3f ; First letter should be Capital letter + ; (nice trick does not affect digits) +NotFirstLetter + cpy PositionInName + bne @+ + ora #$80 ; place cursor +@ sta NameAdr,y + dey + bpl CursorLoop + rts +.endp +;-------------------------------------------------- +.proc EnterNameByJoy + mva #sfx_keyclick sfx_effect + jsr CursorDisplay + ldy PositionInName + ; now in Y we have PositionInName + ldx #(keycodesEnd-keycodes) +SearchCharacter + lda NameAdr,y + and #$7f + cmp #$20 + bcc CharOK ; digit or space + cmp #$60 + bcs CharOK ; not capital letter + ora #$40 +CharOK + cmp scrcodes,x + beq CharacterFound + dex + bpl SearchCharacter + inx +CharacterFound + ; now in X we have Character (index) on PositionInName + ; wait for centered joy + mva #128-15 pressTimer ; reset (trick) +@ lda STICK0 + and #$0f + cmp #$0f + beq checkjoy + bit pressTimer ; trick (no A change) + bpl @- +checkjoy + lda STICK0 + and #$0f + cmp #$0f + bne JoyNotCentered +notpressedJoy + ;fire + lda STRIG0 + beq checkjoy ; fire still pressed + rts +JoyNotCentered + ; this is a place for code :) + cmp #7 + bne NoRight + ; joy right + cpy #7 + beq GoToMainLoop ; jast character + iny + bne GoToMainLoop +NoRight + cmp #11 + bne NoLeft + ; joy left + lda #0 + sta NameAdr,y + dey + bpl GoToMainLoop + iny + beq GoToMainLoop +NoLeft + cmp #14 + bne NoUp + ; joy up + cpx #(keycodesEnd-keycodes-1) + bne @+ + ldx #$00 ; set to first character index (loop) + beq CharAndMainLoop +@ inx + bne CharAndMainLoop +NoUp + cmp #13 + bne EnterNameByJoy ; not down + ; joy down + dex + bpl CharAndMainLoop + ldx #(keycodesEnd-keycodes-1) ; set to last character index (loop) +CharAndMainLoop + lda scrcodes,x + sta NameAdr,y +GoToMainLoop + sty PositionInName + jmp EnterNameByJoy + +.endp +;-------------------------------------------------- .proc HighlightLevel ; this routine highlights the choosen ; level of the computer opponent @@ -1339,7 +1435,7 @@ displayloop beq noleading0 ; if 00000 - last 0 must be cmp zero bne noleading0 - lda space + lda #space beq displaychar ; space = 0 ! noleading0 inx ; set flag (no leading zeroes to cut) @@ -1386,7 +1482,7 @@ TooLittle001 dex lda decimalresult cmp zero bne decimalend1 - lda space + lda #space sta decimalresult decimalend1 @@ -2212,10 +2308,11 @@ EndOfCredits lda ActiveDefenceWeapon,x bne ActiveDefence ; clear brackets - lda #$00 ; space + lda #space sta textbuffer+80+22 sta textbuffer+80+39 - lda #47 ; no weapon name + mwa #emptyLine temp + jmp ClearingOnly ActiveDefence sta temp ;get back number of the weapon mva #0 temp+1 @@ -2227,7 +2324,7 @@ ActiveDefence bpl @- adw temp #NamesOfWeapons - +ClearingOnly ldy #15 @ lda (temp),y @@ -2249,7 +2346,7 @@ ActiveDefence ;displaying the energy of a tank shield (if exist) ;--------------------- ; clear (if no shield) - lda #$00 ; space + lda #space sta textbuffer+40+10 sta textbuffer+40+11 sta textbuffer+40+12 @@ -2278,7 +2375,7 @@ NoShieldEnergy bmi DisplayLeftWind lda #$7f ; (tab) char sta textbuffer+80+20 - lda #0 ;space + lda #space sta textbuffer+80+17 beq DisplayWindValue DisplayLeftWind @@ -2291,7 +2388,7 @@ DisplayLeftWind sta temp+1 lda #$7e ;(del) char sta textbuffer+80+17 - lda #0 ;space + lda #space sta textbuffer+80+20 DisplayWindValue :4 lsrw temp ;divide by 16 to have a nice value on a screen @@ -2333,7 +2430,7 @@ AngleToRight sta decimal lda #$7f ; (tab) character sta textbuffer+40+25 - lda #0 ;space + lda #space sta textbuffer+40+22 beq AngleDisplay AngleToLeft @@ -2344,13 +2441,13 @@ AngleToLeft sta decimal lda #$7e ;(del) char sta textbuffer+40+22 - lda #0 ;space + lda #space sta textbuffer+40+25 beq AngleDisplay VerticallyUp ; now we have value 90 sta decimal - lda #0 ;space + lda #space sta textbuffer+40+25 sta textbuffer+40+22 diff --git a/variables.asm b/variables.asm index 997e0f4..6573a2a 100644 --- a/variables.asm +++ b/variables.asm @@ -151,7 +151,9 @@ LowResDistances ; coarse tank positions divided by 4 (to be in just one byte) .DS [MaxPlayers] ;---------------------------------------------------- TargetTankNr ; Target tank index (for AI routines) - .DS 1 + .DS 1 +SecondTryFlag ; For precise AI aiming + .DS 1 ;---------------------------------------------------- ;Erase .DS 1 ; if 1 only mask of the character is printed ; on the graphics screen. if 0 character is printed normally @@ -204,6 +206,7 @@ EndOfTheFallFlag .DS 1 ; in case of the infinite fall ;Parachute .DS 1 ; are you insured with parachute? FloatingAlt .DS 1 ; floating tank altitude FunkyWallFlag = FloatingAlt ; reuse this variable in different weapon (Funky Bomb)! +PreferHumansFlag = FloatingAlt ; second reuse in AI Aim proc ;---------------------------------------------------- ;Flight ;variables for 5 missiles (used for mirv) @@ -270,9 +273,9 @@ temptankNr .DS 1 ; tables with indexes of weapons on the right lists ; OK (2022) so, L1 is list of offensive weapons, L2 - defensive IndexesOfWeaponsL1 - .ds 8*5 ; max 40 offensive weapons. this is wrong, should be 48, still only 32 defined. + .ds (last_offensive_____ - first_offensive____+1) IndexesOfWeaponsL2 - .ds 8*2 ; max 16 defensive weapons. + .ds (last_defensive_____ - first_defensive____+1) ;---------------------------------------------------- ; variables storing amount of weapons on the first and second @@ -291,7 +294,7 @@ LastWeapon ; and the cursor must be placed elsewhere .DS 1 WhichList ; list currently on the screen - ; (0-offensive, 1-defensive) + ; (0-offensive, %10000000 - defensive (check with bit:bmi for defensives) .DS 1 ;OffsetDL1 .DS 1 ; offset of the list screen (how many lines).... @@ -326,17 +329,17 @@ LaserCoordinate .DS 8 ; 2,2,2,2 ; from $30 the defensive weapons begin TanksWeapons TanksWeapon1 - .DS [64] + .DS [last_defensive_____ - first_offensive____ +1] TanksWeapon2 - .DS [64] + .DS [last_defensive_____ - first_offensive____ +1] TanksWeapon3 - .DS [64] + .DS [last_defensive_____ - first_offensive____ +1] TanksWeapon4 - .DS [64] + .DS [last_defensive_____ - first_offensive____ +1] TanksWeapon5 - .DS [64] + .DS [last_defensive_____ - first_offensive____ +1] TanksWeapon6 - .DS [64] + .DS [last_defensive_____ - first_offensive____ +1] mountaintable ;table of mountains (size=screenwidth) .DS [screenwidth] diff --git a/weapons.asm b/weapons.asm index 51fc624..c7e3313 100644 --- a/weapons.asm +++ b/weapons.asm @@ -19,39 +19,38 @@ pha rts ExplosionRoutines - .word babymissile-1 - .word missile-1 - .word babynuke-1 - .word nuke-1 - .word leapfrog-1 - .word funkybomb-1 - .word mirv-1 - .word deathshead-1 - .word napalm-1 ;napalm - .word hotnapalm-1 ;hotnapalm - .word tracer-1 - .word tracer-1 ;smoketracer - .word babyroller-1 - .word roller-1 - .word heavyroller-1 - .word riotcharge-1 - .word riotblast-1 - .word riotbomb-1 - .word heavyriotbomb-1 - .word babydigger-1 - .word digger-1 - .word heavydigger-1 - .word babysandhog-1 - .word sandhog-1 - .word heavysandhog-1 - .word dirtclod-1 - .word dirtball-1 - .word tonofdirt-1 - .word liquiddirt-1 - .word dirtcharge-1 - .word VOID-1 ;earthdisrupter - .word VOID-1 ;plasmablast - .word laser-1 + .word babymissile-1 ;Baby_Missile___;_00 + .word missile-1 ;Missile________;_01 + .word babynuke-1 ;Baby_Nuke______;_02 + .word nuke-1 ;Nuke___________;_03 + .word leapfrog-1 ;LeapFrog_______;_04 + .word funkybomb-1 ;Funky_Bomb_____;_05 + .word mirv-1 ;MIRV___________;_06 + .word deathshead-1 ;Death_s_Head___;_07 + .word napalm-1 ;Napalm_________;_08 + .word hotnapalm-1 ;Hot_Napalm_____;_09 + .word tracer-1 ;Tracer_________;_10 + .word tracer-1 ;Smoke_Tracer___;_11 + .word babyroller-1 ;Baby_Roller____;_12 + .word roller-1 ;Roller_________;_13 + .word heavyroller-1 ;Heavy_Roller___;_14 + .word riotcharge-1 ;Riot_Charge____;_15 + .word riotblast-1 ;Riot_Blast_____;_16 + .word riotbomb-1 ;Riot_Bomb______;_17 + .word heavyriotbomb-1 ;Heavy_Riot_Bomb;_18 + .word babydigger-1 ;Baby_Digger____;_19 + .word digger-1 ;Digger_________;_20 + .word heavydigger-1 ;Heavy_Digger___;_21 + .word babysandhog-1 ;Baby_Sandhog___;_22 + .word sandhog-1 ;Sandhog________;_23 + .word heavysandhog-1 ;Heavy_Sandhog__;_24 + .word dirtclod-1 ;Dirt_Clod______;_25 + .word dirtball-1 ;Dirt_Ball______;_26 + .word tonofdirt-1 ;Ton_of_Dirt____;_27 + .word liquiddirt-1 ;Liquid_Dirt____;_28 + .word dirtcharge-1 ;Dirt_Charge____;_29 + .word VOID-1 ;Buy_me_________;_30 + .word laser-1 ;Laser__________;_31 VOID tracer @@ -670,21 +669,6 @@ DiggerCharacter mva EndOfTheBarrelY ybyte mva #0 ybyte+1 - ;clc - ;lda xtankstableL,x - ;adc EndOfTheBarrelX,y ; correction of the end of the barrel point (X) - ;sta xbyte - ;lda xtankstableH,x - ;adc #0 - ;sta xbyte+1 - ;sec - ;lda ytankstable,x - ;sbc EndOfTheBarrelY,y ; correction of the end of the barrel point (Y) - ;sta ybyte - ;lda #$00 - ;sbc #$00 - ;sta ybyte+1 - mwa xdraw LaserCoordinate mwa ydraw LaserCoordinate+2 mwa xbyte LaserCoordinate+4 @@ -1449,12 +1433,14 @@ CTRLPressedLeft pressedTAB mva #sfx_purchase sfx_effect ldx TankNr - inc ActiveWeapon,x - lda ActiveWeapon,x - cmp #$30 ; number of offensive weapons - bne @+ - lda #0 + lda ActiveWeapon,x + cmp #last_offensive_____ ; the last possible offensive weapon + bne ?notlasttofirst + lda #first_offensive____ ; #0 sta ActiveWeapon,x + beq @+ ; allways = 0 +?notlasttofirst + inc ActiveWeapon,x @ lda ActiveWeapon,x jsr HowManyBullets ; and we have qty of owned shells. Ufff.... @@ -1464,10 +1450,14 @@ pressedTAB CTRLpressedTAB ldx TankNr - dec ActiveWeapon,x - bpl @+ - lda #$2f ; the last possible offensive weapon + lda ActiveWeapon,x + cmp #first_offensive____ ; #0 + bne ?notfirsttolast + lda #last_offensive_____ ; the last possible offensive weapon sta ActiveWeapon,x + bne @+ ; allways <> 0 +?notfirsttolast + dec ActiveWeapon,x @ lda ActiveWeapon,x jsr HowManyBullets ; and we have qty of owned shells. Ufff.... @@ -3028,7 +3018,8 @@ RangesChecked .endp ;-------------------------------------------------- .proc ClearScreenSoilRange -; cleanup of the soil fall down ranges (left and right) ;-------------------------------------------------- +; cleanup of the soil fall down ranges (left and right) +;-------------------------------------------------- mwa #screenwidth RangeLeft lda #0 sta RangeRight @@ -3043,17 +3034,6 @@ RangesChecked jsr DecreaseWeapon ; and here we have amount of possessed ammo for given weapon sta WeaponDepleted -; ;cmp #0 -; bne AmmunitionDecreased -; ;lda #0 ;if ammo for given weapon ends -; sta ActiveWeapon,x ;then set to default weapon (baby missile) -;AmmunitionDecreased -; lda #99 -; ldy #0 -; sta (weaponPointer),y ;baby missile - always 99 pieces -; -; ;there is a good value in weaponPointer after jsr DecreaseWeapon -; rts .endp