X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=reports.c;h=ccb13cd80a0ac465a6bc205e1f2abe1a19bb0c01;hp=5841aeca6c74f9750fd2a3d2253d32d9ad33fdbf;hb=942f187b68be75931f4bd35015d74d284ef802c4;hpb=eaf59bc9a6f0a5c917df2f51be128ae29ba6a595 diff --git a/reports.c b/reports.c index 5841aec..ccb13cd 100644 --- a/reports.c +++ b/reports.c @@ -4,20 +4,20 @@ #include void attakreport(void) { - if (frozen.future[FCDBAS] < 1e30) { + if (game.future[FCDBAS] < 1e30) { proutn("Starbase in "); cramlc(1, batx, baty); prout(" is currently under attack."); proutn("It can hold out until Stardate "); - cramf(frozen.future[FCDBAS], 0,1); + cramf(game.future[FCDBAS], 0,1); prout("."); } if (isatb == 1) { proutn("Starbase in "); - cramlc(1, state.isx, state.isy); + cramlc(1, game.state.isx, game.state.isy); prout(" is under Super-commander attack."); proutn("It can hold out until Stardate "); - cramf(frozen.future[FSCDBAS], 0, 1); + cramf(game.future[FSCDBAS], 0, 1); prout("."); } } @@ -42,51 +42,48 @@ void report(int f) { case 5: s3="emeritus"; break; default: s3="skilled"; break; } - printf("\nYou %s playing a %s%s %s frozen.\n", + prout(""); + prout("You %s playing a %s%s %s game.", alldone? "were": "are now", s1, s2, s3); if (skill>3 && thawed && !alldone) prout("No plaque is allowed."); - if (tourn) printf("This is tournament game %d.\n", tourn); - if (f) printf("Your secret password is \"%s\"\n",frozen.passwd); - printf("%d of %d Klingons have been killed", - state.killk+state.killc+state.nsckill, inkling); - if (state.killc) printf(", including %d Commander%s.\n", state.killc, state.killc==1?"":"s"); - else if (state.killk+state.nsckill > 0) prout(", but no Commanders."); + if (tourn) prout("This is tournament game %d.", tourn); + if (f) prout("Your secret password is \"%s\"",game.passwd); + proutn("%d of %d Klingons have been killed", + game.state.killk+game.state.killc+game.state.nsckill, inkling); + if (game.state.killc) prout(", including %d Commander%s.", game.state.killc, game.state.killc==1?"":"s"); + else if (game.state.killk+game.state.nsckill > 0) prout(", but no Commanders."); else prout("."); - if (skill > 2) printf("The Super Commander has %sbeen destroyed.\n", - state.nscrem?"not ":""); - if (state.rembase != inbase) { + if (skill > 2) prout("The Super Commander has %sbeen destroyed.", + game.state.nscrem?"not ":""); + if (game.state.rembase != inbase) { proutn("There "); - if (inbase-state.rembase==1) proutn("has been 1 base"); + if (inbase-game.state.rembase==1) proutn("has been 1 base"); else { - proutn("have been "); - crami(inbase-state.rembase, 1); - proutn(" bases"); + proutn("have been %d bases", inbase-game.state.rembase); } - proutn(" destroyed, "); - crami(state.rembase, 1); - prout(" remaining."); + prout(" destroyed, %d remaining.", game.state.rembase); } - else printf("There are %d bases.\n", inbase); - if (frozen.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) { + else prout("There are %d bases.", inbase); + if (game.damage[DRADIO] == 0.0 || condit == IHDOCKED || iseenit) { /* Don't report this if not seen and either the radio is dead or not at base! */ attakreport(); iseenit = 1; } - if (casual) printf("%d casualt%s suffered so far.\n", + if (casual) prout("%d casualt%s suffered so far.", casual, casual==1? "y" : "ies"); - if (nhelp) printf("There were %d call%s for help.\n", + if (nhelp) prout("There were %d call%s for help.", nhelp, nhelp==1 ? "" : "s"); if (ship == IHE) { proutn("You have "); - if (nprobes) crami(nprobes,1); + if (nprobes) proutn("%d", nprobes); else proutn("no"); proutn(" deep space probe"); if (nprobes!=1) proutn("s"); prout("."); } - if ((frozen.damage[DRADIO] == 0.0 || condit == IHDOCKED)&& - frozen.future[FDSPROB] != 1e30) { + if ((game.damage[DRADIO] == 0.0 || condit == IHDOCKED)&& + game.future[FDSPROB] != 1e30) { if (isarmed) proutn("An armed deep space probe is in"); else @@ -104,7 +101,7 @@ void report(int f) { ai *= 2.0; i++; } - printf("Dilithium crystals have been used %d time%s.\n", + prout("Dilithium crystals have been used %d time%s.", i, i==1? "" : "s"); } } @@ -114,7 +111,7 @@ void report(int f) { void lrscan(void) { int x, y; chew(); - if (frozen.damage[DLRSENS] != 0.0) { + if (game.damage[DLRSENS] != 0.0) { /* Now allow base's sensors if docked */ if (condit != IHDOCKED) { prout("LONG-RANGE SENSORS DAMAGED."); @@ -132,10 +129,10 @@ void lrscan(void) { for (x = quadx-1; x <= quadx+1; x++) { for (y = quady-1; y <= quady+1; y++) { if (x == 0 || x > 8 || y == 0 || y > 8) - printf(" -1"); + proutn(" -1"); else { - printf("%5d", state.galaxy[x][y]); - frozen.starch[x][y] = frozen.damage[DRADIO] > 0 ? state.galaxy[x][y]+1000 :1; + proutn("%5d", game.state.galaxy[x][y]); + game.starch[x][y] = game.damage[DRADIO] > 0 ? game.state.galaxy[x][y]+1000 :1; } } putchar('\n'); @@ -147,18 +144,18 @@ void dreprt(void) { int jdam = FALSE, i; chew(); - for (i = 1; i <= ndevice; i++) { - if (frozen.damage[i] > 0.0) { + for (i = 1; i <= NDEVICES; i++) { + if (game.damage[i] > 0.0) { if (!jdam) { skip(1); prout("DEVICE -REPAIR TIMES-"); prout(" IN FLIGHT DOCKED"); jdam = TRUE; } - printf(" %16s ", device[i]); - cramf(frozen.damage[i]+0.05, 8, 2); + proutn(" %16s ", device[i]); + cramf(game.damage[i]+0.05, 8, 2); proutn(" "); - cramf(docfac*frozen.damage[i]+0.005, 8, 2); + cramf(docfac*game.damage[i]+0.005, 8, 2); skip(1); } } @@ -170,7 +167,7 @@ void chart(int nn) { chew(); skip(1); - if (stdamtim != 1e30 && stdamtim != state.date && condit == IHDOCKED) { + if (stdamtim != 1e30 && stdamtim != game.state.date && condit == IHDOCKED) { prout("Spock- \"I revised the Star Chart from the"); prout(" starbase's records.\""); skip(1); @@ -179,14 +176,14 @@ void chart(int nn) { if (stdamtim != 1e30) { if (condit == IHDOCKED) { /* We are docked, so restore chart from base information */ - stdamtim = state.date; + stdamtim = game.state.date; for (i=1; i <= 8 ; i++) for (j=1; j <= 8; j++) - if (frozen.starch[i][j] == 1) frozen.starch[i][j] = state.galaxy[i][j]+1000; + if (game.starch[i][j] == 1) game.starch[i][j] = game.state.galaxy[i][j]+1000; } else { proutn("(Last surveillance update "); - cramf(state.date-stdamtim, 0, 1); + cramf(game.state.date-stdamtim, 0, 1); prout(" stardates ago.)"); } } @@ -194,18 +191,18 @@ void chart(int nn) { prout(" 1 2 3 4 5 6 7 8"); prout(" ----------------------------------------"); - if (nn==0) prout(" -"); + /* if (nn==0) prout(" -"); */ for (i = 1; i <= 8; i++) { - printf("%d -", i); + proutn("%d -", i); for (j = 1; j <= 8; j++) { - if (frozen.starch[i][j] < 0) - printf(" .1."); - else if (frozen.starch[i][j] == 0) - printf(" ..."); - else if (frozen.starch[i][j] > 999) - printf("%5d", frozen.starch[i][j]-1000); + if (game.starch[i][j] < 0) + proutn(" .1."); + else if (game.starch[i][j] == 0) + proutn(" ..."); + else if (game.starch[i][j] > 999) + proutn("%5d", game.starch[i][j]-1000); else - printf("%5d", state.galaxy[i][j]); + proutn("%5d", game.state.galaxy[i][j]); } prout(" -"); } @@ -227,7 +224,7 @@ void srscan(int l) { int goodScan=TRUE; switch (l) { case 1: // SRSCAN - if (frozen.damage[DSRSENS] != 0) { + if (game.damage[DSRSENS] != 0) { /* Allow base's sensors if docked */ if (condit != IHDOCKED) { prout("SHORT-RANGE SENSORS DAMAGED"); @@ -237,8 +234,8 @@ void srscan(int l) { prout("[Using starbase's sensors]"); } if (goodScan) - frozen.starch[quadx][quady] = frozen.damage[DRADIO]>0.0 ? - state.galaxy[quadx][quady]+1000:1; + game.starch[quadx][quady] = game.damage[DRADIO]>0.0 ? + game.state.galaxy[quadx][quady]+1000:1; scan(); if (isit("chart")) nn = TRUE; if (isit("no")) rightside = FALSE; @@ -247,7 +244,7 @@ void srscan(int l) { break; case 2: // REQUEST while (scan() == IHEOL) - printf("Information desired? "); + proutn("Information desired? "); chew(); for (k = 1; k <= 10; k++) if (strncmp(citem,requests[k],min(2,strlen(citem)))==0) @@ -267,18 +264,18 @@ void srscan(int l) { for (i = 1; i <= 10; i++) { int jj = (k!=0 ? k : i); if (leftside) { - printf("%2d ", i); + proutn("%2d ", i); for (j = 1; j <= 10; j++) { if (goodScan || (abs(i-sectx)<= 1 && abs(j-secty) <= 1)) - printf("%c ",frozen.quad[i][j]); + proutn("%c ",game.quad[i][j]); else - printf("- "); + proutn("- "); } } if (rightside) { switch (jj) { case 1: - printf(" Stardate %.1f", state.date); + proutn(" Stardate %.1f", game.state.date); break; case 2: if (condit != IHDOCKED) newcnd(); @@ -288,50 +285,50 @@ void srscan(int l) { case IHYELLOW: cp = "YELLOW"; break; case IHDOCKED: cp = "DOCKED"; break; } - printf(" Condition %s", cp); + proutn(" Condition %s", cp); break; case 3: - printf(" Position "); + proutn(" Position "); cramlc(0, quadx, quady); - putchar(','); + proutn(","); cramlc(0, sectx, secty); break; case 4: - printf(" Life Support "); - if (frozen.damage[DLIFSUP] != 0.0) { + proutn(" Life Support "); + if (game.damage[DLIFSUP] != 0.0) { if (condit == IHDOCKED) - printf("DAMAGED, supported by starbase"); + proutn("DAMAGED, supported by starbase"); else - printf("DAMAGED, reserves=%4.2f", lsupres); + proutn("DAMAGED, reserves=%4.2f", lsupres); } else - printf("ACTIVE"); + proutn("ACTIVE"); break; case 5: - printf(" Warp Factor %.1f", warpfac); + proutn(" Warp Factor %.1f", warpfac); break; case 6: - printf(" Energy %.2f", energy); + proutn(" Energy %.2f", energy); break; case 7: - printf(" Torpedoes %d", torps); + proutn(" Torpedoes %d", torps); break; case 8: - printf(" Shields "); - if (frozen.damage[DSHIELD] != 0) - printf("DAMAGED,"); + proutn(" Shields "); + if (game.damage[DSHIELD] != 0) + proutn("DAMAGED,"); else if (shldup) - printf("UP,"); + proutn("UP,"); else - printf("DOWN,"); - printf(" %d%% %.1f units", + proutn("DOWN,"); + proutn(" %d%% %.1f units", (int)((100.0*shield)/inshld + 0.5), shield); break; case 9: - printf(" Klingons Left %d", state.remkl); + proutn(" Klingons Left %d", game.state.remkl); break; case 10: - printf(" Time Left %.2f", state.remtime); + proutn(" Time Left %.2f", game.state.remtime); break; } @@ -347,7 +344,7 @@ void eta(void) { int key, ix1, ix2, iy1, iy2, prompt=FALSE; int wfl; double ttime, twarp, tpower; - if (frozen.damage[DCOMPTR] != 0.0) { + if (game.damage[DCOMPTR] != 0.0) { prout("COMPUTER DAMAGED, USE A POCKET CALCULATOR."); skip(1); return; @@ -397,7 +394,7 @@ void eta(void) { proutn("Time or arrival date? "); if (scan()==IHREAL) { ttime = aaitem; - if (ttime > state.date) ttime -= state.date; // Actually a star date + if (ttime > game.state.date) ttime -= game.state.date; // Actually a star date if (ttime <= 1e-10 || (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) { prout("We'll never make it, sir."); @@ -455,7 +452,7 @@ void eta(void) { prout("."); if (wfl) { proutn("And we will arrive at stardate "); - cramf(state.date+ttime, 1, 1); + cramf(game.state.date+ttime, 1, 1); prout("."); } else if (twarp==1.0) @@ -465,16 +462,16 @@ void eta(void) { cramf(twarp, 1, 2); skip(1); proutn("and we will arrive at stardate "); - cramf(state.date+ttime, 1, 2); + cramf(game.state.date+ttime, 1, 2); prout("."); } - if (state.remtime < ttime) + if (game.state.remtime < ttime) prout("Unfortunately, the Federation will be destroyed by then."); if (twarp > 6.0) prout("You'll be taking risks at that speed, Captain"); - if ((isatb==1 && state.isy == ix1 && state.isx == iy1 && - frozen.future[FSCDBAS]< ttime+state.date)|| - (frozen.future[FCDBAS]