Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. #include <ctype.h>
  3. #ifdef MSDOS
  4. #include <dos.h>
  5. #endif
  6.  
  7. #ifndef KOS32
  8. #include <time.h>
  9. #else
  10. #include <conio.h>
  11. #include <kos32sys1.h>
  12. #endif
  13.  
  14. #define INCLUDED        // Define externs here
  15. #include "sst.h"
  16.        
  17. /*int getch(void);
  18. */
  19.  
  20. static char line[128], *linep = line;
  21. static int linecount;   /* for paging */
  22.  
  23. static void clearscreen(void);
  24.  
  25. /* Compared to original version, I've changed the "help" command to
  26.    "call" and the "terminate" command to "quit" to better match
  27.    user expectations. The DECUS version apparently made those changes
  28.    as well as changing "freeze" to "save". However I like "freeze".
  29.  
  30.    When I got a later version of Super Star Trek that I was converting
  31.    from, I added the emexit command.
  32.  
  33.    That later version also mentions srscan and lrscan working when
  34.    docked (using the starbase's scanners), so I made some changes here
  35.    to do this (and indicating that fact to the player), and then realized
  36.    the base would have a subspace radio as well -- doing a Chart when docked
  37.    updates the star chart, and all radio reports will be heard. The Dock
  38.    command will also give a report if a base is under attack.
  39.  
  40.    Movecom no longer reports movement if sensors are damaged so you wouldn't
  41.    otherwise know it.
  42.  
  43.    Also added:
  44.  
  45.    1. Better base positioning at startup
  46.  
  47.    2. deathray improvement (but keeping original failure alternatives)
  48.  
  49.    3. Tholian Web
  50.  
  51.    4. Enemies can ram the Enterprise. Regular Klingons and Romulans can
  52.       move in Expert and Emeritus games. This code could use improvement.
  53.  
  54.    5. The deep space probe looks interesting! DECUS version
  55.  
  56.    6. Cloaking (with contributions from Erik Olofsen) and Capturing (BSD version).
  57.  
  58.    */
  59.  
  60. // I don't like the way this is done, relying on an index. But I don't
  61. // want to invest the time to make this nice and table driven.
  62.  
  63. static char *commands[] = {
  64.         "srscan",
  65.         "lrscan",
  66.         "phasers",
  67.         "photons",
  68.         "move",
  69.         "shields",
  70.         "dock",
  71.         "damages",
  72.         "chart",
  73.         "impulse",
  74.         "rest",
  75.         "warp",
  76.         "status",
  77.         "sensors",
  78.         "orbit",
  79.         "transport",
  80.         "mine",
  81.         "crystals",
  82.         "shuttle",
  83.         "planets",
  84.         "request",
  85.         "report",
  86.         "computer",
  87.         "commands",
  88.     "emexit",
  89.     "probe",
  90.     "cloak",
  91.     "capture",
  92.     "score",
  93.         "abandon",
  94.         "destruct",
  95.         "freeze",
  96.         "deathray",
  97.         "debug",
  98.         "call",
  99.         "quit",
  100.     "help"
  101.  
  102. };
  103.  
  104. #define NUMCOMMANDS (sizeof(commands)/sizeof(char *))
  105.  
  106. static void listCommands(int x) {
  107.         prout("   SRSCAN    MOVE      PHASERS   CALL\n"
  108.                   "   STATUS    IMPULSE   PHOTONS   ABANDON\n"
  109.                   "   LRSCAN    WARP      SHIELDS   DESTRUCT\n"
  110.                   "   CHART     REST      DOCK      QUIT\n"
  111.                   "   DAMAGES   REPORT    SENSORS   ORBIT\n"
  112.                   "   TRANSPORT MINE      CRYSTALS  SHUTTLE\n"
  113.                   "   PLANETS   REQUEST   DEATHRAY  FREEZE\n"
  114.           "   COMPUTER  EMEXIT    PROBE     COMMANDS");
  115.     proutn("   ");
  116. #ifdef SCORE
  117.     proutn("SCORE     ");
  118. #endif
  119. #ifdef CLOAKING
  120.     proutn("CLOAK     ");
  121. #endif
  122. #ifdef CAPTURE
  123.     proutn("CAPTURE   ");
  124. #endif
  125.     if (x) proutn("HELP     ");
  126.     prout("");
  127. }
  128.  
  129. static void helpme(void) {
  130.         int i, j;
  131.         char cmdbuf[32];
  132.         char linebuf[132];
  133.         FILE *fp;
  134.         /* Give help on commands */
  135.         int key;
  136.         key = scan();
  137.         while (TRUE) {
  138.                 if (key == IHEOL) {
  139.                         proutn("Help on what command?");
  140.                         key = scan();
  141.                 }
  142.                 if (key == IHEOL) return;
  143.                 for (i = 0; i < NUMCOMMANDS; i++) {
  144.                         if (strcmp(commands[i], citem)==0) break;
  145.                 }
  146.                 if (i != NUMCOMMANDS) break;
  147.                 skip(1);
  148.                 prout("Valid commands:");
  149.                 listCommands(FALSE);
  150.                 key = IHEOL;
  151.                 chew();
  152.                 skip(1);
  153.         }
  154.         if (i == 23) {
  155.                 strcpy(cmdbuf, " ABBREV");
  156.         }
  157.         else {
  158.                 strcpy(cmdbuf, "  Mnemonic:  ");
  159.                 j = 0;
  160.                 while ((cmdbuf[j+13] = toupper(commands[i][j])) != 0) j++;
  161.         }
  162.         fp = fopen("sst.doc", "r");
  163.         if (fp == NULL) {
  164.                 prout("Spock-  \"Captain, that information is missing from the");
  165.                 prout("   computer. You need to find SST.DOC and put it in the");
  166.                 prout("   current directory.\"");
  167.                 return;
  168.         }
  169.         i = strlen(cmdbuf);
  170.         do {
  171.                 if (fgets(linebuf, 132, fp) == NULL) {
  172.                         prout("Spock- \"Captain, there is no information on that command.\"");
  173.                         fclose(fp);
  174.                         return;
  175.                 }
  176.         } while (strncmp(linebuf, cmdbuf, i) != 0);
  177.  
  178.         skip(1);
  179.         prout("Spock- \"Captain, I've found the following information:\"");
  180.         skip(1);
  181.  
  182.         do {
  183.                 if (linebuf[0]!=12) { // ignore page break lines
  184.                         linebuf[strlen(linebuf)-1] = '\0'; // No \n at end
  185.                         prout(linebuf);
  186.                 }
  187.                 fgets(linebuf,132,fp);
  188.         } while (strstr(linebuf, "******")==NULL);
  189.         fclose(fp);
  190. }
  191.  
  192. static void makemoves(void) {
  193.         int i, hitme;
  194.         char ch;
  195.         while (TRUE) { /* command loop */
  196.                 hitme = FALSE;
  197.                 justin = 0;
  198.                 Time = 0.0;
  199.                 i = -1;
  200.                 while (TRUE)  { /* get a command */
  201.                         chew();
  202.                         skip(1);
  203.                         proutn("COMMAND> ");
  204.                         if (scan() == IHEOL) continue;
  205.                         for (i=0; i < 29; i++) // Abbreviations allowed for the first 29 commands, only.
  206.                                 if (isit(commands[i]))
  207.                                         break;
  208.                         if (i < 29) break;
  209.                         for (; i < NUMCOMMANDS; i++)
  210.                                 if (strcmp(commands[i], citem) == 0) break;
  211.                         if (i < NUMCOMMANDS
  212. #ifndef CLOAKING
  213.                             && i != 26 // ignore the CLOAK command
  214. #endif
  215. #ifndef CAPTURE
  216.                             && i != 27 // ignore the CAPTURE command
  217. #endif
  218. #ifndef SCORE
  219.                             && i != 28 // ignore the SCORE command
  220. #endif
  221. #ifndef DEBUG
  222.                             && i != 33 // ignore the DEBUG command
  223. #endif
  224.                            ) break;
  225.  
  226.                         if (skill <= SFAIR)  {
  227.                                 prout("UNRECOGNIZED COMMAND. LEGAL COMMANDS ARE:");
  228.                                 listCommands(TRUE);
  229.                         }
  230.                         else prout("UNRECOGNIZED COMMAND.");
  231.                 }
  232.                 switch (i) { /* command switch */
  233.                         case 0:                 // srscan
  234.                                 srscan(1);
  235.                                 break;
  236.                         case 1:                 // lrscan
  237.                                 lrscan();
  238.                                 break;
  239.                         case 2:                 // phasers
  240.                                 phasers();
  241.                 if (ididit) {
  242. #ifdef CLOAKING
  243.                     if (irhere && d.date >= ALGERON && !isviolreported && iscloaked) {
  244.                         prout("The Romulan ship discovers you are breaking the Treaty of Algeron!");
  245.                         ncviol++;
  246.                         isviolreported = TRUE;
  247.                     }
  248. #endif
  249.                     hitme = TRUE;
  250.                 }
  251.                                 break;
  252.                         case 3:                 // photons
  253.                                 photon();
  254.                 if (ididit) {
  255. #ifdef CLOAKING
  256.                     if (irhere && d.date >= ALGERON && !isviolreported && iscloaked) {
  257.                         prout("The Romulan ship discovers you are breaking the Treaty of Algeron!");
  258.                         ncviol++;
  259.                         isviolreported = TRUE;
  260.                     }
  261. #endif
  262.                     hitme = TRUE;
  263.                 }
  264.                                 break;
  265.                         case 4:                 // move
  266.                                 warp(1);
  267.                                 break;
  268.                         case 5:                 // shields
  269.                                 sheild(1);
  270.                                 if (ididit) {
  271.                                         attack(2);
  272.                                         shldchg = 0;
  273.                                 }
  274.                                 break;
  275.                         case 6:                 // dock
  276.                                 dock();
  277.                                 break;
  278.                         case 7:                 // damages
  279.                                 dreprt();
  280.                                 break;
  281.                         case 8:                 // chart
  282.                                 chart(0);
  283.                                 break;
  284.                         case 9:                 // impulse
  285.                                 impuls();
  286.                                 break;
  287.                         case 10:                // rest
  288.                                 waiting();
  289.                                 if (ididit) hitme = TRUE;
  290.                                 break;
  291.                         case 11:                // warp
  292.                                 setwrp();
  293.                                 break;
  294.                         case 12:                // status
  295.                                 srscan(3);
  296.                                 break;
  297.                         case 13:                        // sensors
  298.                                 sensor();
  299.                                 break;
  300.                         case 14:                        // orbit
  301.                                 orbit();
  302.                                 if (ididit) hitme = TRUE;
  303.                                 break;
  304.                         case 15:                        // transport "beam"
  305.                                 beam();
  306.                                 break;
  307.                         case 16:                        // mine
  308.                                 mine();
  309.                                 if (ididit) hitme = TRUE;
  310.                                 break;
  311.                         case 17:                        // crystals
  312.                                 usecrystals();
  313.                                 break;
  314.                         case 18:                        // shuttle
  315.                                 shuttle();
  316.                                 if (ididit) hitme = TRUE;
  317.                                 break;
  318.                         case 19:                        // Planet list
  319.                                 preport();
  320.                                 break;
  321.                         case 20:                        // Status information
  322.                                 srscan(2);
  323.                                 break;
  324.                         case 21:                        // Game Report
  325.                                 report(0);
  326.                                 break;
  327.                         case 22:                        // use COMPUTER!
  328.                                 eta();
  329.                                 break;
  330.                         case 23:
  331.                                 listCommands(TRUE);
  332.                                 break;
  333.                         case 24:                // Emergency exit
  334.                                 clearscreen();  // Hide screen
  335.                                 freeze(TRUE);   // forced save
  336. #ifdef KOS32
  337.                                 con_exit(1);
  338. #endif                         
  339.                                 exit(1);                // And quick exit
  340.                                 break;
  341.                         case 25:
  342.                                 probe();                // Launch probe
  343.                                 break;
  344. #ifdef CLOAKING
  345.                         case 26:
  346.                                 cloak();        // turn on/off cloaking
  347.                                 if (iscloaking) {
  348.                                         attack(2); // We will be seen while we cloak
  349.                                         iscloaking = FALSE;
  350.                                         iscloaked = TRUE;
  351.                                 }
  352.                                 break;
  353. #endif
  354. #ifdef CAPTURE
  355.                         case 27:
  356.                                 capture();      // Attempt to get Klingon ship to surrender
  357.                                 if (ididit) hitme = TRUE;
  358.                                 break;
  359. #endif
  360. #ifdef SCORE
  361.                         case 28:
  362.                                 score(1);    // get the score
  363.                                 break;
  364. #endif
  365.                         case 29:                        // Abandon Ship
  366.                                 abandn();
  367.                                 break;
  368.                         case 30:                        // Self Destruct
  369.                                 dstrct();
  370.                                 break;
  371.                         case 31:                        // Save Game
  372.                                 freeze(FALSE);
  373.                                 if (skill > SGOOD)
  374.                                         prout("WARNING--Frozen games produce no plaques!");
  375.                                 break;
  376.                         case 32:                        // Try a desparation measure
  377.                                 deathray();
  378.                                 if (ididit) hitme = TRUE;
  379.                                 break;
  380. #ifdef DEBUG
  381.                         case 33:                        // What do we want for debug???
  382.                                 debugme();
  383.                                 break;
  384. #endif
  385.                         case 34:                // Call for help
  386.                                 help();
  387.                                 break;
  388.                         case 35:
  389.                                 alldone = 1;    // quit the game
  390. #ifdef DEBUG
  391.                                 if (idebug) score(0);
  392. #endif
  393.                                 break;
  394.                         case 36:
  395.                                 helpme();       // get help
  396.                                 break;
  397.                 }
  398.                 for (;;) {
  399.                         if (alldone) break;             // Game has ended
  400. #ifdef DEBUG
  401.                         if (idebug) prout("2500");
  402. #endif
  403.                         if (Time != 0.0) {
  404.                                 events();
  405.                                 if (alldone) break;             // Events did us in
  406.                         }
  407.                         if (d.galaxy[quadx][quady] == 1000) { // Galaxy went Nova!
  408.                                 atover(0);
  409.                                 continue;
  410.                         }
  411.                         if (nenhere == 0) movetho();
  412.                         if (hitme && justin==0) {
  413.                                 attack(2);
  414.                                 if (alldone) break;
  415.                                 if (d.galaxy[quadx][quady] == 1000) {   // went NOVA!
  416.                                         atover(0);
  417.                                         hitme = TRUE;
  418.                                         continue;
  419.                                 }
  420.                         }
  421.                         break;
  422.                 }
  423.                 if (alldone) break;
  424.         }
  425. }
  426.  
  427.  
  428. int main(int argc, char **argv) {
  429.         int i;
  430.         int hitme;
  431.         char ch;
  432.        
  433. #ifdef KOS32
  434.         if (con_init_console_dll()) return 1; // init fail
  435.         con_set_title("-SUPER- STAR TREK");
  436.         con_set_flags(CON_COLOR_GREEN);
  437. #endif 
  438.        
  439.         prelim();
  440.  
  441.         if (argc > 1) { // look for -f option
  442.                 if (strcmp(argv[1], "-f")== 0) {
  443.                         coordfixed = 1;
  444.                         argc--;
  445.                         argv++;
  446.                 }
  447.         }
  448.                                        
  449.        
  450.         if (argc > 1) {
  451.                 fromcommandline = 1;
  452.                 line[0] = '\0';
  453.                 while (--argc > 0) {
  454.                         strcat(line, *(++argv));
  455.                         strcat(line, " ");
  456.                 }
  457.         }
  458.         else fromcommandline = 0;
  459.  
  460.  
  461.         while (TRUE) { /* Play a game */
  462.                 setup();
  463.                 if (alldone) {
  464.                         score(0);
  465.                         alldone = 0;
  466.                 }
  467.                 else makemoves();
  468.                 skip(2);
  469.                 stars();
  470.                 skip(1);
  471.  
  472.                 if (tourn && alldone) {
  473.                         printf("Do you want your score recorded?");
  474.                         if (ja()) {
  475.                                 chew2();
  476.                                 freeze(FALSE);
  477.                         }
  478.                 }
  479.                 printf("Do you want to play again?");
  480.                 if (!ja()) break;
  481.         }
  482.         skip(1);
  483.         prout("May the Great Bird of the Galaxy roost upon your home planet.");
  484.         return 0;
  485. }
  486.  
  487.  
  488. void cramen(int i) {
  489.         /* return an enemy */
  490.         char *s;
  491.        
  492.         switch (i) {
  493.                 case IHR: s = "Romulan"; break;
  494.                 case IHK: s = "Klingon"; break;
  495.                 case IHC: s = "Commander"; break;
  496.                 case IHS: s = "Super-commander"; break;
  497.                 case IHSTAR: s = "Star"; break;
  498.                 case IHP: s = "Planet"; break;
  499.                 case IHB: s = "Starbase"; break;
  500.                 case IHBLANK: s = "Black hole"; break;
  501.                 case IHT: s = "Tholean"; break;
  502.                 case IHWEB: s = "Tholean web"; break;
  503.                 default: s = "Unknown??"; break;
  504.         }
  505.         proutn(s);
  506. }
  507.  
  508. void cramlc(int key, int x, int y) {
  509.         if (key == 1) proutn(" Quadrant");
  510.         else if (key == 2) proutn(" Sector");
  511.         proutn(" ");
  512.         crami(x, 1);
  513.         proutn(" - ");
  514.         crami(y, 1);
  515. }
  516.  
  517. void crmena(int i, int enemy, int key, int x, int y) {
  518.         if (i == 1) proutn("***");
  519.         cramen(enemy);
  520.         proutn(" at");
  521.         cramlc(key, x, y);
  522. }
  523.  
  524. void crmshp(void) {
  525.         char *s;
  526.         switch (ship) {
  527.                 case IHE: s = "Enterprise"; break;
  528.                 case IHF: s = "Faerie Queene"; break;
  529.                 default:  s = "Ship???"; break;
  530.         }
  531.         proutn(s);
  532. }
  533.  
  534. void stars(void) {
  535.         prouts("******************************************************");
  536.         skip(1);
  537. }
  538.  
  539. double expran(double avrage) {
  540.         return -avrage*log(1e-7 + Rand());
  541. }
  542.  
  543. double Rand(void) {
  544.         return rand()/(1.0 + (double)RAND_MAX);
  545. }
  546.  
  547. void iran8(int *i, int *j) {
  548.         *i = Rand()*8.0 + 1.0;
  549.         *j = Rand()*8.0 + 1.0;
  550. }
  551.  
  552. void iran10(int *i, int *j) {
  553.         *i = Rand()*10.0 + 1.0;
  554.         *j = Rand()*10.0 + 1.0;
  555. }
  556.  
  557. void chew(void) {
  558.         linecount = 0;
  559.         linep = line;
  560.         *linep = 0;
  561. }
  562.  
  563. void chew2(void) {
  564.         /* return IHEOL next time */
  565.         linecount = 0;
  566.         linep = line+1;
  567.         *linep = 0;
  568. }
  569.  
  570. int scan(void) {
  571.         int i;
  572.         char *cp;
  573.  
  574.         linecount = 0;
  575.  
  576.         // Init result
  577.         aaitem = 0.0;
  578.         *citem = 0;
  579.  
  580.         // Read a line if nothing here
  581.         if (*linep == 0) {
  582.                 if (linep != line) {
  583.                         chew();
  584.                         return IHEOL;
  585.                 }
  586. #ifdef KOS32
  587.                 cp = gets(line);
  588.                 if (!cp) exit();
  589. #else
  590.                 // We should really be using fgets
  591.                 fgets(line,sizeof(line),stdin);
  592. #endif
  593.                 if (line[strlen(line)-1] == '\n')
  594.                         line[strlen(line)-1] = '\0';
  595.                 linep = line;
  596.         }
  597.         // Skip leading white space
  598.         while (*linep == ' ') linep++;
  599.         // Nothing left
  600.         if (*linep == 0) {
  601.                 chew();
  602.                 return IHEOL;
  603.         }
  604.         if (isdigit(*linep) || *linep=='+' || *linep=='-' || *linep=='.') {
  605.                 // treat as a number
  606.             if (sscanf(linep, "%lf%n", &aaitem, &i) < 1) {
  607.                 linep = line; // Invalid numbers are ignored
  608.                 *linep = 0;
  609.                 return IHEOL;
  610.             }
  611.             else {
  612.                 // skip to end
  613.                 linep += i;
  614.                 return IHREAL;
  615.             }
  616.         }
  617.         // Treat as alpha
  618.         cp = citem;
  619.         while (*linep && *linep!=' ') {
  620.                 if ((cp - citem) < 9) *cp++ = tolower(*linep);
  621.                 linep++;
  622.         }
  623.         *cp = 0;
  624.         return IHALPHA;
  625. }
  626.  
  627. int ja(void) {
  628.         chew();
  629.         while (TRUE) {
  630.                 scan();
  631.                 chew();
  632.                 if (*citem == 'y') return TRUE;
  633.                 if (*citem == 'n') return FALSE;
  634.                 proutn("Please answer with \"Y\" or \"N\":");
  635.         }
  636. }
  637.  
  638. void cramf(double x, int w, int d) {
  639.         char buf[64];
  640.         sprintf(buf, "%*.*f", w, d, x);
  641.         proutn(buf);
  642. }
  643.  
  644. void crami(int i, int w) {
  645.         char buf[16];
  646.         sprintf(buf, "%*d", w, i);
  647.         proutn(buf);
  648. }
  649.  
  650. double square(double i) { return i*i; }
  651.                                                                        
  652. static void clearscreen(void) {
  653.         /* Somehow we need to clear the screen */
  654.         proutn("\033[2J\033[0;0H");     /* Hope for an ANSI display */
  655. }
  656.  
  657. /* We will pull these out in case we want to do something special later */
  658.  
  659. void pause(int i) {
  660. #ifdef CLOAKING
  661.         if (iscloaked) return;
  662. #endif
  663.         putchar('\n');
  664.         if (i==1) {
  665.                 if (skill > SFAIR)
  666.                         prout("[ANNOUNCEMENT ARRIVING...]");
  667.                 else
  668.                         prout("[IMPORTANT ANNOUNCEMENT ARRIVING -- HIT ENTER TO CONTINUE]");
  669.                 getchar();
  670.         }
  671.         else {
  672.                 if (skill > SFAIR)
  673.                         proutn("[CONTINUE?]");
  674.                 else
  675.                         proutn("[HIT ENTER TO CONTINUE]");
  676.                 getchar();
  677.                 proutn("\r                           \r");
  678.         }
  679.         if (i != 0) {
  680.                 clearscreen();
  681.         }
  682.     linecount = 0;
  683. }
  684.  
  685.  
  686. void skip(int i) {
  687.         while (i-- > 0) {
  688.                 linecount++;
  689.                 if (linecount >= 23)
  690.                         pause(0);
  691.                 else
  692.                         putchar('\n');
  693.         }
  694. }
  695.  
  696.  
  697. void proutn(char *s) {
  698. #ifndef KOS32
  699.         fputs(s, stdout);
  700. #else
  701.         con_write_asciiz(s);
  702. #endif
  703. }
  704.  
  705. void prout(char *s) {
  706.         proutn(s);
  707.         skip(1);
  708. }
  709.  
  710. void prouts(char *s) {
  711. #ifdef KOS32
  712. #define clock_t long int
  713. #define clock() get_tick_count()
  714. #define CLOCKS_PER_SEC 100
  715. #endif
  716.  
  717.         clock_t endTime;
  718.         /* print slowly! */
  719.         while (*s) {
  720.                 endTime = clock() + CLOCKS_PER_SEC*0.05;
  721.                 while (clock() < endTime) ;
  722.                 putchar(*s++);
  723. #ifndef KOS32
  724.                 fflush(stdout);
  725. #endif
  726.         }
  727. }
  728.  
  729. void huh(void) {
  730.         chew();
  731.         skip(1);
  732.         prout("Beg your pardon, Captain?");
  733. }
  734.  
  735. int isit(char *s) {
  736.         /* New function -- compares s to scaned citem and returns true if it
  737.            matches to the length of s */
  738.  
  739.         return strncmp(s, citem, max(1, strlen(citem))) == 0;
  740.  
  741. }
  742.  
  743. #ifdef DEBUG
  744. void debugme(void) {
  745.         proutn("Reset levels? ");
  746.         if (ja() != 0) {
  747.                 if (energy < inenrg) energy = inenrg;
  748.                 shield = inshld;
  749.                 torps = intorps;
  750.                 lsupres = inlsr;
  751.         }
  752.         proutn("Reset damage? ");
  753.         if (ja() != 0) {
  754.                 int i;
  755.                 for (i=0; i <= ndevice; i++) if (damage[i] > 0.0) damage[i] = 0.0;
  756.                 stdamtim = 1e30;
  757.         }
  758.         proutn("Toggle idebug? ");
  759.         if (ja() != 0) {
  760.                 idebug = !idebug;
  761.                 if (idebug) prout("Debug output ON");
  762.                 else prout("Debug output OFF");
  763.         }
  764.         proutn("Cause selective damage? ");
  765.         if (ja() != 0) {
  766.                 int i, key;
  767.                 for (i=1; i <= ndevice; i++) {
  768.                         proutn("Kill ");
  769.                         proutn(device[i]);
  770.                         proutn("? ");
  771.                         chew();
  772.                         key = scan();
  773.                         if (key == IHALPHA &&  isit("y")) {
  774.                                 damage[i] = 10.0;
  775.                                 if (i == DRADIO) stdamtim = d.date;
  776.                         }
  777.                 }
  778.         }
  779.         proutn("Examine/change events? ");
  780.         if (ja() != 0) {
  781.                 int i;
  782.                 for (i = 1; i < NEVENTS; i++) {
  783.                         int key;
  784.                         if (future[i] == 1e30) continue;
  785.                         switch (i) {
  786.                                 case FSNOVA:  proutn("Supernova       "); break;
  787.                                 case FTBEAM:  proutn("T Beam          "); break;
  788.                                 case FSNAP:   proutn("Snapshot        "); break;
  789.                                 case FBATTAK: proutn("Base Attack     "); break;
  790.                                 case FCDBAS:  proutn("Base Destroy    "); break;
  791.                                 case FSCMOVE: proutn("SC Move         "); break;
  792.                                 case FSCDBAS: proutn("SC Base Destroy "); break;
  793.                         }
  794.                         cramf(future[i]-d.date, 8, 2);
  795.                         chew();
  796.                         proutn("  ?");
  797.                         key = scan();
  798.                         if (key == IHREAL) {
  799.                                 future[i] = d.date + aaitem;
  800.                         }
  801.                 }
  802.                 chew();
  803.         }
  804.         proutn("Make universe visible? ");
  805.         if (ja() != 0) {
  806.                 int i, j;
  807.                 for (i = 1; i < 9; i++)
  808.                 {
  809.                         for (j = 1; j < 9; j++)
  810.                         {
  811.                                 starch[i][j] = 1;
  812.                         }
  813.                 }
  814.         }
  815. }
  816.                        
  817.  
  818. #endif
  819.