summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
404aca2)
and the ANSI-terminal assumption.
Super Star Trek TO-DO list
Super Star Trek TO-DO list
-* Yes-no confirmations and "press-to-continue" situations should print
- a recognizable standard prompt.
-
* The time machine switch. Specify a year, get only the features that
then existed. (This would be partly so people can try the original
non-"super" version Matuszek and Reynolds wrote.)
* The time machine switch. Specify a year, get only the features that
then existed. (This would be partly so people can try the original
non-"super" version Matuszek and Reynolds wrote.)
* Write a curses-based interface. Shouldn't be hard, all output goes through
prout/proutn/prouts so we can split the screen into two panes with the upper
* Write a curses-based interface. Shouldn't be hard, all output goes through
prout/proutn/prouts so we can split the screen into two panes with the upper
- one for the charts. (Note, there's one fputs() used in the help reader to
- avoid % expansion.)
-
-
#include <stdlib.h>
#include <time.h>
#include <stdlib.h>
#include <time.h>
void randomize(void) {
srand((int)time(NULL));
void randomize(void) {
srand((int)time(NULL));
-int getch(void) {
- char chbuf[1];
- struct termio oldstate, newstate;
- ioctl(0,TCGETA,&oldstate);
- newstate = oldstate;
- newstate.c_iflag = 0;
- newstate.c_lflag = 0;
- ioctl(0,TCSETA,&newstate);
- read(0, &chbuf, 1);
- ioctl(0,TCSETA,&oldstate);
-}
-
makehelp.py >sst.doc
sst-doc.html: sst-doc.xml
makehelp.py >sst.doc
sst-doc.html: sst-doc.xml
- xmlto --skip-validation xhhtml-nochunks sst-doc.xml
+ xmlto --skip-validation xhtml-nochunks sst-doc.xml
-install: sst.6 uninstall
+install: uninstall sst.6 sst.doc sst-doc.html
install -m 755 -o 0 -g 0 -d $(ROOT)/usr/bin/
install -m 755 -o 0 -g 0 sst $(ROOT)/usr/bin/sst
install -m 755 -o 0 -g 0 -d $(ROOT)/usr/share/man/man6/
install -m 755 -o 0 -g 0 -d $(ROOT)/usr/bin/
install -m 755 -o 0 -g 0 sst $(ROOT)/usr/bin/sst
install -m 755 -o 0 -g 0 -d $(ROOT)/usr/share/man/man6/
#include <stdlib.h>\r
#include <time.h>\r
#include <stdlib.h>\r
#include <time.h>\r
-#include <sys/ioctl.h>\r
-#include <sys/termio.h>\r
\r
void randomize(void) {\r
srand((int)time(NULL));\r
\r
void randomize(void) {\r
srand((int)time(NULL));\r
if (a < b) return a;\r
return b;\r
}\r
if (a < b) return a;\r
return b;\r
}\r
-\r
-int getch(void) {\r
- char chbuf[1];\r
- struct termio oldstate, newstate;\r
- ioctl(0,TCGETA,&oldstate);\r
- newstate = oldstate;\r
- newgame.state.c_iflag = 0;\r
- newgame.state.c_lflag = 0;\r
- ioctl(0,TCSETA,&newstate);\r
- read(0, &chbuf, 1);\r
- ioctl(0,TCSETA,&oldstate);\r
-}
\ No newline at end of file
+void setup(int needprompt) {\r
int i,j, krem, klumper;\r
int ix, iy;\r
alldone = gamewon = 0;\r
int i,j, krem, klumper;\r
int ix, iy;\r
alldone = gamewon = 0;\r
idebug = 0;\r
#endif\r
// Decide how many of everything\r
idebug = 0;\r
#endif\r
// Decide how many of everything\r
- if (choose()) return; // frozen game\r
+ if (choose(needprompt)) return; // frozen game\r
// Prepare the Enterprise\r
ship = IHE;\r
energy = inenrg = 5000.0;\r
// Prepare the Enterprise\r
ship = IHE;\r
energy = inenrg = 5000.0;\r
proutn(cramlc(sector, sectx, secty));\r
skip(2);\r
prout("Good Luck!");\r
proutn(cramlc(sector, sectx, secty));\r
skip(2);\r
prout("Good Luck!");\r
- if (game.state.nscrem) proutn(" YOU'LL NEED IT.");\r
- skip(1);\r
+ if (game.state.nscrem) prout(" YOU'LL NEED IT.");\r
newqad(0);\r
if (nenhere) shldup=1.0;\r
if (neutz) attack(0); // bad luck to start in a Romulan Neutral Zone\r
}\r
\r
newqad(0);\r
if (nenhere) shldup=1.0;\r
if (neutz) attack(0); // bad luck to start in a Romulan Neutral Zone\r
}\r
\r
+int choose(int needprompt) {\r
tourn = 0;\r
thawed = 0;\r
skill = 0;\r
length = 0;\r
while (TRUE) {\r
tourn = 0;\r
thawed = 0;\r
skill = 0;\r
length = 0;\r
while (TRUE) {\r
- if (fromcommandline) /* Can start with command line options */\r
- fromcommandline = 0;\r
- else\r
- proutn("Would you like a regular, tournament, or frozen game?");\r
+ if (needprompt) /* Can start with command line options */\r
+ proutn("Would you like a regular, tournament, or frozen game?");\r
scan();\r
if (strlen(citem)==0) continue; // Try again\r
if (isit("tournament")) {\r
scan();\r
if (strlen(citem)==0) continue; // Try again\r
if (isit("tournament")) {\r
#define SSTDOC "sst.doc"\r
#endif\r
\r
#define SSTDOC "sst.doc"\r
#endif\r
\r
static char line[128], *linep = line;\r
static int linecount; /* for paging */\r
static int screenheight = 24;\r
static char line[128], *linep = line;\r
static int linecount; /* for paging */\r
static int screenheight = 24;\r
2. deathray improvement (but keeping original failure alternatives)\r
\r
3. Tholian Web\r
2. deathray improvement (but keeping original failure alternatives)\r
\r
3. Tholian Web\r
4. Enemies can ram the Enterprise. Regular Klingons and Romulans can\r
move in Expert and Emeritus games. This code could use improvement.\r
\r
4. Enemies can ram the Enterprise. Regular Klingons and Romulans can\r
move in Expert and Emeritus games. This code could use improvement.\r
\r
while (fgets(linebuf, sizeof(linebuf),fp)) {\r
if (strstr(linebuf, "******"))\r
break;\r
while (fgets(linebuf, sizeof(linebuf),fp)) {\r
if (strstr(linebuf, "******"))\r
break;\r
- /* use fputs here to avoid % expansion */\r
- fputs(linebuf, stdout);\r
if (LINES)\r
screenheight = atoi(LINES);\r
\r
if (LINES)\r
screenheight = atoi(LINES);\r
\r
- fromcommandline = 1;\r
- line[0] = '\0';\r
while (--argc > 0) {\r
strcat(line, *(++argv));\r
strcat(line, " ");\r
}\r
}\r
while (--argc > 0) {\r
strcat(line, *(++argv));\r
strcat(line, " ");\r
}\r
}\r
- else fromcommandline = 0;\r
-\r
\r
while (TRUE) { /* Play a game */\r
\r
while (TRUE) { /* Play a game */\r
+ setup(line[0] == '\0');\r
if (alldone) {\r
score();\r
alldone = 0;\r
if (alldone) {\r
score();\r
alldone = 0;\r
extern void clrscr(void);\r
clrscr();\r
#else\r
extern void clrscr(void);\r
clrscr();\r
#else\r
- proutn("\033[2J"); /* Hope for an ANSI display */\r
+ // proutn("\033[2J"); /* Hope for an ANSI display */\r
+ /* much more in that old-time TTY spirit to just throw linefeeds */\r
+ int i;\r
+ for (i = 0; i < screenheight; i++)\r
+ putchar('\n');\r
#endif\r
}\r
\r
/* We will pull these out in case we want to do something special later */\r
\r
void pause(int i) {\r
#endif\r
}\r
\r
/* We will pull these out in case we want to do something special later */\r
\r
void pause(int i) {\r
putchar('\n');\r
if (i==1) {\r
if (skill > 2)\r
prout("[ANOUNCEMENT ARRIVING...]");\r
else\r
putchar('\n');\r
if (i==1) {\r
if (skill > 2)\r
prout("[ANOUNCEMENT ARRIVING...]");\r
else\r
- prout("[IMPORTANT ANNOUNCEMENT ARRIVING -- HIT SPACE BAR TO CONTINUE]");\r
- getch();\r
+ prout("[IMPORTANT ANNOUNCEMENT ARRIVING -- PRESS ENTER TO CONTINUE]");\r
- if (skill > 2)\r
- proutn("[CONTINUE?]");\r
- else\r
- proutn("[HIT SPACE BAR TO CONTINUE]");\r
- getch();\r
- proutn("\r \r");\r
+ if (skill > 2)\r
+ proutn("[CONTINUE?]");\r
+ else\r
+ proutn("[PRESS ENTER TO CONTINUE]");\r
+\r
+ fgets(buf, sizeof(buf), stdin);\r
if (i != 0) {\r
clearscreen();\r
}\r
if (i != 0) {\r
clearscreen();\r
}\r
+void proutc(char *line) {\r
+ line[strlen(line)-1] = '\0';\r
+ fputs(line, stdout);\r
+ skip(1);\r
+}\r
+\r
void prouts(char *fmt, ...) {\r
clock_t endTime;\r
char *s, buf[BUFSIZ];\r
void prouts(char *fmt, ...) {\r
clock_t endTime;\r
char *s, buf[BUFSIZ];\r
#define nprobes game.nprobes // number of probes available\r
\r
/* the following global state doesn't need to be saved */\r
#define nprobes game.nprobes // number of probes available\r
\r
/* the following global state doesn't need to be saved */\r
-EXTERN int fromcommandline; // Game start from command line options\r
EXTERN char *device[NDEVICES+1];\r
EXTERN int iscore, iskill; // Common PLAQ\r
EXTERN double perdate;\r
EXTERN char *device[NDEVICES+1];\r
EXTERN int iscore, iskill; // Common PLAQ\r
EXTERN double perdate;\r
/* Function prototypes */\r
void prelim(void);\r
void attack(int);\r
/* Function prototypes */\r
void prelim(void);\r
void attack(int);\r
-int choose(void);\r
-void setup(void);\r
+int choose(int);\r
+void setup(int);\r
void score(void);\r
void atover(int);\r
void srscan(int);\r
void score(void);\r
void atover(int);\r
void srscan(int);\r
void scom(int *);\r
void hittem(double *);\r
void prouts(char *, ...);\r
void scom(int *);\r
void hittem(double *);\r
void prouts(char *, ...);\r
int isit(char *);\r
void preport(void);\r
void orbit(void);\r
int isit(char *);\r
void preport(void);\r
void orbit(void);\r
url='http://sst.berlios.de/sst-doc.html'>browseable</ulink>. On
systems where <filename>/usr/share/doc/sst/</filename> is a legal
filename, it will probably be installed there as well.</para>
url='http://sst.berlios.de/sst-doc.html'>browseable</ulink>. On
systems where <filename>/usr/share/doc/sst/</filename> is a legal
filename, it will probably be installed there as well.</para>
+
+<para>Input tokens for the setup prompts will be read from the command
+line before standard input. Thus, for example, you can invoke the
+program as</para>
+
+<programlisting>
+sst regular medium good foobar
+</programlisting>
+
+<para>to start a regular medium game as a good player
+with password "foobar".</para>
</refsect1>
<refsect1 id='authors'><title>AUTHORS</title> <para>Super Star Trek
</refsect1>
<refsect1 id='authors'><title>AUTHORS</title> <para>Super Star Trek