From 0494866db0a61c4111d1fb15836cea9b8c1a9d97 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 18 Feb 2005 03:53:35 +0000 Subject: [PATCH] Merge Stas's fixes to restore old behavior in the chart function and do the Mayday animation. Also get rid of literal \n and \r. --- battle.c | 2 +- io.c | 19 ++++++++++--------- moving.c | 29 +++++++++++++++++------------ planets.c | 3 ++- reports.c | 16 ++++++---------- sst.c | 2 +- sst.h | 2 +- 7 files changed, 38 insertions(+), 35 deletions(-) diff --git a/battle.c b/battle.c index 985774b..bd8070a 100644 --- 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 b3e974e..d341842 100644 --- 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); diff --git a/moving.c b/moving.c index 7dee9e5..b7afb93 100644 --- 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; } diff --git a/planets.c b/planets.c index 68bb27c..9e847eb 100644 --- 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(); diff --git a/reports.c b/reports.c index b074cd8..f169c15 100644 --- 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 c2e02f5..2d454cb 100644 --- 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 c904fef..e186dc0 100644 --- 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); -- 2.31.1