10REM Space Commander
20REM by A. Jackson
30REM (c) 1990 Bazzasoft
40ON ERROR GOTO 2310
50MODE1:VDU23;8202;0;0;0;
60DIMG$(4)
70REPEAT
80won%=0
90IW%=0:ND%=0:EI%=1:E%=100:S%=0:S$="A
AD":PROCstat
100PROCscreen
110REPEAT
120PROCicons
130*FX15,1
140IF (S$="XXX") OR (FS%=5 AND RND(5)=
1) OR (FS%=4 AND RND(10)=1) PROCatt
150IF E%=0 OR won% GOTO 220
160PROCinput
170IF O%=0 PROCint
180IF O%=1 PROCattack
190IF O%=2 PROCcommunicate
200IF O%=3 PROCmove
210IF O%=4 PROCfile
220UNTIL E%=0 OR won%
230IF won% PROCwon ELSE PROCdead
240UNTIL0
250DEFPROCscreen
260VDU19,1,4,0;0;0;
270COLOUR129
280CLS
290MOVE4,920:DRAW1272,920:DRAW1272,4:D
RAW4,4:DRAW4,920:MOVE12,912:DRAW1264,912
:DRAW1264,12:DRAW12,12:DRAW12,912
300ENDPROC
310DEFPROCicons
320PROCicon(0,2,0,1,3)
330IF E%>10 PROCicon(1,12,0,1,3) ELSE
PROCicon(1,12,0,1,2)
340PROCicon(2,24,0,1,3)
350PROCicon(3,35,0,1,3)
360ENDPROC
370DEFPROCicon(I%,X%,Y%,A%,B%)
380VDU26
390M%=0:COLOUR128+A%:COLOURB%
400CALL&90A,I%,X%,Y%,M%
410VDU28,1,30,38,4
420ENDPROC
430DEFPROCinput
440COLOUR129:CLS
450COLOUR128:COLOUR3:PRINTTAB(11,6);"S
PACE COMMANDER"
460COLOUR129:COLOUR2:PRINT'''SPC11;"1
- Intelligence"
470PRINT'SPC10;"2 - Combat Systems"
480PRINT'SPC10;"3 - Communications"
490PRINT'SPC12;"4 - Navigation"
500PRINT'SPC14;"5 - Filing"
510O%=GET-49
520IF O%<0 OR O%>4 GOTO 510
530CLS:ENDPROC
540DEFPROCint
550PROCicon(0,2,0,3,1)
560COLOUR129:COLOUR3
570MOVE100,100:DRAW100,824:DRAW1180,82
4:DRAW1180,100:DRAW100,100
580MOVE150,150:DRAW150,774:DRAW1030,77
4:DRAW1030,150:DRAW150,150
590VDU28,5,26,31,8
600COLOUR128:CLS:COLOUR2
610SOUND1,-15,100,1
620PRINT'''"SYSTEM - ";S$'
630PRINT"WARP GATES"
640PRINT"=========="
650PRINT"NUMBER - ";NG%
660FOR GN%=1 TO NG%
670PRINT"GATE ";GN%;" - SYSTEM ";G$(GN
%-1)
680NEXT
690PRINT'"ENERGY LEVEL - ";E%
700PRINT'SPC(8);"PRESS SPACE"
710REPEAT UNTIL INKEY-99
720SOUND1,-15,100,1
730ENDPROC
740DEFPROCstat
750L1%=ASC(MID$(S$,1,1))-64
760L2%=ASC(MID$(S$,2,1))-64
770L3%=ASC(MID$(S$,3,1))-64
780Z%=L1%+27*L2%+729*L3%:Z%=-Z%
790NG%=RND(Z%):NG%=RND(5)
800FOR GN%=1 TO NG%
810L1%=RND(26)+64:L2%=RND(26)+64:L3%=R
ND(26)+64:G$(GN%-1)=CHR$L1%+CHR$L2%+CHR$
L3%
820NEXT
830FS%=RND(5):DUMMY=RND(-TIME)
840IFS$="AAA" FS%=45 ELSE IF S$="XXX"
FS%=43
850ENDPROC
860DEFPROCattack
870PROCicon(1,12,0,3,1)
880COLOUR129:COLOUR3
890SOUND1,-15,100,1
900IFFS%=0 PRINT"Planet devastated, Si
r."''"PRESS SPACE":REPEAT UNTIL INKEY-99
:ENDPROC
910IF E%<11 PRINT"We don't have enough
energy, Sir."''"PRESS SPACE":REPEAT UNT
IL INKEY-99:ENDPROC
920IF E%<31 PRINT"We're short on energ
y, Sir."'"I wouldn't recommend an attack
."
930IF E%<51 AND E%>30 PRINT"If you thi
nk we can do it, Sir."
940IF E%>50 AND E%<90 PRINT"Phasers lo
cked on, Sir."
950IF E%>89 PRINT"All systems go, Sir.
"
960PRINT'"Do you wish to attack system
";S$;"?"
970REPEAT:G$=GET$:UNTIL INSTR("YyNn",G
$)>0
980IF INSTR("nN",G$) PRINT'"Disengagin
g systems, Sir."''"PRESS SPACE":REPEAT U
NTIL INKEY-99:ENDPROC
990COLOUR2:PRINT'"ALL WEAPONS SYSTEMS
ARE NOW ACTIVE"
1000PRINT"PRESS SPACE BAR TO ABORT COUN
TDOWN"
1010SOUND1,-15,10,5:SOUND1,-15,20,5:SOU
ND1,-15,10,5:SOUND1,-15,20,5
1020J=0
1030FOR I=10 TO 1 STEP -1
1040PRINTTAB(0,7);"T MINUS ";I;" "
1050IF J<>32 J=INKEY(100)
1060IF J=32:I=1
1070NEXT
1080FORI=1 TO 1000:NEXT
1090*FX15,1
1100IF J=32 PRINT'"COUNTDOWN ABORTED"''
"PRESS SPACE":REPEAT UNTIL INKEY-99:ENDP
ROC
1110PRINTTAB(0,7);"WEAPONS CHECK:"
1120FORJ=1 TO 1000:NEXT:PRINT"PHASERS A
CTIVE"
1130FORJ=1 TO 1000:NEXT:PRINT"MISSILES
ACTIVE"
1140FORJ=1 TO 1000:NEXT:PRINT"NEUTRON G
UNS ACTIVE"
1150IF IW%=1 FORJ=1 TO 1000:NEXT:PRINT"
PHOTON RAM ACTIVE"
1160PRINT'"OPENING FIRE"
1170FOR I=1 TO 15:SOUND1,-15,I,1:NEXT:S
OUND0,-15,4,10
1180PRINT'"ENEMY RETALIATING"
1190FOR I=15 TO 1 STEP -1:SOUND1,-15,I,
1:NEXT:SOUND0,-15,4,10
1200N%=70+(10*FS%)
1210REPEAT
1220EA%=RND(E%)+20:NA%=RND(N%)
1230IF IW%=1 EA%=EA%+20
1240IF ND%=1 AND FS%=43 PRINT'"Nuclear
device launched, Sir.":ND%=0:N%=275
1250IF EA%>NA% N%=N%-1
1260IF NA%>EA% E%=E%-1
1270IF NA%=EA% N%=N%-1:E%=E%-1
1280IF E%=70 PRINT'"Energy loss increas
ing, Sir"
1290IF E%=50 PRINT'"Minor systems failu
re, Sir."
1300IF E%=30 PRINT'"Loosing power fast,
Sir."
1310IF E%=10 PRINT'"Primary systems fai
ling, Sir."
1320IF N%=50 PRINT'"Enemy looking weak,
Sir."
1330IF N%=30 PRINT'"Enemy sustaining da
mage, Sir."
1340IF N%=10 PRINT'"Enemy going down, S
ir."
1350UNTIL N%=0 OR E%=0
1360IF E%=0 PRINT'"Life support systems
failing, Sir!":GOTO1440
1370PRINT'"We did it, Sir!":IF FS%=1 S%
=S%-3
1380IF S$="XXX" PRINT'"We got them! We
did it! Hooray!":won%=1
1390IF FS%=2 S%=S%-2
1400IF FS%=3 S%=S%-1
1410IF FS%=4 S%=S%+2
1420IF FS%=5 S%=S%+3
1430FS%=0
1440PRINT'"PRESS SPACE":REPEAT UNTIL IN
KEY-99:ENDPROC
1450DEFPROCcommunicate
1460PROCicon(2,24,0,3,1)
1470COLOUR129:COLOUR3
1480PRINT"Radio systems active, Sir."'"
Which message shall I send?"''"1 - Ident
ify yourself"'"2 - Request permission to
make repairs"
1490REPEAT:G=GET-48:UNTIL G>0 AND G<3
1500IF G=2 GOTO 1590
1510IF FS%=0 PRINT "No answer, Sir."
1520IF FS%=1 PRINT "We are allies of St
ar Fleet. Welcome."
1530IF FS%=2 PRINT "We wish you greetin
gs, friends."
1540IF FS%=3 PRINT "We do not wish to b
e involved."
1550IF FS%=4 PRINT "Leave here, now!"
1560IF FS%=5 PRINT "Die, minions of Sta
r Fleet!"
1570IF FS%=45 PRINT "Welcome to Star Fl
eet HQ!"
1580PRINT'"PRESS SPACE":REPEAT UNTIL IN
KEY-99:ENDPROC
1590IF FS%=0 PRINT"No answer, Sir."
1600IF FS%=1 PRINT"Repairs complete, Si
r.":E%=100*EI%
1610IF FS%=2 PRINT"We've done all we ca
n.":IF E%<70*EI% E%=70*EI%
1620IF FS%=3 PRINT"Request denied."
1630IF FS%=45 PROChq:GOTO1650
1640IF FS%>3 PRINT"They're attacking us
, Sir!":GOTO1160
1650PRINT'"PRESS SPACE":REPEAT UNTIL IN
KEY-99:ENDPROC
1660DEFPROCmove
1670PROCicon(3,35,0,3,1)
1680COLOUR129:COLOUR0
1690PRINT"Navigation systems activated,
Sir."
1700IF NG%=1 PRINT"There is 1 gate from
here." ELSE PRINT"There are ";NG%;" gat
es from here."
1710FOR GN%=1 TO NG%
1720PRINT"GATE NUMBER ";GN%;" - SYSTEM
";G$(GN%-1)
1730NEXT
1740PRINT'"Choose a gate, Sir."
1750PRINT"Press 0 to abort."
1760REPEAT:GN%=GET-48:UNTIL GN%>-1 AND
GN%<NG%+1
1770IFGN%=0 PRINT"Navigation systems de
activated.":GOTO1810
1780PRINT'"Entering gate ";GN%;", Sir."
1790FOR I=1 TO 25:SOUND1,-15,I,1:SOUND2
,-15,I+1,1:NEXT
1800S$=G$(GN%-1):PROCstat
1810PRINT'"PRESS SPACE":REPEAT UNTIL IN
KEY-99:ENDPROC
1820DEFPROCatt
1830CLS:COLOUR129:COLOUR3
1840PRINT"Sir, they're attacking us!"
1850GOTO1110
1860DEFPROChq
1870E%=110*EI%
1880IF S%<0 PRINT"You have been killing
more of our"'"friends than our enemies!
You are"'"henceforth demoted to the ran
k of"'"junior turnip peeler.":E%=0:ENDPR
OC
1890IF S%<20 PRINT"What do you think yo
u're doing? Your"'"progress has been mos
t unsatisfactory and we require improvem
ents.":ENDPROC
1900IF S%<50 PRINT"Go and kill those sl
imy scumballs!"'"Good luck!":ENDPROC
1910IF S%>49 PRINT"You're doing well. W
e have great"'"confidence in you. Well d
one.":ENDPROC
1920IF S%>75 AND EI%=1 PRINT"We have in
stalled your ship with new"'"energy syst
ems.":EI%=2
1930IF S%>100 AND IW%=0 PRINT"We have f
itted you with a new weapon.":IW%=1
1940IF S%>200 AND ND%=0 PRINT"We have f
itted your ship with a small thermonucle
ar device, which will be"'"launched upon
entry into the enemy"'"base-system. All
our hopes go with"'"you and your crew."
:ND%=1
1950ENDPROC
1960DEFPROCdead
1970PRINT'''''"Oh dear. You seem to hav
e failed in"'"your mission. You haven't
actually"'"saved the universe. What a pi
ty. Oh"'"well, that's life for you."'"Yo
u did, however score ";S%
1980PRINT'SPC6"PRESS SPACE TO PLAY AGAI
N":REPEAT UNTIL INKEY-99:ENDPROC
1990DEFPROCwon
2000PRINT'''''"Well done! You've battle
d against all"'"odds to save the univers
e. You have"'"single-handedly defeated t
he Quork"'"base planet. Your score is so
immense that it wouldn't fit on the scr
een."'"You are promoted to Star Fleet Ch
ief."
2010GOTO1980
2020DEFPROCfile
2030CLS
2040COLOUR129:COLOUR2:PRINT'''''"FILING
SYSTEM"'"============="
2050INPUT'"Filename - "F$
2060PRINT'"Load or Save?"
2070PRINT'"L - Load"'"S - Save"'"A - Ab
ort"
2080REPEAT:G$=GET$:UNTIL INSTR("AaLlSs"
,G$):IF INSTR("Aa",G$) ENDPROC
2090IF INSTR("Ll",G$) GOTO 2200
2100F=OPENOUT(F$)
2110PRINT #F,S$
2120PRINT #F,S%
2130PRINT #F,E%
2140PRINT #F,EI%
2150PRINT #F,IW%
2160PRINT #F,ND%
2170PRINT #F,FS%
2180CLOSE #F
2190ENDPROC
2200F=OPENIN(F$)
2210INPUT #F,S$
2220INPUT #F,S%
2230INPUT #F,E%
2240INPUT #F,EI%
2250INPUT #F,IW%
2260INPUT #F,ND%
2270PROCstat
2280INPUT #F,FS%
2290CLOSE #F
2300ENDPROC
2310CLEAR:GOTO 50