Merge Stas's fixes to restore old behavior in the chart function and
authorEric S. Raymond <esr@thyrsus.com>
Fri, 18 Feb 2005 03:53:35 +0000 (03:53 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 18 Feb 2005 03:53:35 +0000 (03:53 +0000)
do the Mayday animation.  Also get rid of literal \n and \r.

battle.c
io.c
moving.c
planets.c
reports.c
sst.c
sst.h

index 985774be115cd8393484be9fe640f83ebbfe86e0..bd8070ad082d2239cabe4065e204d6597dc02a7d 100644 (file)
--- a/battle.c
+++ b/battle.c
@@ -202,7 +202,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
        iy = y + 0.5;
        if (!VALID_SECTOR(ix, iy)) break;
        iquad=game.quad[ix][iy];
-       tracktorpedo(ix, iy, l, i, n);
+       tracktorpedo(ix, iy, l, i, n, iquad);
        if (iquad==IHDOT) continue;
        /* hit something */
        setwnd(message_window);
diff --git a/io.c b/io.c
index b3e974e5124e1c202d1625e543431125d4db6c19..d34184206dda81290214e4fbd52f0bd0b06046a9 100644 (file)
--- a/io.c
+++ b/io.c
@@ -167,7 +167,6 @@ void prouts(char *fmt, ...)
     va_start(ap, fmt);
     vsprintf(buf, fmt, ap);
     va_end(ap);
-    skip(1);
     for (s = buf; *s; s++) {
        delay(30);
        if (game.options & OPTION_CURSES) {
@@ -349,16 +348,18 @@ void warble(void)
 /* sound and visual effects for teleportation */
 {
     if (game.options & OPTION_CURSES) {
-       drawmaps(1);
+       drawmaps(2);
        setwnd(message_window);
        sound(50);
+    }
+    prouts("     . . . . .     ");
+    if (game.options & OPTION_CURSES) {
        delay(1000);
        nosound();
-    } else
-       prouts(" . . . . . ");
+    }
 }
 
-void tracktorpedo(int ix, int iy, int l, int i, int n)
+void tracktorpedo(int ix, int iy, int l, int i, int n, int iquad)
 /* torpedo-track animation */
 {
     if (!game.options & OPTION_CURSES) {
@@ -380,21 +381,21 @@ void tracktorpedo(int ix, int iy, int l, int i, int n)
                drawmaps(2);
                delay(400);
            }
-           if ((game.quad[ix][iy]==IHDOT)||(game.quad[ix][iy]==IHBLANK)){
+           if ((iquad==IHDOT)||(iquad==IHBLANK)){
                put_srscan_sym(ix, iy, '+');
                sound(l*10);
                delay(100);
                nosound();
-               put_srscan_sym(ix, iy, game.quad[ix][iy]);
+               put_srscan_sym(ix, iy, iquad);
            }
            else {
                wattron(curwnd, A_REVERSE);
-               put_srscan_sym(ix, iy, game.quad[ix][iy]);
+               put_srscan_sym(ix, iy, iquad);
                sound(500);
                delay(1000);
                nosound();
                wattroff(curwnd, A_REVERSE);
-               put_srscan_sym(ix, iy, game.quad[ix][iy]);
+               put_srscan_sym(ix, iy, iquad);
            }
        } else {
            proutn("%d - %d   ", ix, iy);
index 7dee9e5f8089b3f521b8ec54c6751f9b5c679678..b7afb93ceb2837024e72d4e5c526405858cf6173 100644 (file)
--- a/moving.c
+++ b/moving.c
@@ -97,9 +97,10 @@ void imove(void)
                        finish(FNEG3);
                        return;
                    }
-                   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");
+                   skip(1);
+                   prout("YOU HAVE ATTEMPTED TO CROSS THE NEGATIVE ENERGY BARRIER");
+                   prout("AT THE EDGE OF THE GALAXY.  THE THIRD TIME YOU TRY THIS,");
+                   prout("YOU WILL BE DESTROYED.");
                }
                /* Compute final position in new quadrant */
                if (trbeam) return; /* Don't bother if we are to be beamed */
@@ -107,7 +108,8 @@ void imove(void)
                quady = (iy+(QUADSIZE-1))/QUADSIZE;
                sectx = ix - QUADSIZE*(quadx-1);
                secty = iy - QUADSIZE*(quady-1);
-               prout("\n\rEntering %s.",
+               skip(1);
+               prout("Entering %s.",
                      cramlc(quadrant, quadx, quady));
                game.quad[sectx][secty] = ship;
                newqad(0);
@@ -639,8 +641,8 @@ void setwrp(void)
        return;
     }
     if (game.damage[DWARPEN] > 0.0 && aaitem > 4.0) {
-       prout("Engineer Scott- \"I'm doing my best, Captain,\n"
-             "  but right now we can only go warp 4.\"");
+       prout("Engineer Scott- \"I'm doing my best, Captain,");
+       prout("  but right now we can only go warp 4.\"");
        return;
     }
     if (aaitem > 10.0) {
@@ -955,7 +957,6 @@ void help(void)
            /* found one -- finish up */
            sectx=ix;
            secty=iy;
-           game.quad[ix][iy]=IHMATER0;
            break;
        }
     }
@@ -974,22 +975,26 @@ void help(void)
        }
        proutn(" attempt to re-materialize ");
        crmshp();
-       warble();
-       if (Rand() > probf) break;
        switch (l){
-       case 1: game.quad[ix][iy]=IHMATER1;
+       case 1: game.quad[ix][iy]=IHMATER0;
            break;
-       case 2: game.quad[ix][iy]=IHMATER2;
+       case 2: game.quad[ix][iy]=IHMATER1;
            break;
-       case 3: game.quad[ix][iy]=IHQUEST;
+       case 3: game.quad[ix][iy]=IHMATER2;
            break;
        }
        textcolor(RED);
+       warble();
+       if (Rand() > probf) break;
        prout("fails.");
        delay(500);
        textcolor(DEFAULT);
     }
     if (l > 3) {
+       game.quad[ix][iy]=IHQUEST;
+       alive = 0;
+       drawmaps(1);
+       setwnd(message_window);
        finish(FMATERIALIZE);
        return;
     }
index 68bb27ca2ee912e7951f6a0548a7426bf81df7e4..9e847ebe0e92c0b1601bd6e6d6af6b6c2f2c2160 100644 (file)
--- a/planets.c
+++ b/planets.c
@@ -69,7 +69,8 @@ void orbit(void)
     }
     if (plnetx == 0 || abs(sectx-plnetx) > 1 || abs(secty-plnety) > 1) {
        crmshp();
-       prout(" not adjacent to planet.\n");
+       prout(" not adjacent to planet.");
+       skip(1);
        return;
     }
     Time = 0.02+0.03*Rand();
index b074cd8801e9e621ad6860fdb2a7b84a0c0b38bf..f169c150e4ddd5bd192887cccb56f2e575169171 100644 (file)
--- a/reports.c
+++ b/reports.c
@@ -188,7 +188,6 @@ void rechart(void)
 void chart(int nn) 
 {
     int i,j;
-    char *cp;
     chew();
 
     if (game.damage[DRADIO] == 0.0)
@@ -217,12 +216,9 @@ void chart(int nn)
            else if (!game.state.galaxy[i][j].charted && game.state.galaxy[i][j].starbase)
                strcpy(buf, ".1.");
            else if (game.state.galaxy[i][j].charted)
-               sprintf(buf, "%d%d%d", game.state.chart[i][j].klingons, game.state.chart[i][j].starbase, game.state.chart[i][j].stars);
+               sprintf(buf, "%3d", game.state.chart[i][j].klingons*100 + game.state.chart[i][j].starbase * 10 + game.state.chart[i][j].stars);
            else
                strcpy(buf, "...");
-           for (cp = buf; cp < buf + sizeof(buf); cp++)
-               if (*cp == '0')
-                   *cp = '.';
            proutn(buf);
            if ((game.options & OPTION_SHOWME) && i == quadx && j == quady)
                proutn(">");
@@ -341,7 +337,7 @@ int srscan(int l)
            else
                prout("  [Using Base's sensors]");
        }
-       else proutn("     Short-range scan");
+       else prout("     Short-range scan");
        if (goodScan && !game.damage[DRADIO]) { 
            game.state.chart[quadx][quady].klingons = game.state.galaxy[quadx][quady].klingons;
            game.state.chart[quadx][quady].starbase = game.state.galaxy[quadx][quady].starbase;
@@ -352,7 +348,7 @@ int srscan(int l)
        if (isit("chart")) nn = TRUE;
        if (isit("no")) rightside = FALSE;
        chew();
-       proutn("    1 2 3 4 5 6 7 8 9 10\n");
+       prout("    1 2 3 4 5 6 7 8 9 10");
        break;
     case SCAN_REQUEST:
        while (scan() == IHEOL)
@@ -362,9 +358,9 @@ int srscan(int l)
            if (strncmp(citem,requests[req],min(2,strlen(citem)))==0)
                break;
        if (req > sizeof(requests)/sizeof(requests[0])) {
-           prout("UNRECOGNIZED REQUEST. Legal requests are:\n"
-                 "  date, condition, position, lsupport, warpfactor,\n"
-                 "  energy, torpedoes, shields, klingons, time, bases.");
+           prout("UNRECOGNIZED REQUEST. Legal requests are:");
+           prout("  date, condition, position, lsupport, warpfactor,");
+           prout("  energy, torpedoes, shields, klingons, time, bases.");
            return FALSE;
        }
        // no break
diff --git a/sst.c b/sst.c
index c2e02f5be68c6e83537a2ba709fbf5ca954421cf..2d454cbace8a96052649698ced7137770730ec8d 100644 (file)
--- a/sst.c
+++ b/sst.c
@@ -537,7 +537,7 @@ int main(int argc, char **argv)
     while (TRUE) { /* Play a game */
        setwnd(fullscreen_window);
 #ifdef DEBUG
-       prout("INITIAL OPTIONS: %0lx\n", game.options);
+       prout("INITIAL OPTIONS: %0lx", game.options);
 #endif /* DEBUG */
        clrscr();
        prelim();
diff --git a/sst.h b/sst.h
index c904feff5f974bc5ffb6a52b955e19d6249ea391..e186dc0ab97fe2abaf5f4179f2a86d028c6e4e33 100644 (file)
--- a/sst.h
+++ b/sst.h
@@ -479,7 +479,7 @@ void iostart(void);
 void setwnd(WINDOW *);
 void warble(void);
 void boom(int ii, int jj);
-void tracktorpedo(int ix, int iy, int l, int i, int n);
+void tracktorpedo(int ix, int iy, int l, int i, int n, int iquad);
 void cgetline(char *, int);
 void waitfor(void);
 void setpassword(void);