X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=moving.c;h=b0e68cded51fbcd3ff6792e8a38ed02367864161;hb=93ede5b2bb8928b8aa17e750f48e6c5e59b81ab1;hp=07eb148b3eecdbc0eb4c9af5925aac61ff736c82;hpb=4a5bcd72352292e038b55645a1d6207407b30f71;p=super-star-trek.git diff --git a/moving.c b/moving.c index 07eb148..b0e68cd 100644 --- a/moving.c +++ b/moving.c @@ -1,11 +1,12 @@ +#include #include "sst.h" static void getcd(int, int); void imove(void) { double angle, deltax, deltay, bigger, x, y, - finald, finalx, finaly, stopegy; - int trbeam = 0, n, l, ix, iy, kink, kinks, iquad; + finald, finalx, finaly, stopegy, probf; + int trbeam = 0, n, l, ix=0, iy=0, kink, kinks, iquad; if (inorbit) { prout("Helmsman Sulu- \"Leaving standard orbit.\""); @@ -98,11 +99,11 @@ void imove(void) { quady = (iy+9)/10; sectx = ix - 10*(quadx-1); secty = iy - 10*(quady-1); - prout(""); - prout("Entering %s.", + proutn("\n\rEntering %s.", cramlc(quadrant, quadx, quady)); game.quad[sectx][secty] = ship; newqad(0); + if (skill>1) attack(0); return; } iquad = game.quad[ix][iy]; @@ -117,6 +118,7 @@ void imove(void) { case IHC: case IHS: case IHR: + case IHQUEST: sectx = ix; secty = iy; ram(0, iquad, sectx, secty); @@ -131,7 +133,23 @@ void imove(void) { crmshp(); proutn(" pulled into black hole at "); prout(cramlc(sector, ix, iy)); - finish(FHOLE); + /* + * Getting pulled into a black + * hole was certain death in + * Almy's original. Stas + * Sergeev added a possibility + * that you'll get timewarped + * instead. + */ + n=0; + for (l=1;l<=NDEVICES+1;l++) + if (game.damage[l]>0) n++; + probf=pow(1.4,(energy+shield)/5000.0-1.0)* + pow(1.3,1.0/(n+1)-1.0); + if (Rand()>probf) + timwrp(); + else + finish(FHOLE); return; default: /* something else */ @@ -183,12 +201,15 @@ label100: } newcnd(); iattak = 0; +#ifdef SERGEEV + drawmaps(0); +#endif /* SERGEEV */ return; } -void dock(void) { +void dock(int l) { chew(); - if (condit == IHDOCKED) { + if (condit == IHDOCKED && l) { prout("Already docked."); return; } @@ -202,7 +223,8 @@ void dock(void) { return; } condit = IHDOCKED; - prout("Docked."); + if (l) prout("Docked."); + ididit=1; if (energy < inenrg) energy = inenrg; shield = inshld; torps = intorps; @@ -211,7 +233,7 @@ void dock(void) { (game.future[FCDBAS] < 1e30 || isatb == 1) && iseenit == 0) { /* get attack report from base */ prout("Lt. Uhura- \"Captain, an important message from the starbase:\""); - attakreport(); + attakreport(0); iseenit = 1; } } @@ -226,7 +248,7 @@ static void getcd(int isprobe, int akey) { are always displayed y - x, where +y is downward! */ - int irowq=quadx, icolq=quady, irows, icols, itemp=0, iprompt=0, key; + int irowq=quadx, icolq=quady, irows, icols, itemp=0, iprompt=0, key=0; double xi, xj, xk, xl; double deltax, deltay; int automatic = -1; @@ -443,7 +465,7 @@ void impuls(void) { if (Time >= game.state.remtime) { prout("First Officer Spock- \"Captain, our speed under impulse"); prout("power is only 0.95 sectors per stardate. Are you sure"); - prout("we dare spend the time?\""); + proutn("we dare spend the time?\" "); if (ja() == 0) return; } /* Activate impulse engines and pay the cost */ @@ -519,8 +541,8 @@ void warp(int i) { proutn(" a trip would require approximately %2.0f", 100.0*Time/game.state.remtime); prout(" percent of our"); - prout(" remaining time. Are you sure this is wise?\""); - if (ja() == 0) { ididit = 0; return;} + proutn(" remaining time. Are you sure this is wise?\" "); + if (ja() == 0) { ididit = 0; Time=0; return;} } } /* Entry WARPX */ @@ -600,7 +622,7 @@ void setwrp(void) { while ((key=scan()) == IHEOL) { chew(); - proutn("Warp factor-"); + proutn("Warp factor- "); } chew(); if (key != IHREAL) { @@ -628,7 +650,7 @@ void setwrp(void) { warpfac = aaitem; wfacsq=warpfac*warpfac; if (warpfac <= oldfac || warpfac <= 6.0) { - proutn("Helmsman Sulu- \"Warp factor %do, Captain.\"", + proutn("Helmsman Sulu- \"Warp factor %d, Captain.\"", (int)warpfac); return; } @@ -793,6 +815,9 @@ void timwrp() { game.damage[DRADIO] += Time; } newqad(0); +#ifdef SERGEEV + events(); +#endif /* SERGEEV */ } void probe(void) { @@ -840,7 +865,7 @@ void probe(void) { key = scan(); } else if (key == IHEOL) { - proutn("Arm NOVAMAX warhead?"); + proutn("Arm NOVAMAX warhead? "); isarmed = ja(); } getcd(TRUE, key); @@ -863,13 +888,17 @@ void probe(void) { probecy = quady; game.future[FDSPROB] = game.state.date + 0.01; // Time to move one sector prout("Ensign Chekov- \"The deep space probe is launched, Captain.\""); + ididit = 1; return; } void help(void) { /* There's more than one way to move in this game! */ double ddist, xdist, probf; - int line, l, ix, iy; + int line = 0, l, ix, iy; +#ifdef SERGEEV + int pox, posy; +#endif /* SERGEEV */ chew(); /* Test for conditions which prevent calling for help */ @@ -917,6 +946,25 @@ void help(void) { proutn(""); crmshp(); prout(" dematerializes."); +#ifdef SERGEEV + sectx=0; + for (l = 1; l <= 5; l++) { + ix = basex+3.0*Rand()-1; + iy = basey+3.0*Rand()-1; + if (ix>=1 && ix<=10 && iy>=1 && iy<=10 && game.quad[ix][iy]==IHDOT) { + /* found one -- finish up */ + sectx=ix; + secty=iy; + game.quad[ix][iy]=IHMATER0; + break; + } + } + if (sectx==0){ + prout("You have been lost in space..."); + finish(FMATERIALIZE); + return; + } +#endif /* SERGEEV */ /* Give starbase three chances to rematerialize starship */ probf = pow((1.0 - pow(0.98,ddist)), 0.33333333); for (l = 1; l <= 3; l++) { @@ -945,7 +993,7 @@ void help(void) { sectx=ix; secty=iy; game.quad[ix][iy]=ship; - dock(); + dock(0); skip(1); prout("Lt. Uhura- \"Captain, we made it!\""); return;