From: Eric S. Raymond Date: Thu, 20 Jan 2005 07:23:49 +0000 (+0000) Subject: Merge some more SERGEEV stuff. X-Git-Tag: 2.0~416 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=1072751ee59a11b65fe84d0314fee4bbcf14990e;p=super-star-trek.git Merge some more SERGEEV stuff. --- diff --git a/planets.c b/planets.c index eed3210..a9ec295 100644 --- a/planets.c +++ b/planets.c @@ -58,7 +58,6 @@ void preport(void) { void orbit(void) { skip(1); chew(); - ididit=0; if (inorbit!=0) { prout("Already in standard orbit."); return; @@ -114,7 +113,7 @@ void beam(void) { prout("Transporter damaged."); if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) { skip(1); - prout("Spock- \"May I suggest the shuttle craft, Sir?\" "); + proutn("Spock- \"May I suggest the shuttle craft, Sir?\" "); if (ja() != 0) shuttle(); } return; diff --git a/setup.c b/setup.c index 55db1d9..9de1a95 100644 --- a/setup.c +++ b/setup.c @@ -1,12 +1,24 @@ #include #include "sst.h" +#ifdef SERGEEV +#ifdef __linux__ +static long filelength(int fd) { +struct stat buf; + fstat(fd, &buf); + return buf.st_size; +} +#endif +#endif /* SERGEEV */ + void prelim(void) { skip(2); prout("-SUPER- STAR TREK"); skip(1); +#ifndef SERGEEV prout("Latest update-21 Sept 78"); skip(1); +#endif /* SERGEEV */ } void freeze(int boss) { diff --git a/sst.c b/sst.c index 330d8de..3567c25 100644 --- a/sst.c +++ b/sst.c @@ -35,9 +35,9 @@ Here are Tom Almy's changes: 1. Better base positioning at startup - 2. deathray improvement (but keeping original failure alternatives) + 2. Deathray improvement (but keeping original failure alternatives) - 3. Tholian Web + 3. Tholian Web. 4. Enemies can ram the Enterprise. Regular Klingons and Romulans can move in Expert and Emeritus games. This code could use improvement. @@ -47,7 +47,7 @@ Here are Tom Almy's changes: 6. Perhaps cloaking to be added later? BSD version Here are Stas Sergeev's changes (controlled by the proprocessor symbol -SERGEEV, not yet merged): +SERGEEV, not yet completely merged): 1. The Space Thingy can be shoved, if you it ram, and can fire back if fired upon. @@ -133,6 +133,21 @@ static void listCommands(int x) { if (x) prout(" HELP"); } +#ifdef SERGEEV +void setwnd(short wndnum){ + int cury; + cury=wherey()+wnds[curwnd].wndtop-wnds[wndnum].wndtop; + if ((curwnd==0)&&(wndnum!=0)) clrscr(); + window(wnds[wndnum].wndleft, wnds[wndnum].wndtop, wnds[wndnum].wndright, wnds[wndnum].wndbottom); + if ((curwnd==wndnum)&&(cury>wnds[wndnum].wndbottom-wnds[wndnum].wndtop+1)){ + gotoxy(wnds[wndnum].wndright-wnds[wndnum].wndleft+1,wnds[wndnum].wndbottom-wnds[wndnum].wndtop+1); + skip(1); + } + curwnd=wndnum; + gotoxy(1,cury); +} +#endif /* SERGEEV */ + static void helpme(void) { int i, j; char cmdbuf[32], *cp; @@ -143,9 +158,15 @@ static void helpme(void) { key = scan(); while (TRUE) { if (key == IHEOL) { - proutn("Help on what command?"); +#ifdef SERGEEV + setwnd(5); +#endif /* SERGEEV */ + proutn("Help on what command? "); key = scan(); } +#ifdef SERGEEV + setwnd(4); +#endif /* SERGEEV */ if (key == IHEOL) return; for (i = 0; i < NUMCOMMANDS; i++) { if (strcmp(commands[i], citem)==0) break; @@ -442,11 +463,17 @@ int main(int argc, char **argv) { freeze(FALSE); } } - proutn("Do you want to play again?"); + proutn("Do you want to play again? "); if (!ja()) break; +#ifdef SERGEEV + setwnd(0); + clrscr(); +#endif /* SERGEEV */ } skip(1); +#ifndef SERGEEV ioend(); +#endif /* SERGEEV */ puts("May the Great Bird of the Galaxy roost upon your home planet."); exit(0); } @@ -588,7 +615,7 @@ int ja(void) { chew(); if (*citem == 'y') return TRUE; if (*citem == 'n') return FALSE; - proutn("Please answer with \"Y\" or \"N\":"); + proutn("Please answer with \"Y\" or \"N\": "); } } diff --git a/sst.h b/sst.h index 0e198f4..0897783 100644 --- a/sst.h +++ b/sst.h @@ -438,3 +438,10 @@ void iostart(int); void ioend(void); void getline(char *, int); void commandhook(char *, int); + +#ifdef SERGEEV +typedef struct { + int wndleft,wndtop,wndright,wndbottom; +} wnd; +extern wnd wnds[6]; +#endif /* SERGEEV */