.c.obj:; bcc $(CFLAGS) -c $*.c\r
\r
OBJS= sst.obj setup.obj reports.obj finish.obj moving.obj\\r
- battle.obj events.obj ai.obj planets.obj\r
+ battle.obj events.obj ai.obj planets.obj io.o\r
\r
sst.exe: $(OBJS) sst.lnk\r
bcc @sst.lnk\r
\r
\r
sst.lnk: makefile\r
- >sst.lnk $(CFLAGS) -M $(OBJS) noeh$(MODEL).lib
\ No newline at end of file
+ >sst.lnk $(CFLAGS) -M $(OBJS) noeh$(MODEL).lib\r
#define INCLUDED // Define externs here\r
#include "sst.h"\r
#include <ctype.h>\r
-#include <stdarg.h>\r
-#ifdef MSDOS\r
-#include <dos.h>\r
-#endif\r
-#include <time.h>\r
\r
#ifndef SSTDOC\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
-\r
-static void clearscreen(void);\r
\r
/* Compared to original version, I've changed the "help" command to\r
"call" and the "terminate" command to "quit" to better match\r
int i;\r
int hitme;\r
char ch;\r
- prelim();\r
- char *LINES = getenv("LINES");\r
- \r
- if (LINES)\r
- screenheight = atoi(LINES);\r
\r
+ prelim(); \r
+ iostart();\r
line[0] = '\0';\r
if (argc > 1) {\r
while (--argc > 0) {\r
}\r
\r
void chew(void) {\r
- linecount = 0;\r
linep = line;\r
*linep = 0;\r
}\r
\r
void chew2(void) {\r
/* return IHEOL next time */\r
- linecount = 0;\r
linep = line+1;\r
*linep = 0;\r
}\r
int i;\r
char *cp;\r
\r
- linecount = 0;\r
-\r
// Init result\r
aaitem = 0.0;\r
*citem = 0;\r
\r
double square(double i) { return i*i; }\r
\r
-static void clearscreen(void) {\r
- /* Somehow we need to clear the screen */\r
-#ifdef __BORLANDC__\r
- extern void clrscr(void);\r
- clrscr();\r
-#else\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
- char buf[BUFSIZ];\r
- putchar('\n');\r
- if (i==1) {\r
- if (skill > 2)\r
- prout("[ANOUNCEMENT ARRIVING...]");\r
- else\r
- prout("[IMPORTANT ANNOUNCEMENT ARRIVING -- PRESS ENTER TO CONTINUE]");\r
- }\r
- else {\r
- if (skill > 2)\r
- proutn("[CONTINUE?]");\r
- else\r
- proutn("[PRESS ENTER TO CONTINUE]");\r
-\r
- }\r
- fgets(buf, sizeof(buf), stdin);\r
- if (i != 0) {\r
- clearscreen();\r
- }\r
- linecount = 0;\r
-}\r
-\r
-\r
-void skip(int i) {\r
- while (i-- > 0) {\r
- linecount++;\r
- if (linecount >= screenheight)\r
- pause(0);\r
- else\r
- putchar('\n');\r
- }\r
-}\r
-\r
-\r
-void proutn(char *fmt, ...) {\r
- va_list ap;\r
- va_start(ap, fmt);\r
- vprintf(fmt, ap);\r
- va_end(ap);\r
-}\r
-\r
-void prout(char *fmt, ...) {\r
- va_list ap;\r
- va_start(ap, fmt);\r
- vprintf(fmt, ap);\r
- va_end(ap);\r
- skip(1);\r
-}\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
- /* print slowly! */\r
- va_list ap;\r
- va_start(ap, fmt);\r
- vsprintf(buf, fmt, ap);\r
- va_end(ap);\r
- skip(1);\r
- for (s = buf; *s; s++) {\r
- endTime = clock() + CLOCKS_PER_SEC*0.05;\r
- while (clock() < endTime) ;\r
- putchar(*s);\r
- fflush(stdout);\r
- }\r
-}\r
-\r
void huh(void) {\r
chew();\r
skip(1);\r