3 static char classes[4][2]={"","M","N","O"};
\r
6 static int consumeTime(void) {
\r
7 /* I think most of this avoidance was caused by overlay scheme.
\r
8 Let's see what happens if all events can occur here */
\r
13 /* Don't wory about this */
\r
14 if (future[FTBEAM] <= state.date+Time && state.remcom != 0 && condit != IHDOCKED) {
\r
15 /* We are about to be tractor beamed -- operation fails */
\r
19 // asave = future[FSNOVA];
\r
20 // future[FSNOVA] = 1e30; /* defer supernovas */
\r
21 events(); /* Used to avoid if future[FSCMOVE] within time */
\r
22 // future[FSNOVA] = asave;
\r
23 /*fails if game over, quadrant super-novas or we've moved to new quadrant*/
\r
24 if (alldone || state.galaxy[quadx][quady] == 1000 || justin != 0) return 1;
\r
28 void preport(void) {
\r
32 prout("Spock- \"Planet report follows, Captain.\"");
\r
34 for (i = 1; i <= inplan; i++) {
\r
35 if (state.plnets[i].known
\r
37 || ( idebug && state.plnets[i].x !=0)
\r
42 if (idebug && state.plnets[i].known==0) proutn("(Unknown) ");
\r
44 cramlc(1, state.plnets[i].x, state.plnets[i].y);
\r
46 proutn(classes[state.plnets[i].pclass]);
\r
48 if (state.plnets[i].crystals == 0) proutn("no ");
\r
49 prout("dilithium crystals present.");
\r
50 if (state.plnets[i].known==2)
\r
51 prout(" Shuttle Craft Galileo on surface.");
\r
54 if (iknow==0) prout("No information available.");
\r
64 prout("Already in standard orbit.");
\r
67 if (damage[DWARPEN] != 0 && damage[DIMPULS] != 0) {
\r
68 prout("Both warp and impulse engines damaged.");
\r
71 if (plnetx == 0 || abs(sectx-plnetx) > 1 || abs(secty-plnety) > 1) {
\r
73 prout(" not adjacient to planet.\n");
\r
76 Time = 0.02+0.03*Rand();
\r
77 prout("Helmsman Sulu- \"Entering standard orbit, Sir.\"");
\r
79 if (consumeTime()) return;
\r
80 proutn("Sulu- \"Entered orbit at altitude ");
\r
81 cramf(height = (1400.+7200.*Rand()), 0, 2);
\r
82 prout(" kilometers.\"");
\r
90 if (damage[DSRSENS] != 0.0) {
\r
91 prout("Short range sensors damaged.");
\r
95 prout("No planet in this quadrant.");
\r
98 proutn("Spock- \"Sensor scan for");
\r
99 cramlc(1, quadx, quady);
\r
102 proutn(" Planet at");
\r
103 cramlc(2, plnetx, plnety);
\r
104 proutn(" is of class ");
\r
105 proutn(classes[state.plnets[iplnet].pclass]);
\r
107 if (state.plnets[iplnet].known==2)
\r
108 prout(" Sensors show Galileo still on surface.");
\r
109 proutn(" Readings indicate");
\r
110 if (state.plnets[iplnet].crystals == 0) proutn(" no");
\r
111 prout(" dilithium crystals present.\"");
\r
112 if (state.plnets[iplnet].known == 0) state.plnets[iplnet].known = 1;
\r
119 if (damage[DTRANSP] != 0) {
\r
120 prout("Transporter damaged.");
\r
121 if (damage[DSHUTTL]==0 && (state.plnets[iplnet].known==2 || iscraft == 1)) {
\r
123 prout("Spock- \"May I suggest the shuttle craft, Sir?\" ");
\r
124 if (ja() != 0) shuttle();
\r
130 prout(" not in standard orbit.");
\r
134 prout("Impossible to transport through shields.");
\r
137 if (state.plnets[iplnet].known==0) {
\r
138 prout("Spock- \"Captain, we have no information on this planet");
\r
139 prout(" and Starfleet Regulations clearly state that in this situation");
\r
140 prout(" you may not go down.\"");
\r
144 /* Coming from planet */
\r
145 if (state.plnets[iplnet].known==2) {
\r
146 proutn("Spock- \"Wouldn't you rather take the Galileo?\" ");
\r
151 prout("Your crew hides the Galileo to prevent capture by aliens.");
\r
153 prout("Landing party assembled, ready to beam up.");
\r
155 prout("Kirk whips out communicator...");
\r
156 prouts("BEEP BEEP BEEP");
\r
158 prout("\"Kirk to enterprise- Lock on coordinates...energize.\"");
\r
161 /* Going to planet */
\r
162 if (state.plnets[iplnet].crystals==0) {
\r
163 prout("Spock- \"Captain, I fail to see the logic in");
\r
164 prout(" exploring a planet with no dilithium crystals.");
\r
165 proutn(" Are you sure this is wise?\" ");
\r
171 prout("Scotty- \"Transporter room ready, Sir.\"");
\r
173 prout("Kirk, and landing party prepare to beam down to planet surface.");
\r
175 prout("Kirk- \"Energize.\"");
\r
178 prouts("WWHOOOIIIIIRRRRREEEE.E.E. . . . . . .");
\r
180 if (Rand() > 0.98) {
\r
181 prouts("BOOOIIIOOOIIOOOOIIIOIING . . .");
\r
183 prout("Scotty- \"Oh my God! I've lost them.\"");
\r
187 prouts(". . . . . . .E.E.EEEERRRRRIIIIIOOOHWW");
\r
189 prout("Transport complete.");
\r
191 if (landed==1 && state.plnets[iplnet].known==2) {
\r
192 prout("The shuttle craft Galileo is here!");
\r
194 if (landed!=1 && imine==1) {
\r
208 prout("Mining party not on planet.");
\r
211 if (state.plnets[iplnet].crystals == 0) {
\r
212 prout("No dilithium crystals on this planet.");
\r
216 prout("You've already mined enough crystals for this trip.");
\r
219 if (icrystl == 1 && cryprob == 0.05) {
\r
220 proutn("With all those fresh crystals aboard the ");
\r
223 prout("there's no reason to mine more at this time.");
\r
226 Time = (0.1+0.2*Rand())*state.plnets[iplnet].pclass;
\r
227 if (consumeTime()) return;
\r
228 prout("Mining operation complete.");
\r
233 void usecrystals(void) {
\r
238 prout("No dilithium crystals available.");
\r
241 if (energy >= 1000) {
\r
242 prout("Spock- \"Captain, Starfleet Regulations prohibit such an operation");
\r
243 prout(" except when condition Yellow exists.");
\r
246 prout("Spock- \"Captain, I must warn you that loading");
\r
247 prout(" raw dilithium crystals into the ship's power");
\r
248 prout(" system may risk a severe explosion.");
\r
249 proutn(" Are you sure this is wise?\" ");
\r
255 prout("Engineering Officer Scott- \"(GULP) Aye Sir.");
\r
256 prout(" Mr. Spock and I will try it.\"");
\r
258 prout("Spock- \"Crystals in place, Sir.");
\r
259 prout(" Ready to activate circuit.\"");
\r
261 prouts("Scotty- \"Keep your fingers crossed, Sir!\"");
\r
263 if (Rand() <= cryprob) {
\r
264 prouts(" \"Activating now! - - No good! It's***");
\r
266 prouts("***RED ALERT! RED A*L********************************");
\r
269 prouts("****************** KA-BOOM!!!! *******************");
\r
274 energy += 5000.0*(1.0 + 0.9*Rand());
\r
275 prouts(" \"Activating now! - - ");
\r
276 prout("The instruments");
\r
277 prout(" are going crazy, but I think it's");
\r
278 prout(" going to work!! Congratulations, Sir!\"");
\r
283 void shuttle(void) {
\r
288 if(damage[DSHUTTL] != 0.0) {
\r
289 if (damage[DSHUTTL] == -1.0) {
\r
290 if (inorbit && state.plnets[iplnet].known == 2)
\r
291 prout("Ye Faerie Queene has no shuttle craft bay to dock it at.");
\r
293 prout("Ye Faerie Queene had no shuttle craft.");
\r
295 else if (damage[DSHUTTL] > 0)
\r
296 prout("The Galileo is damaged.");
\r
297 else prout("Shuttle craft is now serving Big Macs.");
\r
302 prout(" not in standard orbit.");
\r
305 if ((state.plnets[iplnet].known != 2) && iscraft != 1) {
\r
306 prout("Shuttle craft not currently available.");
\r
309 if (landed==-1 && state.plnets[iplnet].known==2) {
\r
310 prout("You will have to beam down to retrieve the shuttle craft.");
\r
313 if (shldup!=0 || condit == IHDOCKED) {
\r
314 prout("Shuttle craft cannot pass through shields.");
\r
317 if (state.plnets[iplnet].known==0) {
\r
318 prout("Spock- \"Captain, we have no information on this planet");
\r
319 prout(" and Starfleet Regulations clearly state that in this situation");
\r
320 prout(" you may not fly down.\"");
\r
323 Time = 3.0e-5*height;
\r
324 if (Time >= 0.8*state.remtime) {
\r
325 prout("First Officer Spock- \"Captain, I compute that such");
\r
326 prout(" a maneuver would require approximately ");
\r
327 cramf(100*Time/state.remtime,0,4);
\r
329 prout("remaining time.");
\r
330 prout("Are you sure this is wise?\" ");
\r
337 /* Kirk on planet */
\r
339 /* Galileo on ship! */
\r
340 if (damage[DTRANSP]==0) {
\r
341 proutn("Spock- \"Would you rather use the transporter?\" ");
\r
346 proutn("Shuttle crew");
\r
349 proutn("Rescue party");
\r
350 prout(" boards Galileo and swoops toward planet surface.");
\r
353 if (consumeTime()) return;
\r
354 state.plnets[iplnet].known=2;
\r
355 prout("Trip complete.");
\r
359 /* Ready to go back to ship */
\r
360 prout("You and your mining party board the");
\r
361 prout("shuttle craft for the trip back to the Enterprise.");
\r
363 prout("The short hop begins . . .");
\r
364 state.plnets[iplnet].known=1;
\r
368 if (consumeTime()) return;
\r
376 prout("Trip complete.");
\r
382 /* and so is Galileo */
\r
383 prout("Mining party assembles in the hangar deck,");
\r
384 prout("ready to board the shuttle craft \"Galileo\".");
\r
386 prouts("The hangar doors open; the trip begins.");
\r
390 if (consumeTime()) return;
\r
391 state.plnets[iplnet].known = 2;
\r
394 prout("Trip complete");
\r
400 void deathray(void) {
\r
407 prout("Ye Faerie Queene has no death ray.");
\r
411 prout("Sulu- \"But Sir, there are no enemies in this quadrant.\"");
\r
414 if (damage[DDRAY] > 0.0) {
\r
415 prout("Death Ray is damaged.");
\r
418 prout("Spock- \"Captain, the 'Experimental Death Ray'");
\r
419 prout(" is highly unpredictible. Considering the alternatives,");
\r
420 prout(" are you sure this is wise?\" ");
\r
421 if (ja()==0) return;
\r
422 prout("Spock- \"Acknowledged.\"");
\r
425 prouts("WHOOEE ... WHOOEE ... WHOOEE ... WHOOEE");
\r
427 prout("Crew scrambles in emergency preparation.");
\r
428 prout("Spock and Scotty ready the death ray and");
\r
429 prout("prepare to channel all ship's power to the device.");
\r
431 prout("Spock- \"Preparations complete, sir.\"");
\r
432 prout("Kirk- \"Engage!\"");
\r
434 prouts("WHIRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR");
\r
437 prouts("Sulu- \"Captain! It's working!\"");
\r
439 while (nenhere > 0)
\r
440 deadkl(kx[1],ky[1],quad[kx[1]][ky[1]],kx[1],ky[1]);
\r
441 prout("Ensign Chekov- \"Congratulations, Captain!\"");
\r
442 if (state.remkl == 0) finish(FWON);
\r
443 prout("Spock- \"Captain, I believe the `Experimental Death Ray'");
\r
444 if (Rand() <= 0.05) {
\r
445 prout(" is still operational.\"");
\r
448 prout(" has been rendered disfunctional.\"");
\r
449 damage[DDRAY] = 39.95;
\r
453 r = Rand(); // Pick failure method
\r
455 prouts("Sulu- \"Captain! It's working!\"");
\r
457 prouts("***RED ALERT! RED ALERT!");
\r
459 prout("***MATTER-ANTIMATTER IMPLOSION IMMINENT!");
\r
461 prouts("***RED ALERT! RED A*L********************************");
\r
464 prouts("****************** KA-BOOM!!!! *******************");
\r
470 prouts("Sulu- \"Captain! Yagabandaghangrapl, brachriigringlanbla!\"");
\r
472 prout("Lt. Uhura- \"Graaeek! Graaeek!\"");
\r
474 prout("Spock- \"Facinating! . . . All humans aboard");
\r
475 prout(" have apparently been transformed into strange mutations.");
\r
476 prout(" Vulcans do not seem to be affected.");
\r
478 prout("Kirk- \"Raauch! Raauch!\"");
\r
484 prouts("Sulu- \"Captain! It's --WHAT?!?!\"");
\r
486 proutn("Spock- \"I believe the word is");
\r
487 prouts(" *ASTONISHING*");
\r
488 prout(" Mr. Sulu.");
\r
489 for (i=1; i<=10; i++)
\r
490 for (j=1; j<=10; j++)
\r
491 if (quad[i][j] == IHDOT) quad[i][j] = IHQUEST;
\r
492 prout(" Captain, our quadrant is now infested with");
\r
493 prouts(" - - - - - - *THINGS*.");
\r
495 prout(" I have no logical explanation.\"");
\r
498 prouts("Sulu- \"Captain! The Death Ray is creating tribbles!\"");
\r
500 prout("Scotty- \"There are so many tribbles down here");
\r
501 prout(" in Engineering, we can't move for 'em, Captain.\"");
\r