6 #define EXTERN extern
\r
13 #define ndevice (15) // Number of devices
\r
14 #define phasefac (2.0)
\r
15 #define PLNETMAX (10)
\r
19 int x; /* Quadrant location of planet */
\r
21 int pclass; /* class M, N, or O (1, 2, or 3) */
\r
22 int crystals; /* has crystals */
\r
23 int known; /* =1 contents known, =2 shuttle on this planet */
\r
27 int snap, // snapshot taken
\r
28 remkl, // remaining klingons
\r
29 remcom, // remaining commanders
\r
30 rembase, // remaining bases
\r
31 starkl, // destroyed stars
\r
32 basekl, // destroyed bases
\r
33 killk, // Klingons killed
\r
34 killc, // commanders killed
\r
35 galaxy[9][9], // The Galaxy (subscript 0 not used)
\r
36 cx[11],cy[11], // Commander quadrant coordinates
\r
37 baseqx[6], // Base quadrant X
\r
38 baseqy[6], // Base quadrant Y
\r
39 newstuf[9][9], // Extended galaxy goodies
\r
40 isx, isy, // Coordinate of Super Commander
\r
41 nscrem, // remaining super commanders
\r
42 nromkl, // Romulans killed
\r
43 nromrem, // Romulans remaining
\r
44 nsckill, // super commanders killed
\r
45 nplankl; // destroyed planets
\r
46 PLANETS plnets[PLNETMAX+1]; // Planet information
\r
47 double date, // stardate
\r
48 remres, // remaining resources
\r
49 remtime; // remaining time
\r
50 } d, snapsht; // Data that is snapshot
\r
53 quad[11][11]; // contents of our quadrant
\r
55 // Scalar variables that are needed for freezing the game
\r
56 // are placed in a structure. #defines are used to access by their
\r
57 // original names. Gee, I could have done this with the d structure,
\r
58 // but I just didn't think of it back when I started.
\r
60 EXTERN struct foo2 {
\r
150 #define inkling a.inkling // Initial number of klingons
\r
151 #define inbase a.inbase // Initial number of bases
\r
152 #define incom a.incom // Initian number of commanders
\r
153 #define instar a.instar // Initial stars
\r
154 #define intorps a.intorps // Initial/Max torpedoes
\r
155 #define condit a.condit // Condition (red, yellow, green docked)
\r
156 #define torps a.torps // number of torpedoes
\r
157 #define ship a.ship // Ship type -- 'E' is Enterprise
\r
158 #define quadx a.quadx // where we are
\r
159 #define quady a.quady //
\r
160 #define sectx a.sectx // where we are
\r
161 #define secty a.secty //
\r
162 #define length a.length // length of game
\r
163 #define skill a.skill // skill level
\r
164 #define basex a.basex // position of base in current quad
\r
165 #define basey a.basey //
\r
166 #define klhere a.klhere // klingons here
\r
167 #define comhere a.comhere // commanders here
\r
168 #define casual a.casual // causalties
\r
169 #define nhelp a.nhelp // calls for help
\r
170 #define nkinks a.nkinks //
\r
171 #define ididit a.ididit // Action taken -- allows enemy to attack
\r
172 #define gamewon a.gamewon // Finished!
\r
173 #define alive a.alive // We are alive (not killed)
\r
174 #define justin a.justin // just entered quadrant
\r
175 #define alldone a.alldone // game is now finished
\r
176 #define shldchg a.shldchg // shield is changing (affects efficiency)
\r
177 #define thingx a.thingx // location of strange object in galaxy
\r
178 #define thingy a.thingy //
\r
179 #define plnetx a.plnetx // location of planet in quadrant
\r
180 #define plnety a.plnety //
\r
181 #define inorbit a.inorbit // orbiting
\r
182 #define landed a.landed // party on planet (1), on ship (-1)
\r
183 #define iplnet a.iplnet // planet # in quadrant
\r
184 #define imine a.imine // mining
\r
185 #define inplan a.inplan // initial planets
\r
186 #define nenhere a.nenhere // Number of enemies in quadrant
\r
187 #define ishere a.ishere // Super-commander in quandrant
\r
188 #define neutz a.neutz // Romulan Neutral Zone
\r
189 #define irhere a.irhere // Romulans in quadrant
\r
190 #define icraft a.icraft // Kirk in Galileo
\r
191 #define ientesc a.ientesc // Attempted escape from supercommander
\r
192 #define iscraft a.iscraft // =1 if craft on ship, -1 if removed from game
\r
193 #define isatb a.isatb // =1 if SuperCommander is attacking base
\r
194 #define iscate a.iscate // Super Commander is here
\r
196 #define idebug a.idebug // Debug mode
\r
198 #define iattak a.iattak // attack recursion elimination (was cracks[4])
\r
199 #define icrystl a.icrystl // dilithium crystals aboard
\r
200 #define tourn a.tourn // Tournament number
\r
201 #define thawed a.thawed // Thawed game
\r
202 #define batx a.batx // Base coordinates being attacked
\r
203 #define baty a.baty //
\r
204 #define ithere a.ithere // Tholean is here
\r
205 #define ithx a.ithx // coordinates of tholean
\r
206 #define ithy a.ithy
\r
207 #define iseenit a.iseenit // Seen base attack report
\r
208 #define inresor a.inresor // initial resources
\r
209 #define intime a.intime // initial time
\r
210 #define inenrg a.inenrg // Initial/Max Energy
\r
211 #define inshld a.inshld // Initial/Max Shield
\r
212 #define inlsr a.inlsr // initial life support resources
\r
213 #define indate a.indate // Initial date
\r
214 #define energy a.energy // Energy level
\r
215 #define shield a.shield // Shield level
\r
216 #define shldup a.shldup // Shields are up
\r
217 #define warpfac a.warpfac // Warp speed
\r
218 #define wfacsq a.wfacsq // squared warp factor
\r
219 #define lsupres a.lsupres // life support reserves
\r
220 #define dist a.dist // movement distance
\r
221 #define direc a.direc // movement direction
\r
222 #define Time a.Time // time taken by current operation
\r
223 #define docfac a.docfac // repair factor when docking (constant?)
\r
224 #define resting a.resting // rest time
\r
225 #define damfac a.damfac // damage factor
\r
226 #define stdamtim a.stdamtim // time that star chart was damaged
\r
227 #define cryprob a.cryprob // probability that crystal will work
\r
228 #define probex a.probex // location of probe
\r
229 #define probey a.probey
\r
230 #define probecx a.probecx // current probe quadrant
\r
231 #define probecy a.probecy
\r
232 #define probeinx a.probeinx // Probe x,y increment
\r
233 #define probeiny a.probeiny
\r
234 #define proben a.proben // number of moves for probe
\r
235 #define isarmed a.isarmed // Probe is armed
\r
236 #define nprobes a.nprobes // number of probes available
\r
239 kx[21], // enemy sector locations
\r
241 starch[9][9]; // star chart
\r
243 EXTERN int fromcommandline; // Game start from command line options
\r
246 EXTERN char passwd[10], // Self Destruct password
\r
247 *device[ndevice+1];
\r
249 EXTERN PLANETS nulplanet; // zeroed planet structure
\r
252 kpower[21], // enemy energy levels
\r
253 kdist[21], // enemy distances
\r
254 kavgd[21], // average distances
\r
255 damage[ndevice+1], // damage encountered
\r
256 future[NEVENTS+1]; // future events
\r
258 EXTERN int iscore, iskill; // Common PLAQ
\r
259 EXTERN double perdate;
\r
261 typedef enum {FWON, FDEPLETE, FLIFESUP, FNRG, FBATTLE,
\r
262 FNEG3, FNOVA, FSNOVAED, FABANDN, FDILITHIUM,
\r
263 FMATERIALIZE, FPHASER, FLOST, FMINING, FDPLANET,
\r
264 FPNOVA, FSSC, FSTRACTOR, FDRAY, FTRIBBLE,
\r
268 EXTERN double aaitem;
\r
269 EXTERN char citem[10];
\r
272 /* Define devices */
\r
286 #define DDRAY 14 // Added deathray
\r
287 #define DDSP 15 // Added deep space probe
\r
289 /* Define future events */
\r
290 #define FSPY 0 // Spy event happens always (no future[] entry)
\r
291 // can cause SC to tractor beam Enterprise
\r
292 #define FSNOVA 1 // Supernova
\r
293 #define FTBEAM 2 // Commander tractor beams Enterprise
\r
294 #define FSNAP 3 // Snapshot for time warp
\r
295 #define FBATTAK 4 // Commander attacks base
\r
296 #define FCDBAS 5 // Commander destroys base
\r
297 #define FSCMOVE 6 // Supercommander moves (might attack base)
\r
298 #define FSCDBAS 7 // Supercommander destroys base
\r
299 #define FDSPROB 8 // Move deep space probe
\r
302 PLANETS nulplanet = {0};
\r
303 char *device[ndevice+1] = {
\r
332 #define IHBLANK ' '
\r
334 #define IHQUEST '?'
\r
339 #define IHGREEN 'G'
\r
340 #define IHYELLOW 'Y'
\r
342 #define IHDOCKED 'D'
\r
345 /* Function prototypes */
\r
354 void phasers(void);
\r
369 void finish(FINTYPE);
\r
377 #define IHALPHA (1)
\r
382 void prout(char *s);
\r
383 void proutn(char *s);
\r
389 void cramlc(int, int, int);
\r
390 double expran(double);
\r
392 void iran8(int *, int *);
\r
393 void iran10(int *, int *);
\r
394 double square(double);
\r
395 void dropin(int, int*, int*);
\r
399 void ram(int, int, int, int);
\r
400 void crmena(int, int, int, int, int);
\r
401 void deadkl(int, int, int, int, int);
\r
404 void torpedo(double, double, int, int, double *);
\r
405 void cramf(double, int, int);
\r
406 void crami(int, int);
\r
409 void nova(int, int);
\r
410 void snova(int, int);
\r
412 void hittem(double *);
\r
413 void prouts(char *);
\r
415 void preport(void);
\r
420 void usecrystals(void);
\r
421 void shuttle(void);
\r
422 void deathray(void);
\r
423 void debugme(void);
\r
424 void attakreport(void);
\r
425 void movetho(void);
\r