double angle, deltax, deltay, bigger, x, y,\r
finald, finalx, finaly, stopegy;\r
int trbeam = 0, n, l, ix, iy, kink, kinks, iquad;\r
\r
if (inorbit) {\r
double angle, deltax, deltay, bigger, x, y,\r
finald, finalx, finaly, stopegy;\r
int trbeam = 0, n, l, ix, iy, kink, kinks, iquad;\r
\r
if (inorbit) {\r
- dist = dist*(future[FTBEAM]-d.date)/Time + 0.1;\r
- Time = future[FTBEAM] - d.date + 1e-5;\r
+ dist = dist*(game.future[FTBEAM]-game.state.date)/Time + 0.1;\r
+ Time = game.future[FTBEAM] - game.state.date + 1e-5;\r
- finald = sqrt((ix-kx[l])*(double)(ix-kx[l]) +\r
- (iy-ky[l])*(double)(iy-ky[l]));\r
- kavgd[l] = 0.5 * (finald+kdist[l]);\r
+ finald = sqrt((ix-game.kx[l])*(double)(ix-game.kx[l]) +\r
+ (iy-game.ky[l])*(double)(iy-game.ky[l]));\r
+ game.kavgd[l] = 0.5 * (finald+game.kdist[l]);\r
- proutn("\nEntering");\r
- cramlc(1, quadx, quady);\r
- skip(1);\r
- quad[sectx][secty] = ship;\r
+ prout("");\r
+ prout("Entering %s.",\r
+ cramlc(quadrant, quadx, quady));\r
+ game.quad[sectx][secty] = ship;\r
if (iquad != IHDOT) {\r
/* object encountered in flight path */\r
stopegy = 50.0*dist/Time;\r
dist=0.1*sqrt((sectx-ix)*(double)(sectx-ix) +\r
(secty-iy)*(double)(secty-iy));\r
switch (iquad) {\r
if (iquad != IHDOT) {\r
/* object encountered in flight path */\r
stopegy = 50.0*dist/Time;\r
dist=0.1*sqrt((sectx-ix)*(double)(sectx-ix) +\r
(secty-iy)*(double)(secty-iy));\r
switch (iquad) {\r
- cramf(stopegy, 0, 2);\r
- prout(" units of energy.");\r
+ prout("%2d units of energy.", (int)stopegy);\r
- finald = sqrt((ix-kx[l])*(double)(ix-kx[l]) +\r
- (iy-ky[l])*(double)(iy-ky[l]));\r
- kavgd[l] = 0.5 * (finald+kdist[l]);\r
- kdist[l] = finald;\r
+ finald = sqrt((ix-game.kx[l])*(double)(ix-game.kx[l]) +\r
+ (iy-game.ky[l])*(double)(iy-game.ky[l]));\r
+ game.kavgd[l] = 0.5 * (finald+game.kdist[l]);\r
+ game.kdist[l] = finald;\r
/* get attack report from base */\r
prout("Lt. Uhura- \"Captain, an important message from the starbase:\"");\r
attakreport();\r
/* get attack report from base */\r
prout("Lt. Uhura- \"Captain, an important message from the starbase:\"");\r
attakreport();\r
- proutn("Helmsman Sulu- \"Course locked in for");\r
- cramlc(2, irows, icols);\r
- prout(".\"");\r
+ proutn("Helmsman Sulu- \"Course locked in for %s.\"",\r
+ cramlc(sector, irows, icols));\r
prout("First Officer Spock- \"Captain, the impulse engines");\r
prout("require 20.0 units to engage, plus 100.0 units per");\r
if (energy > 30) {\r
prout("First Officer Spock- \"Captain, the impulse engines");\r
prout("require 20.0 units to engage, plus 100.0 units per");\r
if (energy > 30) {\r
- proutn("quadrant. We can go, therefore, a maximum of ");\r
- cramf(0.01 * (energy-20.0)-0.05, 0, 1);\r
+ proutn("quadrant. We can go, therefore, a maximum of %d", \r
+ (int)(0.01 * (energy-20.0)-0.05));\r
prout("First Officer Spock- \"Captain, our speed under impulse");\r
prout("power is only 0.95 sectors per stardate. Are you sure");\r
prout("we dare spend the time?\"");\r
if (ja() == 0) return;\r
}\r
/* Activate impulse engines and pay the cost */\r
prout("First Officer Spock- \"Captain, our speed under impulse");\r
prout("power is only 0.95 sectors per stardate. Are you sure");\r
prout("we dare spend the time?\"");\r
if (ja() == 0) return;\r
}\r
/* Activate impulse engines and pay the cost */\r
- proutn("We haven't the energy, but we could do it at warp ");\r
- crami(iwarp, 1);\r
- if (shldup)\r
- prout(",\nif you'll lower the shields.");\r
+ proutn("We haven't the energy, but we could do it at warp %d", iwarp);\r
+ if (shldup) {\r
+ prout(",");\r
+ prout("if you'll lower the shields.");\r
+ }\r
- proutn(" a trip would require approximately ");\r
- cramf(100.0*Time/d.remtime, 0, 2);\r
+ proutn(" a trip would require approximately %2.0f",\r
+ 100.0*Time/game.state.remtime);\r
if (alldone) return;\r
energy -= dist*warpfac*warpfac*warpfac*(shldup+1);\r
if (energy <= 0) finish(FNRG);\r
Time = 10.0*dist/wfacsq;\r
if (twarp) timwrp();\r
if (blooey) {\r
if (alldone) return;\r
energy -= dist*warpfac*warpfac*warpfac*(shldup+1);\r
if (energy <= 0) finish(FNRG);\r
Time = 10.0*dist/wfacsq;\r
if (twarp) timwrp();\r
if (blooey) {\r
prout("Engineer Scott- \"I'm doing my best, Captain,\n"\r
" but right now we can only go warp 4.\"");\r
return;\r
prout("Engineer Scott- \"I'm doing my best, Captain,\n"\r
" but right now we can only go warp 4.\"");\r
return;\r
- proutn("Helmsman Sulu- \"Warp factor ");\r
- cramf(warpfac, 0, 1);\r
- prout(", Captain.\"");\r
+ proutn("Helmsman Sulu- \"Warp factor %do, Captain.\"", \r
+ (int)warpfac);\r
- proutn("Warp factor set to ");\r
- cramf(warpfac, 1, 1);\r
- skip(1);\r
+ prout("Warp factor set to %d", (int)warpfac);\r
- } while (d.galaxy[quadx][quady] == 1000);\r
- if (d.remkl==0) finish(FWON); /* Snova killed remaining enemy. */\r
+ } while (game.state.galaxy[quadx][quady] == 1000);\r
+ if (game.state.remkl==0) finish(FWON); /* Snova killed remaining enemy. */\r
- proutn("You are traveling backwards in time ");\r
- cramf(d.date-snapsht.date, 0, 2);\r
- prout(" stardates.");\r
- d = snapsht;\r
- d.snap = 0;\r
- if (d.remcom) {\r
- future[FTBEAM] = d.date + expran(intime/d.remcom);\r
- future[FBATTAK] = d.date + expran(0.3*intime);\r
- }\r
- future[FSNOVA] = d.date + expran(0.5*intime);\r
- future[FSNAP] = d.date +expran(0.25*d.remtime); /* next snapshot will\r
+ prout("You are traveling backwards in time %d stardates.",\r
+ (int)(game.state.date-game.snapsht.date));\r
+ game.state = game.snapsht;\r
+ game.state.snap = 0;\r
+ if (game.state.remcom) {\r
+ game.future[FTBEAM] = game.state.date + expran(intime/game.state.remcom);\r
+ game.future[FBATTAK] = game.state.date + expran(0.3*intime);\r
+ }\r
+ game.future[FSNOVA] = game.state.date + expran(0.5*intime);\r
+ game.future[FSNAP] = game.state.date +expran(0.25*game.state.remtime); /* next snapshot will\r
batx = baty = 0;\r
\r
/* Make sure Galileo is consistant -- Snapshot may have been taken\r
when on planet, which would give us two Galileos! */\r
gotit = 0;\r
batx = baty = 0;\r
\r
/* Make sure Galileo is consistant -- Snapshot may have been taken\r
when on planet, which would give us two Galileos! */\r
gotit = 0;\r
gotit = 1;\r
if (iscraft==1 && ship==IHE) {\r
prout("Checkov- \"Security reports the Galileo has disappeared, Sir!");\r
gotit = 1;\r
if (iscraft==1 && ship==IHE) {\r
prout("Checkov- \"Security reports the Galileo has disappeared, Sir!");\r
}\r
/* Likewise, if in the original time the Galileo was abandoned, but\r
was on ship earlier, it would have vanished -- lets restore it */\r
}\r
/* Likewise, if in the original time the Galileo was abandoned, but\r
was on ship earlier, it would have vanished -- lets restore it */\r
prout("Checkov- \"Security reports the Galileo has reappeared in the dock!\"");\r
iscraft = 1;\r
}\r
\r
/* Revert star chart to earlier era, if it was known then*/\r
prout("Checkov- \"Security reports the Galileo has reappeared in the dock!\"");\r
iscraft = 1;\r
}\r
\r
/* Revert star chart to earlier era, if it was known then*/\r
- if (starch[l][ll] > 1)\r
- starch[l][ll]=damage[DRADIO]>0.0 ? d.galaxy[l][ll]+1000 :1;\r
+ if (game.starch[l][ll] > 1)\r
+ game.starch[l][ll]=game.damage[DRADIO]>0.0 ? game.state.galaxy[l][ll]+1000 :1;\r
- for (l = 1; l <= d.rembase; l++) {\r
- xdist=10.0*sqrt(square(d.baseqx[l]-quadx)+square(d.baseqy[l]-quady));\r
+ for (l = 1; l <= game.state.rembase; l++) {\r
+ xdist=10.0*sqrt(square(game.state.baseqx[l]-quadx)+square(game.state.baseqy[l]-quady));\r
- quad[sectx][secty]=IHDOT;\r
- proutn("Starbase in");\r
- cramlc(1, quadx, quady);\r
- proutn(" responds--");\r
+ game.quad[sectx][secty]=IHDOT;\r
+ proutn("Starbase in %s responds--", cramlc(quadrant, quadx, quady));\r
+ proutn("");\r
for (l = 1; l <= 5; l++) {\r
ix = basex+3.0*Rand()-1;\r
iy = basey+3.0*Rand()-1;\r
for (l = 1; l <= 5; l++) {\r
ix = basex+3.0*Rand()-1;\r
iy = basey+3.0*Rand()-1;\r