Merge some more SERGEEV stuff.
[super-star-trek.git] / sst.c
diff --git a/sst.c b/sst.c
index b456772c5a9a058e5e71a61c1d5f7feaf7313c32..3567c2551b8aa14c25d622fdcc77a5de6d3097b4 100644 (file)
--- a/sst.c
+++ b/sst.c
@@ -35,10 +35,10 @@ Here are Tom Almy's changes:
 \r
    1. Better base positioning at startup\r
 \r
-   2. deathray improvement (but keeping original failure alternatives)\r
+   2. Deathray improvement (but keeping original failure alternatives)\r
+\r
+   3. Tholian Web.\r
 \r
-   3. Tholian Web\r
-s\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
@@ -47,7 +47,7 @@ s
    6. Perhaps cloaking to be added later? BSD version\r
 \r
 Here are Stas Sergeev's changes (controlled by the proprocessor symbol\r
-SERGEEV, not yet merged):\r
+SERGEEV, not yet completely merged):\r
 \r
    1. The Space Thingy can be shoved, if you it ram, and can fire back if \r
       fired upon.\r
@@ -78,7 +78,8 @@ SERGEEV, not yet merged):
        There are other minor adjustments to what yields an attack\r
        and what does not.\r
 \r
-    10. Ramming a black hole is no longer instant death.  \r
+    10. Ramming a black hole is no longer instant death.  There is a\r
+        chance you might get timewarped instead.\r
 \r
    */\r
 \r
@@ -132,6 +133,21 @@ static void listCommands(int x) {
        if (x) prout("   HELP");\r
 }\r
 \r
+#ifdef SERGEEV\r
+void setwnd(short wndnum){\r
+     int cury;\r
+     cury=wherey()+wnds[curwnd].wndtop-wnds[wndnum].wndtop;\r
+     if ((curwnd==0)&&(wndnum!=0)) clrscr();\r
+     window(wnds[wndnum].wndleft, wnds[wndnum].wndtop, wnds[wndnum].wndright, wnds[wndnum].wndbottom);\r
+     if ((curwnd==wndnum)&&(cury>wnds[wndnum].wndbottom-wnds[wndnum].wndtop+1)){\r
+        gotoxy(wnds[wndnum].wndright-wnds[wndnum].wndleft+1,wnds[wndnum].wndbottom-wnds[wndnum].wndtop+1);\r
+       skip(1);\r
+     }\r
+     curwnd=wndnum;\r
+     gotoxy(1,cury);\r
+}\r
+#endif /* SERGEEV */\r
+\r
 static void helpme(void) {\r
        int i, j;\r
        char cmdbuf[32], *cp;\r
@@ -142,9 +158,15 @@ static void helpme(void) {
        key = scan();\r
        while (TRUE) {\r
                if (key == IHEOL) {\r
-                       proutn("Help on what command?");\r
+#ifdef SERGEEV\r
+                        setwnd(5);\r
+#endif /* SERGEEV */\r
+                        proutn("Help on what command? ");\r
                        key = scan();\r
                }\r
+#ifdef SERGEEV\r
+                setwnd(4);\r
+#endif /* SERGEEV */\r
                if (key == IHEOL) return;\r
                for (i = 0; i < NUMCOMMANDS; i++) {\r
                        if (strcmp(commands[i], citem)==0) break;\r
@@ -199,9 +221,29 @@ static void helpme(void) {
        fclose(fp);\r
 }\r
 \r
+#ifdef SERGEEV\r
+void drawmaps(short l){\r
+     _setcursortype(_NOCURSOR);\r
+     if (l==1) sensor();\r
+     if (l!=2) setwnd(1);\r
+     gotoxy(1,1);\r
+     strcpy(line,"s");\r
+     srscan(1);\r
+     if (l!=2){\r
+        setwnd(2);\r
+        clrscr();\r
+        srscan(2);\r
+        setwnd(3);\r
+        clrscr();\r
+        strcpy(line,"l");\r
+        lrscan();\r
+        _setcursortype(_NORMALCURSOR);\r
+     }\r
+}\r
+#endif /* SERGEEV */\r
+\r
 static void makemoves(void) {\r
        int i, hitme;\r
-       char ch;\r
        while (TRUE) { /* command loop */\r
                hitme = FALSE;\r
                justin = 0;\r
@@ -385,9 +427,6 @@ static void makemoves(void) {
 \r
 int main(int argc, char **argv) {\r
     int i, option, usecurses = TRUE;\r
-       int hitme;\r
-       char ch;\r
-\r
        while ((option = getopt(argc, argv, "t")) != -1) {\r
            switch (option) {\r
            case 't':\r
@@ -424,12 +463,19 @@ int main(int argc, char **argv) {
                                freeze(FALSE);\r
                        }\r
                }\r
-               proutn("Do you want to play again?");\r
+               proutn("Do you want to play again? ");\r
                if (!ja()) break;\r
+#ifdef SERGEEV\r
+               setwnd(0);\r
+               clrscr();\r
+#endif /* SERGEEV */\r
        }\r
        skip(1);\r
+#ifndef SERGEEV\r
        ioend();\r
+#endif /* SERGEEV */\r
        puts("May the Great Bird of the Galaxy roost upon your home planet.");\r
+       exit(0);\r
 }\r
 \r
 \r
@@ -569,7 +615,7 @@ int ja(void) {
                chew();\r
                if (*citem == 'y') return TRUE;\r
                if (*citem == 'n') return FALSE;\r
-               proutn("Please answer with \"Y\" or \"N\":");\r
+               proutn("Please answer with \"Y\" or \"N\": ");\r
        }\r
 }\r
 \r