4 static void getcd(int, int);
\r
7 double angle, deltax, deltay, bigger, x, y,
\r
8 finald, finalx, finaly, stopegy, probf;
\r
9 int trbeam = 0, n, l, ix=0, iy=0, kink, kinks, iquad;
\r
12 prout("Helmsman Sulu- \"Leaving standard orbit.\"");
\r
16 angle = ((15.0 - direc) * 0.5235988);
\r
17 deltax = -sin(angle);
\r
18 deltay = cos(angle);
\r
19 if (fabs(deltax) > fabs(deltay))
\r
20 bigger = fabs(deltax);
\r
22 bigger = fabs(deltay);
\r
27 /* If tractor beam is to occur, don't move full distance */
\r
28 if (game.state.date+Time >= game.future[FTBEAM]) {
\r
31 dist = dist*(game.future[FTBEAM]-game.state.date)/Time + 0.1;
\r
32 Time = game.future[FTBEAM] - game.state.date + 1e-5;
\r
34 /* Move within the quadrant */
\r
35 game.quad[sectx][secty] = IHDOT;
\r
38 n = 10.0*dist*bigger+0.5;
\r
41 for (l = 1; l <= n; l++) {
\r
42 ix = (x += deltax) + 0.5;
\r
43 iy = (y += deltay) + 0.5;
\r
44 if (ix < 1 || ix > 10 || iy < 1 || iy > 10) {
\r
45 /* Leaving quadrant -- allow final enemy attack */
\r
46 /* Don't do it if being pushed by Nova */
\r
47 if (nenhere != 0 && iattak != 2) {
\r
49 for (l = 1; l <= nenhere; l++) {
\r
50 finald = sqrt((ix-game.kx[l])*(double)(ix-game.kx[l]) +
\r
51 (iy-game.ky[l])*(double)(iy-game.ky[l]));
\r
52 game.kavgd[l] = 0.5 * (finald+game.kdist[l]);
\r
54 if (game.state.galaxy[quadx][quady] != 1000) attack(0);
\r
55 if (alldone) return;
\r
57 /* compute final position -- new quadrant and sector */
\r
58 x = 10*(quadx-1)+sectx;
\r
59 y = 10*(quady-1)+secty;
\r
60 ix = x+10.0*dist*bigger*deltax+0.5;
\r
61 iy = y+10.0*dist*bigger*deltay+0.5;
\r
62 /* check for edge of galaxy */
\r
82 if (kink) kinks = 1;
\r
88 /* Three strikes -- you're out! */
\r
92 prout("\nYOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER\n"
\r
93 "AT THE EDGE OF THE GALAXY. THE THIRD TIME YOU TRY THIS,\n"
\r
94 "YOU WILL BE DESTROYED.\n");
\r
96 /* Compute final position in new quadrant */
\r
97 if (trbeam) return; /* Don't bother if we are to be beamed */
\r
100 sectx = ix - 10*(quadx-1);
\r
101 secty = iy - 10*(quady-1);
\r
102 proutn("\n\rEntering %s.",
\r
103 cramlc(quadrant, quadx, quady));
\r
104 game.quad[sectx][secty] = ship;
\r
106 if (skill>1) attack(0);
\r
109 iquad = game.quad[ix][iy];
\r
110 if (iquad != IHDOT) {
\r
111 /* object encountered in flight path */
\r
112 stopegy = 50.0*dist/Time;
\r
113 dist=0.1*sqrt((sectx-ix)*(double)(sectx-ix) +
\r
114 (secty-iy)*(double)(secty-iy));
\r
116 case IHT: /* Ram a Tholian */
\r
117 case IHK: /* Ram enemy ship */
\r
124 ram(0, iquad, sectx, secty);
\r
130 prouts("***RED ALERT! RED ALERT!");
\r
134 proutn(" pulled into black hole at ");
\r
135 prout(cramlc(sector, ix, iy));
\r
137 * Getting pulled into a black
\r
138 * hole was certain death in
\r
139 * Almy's original. Stas
\r
140 * Sergeev added a possibility
\r
141 * that you'll get timewarped
\r
145 for (l=1;l<=NDEVICES+1;l++)
\r
146 if (game.damage[l]>0) n++;
\r
147 probf=pow(1.4,(energy+shield)/5000.0-1.0)*
\r
148 pow(1.3,1.0/(n+1)-1.0);
\r
155 /* something else */
\r
158 if (iquad == IHWEB)
\r
159 proutn(" encounters Tholian web at ");
\r
161 proutn(" blocked by object at ");
\r
162 proutn(cramlc(sector, ix,iy));
\r
164 proutn("Emergency stop required ");
\r
165 prout("%2d units of energy.", (int)stopegy);
\r
167 finalx = x-deltax+0.5;
\r
169 finaly = y-deltay+0.5;
\r
177 goto label100; /* sorry! */
\r
180 dist = 0.1*sqrt((sectx-ix)*(double)(sectx-ix) +
\r
181 (secty-iy)*(double)(secty-iy));
\r
188 /* No quadrant change -- compute new avg enemy distances */
\r
189 game.quad[sectx][secty] = ship;
\r
191 for (l = 1; l <= nenhere; l++) {
\r
192 finald = sqrt((ix-game.kx[l])*(double)(ix-game.kx[l]) +
\r
193 (iy-game.ky[l])*(double)(iy-game.ky[l]));
\r
194 game.kavgd[l] = 0.5 * (finald+game.kdist[l]);
\r
195 game.kdist[l] = finald;
\r
198 if (game.state.galaxy[quadx][quady] != 1000 && iattak == 0)
\r
200 for (l = 1 ; l <= nenhere; l++) game.kavgd[l] = game.kdist[l];
\r
206 #endif /* SERGEEV */
\r
212 if (condit == IHDOCKED && l) {
\r
213 prout("Already docked.");
\r
217 prout("You must first leave standard orbit.");
\r
220 if (basex==0 || abs(sectx-basex) > 1 || abs(secty-basey) > 1) {
\r
222 prout(" not adjacent to base.");
\r
226 if (l) prout("Docked.");
\r
228 if (energy < inenrg) energy = inenrg;
\r
232 if (stdamtim != 1e30 &&
\r
233 (game.future[FCDBAS] < 1e30 || isatb == 1) && iseenit == 0) {
\r
234 /* get attack report from base */
\r
235 prout("Lt. Uhura- \"Captain, an important message from the starbase:\"");
\r
241 static void getcd(int isprobe, int akey) {
\r
242 /* This program originally required input in terms of a (clock)
\r
243 direction and distance. Somewhere in history, it was changed to
\r
244 cartesian coordinates. So we need to convert. I think
\r
245 "manual" input should still be done this way -- it's a real
\r
246 pain if the computer isn't working! Manual mode is still confusing
\r
247 because it involves giving x and y motions, yet the coordinates
\r
248 are always displayed y - x, where +y is downward! */
\r
251 int irowq=quadx, icolq=quady, irows, icols, itemp=0, iprompt=0, key=0;
\r
252 double xi, xj, xk, xl;
\r
253 double deltax, deltay;
\r
254 int automatic = -1;
\r
256 /* Get course direction and distance. If user types bad values, return
\r
257 with DIREC = -1.0. */
\r
261 if (landed == 1 && !isprobe) {
\r
262 prout("Dummy! You can't leave standard orbit until you");
\r
263 proutn("are back abourt the ");
\r
269 while (automatic == -1) {
\r
270 if (game.damage[DCOMPTR]) {
\r
272 prout("Computer damaged; manual navigation only");
\r
274 prout("Computer damaged; manual movement only");
\r
280 if (isprobe && akey != -1) {
\r
281 /* For probe launch, use pre-scaned value first time */
\r
288 if (key == IHEOL) {
\r
289 proutn("Manual or automatic- ");
\r
293 else if (key == IHALPHA) {
\r
294 if (isit("manual")) {
\r
299 else if (isit("automatic")) {
\r
310 else { /* numeric */
\r
312 prout("(Manual navigation assumed.)");
\r
314 prout("(Manual movement assumed.)");
\r
321 while (key == IHEOL) {
\r
323 proutn("Target quadrant or quadrant§or- ");
\r
325 proutn("Destination sector or quadrant§or- ");
\r
331 if (key != IHREAL) {
\r
337 if (key != IHREAL){
\r
343 if (key == IHREAL) {
\r
344 /* both quadrant and sector specified */
\r
347 if (key != IHREAL) {
\r
360 /* only quadrant specified -- go to center of dest quad */
\r
371 if (irowq<1 || irowq > 8 || icolq<1 || icolq > 8 ||
\r
372 irows<1 || irows > 10 || icols<1 || icols > 10) {
\r
380 proutn("Helmsman Sulu- \"Course locked in for %s.\"",
\r
381 cramlc(sector, irows, icols));
\r
384 else prout("Ensign Chekov- \"Course laid in, Captain.\"");
\r
386 deltax = icolq - quady + 0.1*(icols-secty);
\r
387 deltay = quadx - irowq + 0.1*(sectx-irows);
\r
389 else { /* manual */
\r
390 while (key == IHEOL) {
\r
391 proutn("X and Y displacements- ");
\r
397 if (key != IHREAL) {
\r
403 if (key != IHREAL) {
\r
409 /* Check for zero movement */
\r
410 if (deltax == 0 && deltay == 0) {
\r
414 if (itemp == 2 && !isprobe) {
\r
416 prout("Helmsman Sulu- \"Aye, Sir.\"");
\r
418 dist = sqrt(deltax*deltax + deltay*deltay);
\r
419 direc = atan2(deltax, deltay)*1.90985932;
\r
420 if (direc < 0.0) direc += 12.0;
\r
428 void impuls(void) {
\r
432 if (game.damage[DIMPULS]) {
\r
435 prout("Engineer Scott- \"The impulse engines are damaged, Sir.\"");
\r
439 if (energy > 30.0) {
\r
441 if (direc == -1.0) return;
\r
442 power = 20.0 + 100.0*dist;
\r
447 if (power >= energy) {
\r
448 /* Insufficient power for trip */
\r
450 prout("First Officer Spock- \"Captain, the impulse engines");
\r
451 prout("require 20.0 units to engage, plus 100.0 units per");
\r
453 proutn("quadrant. We can go, therefore, a maximum of %d",
\r
454 (int)(0.01 * (energy-20.0)-0.05));
\r
455 prout(" quadrants.\"");
\r
458 prout("quadrant. They are, therefore, useless.\"");
\r
463 /* Make sure enough time is left for the trip */
\r
465 if (Time >= game.state.remtime) {
\r
466 prout("First Officer Spock- \"Captain, our speed under impulse");
\r
467 prout("power is only 0.95 sectors per stardate. Are you sure");
\r
468 proutn("we dare spend the time?\" ");
\r
469 if (ja() == 0) return;
\r
471 /* Activate impulse engines and pay the cost */
\r
474 if (alldone) return;
\r
475 power = 20.0 + 100.0*dist;
\r
478 if (energy <= 0) finish(FNRG);
\r
484 int blooey=0, twarp=0, iwarp;
\r
487 if (i!=2) { /* Not WARPX entry */
\r
489 if (game.damage[DWARPEN] > 10.0) {
\r
492 prout("Engineer Scott- \"The impulse engines are damaged, Sir.\"");
\r
495 if (game.damage[DWARPEN] > 0.0 && warpfac > 4.0) {
\r
498 prout("Engineer Scott- \"Sorry, Captain. Until this damage");
\r
499 prout(" is repaired, I can only give you warp 4.\"");
\r
503 /* Read in course and distance */
\r
505 if (direc == -1.0) return;
\r
507 /* Make sure starship has enough energy for the trip */
\r
508 power = (dist+0.05)*warpfac*warpfac*warpfac*(shldup+1);
\r
511 if (power >= energy) {
\r
512 /* Insufficient power for trip */
\r
515 prout("Engineering to bridge--");
\r
516 if (shldup==0 || 0.5*power > energy) {
\r
517 iwarp = pow((energy/(dist+0.05)), 0.333333333);
\r
519 prout("We can't do it, Captain. We haven't the energy.");
\r
522 proutn("We haven't the energy, but we could do it at warp %d", iwarp);
\r
525 prout("if you'll lower the shields.");
\r
532 prout("We haven't the energy to go that far with the shields up.");
\r
536 /* Make sure enough time is left for the trip */
\r
537 Time = 10.0*dist/wfacsq;
\r
538 if (Time >= 0.8*game.state.remtime) {
\r
540 prout("First Officer Spock- \"Captain, I compute that such");
\r
541 proutn(" a trip would require approximately %2.0f",
\r
542 100.0*Time/game.state.remtime);
\r
543 prout(" percent of our");
\r
544 proutn(" remaining time. Are you sure this is wise?\" ");
\r
545 if (ja() == 0) { ididit = 0; Time=0; return;}
\r
549 if (warpfac > 6.0) {
\r
550 /* Decide if engine damage will occur */
\r
551 double prob = dist*(6.0-warpfac)*(6.0-warpfac)/66.666666666;
\r
552 if (prob > Rand()) {
\r
554 dist = Rand()*dist;
\r
556 /* Decide if time warp will occur */
\r
557 if (0.5*dist*pow(7.0,warpfac-10.0) > Rand()) twarp=1;
\r
559 if (idebug &&warpfac==10 && twarp==0) {
\r
561 proutn("Force time warp? ");
\r
562 if (ja()==1) twarp=1;
\r
565 if (blooey || twarp) {
\r
566 /* If time warp or engine damage, check path */
\r
567 /* If it is obstructed, don't do warp or damage */
\r
568 double angle = ((15.0-direc)*0.5235998);
\r
569 double deltax = -sin(angle);
\r
570 double deltay = cos(angle);
\r
571 double bigger, x, y;
\r
573 if (fabs(deltax) > fabs(deltay))
\r
574 bigger = fabs(deltax);
\r
576 bigger = fabs(deltay);
\r
580 n = 10.0 * dist * bigger +0.5;
\r
583 for (l = 1; l <= n; l++) {
\r
586 if (ix < 1 || ix > 10) break;
\r
589 if (iy < 1 || iy > 10) break;
\r
590 if (game.quad[ix][iy] != IHDOT) {
\r
599 /* Activate Warp Engines and pay the cost */
\r
601 if (alldone) return;
\r
602 energy -= dist*warpfac*warpfac*warpfac*(shldup+1);
\r
603 if (energy <= 0) finish(FNRG);
\r
604 Time = 10.0*dist/wfacsq;
\r
605 if (twarp) timwrp();
\r
607 game.damage[DWARPEN] = damfac*(3.0*Rand()+1.0);
\r
609 prout("Engineering to bridge--");
\r
610 prout(" Scott here. The warp engines are damaged.");
\r
611 prout(" We'll have to reduce speed to warp 4.");
\r
619 void setwrp(void) {
\r
623 while ((key=scan()) == IHEOL) {
\r
625 proutn("Warp factor- ");
\r
628 if (key != IHREAL) {
\r
632 if (game.damage[DWARPEN] > 10.0) {
\r
633 prout("Warp engines inoperative.");
\r
636 if (game.damage[DWARPEN] > 0.0 && aaitem > 4.0) {
\r
637 prout("Engineer Scott- \"I'm doing my best, Captain,\n"
\r
638 " but right now we can only go warp 4.\"");
\r
641 if (aaitem > 10.0) {
\r
642 prout("Helmsman Sulu- \"Our top speed is warp 10, Captain.\"");
\r
645 if (aaitem < 1.0) {
\r
646 prout("Helmsman Sulu- \"We can't go below warp 1, Captain.\"");
\r
651 wfacsq=warpfac*warpfac;
\r
652 if (warpfac <= oldfac || warpfac <= 6.0) {
\r
653 proutn("Helmsman Sulu- \"Warp factor %d, Captain.\"",
\r
657 if (warpfac < 8.00) {
\r
658 prout("Engineer Scott- \"Aye, but our maximum safe speed is warp 6.\"");
\r
661 if (warpfac == 10.0) {
\r
662 prout("Engineer Scott- \"Aye, Captain, we'll try it.\"");
\r
665 prout("Engineer Scott- \"Aye, Captain, but our engines may not take it.\"");
\r
669 void atover(int igrab) {
\r
670 double power, distreq;
\r
673 /* is captain on planet? */
\r
675 if (game.damage[DTRANSP]) {
\r
679 prout("Scotty rushes to the transporter controls.");
\r
681 prout("But with the shields up it's hopeless.");
\r
684 prouts("His desperate attempt to rescue you . . .");
\r
685 if (Rand() <= 0.5) {
\r
690 prout("SUCCEEDS!");
\r
693 proutn("The crystals mined were ");
\r
694 if (Rand() <= 0.25) {
\r
705 /* Check to see if captain in shuttle craft */
\r
706 if (icraft) finish(FSTRACTOR);
\r
707 if (alldone) return;
\r
709 /* Inform captain of attempt to reach safety */
\r
713 prouts("***RED ALERT! READ ALERT!");
\r
717 prout(" has stopped in a quadrant containing");
\r
718 prouts(" a supernova.");
\r
721 proutn("***Emergency automatic override attempts to hurl ");
\r
724 prout("safely out of quadrant.");
\r
725 game.starch[quadx][quady] = game.damage[DRADIO] > 0.0 ? game.state.galaxy[quadx][quady]+1000:1;
\r
727 /* Try to use warp engines */
\r
728 if (game.damage[DWARPEN]) {
\r
730 prout("Warp engines damaged.");
\r
734 warpfac = 6.0+2.0*Rand();
\r
735 wfacsq = warpfac * warpfac;
\r
736 prout("Warp factor set to %d", (int)warpfac);
\r
737 power = 0.75*energy;
\r
738 dist = power/(warpfac*warpfac*warpfac*(shldup+1));
\r
739 distreq = 1.4142+Rand();
\r
740 if (distreq < dist) dist = distreq;
\r
741 Time = 10.0*dist/wfacsq;
\r
742 direc = 12.0*Rand(); /* How dumb! */
\r
747 /* This is bad news, we didn't leave quadrant. */
\r
748 if (alldone) return;
\r
750 prout("Insufficient energy to leave quadrant.");
\r
754 /* Repeat if another snova */
\r
755 } while (game.state.galaxy[quadx][quady] == 1000);
\r
756 if (game.state.remkl==0) finish(FWON); /* Snova killed remaining enemy. */
\r
761 prout("***TIME WARP ENTERED.");
\r
762 if (game.state.snap && Rand() < 0.5) {
\r
763 /* Go back in time */
\r
764 prout("You are traveling backwards in time %d stardates.",
\r
765 (int)(game.state.date-game.snapsht.date));
\r
766 game.state = game.snapsht;
\r
767 game.state.snap = 0;
\r
768 if (game.state.remcom) {
\r
769 game.future[FTBEAM] = game.state.date + expran(intime/game.state.remcom);
\r
770 game.future[FBATTAK] = game.state.date + expran(0.3*intime);
\r
772 game.future[FSNOVA] = game.state.date + expran(0.5*intime);
\r
773 game.future[FSNAP] = game.state.date +expran(0.25*game.state.remtime); /* next snapshot will
\r
775 if (game.state.nscrem) game.future[FSCMOVE] = 0.2777;
\r
777 game.future[FCDBAS] = game.future[FSCDBAS] = 1e30;
\r
780 /* Make sure Galileo is consistant -- Snapshot may have been taken
\r
781 when on planet, which would give us two Galileos! */
\r
783 for (l = 0; l < inplan; l++) {
\r
784 if (game.state.plnets[l].known == shuttle_down) {
\r
786 if (iscraft==1 && ship==IHE) {
\r
787 prout("Checkov- \"Security reports the Galileo has disappeared, Sir!");
\r
792 /* Likewise, if in the original time the Galileo was abandoned, but
\r
793 was on ship earlier, it would have vanished -- lets restore it */
\r
794 if (iscraft==0 && gotit==0 && game.damage[DSHUTTL] >= 0.0) {
\r
795 prout("Checkov- \"Security reports the Galileo has reappeared in the dock!\"");
\r
799 /* Revert star chart to earlier era, if it was known then*/
\r
800 if (game.damage[DRADIO]==0.0 || stdamtim > game.state.date) {
\r
801 for (l = 1; l <= 8; l++)
\r
802 for (ll = 1; ll <= 8; ll++)
\r
803 if (game.starch[l][ll] > 1)
\r
804 game.starch[l][ll]=game.damage[DRADIO]>0.0 ? game.state.galaxy[l][ll]+1000 :1;
\r
805 prout("Spock has reconstructed a correct star chart from memory");
\r
806 if (game.damage[DRADIO] > 0.0) stdamtim = game.state.date;
\r
810 /* Go forward in time */
\r
811 Time = -0.5*intime*log(Rand());
\r
812 prout("You are traveling forward in time %d stardates.", (int)Time);
\r
813 /* cheat to make sure no tractor beams occur during time warp */
\r
814 game.future[FTBEAM] += Time;
\r
815 game.damage[DRADIO] += Time;
\r
820 #endif /* SERGEEV */
\r
824 double angle, bigger;
\r
826 /* New code to launch a deep space probe */
\r
827 if (nprobes == 0) {
\r
831 prout("Engineer Scott- \"We have no more deep space probes, Sir.\"");
\r
833 prout("Ye Faerie Queene has no deep space probes.");
\r
836 if (game.damage[DDSP] != 0.0) {
\r
839 prout("Engineer Scott- \"The probe launcher is damaged, Sir.\"");
\r
842 if (game.future[FDSPROB] != 1e30) {
\r
845 if (game.damage[DRADIO] != 0 && condit != IHDOCKED) {
\r
846 prout("Spock- \"Records show the previous probe has not yet");
\r
847 prout(" reached its destination.\"");
\r
850 prout("Uhura- \"The previous probe is still reporting data, Sir.\"");
\r
855 if (key == IHEOL) {
\r
856 /* slow mode, so let Kirk know how many probes there are left */
\r
857 prout(nprobes==1 ? "%d probe left." : "%d probes left.", nprobes);
\r
858 proutn("Are you sure you want to fire a probe? ");
\r
859 if (ja()==0) return;
\r
863 if (key == IHALPHA && strcmp(citem,"armed") == 0) {
\r
867 else if (key == IHEOL) {
\r
868 proutn("Arm NOVAMAX warhead? ");
\r
872 if (direc == -1.0) return;
\r
874 angle = ((15.0 - direc) * 0.5235988);
\r
875 probeinx = -sin(angle);
\r
876 probeiny = cos(angle);
\r
877 if (fabs(probeinx) > fabs(probeiny))
\r
878 bigger = fabs(probeinx);
\r
880 bigger = fabs(probeiny);
\r
882 probeiny /= bigger;
\r
883 probeinx /= bigger;
\r
884 proben = 10.0*dist*bigger +0.5;
\r
885 probex = quadx*10 + sectx - 1; // We will use better packing than original
\r
886 probey = quady*10 + secty - 1;
\r
889 game.future[FDSPROB] = game.state.date + 0.01; // Time to move one sector
\r
890 prout("Ensign Chekov- \"The deep space probe is launched, Captain.\"");
\r
896 /* There's more than one way to move in this game! */
\r
897 double ddist, xdist, probf;
\r
898 int line = 0, l, ix, iy;
\r
901 #endif /* SERGEEV */
\r
904 /* Test for conditions which prevent calling for help */
\r
905 if (condit == IHDOCKED) {
\r
906 prout("Lt. Uhura- \"But Captain, we're already docked.\"");
\r
909 if (game.damage[DRADIO] != 0) {
\r
910 prout("Subspace radio damaged.");
\r
913 if (game.state.rembase==0) {
\r
914 prout("Lt. Uhura- \"Captain, I'm not getting any response from Starbase.\"");
\r
918 proutn("You must be aboard the ");
\r
923 /* OK -- call for help from nearest starbase */
\r
926 /* There's one in this quadrant */
\r
927 ddist = sqrt(square(basex-sectx)+square(basey-secty));
\r
931 for (l = 1; l <= game.state.rembase; l++) {
\r
932 xdist=10.0*sqrt(square(game.state.baseqx[l]-quadx)+square(game.state.baseqy[l]-quady));
\r
933 if (xdist < ddist) {
\r
938 /* Since starbase not in quadrant, set up new quadrant */
\r
939 quadx = game.state.baseqx[line];
\r
940 quady = game.state.baseqy[line];
\r
943 /* dematerialize starship */
\r
944 game.quad[sectx][secty]=IHDOT;
\r
945 proutn("Starbase in %s responds--", cramlc(quadrant, quadx, quady));
\r
948 prout(" dematerializes.");
\r
951 for (l = 1; l <= 5; l++) {
\r
952 ix = basex+3.0*Rand()-1;
\r
953 iy = basey+3.0*Rand()-1;
\r
954 if (ix>=1 && ix<=10 && iy>=1 && iy<=10 && game.quad[ix][iy]==IHDOT) {
\r
955 /* found one -- finish up */
\r
958 game.quad[ix][iy]=IHMATER0;
\r
963 prout("You have been lost in space...");
\r
964 finish(FMATERIALIZE);
\r
967 #endif /* SERGEEV */
\r
968 /* Give starbase three chances to rematerialize starship */
\r
969 probf = pow((1.0 - pow(0.98,ddist)), 0.33333333);
\r
970 for (l = 1; l <= 3; l++) {
\r
972 case 1: proutn("1st"); break;
\r
973 case 2: proutn("2nd"); break;
\r
974 case 3: proutn("3rd"); break;
\r
976 proutn(" attempt to re-materialize ");
\r
978 prouts(" . . . . . ");
\r
979 if (Rand() > probf) break;
\r
983 finish(FMATERIALIZE);
\r
986 /* Rematerialization attempt should succeed if can get adj to base */
\r
987 for (l = 1; l <= 5; l++) {
\r
988 ix = basex+3.0*Rand()-1;
\r
989 iy = basey+3.0*Rand()-1;
\r
990 if (ix>=1 && ix<=10 && iy>=1 && iy<=10 && game.quad[ix][iy]==IHDOT) {
\r
991 /* found one -- finish up */
\r
992 prout("succeeds.");
\r
995 game.quad[ix][iy]=ship;
\r
998 prout("Lt. Uhura- \"Captain, we made it!\"");
\r
1002 finish(FMATERIALIZE);
\r