SHOWDOWN for Sinclair Spectrum
by Andrew McCabe
from Popular Computing Weekly, 8th March 1984

A new game for the 48K Spectrum by Andrew McCabe.


[This program needs Issue 2 emulation, because of its use of IN.]


The object of this game is to shoot your opponent three times,
preferably without getting shot yourself. The two outlaws on screen
both have five bullets, so you will have to conserve your ammunition.

The outlaws can be moved up and down the screen, as can their guns. It
is also possible to guide the bullets after they have been fired.
Other features include falling tombstones, cacti and wagons which
absorb bullets.


Notes

Line 10 calls the subroutine which sets up the UDGs (*9000 onwards).

*20-40 are concerned with initialising the variables (13,2 strings
which contain the different positions of each cowpoke's gun).

*50-110 set up the display, excluding the cowpokes and wagon.

*120 checks to see if the second cactus has been printed and, if not,
the values of P&Q are altered (and thus the position of the second
cactus (both P&Q are utilised later to save money space)).

*150 prompts the player that the program is ready and waits for any
key to be pressed before starting the main loop.

Sometimes a line can be put in which bypasses the scanning of the
keyboard if no key is pressed. However, in this program 90% of the
main loop is concerned with keyboard scanning, so this would save
little, if any time.

The main loop starts at *200 & terminates at *905. *200&210 scan the
keyboard (using IN, so any combination of keys can be pressed at once)
to see if the left cowpoke's movement keys have been depressed. If so,
then this position is altered between the parameters of 1&20 and a
space is printed either above or below him.

*220&230 scan the keyboard to see if the left cowpoke's gun aiming
keys have been depressed. If so, then W (and thus the part of A string
sliced, and the direction of the next bullet it fired) are altered.

*250 prints the left cowpoke in his new position along with the part
of A string containing the correct position of his gun.

*300-350 are in effect the same as *200-250, but for the right
cowpoke.

*400&500 check to see if a cowpoke has fired a bullet. If so, then the
values of P&J (depending on which cowpoke fired) are set to the
position of his gun (ie. greater than nought).

*600&700 check to see if a bullet is in the air. If so, then the
subroutine pertaining to the flight of that bullet is called.

*710 checks to see if H is greater than 16. If so, then H is set as a
random number between 16&10.

*800 sees if H=77 and if so sets it to 15.

*900 sees if H is smaller than 16 (ie. checks if the wagon is being
displayed) and if so calls the subroutine dealing with wagon movement.

*910 prints the wagon before decrementing H (ie. moving the wagon up
the screen) and returning to the main loop.

The subroutine *1000-1120 deals with the left cowpoke's bullet. It
increments its horizontal position by 1 and its vertical position by W
(-1, 1, or 0). It then calls the routine dealing with the death of the
right cowpoke if it scores a hit, or returns to the main loop if not.

The subroutine *2000-2120 is the same except it deals with the right
cowpoke's bullet. NB. When a bullet is fired the bullet count of the
then particular cowpoke is decreased.

*4000-4160 deal with the death of the right cowpoke; firstly they
decrement A (ie. the cowpoke rises to "boot hill") then a tombstone is
laid while a warped version of the "death march" is played. Finally,
the cowpoke's life count is decreased, a check is made to see if he
has lost 3 lives; if so then the program jumps to the routine dealing
with a victory for player; if not then it jumps to line 150.

*5000-5160 do the same as the previous routine, except that they deal
with the death of player 1.

The rating is calculated by how many lives the victor lost and how
long he took to defeat his opponent. This is done using the variable T
which is incremented every time the main loop is executed. 30.is then
edded to T for every life lost by the victory. Finally, this number is
divided by 100. Using this final number an area between the start and
finish of the list of famous cowboys is printed over.


Variables

A	RIGHT COWPOKE'S POSITION
C	BULLET COUNT OF LEFT COWPOKE
D	BULLET COUNT OF RIGHT COWPOKE
F	ONLY IN INITIALISING OF UDGs
G	ONLY IN INITIALISING OF UDGs
H	WAGON POSITION (IF WAGON IS VISIBLE)
I	ONLY IN INITIALISING UDGs
J	VERTICAL POS. OF RIGHT COWPOKE'S BULLET
K	HORIZONTAL POS. OF RIGHT COWPOKE'S BULLET
L	LEFT COWPOKE'S LIFE COUNT
M	RIGHT COWPOKE'S LIFE COUNT
P(*110)	VERTICAL POS. OF CACTUS
P(later)	VERTICAL POS. OF LEFT COWPOKE'S BULLET
O(*110)	HORIZONTAL POS. OF CACTUS
Q(later)	HORIZONTAL POS. OF LEFT COWPOKE'S BULLET
T	NUMBER OF TIMES MAIN LOOP HAS OCCURRED
W	DIRECTION OF LEFT COWPOKE'S GUN
Z	DIRECTION OF RIGHT COWPOKE'S GUN
Y(LOOP)	PART OF A BEEP STATEMENT EXECUTED WHEN A COWPOKE IS KILLED
F(LOOP)	POS. OF FALLING TOMBSTONE
A string	CONTAINS THE 3 POSITIONS OF THE LEFT COWPOKE'S GUN
B string	CONTAINS THE 3 POSITIONS OF THE RIGHT COWPOKE'S GUN
Z string	CONTAINS THE NAMES OF 5 FAMOUS OUTLAWS

