void dstrct() {\r
/* Finish with a BANG! */\r
chew();\r
- if (frozen.damage[DCOMPTR] != 0.0) {\r
+ if (game.damage[DCOMPTR] != 0.0) {\r
prout("Computer damaged; cannot execute destruct sequence.");\r
return;\r
}\r
prout("SELF-DESTRUCT-SEQUENCE-WILL-BE-ABORTED");\r
scan();\r
chew();\r
- if (strcmp(frozen.passwd, citem) != 0) {\r
+ if (strcmp(game.passwd, citem) != 0) {\r
prouts("PASSWORD-REJECTED;"); skip(1);\r
prout("CONTINUITY-EFFECTED");\r
skip(1);\r
double whammo = 25.0 * energy;\r
int l=1;\r
while (l <= nenhere) {\r
- if (frozen.kpower[l]*frozen.kdist[l] <= whammo) \r
- deadkl(frozen.kx[l],frozen.ky[l], frozen.quad[frozen.kx[l]][frozen.ky[l]], frozen.kx[l], frozen.ky[l]);\r
+ if (game.kpower[l]*game.kdist[l] <= whammo) \r
+ deadkl(game.kx[l],game.ky[l], game.quad[game.kx[l]][game.ky[l]], game.kx[l], game.ky[l]);\r
l++;\r
}\r
}\r
int igotit = 0;\r
alldone = 1;\r
skip(3);\r
- printf("It is stardate %.1f .\n\n", state.date);\r
+ prout("It is stardate %.1f.", game.state.date);\r
+ prout("");\r
switch (ifin) {\r
case FWON: // Game has been won\r
- if (state.nromrem != 0)\r
- printf("The remaining %d Romulans surrender to Starfleet Command.\n",\r
- state.nromrem);\r
+ if (game.state.nromrem != 0)\r
+ prout("The remaining %d Romulans surrender to Starfleet Command.",\r
+ game.state.nromrem);\r
\r
prout("You have smashed the Klingon invasion fleet and saved");\r
prout("the Federation.");\r
gamewon=1;\r
if (alive) {\r
double badpt;\r
- badpt = 5.*state.starkl + casual + 10.*state.nplankl +\r
- 45.*nhelp+100.*state.basekl;\r
+ badpt = 5.*game.state.starkl + casual + 10.*game.state.nplankl +\r
+ 45.*nhelp+100.*game.state.basekl;\r
if (ship == IHF) badpt += 100.0;\r
else if (ship == 0) badpt += 200.0;\r
if (badpt < 100.0) badpt = 0.0; // Close enough!\r
- if (state.date-indate < 5.0 ||\r
+ if (game.state.date-indate < 5.0 ||\r
// killsPerDate >= RateMax\r
- (state.killk+state.killc+state.nsckill)/(state.date-indate) >=\r
+ (game.state.killk+game.state.killc+game.state.nsckill)/(game.state.date-indate) >=\r
0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) {\r
skip(1);\r
prout("In fact, you have done so well that Starfleet Command");\r
prout("promotes you to Commodore Emeritus.");\r
skip(1);\r
prout("Now that you think you're really good, try playing");\r
- prout("the \"Emeritus\" frozen. It will splatter your ego.");\r
+ prout("the \"Emeritus\" game. It will splatter your ego.");\r
break;\r
case 5:\r
skip(1);\r
prout("conquered. Your starship is now Klingon property,");\r
prout("and you are put on trial as a war criminal. On the");\r
proutn("basis of your record, you are ");\r
- if (state.remkl*3.0 > inkling) {\r
+ if (game.state.remkl*3.0 > inkling) {\r
prout("aquitted.");\r
skip(1);\r
prout("LIVE LONG AND PROSPER.");\r
if (ship==IHF) ship= 0;\r
else if (ship == IHE) ship = IHF;\r
alive = 0;\r
- if (state.remkl != 0) {\r
- double goodies = state.remres/inresor;\r
- double baddies = (state.remkl + 2.0*state.remcom)/(inkling+2.0*incom);\r
+ if (game.state.remkl != 0) {\r
+ double goodies = game.state.remres/inresor;\r
+ double baddies = (game.state.remkl + 2.0*game.state.remcom)/(inkling+2.0*incom);\r
if (goodies/baddies >= 1.0+0.5*Rand()) {\r
prout("As a result of your actions, a treaty with the Klingon");\r
prout("Empire has been signed. The terms of the treaty are");\r
}\r
\r
void score(void) {\r
- double timused = state.date - indate;\r
+ double timused = game.state.date - indate;\r
int ithperd, iwon, klship;\r
\r
- pause(0);\r
+ pause_game(0);\r
\r
iskill = skill;\r
- if ((timused == 0 || state.remkl != 0) && timused < 5.0) timused = 5.0;\r
- perdate = (state.killc + state.killk + state.nsckill)/timused;\r
+ if ((timused == 0 || game.state.remkl != 0) && timused < 5.0) timused = 5.0;\r
+ perdate = (game.state.killc + game.state.killk + game.state.nsckill)/timused;\r
ithperd = 500*perdate + 0.5;\r
iwon = 0;\r
if (gamewon) iwon = 100*skill;\r
if (ship == IHE) klship = 0;\r
else if (ship == IHF) klship = 1;\r
else klship = 2;\r
- if (gamewon == 0) state.nromrem = 0; // None captured if no win\r
- iscore = 10*state.killk + 50*state.killc + ithperd + iwon\r
- - 100*state.basekl - 100*klship - 45*nhelp -5*state.starkl - casual\r
- + 20*state.nromkl + 200*state.nsckill - 10*state.nplankl + state.nromrem;\r
+ if (gamewon == 0) game.state.nromrem = 0; // None captured if no win\r
+ iscore = 10*game.state.killk + 50*game.state.killc + ithperd + iwon\r
+ - 100*game.state.basekl - 100*klship - 45*nhelp -5*game.state.starkl - casual\r
+ + 20*game.state.nromkl + 200*game.state.nsckill - 10*game.state.nplankl + game.state.nromrem;\r
if (alive == 0) iscore -= 200;\r
skip(2);\r
prout("Your score --");\r
- if (state.nromkl)\r
- printf("%6d Romulans destroyed %5d\n",\r
- state.nromkl,20*state.nromkl);\r
- if (state.nromrem)\r
- printf("%6d Romulans captured %5d\n",\r
- state.nromrem, state.nromrem);\r
- if (state.killk)\r
- printf("%6d ordinary Klingons destroyed %5d\n",\r
- state.killk, 10*state.killk);\r
- if (state.killc)\r
- printf("%6d Klingon commanders destroyed %5d\n",\r
- state.killc, 50*state.killc);\r
- if (state.nsckill)\r
- printf("%6d Super-Commander destroyed %5d\n",\r
- state.nsckill, 200*state.nsckill);\r
+ if (game.state.nromkl)\r
+ prout("%6d Romulans destroyed %5d",\r
+ game.state.nromkl,20*game.state.nromkl);\r
+ if (game.state.nromrem)\r
+ prout("%6d Romulans captured %5d",\r
+ game.state.nromrem, game.state.nromrem);\r
+ if (game.state.killk)\r
+ prout("%6d ordinary Klingons destroyed %5d",\r
+ game.state.killk, 10*game.state.killk);\r
+ if (game.state.killc)\r
+ prout("%6d Klingon commanders destroyed %5d",\r
+ game.state.killc, 50*game.state.killc);\r
+ if (game.state.nsckill)\r
+ prout("%6d Super-Commander destroyed %5d",\r
+ game.state.nsckill, 200*game.state.nsckill);\r
if (ithperd)\r
- printf("%6.2f Klingons per stardate %5d\n",\r
+ prout("%.2f Klingons per stardate %5d",\r
perdate, ithperd);\r
- if (state.starkl)\r
- printf("%6d stars destroyed by your action %5d\n",\r
- state.starkl, -5*state.starkl);\r
- if (state.nplankl)\r
- printf("%6d planets destroyed by your action %5d\n",\r
- state.nplankl, -10*state.nplankl);\r
- if (state.basekl)\r
- printf("%6d bases destroyed by your action %5d\n",\r
- state.basekl, -100*state.basekl);\r
+ if (game.state.starkl)\r
+ prout("%6d stars destroyed by your action %5d",\r
+ game.state.starkl, -5*game.state.starkl);\r
+ if (game.state.nplankl)\r
+ prout("%6d planets destroyed by your action %5d",\r
+ game.state.nplankl, -10*game.state.nplankl);\r
+ if (game.state.basekl)\r
+ prout("%6d bases destroyed by your action %5d",\r
+ game.state.basekl, -100*game.state.basekl);\r
if (nhelp)\r
- printf("%6d calls for help from starbase %5d\n",\r
+ prout("%6d calls for help from starbase %5d",\r
nhelp, -45*nhelp);\r
if (casual)\r
- printf("%6d casualties incurred %5d\n",\r
+ prout("%6d casualties incurred %5d",\r
casual, -casual);\r
if (klship)\r
- printf("%6d ship(s) lost or destroyed %5d\n",\r
+ prout("%6d ship(s) lost or destroyed %5d",\r
klship, -100*klship);\r
if (alive==0)\r
prout("Penalty for getting yourself killed -200");\r
case 4: proutn("Expert game "); break;\r
case 5: proutn("Emeritus game"); break;\r
}\r
- printf(" %5d\n", iwon);\r
+ prout(" %5d", iwon);\r
}\r
skip(2);\r
- printf("TOTAL SCORE %5d\n", iscore);\r
+ prout("TOTAL SCORE %5d", iscore);\r
}\r
\r
void plaque(void) {\r
skip(2);\r
\r
while (fp == NULL) {\r
- printf("File or device name for your plaque:");\r
+ proutn("File or device name for your plaque:");\r
fgets(winner, 128, stdin);\r
winner[strlen(winner)-1] = '\0';\r
fp = fopen(winner, "w");\r
if (fp==NULL) {\r
- printf("Invalid name.\n");\r
+ prout("Invalid name.");\r
}\r
}\r
\r
- printf("Enter name to go on plaque (up to 30 characters):");\r
+ proutn("Enter name to go on plaque (up to 30 characters):");\r
fgets(winner, 128, stdin);\r
winner[strlen(winner)-1] = '\0';\r
winner[30] = '\0';\r