+#include <unistd.h>\r
#include "sst.h"\r
\r
static void getcd(int, int);\r
\r
void imove(void) {\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
+ finald, finalx, finaly, stopegy, probf;\r
+ int trbeam = 0, n, l, ix=0, iy=0, kink, kinks, iquad;\r
\r
if (inorbit) {\r
prout("Helmsman Sulu- \"Leaving standard orbit.\"");\r
quady = (iy+9)/10;\r
sectx = ix - 10*(quadx-1);\r
secty = iy - 10*(quady-1);\r
- prout("");\r
- prout("Entering %s.",\r
+ proutn("\n\rEntering %s.",\r
cramlc(quadrant, quadx, quady));\r
game.quad[sectx][secty] = ship;\r
newqad(0);\r
+ if (skill>1) attack(0);\r
return;\r
}\r
iquad = game.quad[ix][iy];\r
case IHC:\r
case IHS:\r
case IHR:\r
+ case IHQUEST:\r
sectx = ix;\r
secty = iy;\r
ram(0, iquad, sectx, secty);\r
crmshp();\r
proutn(" pulled into black hole at ");\r
prout(cramlc(sector, ix, iy));\r
- finish(FHOLE);\r
+ /*\r
+ * Getting pulled into a black \r
+ * hole was certain death in\r
+ * Almy's original. Stas \r
+ * Sergeev added a possibility\r
+ * that you'll get timewarped\r
+ * instead.\r
+ */\r
+ n=0;\r
+ for (l=1;l<=NDEVICES+1;l++)\r
+ if (game.damage[l]>0) n++;\r
+ probf=pow(1.4,(energy+shield)/5000.0-1.0)*\r
+ pow(1.3,1.0/(n+1)-1.0);\r
+ if (Rand()>probf) \r
+ timwrp();\r
+ else \r
+ finish(FHOLE);\r
return;\r
default:\r
/* something else */\r
}\r
newcnd();\r
iattak = 0;\r
+#ifdef SERGEEV\r
+ drawmaps(0);\r
+#endif /* SERGEEV */\r
return;\r
}\r
\r
-void dock(void) {\r
+void dock(int l) {\r
chew();\r
- if (condit == IHDOCKED) {\r
+ if (condit == IHDOCKED && l) {\r
prout("Already docked.");\r
return;\r
}\r
return;\r
}\r
condit = IHDOCKED;\r
- prout("Docked.");\r
+ if (l) prout("Docked.");\r
+ ididit=1;\r
if (energy < inenrg) energy = inenrg;\r
shield = inshld;\r
torps = intorps;\r
(game.future[FCDBAS] < 1e30 || isatb == 1) && iseenit == 0) {\r
/* get attack report from base */\r
prout("Lt. Uhura- \"Captain, an important message from the starbase:\"");\r
- attakreport();\r
+ attakreport(0);\r
iseenit = 1;\r
}\r
}\r
are always displayed y - x, where +y is downward! */\r
\r
\r
- int irowq=quadx, icolq=quady, irows, icols, itemp=0, iprompt=0, key;\r
+ int irowq=quadx, icolq=quady, irows, icols, itemp=0, iprompt=0, key=0;\r
double xi, xj, xk, xl;\r
double deltax, deltay;\r
int automatic = -1;\r
if (Time >= game.state.remtime) {\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
+ proutn("we dare spend the time?\" ");\r
if (ja() == 0) return;\r
}\r
/* Activate impulse engines and pay the cost */\r
proutn(" a trip would require approximately %2.0f",\r
100.0*Time/game.state.remtime);\r
prout(" percent of our");\r
- prout(" remaining time. Are you sure this is wise?\"");\r
- if (ja() == 0) { ididit = 0; return;}\r
+ proutn(" remaining time. Are you sure this is wise?\" ");\r
+ if (ja() == 0) { ididit = 0; Time=0; return;}\r
}\r
}\r
/* Entry WARPX */\r
\r
while ((key=scan()) == IHEOL) {\r
chew();\r
- proutn("Warp factor-");\r
+ proutn("Warp factor- ");\r
}\r
chew();\r
if (key != IHREAL) {\r
warpfac = aaitem;\r
wfacsq=warpfac*warpfac;\r
if (warpfac <= oldfac || warpfac <= 6.0) {\r
- proutn("Helmsman Sulu- \"Warp factor %do, Captain.\"", \r
+ proutn("Helmsman Sulu- \"Warp factor %d, Captain.\"", \r
(int)warpfac);\r
return;\r
}\r
game.damage[DRADIO] += Time;\r
}\r
newqad(0);\r
+#ifdef SERGEEV\r
+ events();\r
+#endif /* SERGEEV */\r
}\r
\r
void probe(void) {\r
key = scan();\r
}\r
else if (key == IHEOL) {\r
- proutn("Arm NOVAMAX warhead?");\r
+ proutn("Arm NOVAMAX warhead? ");\r
isarmed = ja();\r
}\r
getcd(TRUE, key);\r
probecy = quady;\r
game.future[FDSPROB] = game.state.date + 0.01; // Time to move one sector\r
prout("Ensign Chekov- \"The deep space probe is launched, Captain.\"");\r
+ ididit = 1;\r
return;\r
}\r
\r
void help(void) {\r
/* There's more than one way to move in this game! */\r
double ddist, xdist, probf;\r
- int line, l, ix, iy;\r
+ int line = 0, l, ix, iy;\r
+#ifdef SERGEEV\r
+ int pox, posy;\r
+#endif /* SERGEEV */\r
\r
chew();\r
/* Test for conditions which prevent calling for help */\r
proutn("");\r
crmshp();\r
prout(" dematerializes.");\r
+#ifdef SERGEEV\r
+ sectx=0;\r
+ for (l = 1; l <= 5; l++) {\r
+ ix = basex+3.0*Rand()-1;\r
+ iy = basey+3.0*Rand()-1;\r
+ if (ix>=1 && ix<=10 && iy>=1 && iy<=10 && game.quad[ix][iy]==IHDOT) {\r
+ /* found one -- finish up */\r
+ sectx=ix;\r
+ secty=iy;\r
+ game.quad[ix][iy]=IHMATER0;\r
+ break;\r
+ }\r
+ }\r
+ if (sectx==0){\r
+ prout("You have been lost in space...");\r
+ finish(FMATERIALIZE);\r
+ return;\r
+ }\r
+#endif /* SERGEEV */\r
/* Give starbase three chances to rematerialize starship */\r
probf = pow((1.0 - pow(0.98,ddist)), 0.33333333);\r
for (l = 1; l <= 3; l++) {\r
sectx=ix;\r
secty=iy;\r
game.quad[ix][iy]=ship;\r
- dock();\r
+ dock(0);\r
skip(1);\r
prout("Lt. Uhura- \"Captain, we made it!\"");\r
return;\r