Added the ability to suppress newer features with a game type option.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 12 Sep 2006 10:23:36 +0000 (10:23 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 12 Sep 2006 10:23:36 +0000 (10:23 +0000)
TODO
ai.c
battle.c
moving.c
planets.c
setup.c
sst-doc.xml
sst.c
sst.h
sst.xml

diff --git a/TODO b/TODO
index b0986e636ee22b2983a3695cd9dbad81a516975e..2a95c4725d06d2f80405b819a91004775ffb0085 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,7 @@
                Super Star Trek TO-DO list
 
                Super Star Trek TO-DO list
 
-* 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.)
+* Wrap a GUI around it.
+
+* Find out what the deathray behavior was before Tom Almy changed it,
+  and reverse the change when the game type is 'plain'.
+
diff --git a/ai.c b/ai.c
index 1e70f2a72c84f7865cdac3cf46ee27abf62d8c2c..a1b4bbf6f92ef101dc9ac53ed5a8b3af39f8fcde 100644 (file)
--- a/ai.c
+++ b/ai.c
@@ -151,7 +151,7 @@ static void movebaddy(int comx, int comy, int loccom, int ienm)
        else {
            if (forces > 1000.0) /* Very strong -- move in for kill */
                motion = (1.0-square(Rand()))*dist1 + 1.0;
        else {
            if (forces > 1000.0) /* Very strong -- move in for kill */
                motion = (1.0-square(Rand()))*dist1 + 1.0;
-           if (condit==IHDOCKED) /* protected by base -- back off ! */
+           if (condit==IHDOCKED && (game.options & OPTION_BASE)) /* protected by base -- back off ! */
                motion -= skill*(2.0-square(Rand()));
        }
 #ifdef DEBUG
                motion -= skill*(2.0-square(Rand()));
        }
 #ifdef DEBUG
@@ -213,7 +213,7 @@ static void movebaddy(int comx, int comy, int loccom, int ienm)
                looky = nexty + krawly;
                krawly = -krawly;
            }
                looky = nexty + krawly;
                krawly = -krawly;
            }
-           else if (game.quad[lookx][looky] != IHDOT) {
+           else if ((game.options & OPTION_RAMMING) && game.quad[lookx][looky] != IHDOT) {
                /* See if we should ram ship */
                if (game.quad[lookx][looky] == ship &&
                    (ienm == IHC || ienm == IHS)) {
                /* See if we should ram ship */
                if (game.quad[lookx][looky] == ship &&
                    (ienm == IHC || ienm == IHS)) {
@@ -294,12 +294,13 @@ void movcom(void)
     /* if skill level is high, move other Klingons and Romulans too!
        Move these last so they can base their actions on what the
        commander(s) do. */
     /* if skill level is high, move other Klingons and Romulans too!
        Move these last so they can base their actions on what the
        commander(s) do. */
-    if (skill >= SKILL_EXPERT) for_local_enemies(i) {
-       ix = game.kx[i];
-       iy = game.ky[i];
-       if (game.quad[ix][iy] == IHK || game.quad[ix][iy] == IHR)
-           movebaddy(ix, iy, i, game.quad[ix][iy]);
-    }
+    if (skill >= SKILL_EXPERT && (game.options & OPTION_MVBADDY)) 
+       for_local_enemies(i) {
+           ix = game.kx[i];
+           iy = game.ky[i];
+           if (game.quad[ix][iy] == IHK || game.quad[ix][iy] == IHR)
+               movebaddy(ix, iy, i, game.quad[ix][iy]);
+       }
 
     sortkl();
 }
 
     sortkl();
 }
index 903e216b3f61760a57d4d1958b0417ccf805124a..56a981fc97e54a6cd74dc1876b48f90b472850b1 100644 (file)
--- a/battle.c
+++ b/battle.c
@@ -349,7 +349,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
            } else {
                /*
                 * Stas Sergeev added the possibility that
            } else {
                /*
                 * Stas Sergeev added the possibility that
-                * you can shove the Thingy abd piss it off.
+                * you can shove the Thingy and piss it off.
                 * It then becomes an enemy and may fire at you.
                 */
                iqengry=1;
                 * It then becomes an enemy and may fire at you.
                 */
                iqengry=1;
index 7d3f6dfcbbb52eaca28e37ba13a596cc1fcdb447..a5d11b3e25b7fba12bacd3d2726b8456365a220c 100644 (file)
--- a/moving.c
+++ b/moving.c
@@ -153,7 +153,7 @@ void imove(void)
                        if (game.damage[l]>0) 
                            n++;
                    probf=pow(1.4,(energy+shield)/5000.0-1.0)*pow(1.3,1.0/(n+1)-1.0);
                        if (game.damage[l]>0) 
                            n++;
                    probf=pow(1.4,(energy+shield)/5000.0-1.0)*pow(1.3,1.0/(n+1)-1.0);
-                   if (Rand()>probf) 
+                   if ((game.options & OPTION_BLKHOLE) && Rand()>probf) 
                        timwrp();
                    else 
                        finish(FHOLE);
                        timwrp();
                    else 
                        finish(FHOLE);
index 7dd95415b29cfb945fcd2f8bdff13791e5816e30..bce9a1a7fdfb483ec7f5f5414ff470e5286e310b 100644 (file)
--- a/planets.c
+++ b/planets.c
@@ -10,7 +10,7 @@ static int consumeTime(void)
 //  double asave;
     ididit = 1;
 #if 0
 //  double asave;
     ididit = 1;
 #if 0
-    /* Don't wory about this */
+    /* Don't worry about this */
     if (future[FTBEAM] <= game.state.date+Time && game.state.remcom != 0 && condit != IHDOCKED) {
        /* We are about to be tractor beamed -- operation fails */
        return 1;
     if (future[FTBEAM] <= game.state.date+Time && game.state.remcom != 0 && condit != IHDOCKED) {
        /* We are about to be tractor beamed -- operation fails */
        return 1;
diff --git a/setup.c b/setup.c
index 72c2e8402b9d4e41e33e688fe975922933e7d7ca..88884671d08a488c83ddda8e44045680c4ef9b3b 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -467,6 +467,23 @@ int choose(int needprompt)
            else if (skill == SKILL_NONE) proutn("Are you a Novice, Fair, Good, Expert, or Emeritus player? ");
        }
     }
            else if (skill == SKILL_NONE) proutn("Are you a Novice, Fair, Good, Expert, or Emeritus player? ");
        }
     }
+    // Choose game options -- added by ESR for SST2K
+    if (scan() != IHALPHA) {
+       chew();
+       proutn("Choose your game options: ");
+       scan();
+    }
+    if (isit("plain"))
+       // Approximates the UT FORTRAN version.
+       game.options &=~ (OPTION_THOLIAN | OPTION_PLANETS | OPTION_THINGY | OPTION_PROBE | OPTION_RAMMING | OPTION_MVBADDY | OPTION_BLKHOLE | OPTION_BASE);
+    if (isit("almy"))
+       // Approximates Tom Almy's version.
+       game.options &=~ (OPTION_THINGY | OPTION_BLKHOLE | OPTION_BASE);
+    else if (strlen(citem)) {
+           proutn("What is \"");
+           proutn(citem);
+           prout("\"?");
+    }
     setpassword();
 #ifdef DEBUG
     if (strcmp(game.passwd, "debug")==0) idebug = 1;
     setpassword();
 #ifdef DEBUG
     if (strcmp(game.passwd, "debug")==0) idebug = 1;
index 62662b75a3c5d4a07cd6c4f796ac5e047b2f5089..85e56f83bd32c7e03d14aba1ae9334971b3313b2 100644 (file)
@@ -229,6 +229,36 @@ and start a new game.</para>
 
 <para>The Klingons are waiting.</para>
 
 
 <para>The Klingons are waiting.</para>
 
+</chapter>
+<chapter><title>Starting the Game</title>
+
+<para>The program will ask you some setup questions.  You can give it 
+command-line arguments that will be treated as answers.  Any token
+may be abbreviated to a unique prefix.</para>
+
+<para>The first question concerns whether you want a regullar,
+tournament, or saved game.  For discussion, see the <link
+linkend="freeze">description of the freeze command</link>.</para>
+
+<para>The second question will concern the length of the game.  
+Longer games include more enemies.</para>
+
+<para>The third question will set the game's difficulty level.
+You should probably start out at the novice level, even if you are
+already familiar with one of the other versions of the Star Trek
+game&mdash;but, of course, the level of game you play is up to you.  If
+you want to start at the Expert level, go ahead.  It's your funeral.
+The Emeritus game is strictly for masochists.</para>
+
+<para>The fourth question, new in SST2K, sets your game options.  A
+blank answer enables all SST2K features.  The option 'plain' disables
+a number of features (Tholians, planets &amp; dilithium, Thingies
+shooting back, deep-space-probes, Klingon ramming and movement,
+time-warping through black holes), approximating the original CDC 6600
+FORTRAN game from UT Austin.  The option 'almy' approximates Tom
+Almy's C translation from 1979, disabling Thingies shooting back and
+time-warping through black holes.</para>
+
 </chapter>
 <chapter><title>How To Issue Commands</title>
 
 </chapter>
 <chapter><title>How To Issue Commands</title>
 
@@ -303,7 +333,7 @@ complicated, but you will learn the abbreviations qGuickly enough.</para>
 
 <orderedlist>
 <listitem><para>You can abbreviate practically anything</para></listitem>
 
 <orderedlist>
 <listitem><para>You can abbreviate practically anything</para></listitem>
-<listitem><para>If you forget, the computer will proompt you</para></listitem>
+<listitem><para>If you forget, the computer will prompt you</para></listitem>
 <listitem><para>If you remember, you can type it all on one line</para></listitem>
 </orderedlist>
 
 <listitem><para>If you remember, you can type it all on one line</para></listitem>
 </orderedlist>
 
@@ -1220,7 +1250,7 @@ in the galaxy.  Since planets do not show up on long-range scans, the
 only way to obtain this information is with the <quote>SENSORS</quote> command.</para>
 
 </sect1>
 only way to obtain this information is with the <quote>SENSORS</quote> command.</para>
 
 </sect1>
-<sect1><title>Freeze</title>
+<sect1 id="freeze"><title>Freeze</title>
 
 <literallayout> 
 Mnemonic:  FREEZE
 
 <literallayout> 
 Mnemonic:  FREEZE
@@ -1497,12 +1527,6 @@ print the certificate to a file, import it into your word processor,
 selecting Courier 8pt font, and then print in <quote>landscape
 orientation</quote>.</para>
 
 selecting Courier 8pt font, and then print in <quote>landscape
 orientation</quote>.</para>
 
-<para>You should probably start out at the novice level, even if you are
-already familiar with one of the other versions of the Star Trek
-game&mdash;but, of course, the level of game you play is up to you.  If
-you want to start at the Expert level, go ahead.  It's your funeral.
-The emeritus game is strictly for masochists.</para>
-
 </chapter>
 <chapter><title>Handy Reference Page</title>
 
 </chapter>
 <chapter><title>Handy Reference Page</title>
 
diff --git a/sst.c b/sst.c
index e27f7fb125a0d2348235f5893cd16e33e88ae708..b8aa18301215b5165f40dddfb7daca67dd7618d8 100644 (file)
--- a/sst.c
+++ b/sst.c
@@ -15,19 +15,28 @@ Dave Matuszek says:
 
    SRSCAN, MOVE, PHASERS, CALL, STATUS, IMPULSE, PHOTONS, ABANDON,
    LRSCAN, WARP, SHIELDS, DESTRUCT, CHART, REST, DOCK, QUIT, and DAMAGE
 
    SRSCAN, MOVE, PHASERS, CALL, STATUS, IMPULSE, PHOTONS, ABANDON,
    LRSCAN, WARP, SHIELDS, DESTRUCT, CHART, REST, DOCK, QUIT, and DAMAGE
-   were in the original non-"super" version.
+   were in the original non-"super" version of UT FORTRAN Star Trek.
 
    Tholians weren't in the original. Dave is dubious about their merits.
 
    Tholians weren't in the original. Dave is dubious about their merits.
+   (They are now controlled by OPTION_THOLIAN and turned off if the game
+   type is "plain".)
 
    Planets and dilithium crystals weren't in the original.  Dave is OK
 
    Planets and dilithium crystals weren't in the original.  Dave is OK
-   with this idea. He says the bit about the Galileo getting
-   turned into a McDonald's is "consistant with our original vision".
+   with this idea. (It's now controlled by OPTION_PLANETS and turned 
+   off if the game type is "plain".)
+
+   Dave says the bit about the Galileo getting turned into a
+   McDonald's is "consistant with our original vision".  (This has been
+   left permanently enabled, as it can only happen if OPTION_PLANETS
+   is on.)
 
    Dave also says the Space Thingy should not be preserved across saved
    games, so you can't prove to others that you've seen it.  He says it
    shouldn't fire back, either.  It should do nothing except scream and
    disappear when hit by photon torpedos.  It's OK that it may move
 
    Dave also says the Space Thingy should not be preserved across saved
    games, so you can't prove to others that you've seen it.  He says it
    shouldn't fire back, either.  It should do nothing except scream and
    disappear when hit by photon torpedos.  It's OK that it may move
-   when attacked, but it didn't in the original.
+   when attacked, but it didn't in the original.  (Whether the Thingy
+   can fire back is now controlled by OPTION_THINGY and turned off if the
+   game type is "plain" or "almy".  The no-save behavior has been restored.)
 
    The Faerie Queen, black holes, and time warping were in the original.
 
 
    The Faerie Queen, black holes, and time warping were in the original.
 
@@ -37,6 +46,7 @@ Here are Tom Almy's changes:
    "call" and the "terminate" command to "quit" to better match
    user expectations. The DECUS version apparently made those changes
    as well as changing "freeze" to "save". However I like "freeze".
    "call" and the "terminate" command to "quit" to better match
    user expectations. The DECUS version apparently made those changes
    as well as changing "freeze" to "save". However I like "freeze".
+   (Both "freeze" and "save" work in SST2K.)
 
    When I got a later version of Super Star Trek that I was converting
    from, I added the emexit command.
 
    When I got a later version of Super Star Trek that I was converting
    from, I added the emexit command.
@@ -48,62 +58,75 @@ Here are Tom Almy's changes:
    updates the star chart, and all radio reports will be heard. The Dock
    command will also give a report if a base is under attack.
 
    updates the star chart, and all radio reports will be heard. The Dock
    command will also give a report if a base is under attack.
 
-   Movecom no longer reports movement if sensors are damaged so you wouldn't
-   otherwise know it.
+   Klingon commander movements are no longer reported if long-range 
+   sensors are damaged.
 
    Also added:
 
 
    Also added:
 
-   1. Better base positioning at startup
+   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.  (Now controlled by OPTION_THOLIAN and turned off 
+      if game type is "plain".)
 
 
-   3. Tholian Web.
+   4. Enemies can ram the Enterprise. (Now controlled by OPTION_RAMMING
+      and turned off if game type is "plain".)
 
 
-   4. Enemies can ram the Enterprise. Regular Klingons and Romulans can
-      move in Expert and Emeritus games. This code could use improvement.
+   5. Regular Klingons and Romulans can move in Expert and Emeritus games. 
+      This code could use improvement. (Now controlled by OPTION_MVBADDY
+      and turned off if game type is "plain".)
 
 
-   5. The deep space probe looks interesting! DECUS version
+   6. The deep-space probe feature from the DECUS version.  (Now controlled
+      by OPTION_PROBE and turned off if game type is "plain").
 
 
-   6. Perhaps cloaking to be added later? BSD version
+   In June 2004 I fixed a number of bugs involving: 1) parsing invalid
+   numbers, 2) manual phasers when SR scan is damaged and commander is
+   present, 3) time warping into the future, 4) hang when moving
+   klingons in crowded quadrants.  (These fixes are in SST2K.)
 
 Here are Stas Sergeev's changes:
 
    1. The Space Thingy can be shoved, if you ram it, and can fire back if 
 
 Here are Stas Sergeev's changes:
 
    1. The Space Thingy can be shoved, if you ram it, and can fire back if 
-      fired upon.
+      fired upon. (Now controlled by OPTION_THINGY and turned off if game 
+      type is "plain" or "almy".)
 
 
-   2. The Tholian can be hit with phasers
-
-   3. When you are docked, base covers you with an almost invincible shields 
-      (a commander can still ram you, or a Romulan can destroy the base,
+   2. When you are docked, base covers you with an almost invincible shield. 
+      (A commander can still ram you, or a Romulan can destroy the base,
       or a SCom can even succeed with direct attack IIRC, but this rarely 
       or a SCom can even succeed with direct attack IIRC, but this rarely 
-      happens).
+      happens.)  (Now controlled by OPTION_BASE and turned off if game 
+      type is "plain" or "almy".)
+
+   3. Ramming a black hole is no longer instant death.  There is a
+      chance you might get timewarped instead. (Now controlled by 
+      OPTION_BLKHOLE and turned off if game type is "plain" or "almy".)
 
 
-   4. SCom can't escape from you if no more enemies remain (without this, 
+   4. The Tholian can be hit with phasers.
+
+   5. SCom can't escape from you if no more enemies remain (without this, 
       chasing SCom can take an eternity).
 
       chasing SCom can take an eternity).
 
-   5. Probe target you enter is now the destination quadrant. Before I don't 
+   6. Probe target you enter is now the destination quadrant. Before I don't 
       remember what it was, but it was something I had difficulty using.
 
       remember what it was, but it was something I had difficulty using.
 
-   6. Secret password is now autogenerated.
+   7. Secret password is now autogenerated.
 
 
-   7. "Plaque" is adjusted for A4 paper :-)
+   8. "Plaque" is adjusted for A4 paper :-)
 
 
-   8. Phasers now tells you how much energy needed, but only if the computer 
-       is alive.
+   9. Phasers now tells you how much energy needed, but only if the computer 
+      is alive.
 
 
-   9. Planets are auto-scanned when you enter the quadrant.
+   10. Planets are auto-scanned when you enter the quadrant.
 
 
-   10. Mining or using crystals in presense of enemy now yields an attack.
+   11. Mining or using crystals in presense of enemy now yields an attack.
        There are other minor adjustments to what yields an attack
        and what does not.
 
        There are other minor adjustments to what yields an attack
        and what does not.
 
-   11. Ramming a black hole is no longer instant death.  There is a
-       chance you might get timewarped instead.
-
    12. "freeze" command reverts to "save", most people will understand this
    12. "freeze" command reverts to "save", most people will understand this
-        better anyway.
+       better anyway. (SST2K recognizes both.)
 
 
-   13. Screen-oriented interface, with sensor scans always up.
+   13. Screen-oriented interface, with sensor scans always up.  (SST2K
+       supports both screen-oriented and TTY modes.)
 
 Eric Raymond's changes:
 
 
 Eric Raymond's changes:
 
@@ -114,7 +137,10 @@ for a lot of magic numbers and refactored the heck out of it.
 
    2. Status report now indicates when dilithium crystals are on board.
 
 
    2. Status report now indicates when dilithium crystals are on board.
 
-   3. Per Dave Matuszek's remarks, Thingy state is not saved across games.
+   3. Per Dave Matuszek's remarks, Thingy state is never saved across games.
+
+   4. Added game option selection so you can play a close (but not bug-for-
+      bug identical) approximation of older versions.
 */
 
 /* the input queue */
 */
 
 /* the input queue */
diff --git a/sst.h b/sst.h
index ae8c4f54421a4b2e2cd88e1d7992cec565dd2820..da74f319dd532e679ae3ee420c320e33f175d57a 100644 (file)
--- a/sst.h
+++ b/sst.h
@@ -101,6 +101,10 @@ typedef struct {
 #define OPTION_THINGY  0x00000010      /* Space Thingy can shoot back */
 #define OPTION_PROBE   0x00000020      /* deep-space probes */
 #define OPTION_SHOWME  0x00000040      /* bracket Enterprise in chart */
 #define OPTION_THINGY  0x00000010      /* Space Thingy can shoot back */
 #define OPTION_PROBE   0x00000020      /* deep-space probes */
 #define OPTION_SHOWME  0x00000040      /* bracket Enterprise in chart */
+#define OPTION_RAMMING 0x00000080      /* enemies may ram Enterprise */
+#define OPTION_MVBADDY 0x00000100      /* more enemies can move */
+#define OPTION_BLKHOLE 0x00000200      /* black hole may timewarp you */
+#define OPTION_BASE    0x00000400      /* bases have good shields */
 
 /* Define devices */
 #define DSRSENS 0
 
 /* Define devices */
 #define DSRSENS 0
diff --git a/sst.xml b/sst.xml
index 3adfbbc12524b429e75b9ac0180be9003b34bb91..8f01be83c778f066602586ea768e5d587ec61b83 100644 (file)
--- a/sst.xml
+++ b/sst.xml
@@ -47,10 +47,11 @@ remainder of the command line before standard input.  Thus, for
 example, you can invoke the program as</para>
 
 <programlisting>
 example, you can invoke the program as</para>
 
 <programlisting>
-sst regular medium good
+sst regular medium good plain
 </programlisting>
 
 </programlisting>
 
-<para>to start a regular medium game as a good player.</para>
+<para>to start a regular medium game as a good player in 'plain'
+mode (with only the features from the FOTRAN original enabled).</para>
 </refsect1>
 
 <refsect1 id='authors'><title>AUTHORS</title> 
 </refsect1>
 
 <refsect1 id='authors'><title>AUTHORS</title>