8 #define c_printf proutn
11 void attakreport(int l) {
13 if (game.future[FCDBAS] < 1e30) {
14 prout("Starbase in %s is currently under Commander attack.",
15 cramlc(quadrant, batx, baty));
16 prout("It can hold out until Stardate %d.",
17 (int)game.future[FCDBAS]);
20 prout("Starbase in %s is under Super-commander attack.",
21 cramlc(quadrant, game.state.isx, game.state.isy));
22 prout("It can hold out until Stardate %d.",
23 (int)game.future[FSCDBAS]);
26 if (game.future[FCDBAS] < 1e30)
27 proutn("Base in %i - %i attacked by C. Alive until %.1f", batx, baty, game.future[FCDBAS]);
29 proutn("Base in %i - %i attacked by S. Alive until %.1f", game.state.isx, game.state.isy, game.future[FSCDBAS]);
41 s1 = (thawed?"thawed ":"");
43 case 1: s2="short"; break;
44 case 2: s2="medium"; break;
45 case 4: s2="long"; break;
46 default: s2="unknown length"; break;
49 case 1: s3="novice"; break;
50 case 2: s3="fair"; break;
51 case 3: s3="good"; break;
52 case 4: s3="expert"; break;
53 case 5: s3="emeritus"; break;
54 default: s3="skilled"; break;
57 prout("You %s playing a %s%s %s game.",
58 alldone? "were": "are now", s1, s2, s3);
59 if (skill>3 && thawed && !alldone) prout("No plaque is allowed.");
60 if (tourn) prout("This is tournament game %d.", tourn);
61 prout("Your secret password is \"%s\"",game.passwd);
62 proutn("%d of %d Klingons have been killed",
63 game.state.killk+game.state.killc+game.state.nsckill, inkling);
64 if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s");
65 else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders.");
67 if (skill > 2) prout("The Super Commander has %sbeen destroyed.",
68 game.state.nscrem?"not ":"");
69 if (game.state.rembase != inbase) {
71 if (inbase-game.state.rembase==1) proutn("has been 1 base");
73 proutn("have been %d bases", inbase-game.state.rembase);
75 prout(" destroyed, %d remaining.", game.state.rembase);
77 else prout("There are %d bases.", inbase);
78 if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) {
79 /* Don't report this if not seen and
80 either the radio is dead or not at base! */
84 if (casual) prout("%d casualt%s suffered so far.",
85 casual, casual==1? "y" : "ies");
86 if (nhelp) prout("There were %d call%s for help.",
87 nhelp, nhelp==1 ? "" : "s");
90 if (nprobes) proutn("%d", nprobes);
92 proutn(" deep space probe");
93 if (nprobes!=1) proutn("s");
96 if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&&
97 game.future[FDSPROB] != 1e30) {
99 proutn("An armed deep space probe is in");
101 proutn("A deep space probe is in");
102 proutn(cramlc(quadrant, probecx, probecy));
107 prout("Dilithium crystals aboard ship... not yet used.");
111 while (cryprob > ai) {
115 prout("Dilithium crystals have been used %d time%s.",
125 if (game.damage[DLRSENS] != 0.0) {
126 /* Now allow base's sensors if docked */
127 if (condit != IHDOCKED) {
128 prout("LONG-RANGE SENSORS DAMAGED.");
131 proutn("Starbase's long-range scan");
134 prout("Long-range scan");
136 for (x = quadx-1; x <= quadx+1; x++) {
138 for (y = quady-1; y <= quady+1; y++) {
139 if (x == 0 || x > 8 || y == 0 || y > 8)
142 if (game.state.galaxy[x][y]<1000) proutn(" %3d", game.state.galaxy[x][y]);
144 game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 : 1;
155 for (i = 1; i <= NDEVICES; i++) {
156 if (game.damage[i] > 0.0) {
158 prout("DEVICE -REPAIR TIMES-");
159 prout(" IN FLIGHT DOCKED");
162 prout(" %16s %8.2f %8.2f",
165 docfac*game.damage[i]+0.005);
168 if (!jdam) prout("All devices functional.");
175 if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) {
176 c_printf("Spock- \"I revised the Star Chart from the starbase's records.\"\n\r");
178 if (nn == 0) c_printf(" STAR CHART FOR THE KNOWN GALAXY\n\r");
179 if (stdamtim != 1e30) {
180 if (condit == IHDOCKED) {
181 /* We are docked, so restore chart from base information */
182 stdamtim = game.state.date;
183 for (i=1; i <= 8 ; i++)
184 for (j=1; j <= 8; j++)
185 if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000;
188 proutn("(Last surveillance update %d stardates ago.",
189 (int)(game.state.date-stdamtim));
193 prout(" 1 2 3 4 5 6 7 8");
194 for (i = 1; i <= 8; i++) {
196 for (j = 1; j <= 8; j++) {
199 if (game.starch[i][j] < 0)
201 else if (game.starch[i][j] == 0)
203 else if (game.starch[i][j] > 999)
204 if ((i==quadx)&&(j==quady)){
206 gotoxy(wherex()-1,wherey());
208 if (game.starch[i][i]<2000)
209 sprintf(buf, "%03d", game.starch[i][j]-1000);
214 if (game.starch[i][j]<2000)
215 sprintf(buf, "%03d", game.starch[i][j]-1000);
218 else if ((i==quadx)&&(j==quady)){
220 gotoxy(wherex()-1,wherey());
222 sprintf(buf, "%03d", game.state.galaxy[i][j]);
224 else if (game.state.galaxy[i][j]>=1000)
227 sprintf(buf, "%03d", game.state.galaxy[i][j]);
228 for (cp = buf; cp < buf + sizeof(buf); cp++)
234 if (i<8) c_printf("\n\r");
237 proutn(""); /* flush output */
246 int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE, t, dam=0;
250 if (game.damage[DSRSENS] != 0) {
251 /* Allow base's sensors if docked */
252 if (condit != IHDOCKED) {
253 prout(" S.R. SENSORS DAMAGED!");
257 prout(" [Using Base's sensors]");
259 else c_printf(" Short-range scan\n\r");
260 if (goodScan) game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ? game.state.galaxy[quadx][quady]+1000:1;
262 if (isit("chart")) nn = TRUE;
265 c_printf(" 1 2 3 4 5 6 7 8 9 10\n\r");
275 if (condit != IHDOCKED) newcnd();
276 for (i = 1; i <= 10; i++) {
280 for (j = 1; j <= 10; j++) {
281 if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)){
282 if ((game.quad[i][j]==IHMATER0)||(game.quad[i][j]==IHMATER1)||(game.quad[i][j]==IHMATER2)||(game.quad[i][j]==IHE)||(game.quad[i][j]==IHF)){
284 case IHRED: textcolor(RED); break;
285 case IHGREEN: textcolor(GREEN); break;
286 case IHYELLOW: textcolor(YELLOW); break;
287 case IHDOCKED: textcolor(LIGHTGRAY); break;
288 case IHDEAD: textcolor(WHITE);
291 if (game.quad[i][j]!=ship) highvideo();
295 if (game.quad[i][j] & 128) highvideo();
297 c_printf("%c ",game.quad[i][j] & 127);
298 textcolor(LIGHTGRAY);
307 proutn("Stardate %.1f, Time Left %.2f", game.state.date, game.state.remtime);
310 if (condit != IHDOCKED) newcnd();
312 case IHRED: cp = "RED"; break;
313 case IHGREEN: cp = "GREEN"; break;
314 case IHYELLOW: cp = "YELLOW"; break;
315 case IHDOCKED: cp = "DOCKED"; break;
316 case IHDEAD: cp="DEAD"; break;
318 for (t=0;t<=NDEVICES;t++)
319 if (game.damage[t]>0) dam++;
320 proutn("Condition %s, %i DAMAGES", cp, dam);
323 proutn("Position %d - %d , %d - %d",
324 quadx, quady, sectx, secty);
327 proutn("Life Support ");
328 if (game.damage[DLIFSUP] != 0.0) {
329 if (condit == IHDOCKED)
330 proutn("DAMAGED, Base provides");
332 proutn("DAMAGED, reserves=%4.2f", lsupres);
338 proutn("Warp Factor %.1f", warpfac);
341 proutn("Energy %.2f", energy);
344 proutn("Torpedoes %d", torps);
348 if (game.damage[DSHIELD] != 0)
354 proutn(" %d%% %.1f units",
355 (int)((100.0*shield)/inshld + 0.5), shield);
358 proutn("Klingons Left %d", game.state.remkl);
365 if (i<10) c_printf("\n\r");
366 if (k!=0) return(goodScan);
379 int ix1, ix2, iy1, iy2, prompt=FALSE;
381 double ttime, twarp, tpower;
382 if (game.damage[DCOMPTR] != 0.0) {
383 prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR.");
387 if (scan() != IHREAL) {
390 proutn("Destination quadrant and/or sector? ");
391 if (scan()!=IHREAL) {
397 if (scan() != IHREAL) {
402 if (scan() == IHREAL) {
404 if (scan() != IHREAL) {
411 if (quady>ix1) ix2 = 1;
413 if (quadx>iy1) iy2 = 1;
417 if (ix1 > 8 || ix1 < 1 || iy1 > 8 || iy1 < 1 ||
418 ix2 > 10 || ix2 < 1 || iy2 > 10 || iy2 < 1) {
422 dist = sqrt(square(iy1-quadx+0.1*(iy2-sectx))+
423 square(ix1-quady+0.1*(ix2-secty)));
426 if (prompt) prout("Answer \"no\" if you don't know the value:");
429 proutn("Time or arrival date? ");
430 if (scan()==IHREAL) {
432 if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date
433 if (ttime <= 1e-10 ||
434 (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) {
435 prout("We'll never make it, sir.");
439 if (twarp < 1.0) twarp = 1.0;
443 proutn("Warp factor? ");
444 if (scan()== IHREAL) {
447 if (twarp<1.0 || twarp > 10.0) {
453 prout("Captain, certainly you can give me one of these.");
457 ttime = (10.0*dist)/square(twarp);
458 tpower = dist*twarp*twarp*twarp*(shldup+1);
459 if (tpower >= energy) {
460 prout("Insufficient energy, sir.");
461 if (shldup==0 || tpower > energy*2.0) {
463 proutn("New warp factor to try? ");
464 if (scan() == IHREAL) {
467 if (twarp<1.0 || twarp > 10.0) {
479 prout("But if you lower your shields,");
485 prout(" energy will be %.2f.", energy-tpower);
487 prout("And we will arrive at stardate %.2f.",
488 game.state.date+ttime);
491 prout("Any warp speed is adequate.");
493 prout("Minimum warp needed is %.2f,", twarp);
494 prout("and we will arrive at stardate %.2f.",
495 game.state.date+ttime);
497 if (game.state.remtime < ttime)
498 prout("Unfortunately, the Federation will be destroyed by then.");
500 prout("You'll be taking risks at that speed, Captain");
501 if ((isatb==1 && game.state.isy == ix1 && game.state.isx == iy1 &&
502 game.future[FSCDBAS]< ttime+game.state.date)||
503 (game.future[FCDBAS]<ttime+game.state.date && baty==ix1 && batx == iy1))
504 prout("The starbase there will be destroyed by then.");
505 proutn("New warp factor to try? ");
506 if (scan() == IHREAL) {
509 if (twarp<1.0 || twarp > 10.0) {