X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=moving.c;h=17f3a2282767a738921a6a98fb3b1cc1ee5dca68;hp=05c3d3ab95761cf83e570d13d7220b3d4aeed39c;hb=7453bc4027cf9dcf29ebae79341070c3bfb30aed;hpb=ba71f219a8543b5510a53c59ce793339b84903a7 diff --git a/moving.c b/moving.c index 05c3d3a..17f3a22 100644 --- a/moving.c +++ b/moving.c @@ -1,4 +1,6 @@ #include +#include "sstlinux.h" +#include "conio.h" #include "sst.h" static void getcd(int, int); @@ -51,7 +53,13 @@ void imove(void) { (iy-game.ky[l])*(double)(iy-game.ky[l])); game.kavgd[l] = 0.5 * (finald+game.kdist[l]); } - if (game.state.galaxy[quadx][quady] != 1000) attack(0); + /* + * Stas Sergeev added the condition + * that attacks only happen if Klingons + * are present and your skill is > 3. + */ + if (skill > 3 && klhere > 0 && game.state.galaxy[quadx][quady] != 1000) + attack(0); if (alldone) return; } /* compute final position -- new quadrant and sector */ @@ -89,9 +97,9 @@ void imove(void) { finish(FNEG3); return; } - prout("\nYOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER\n" - "AT THE EDGE OF THE GALAXY. THE THIRD TIME YOU TRY THIS,\n" - "YOU WILL BE DESTROYED.\n"); + prout("\n\rYOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER\n\r" + "AT THE EDGE OF THE GALAXY. THE THIRD TIME YOU TRY THIS,\n\r" + "YOU WILL BE DESTROYED.\n\r"); } /* Compute final position in new quadrant */ if (trbeam) return; /* Don't bother if we are to be beamed */ @@ -99,7 +107,7 @@ void imove(void) { quady = (iy+9)/10; sectx = ix - 10*(quadx-1); secty = iy - 10*(quady-1); - proutn("\n\rEntering %s.", + prout("\n\rEntering %s.", cramlc(quadrant, quadx, quady)); game.quad[sectx][secty] = ship; newqad(0); @@ -201,9 +209,7 @@ label100: } newcnd(); iattak = 0; -#ifdef SERGEEV drawmaps(0); -#endif /* SERGEEV */ return; } @@ -377,7 +383,7 @@ static void getcd(int isprobe, int akey) { if (!isprobe) { if (itemp) { if (iprompt) { - proutn("Helmsman Sulu- \"Course locked in for %s.\"", + prout("Helmsman Sulu- \"Course locked in for %s.\"", cramlc(sector, irows, icols)); } } @@ -815,9 +821,7 @@ void timwrp() { game.damage[DRADIO] += Time; } newqad(0); -#ifdef SERGEEV - events(); -#endif /* SERGEEV */ + events(); /* Stas Sergeev added this -- do pending events */ } void probe(void) { @@ -896,9 +900,6 @@ void help(void) { /* There's more than one way to move in this game! */ double ddist, xdist, probf; int line = 0, l, ix, iy; -#ifdef SERGEEV - int pox, posy; -#endif /* SERGEEV */ chew(); /* Test for conditions which prevent calling for help */ @@ -946,7 +947,6 @@ void help(void) { proutn(""); crmshp(); prout(" dematerializes."); -#ifdef SERGEEV sectx=0; for (l = 1; l <= 5; l++) { ix = basex+3.0*Rand()-1; @@ -964,7 +964,6 @@ void help(void) { 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++) { @@ -975,30 +974,30 @@ void help(void) { } proutn(" attempt to re-materialize "); crmshp(); - prouts(" . . . . . "); + warble(); if (Rand() > probf) break; + switch (l){ + case 1: game.quad[ix][iy]=IHMATER1; + break; + case 2: game.quad[ix][iy]=IHMATER2; + break; + case 3: game.quad[ix][iy]=IHQUEST; + break; + } + textcolor(RED); prout("fails."); + delay(500); + textcolor(LIGHTGRAY); } if (l > 3) { finish(FMATERIALIZE); return; } - /* Rematerialization attempt should succeed if can get adj to base */ - 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 */ - prout("succeeds."); - sectx=ix; - secty=iy; - game.quad[ix][iy]=ship; - dock(0); - skip(1); - prout("Lt. Uhura- \"Captain, we made it!\""); - return; - } - } - finish(FMATERIALIZE); - return; + game.quad[ix][iy]=ship; + textcolor(WHITE); + prout("succeeds."); + textcolor(LIGHTGRAY); + dock(0); + skip(1); + prout("Lt. Uhura- \"Captain, we made it!\""); }