]> skyeroc.xyz Git - dgamelaunch/commitdiff
allow dynamic switching of graphics stripping
authorJoshua Kwan <joshk@triplehelix.org>
Mon, 2 Feb 2004 20:43:12 +0000 (20:43 +0000)
committerJoshua Kwan <joshk@triplehelix.org>
Mon, 2 Feb 2004 20:43:12 +0000 (20:43 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@216 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

ttyplay.c

index 08b3d67f21acabf8f2472f52996b46c88cd2d447..c3a4cf3c2afc08c2dcc86da7db20c3ca238682ce 100644 (file)
--- a/ttyplay.c
+++ b/ttyplay.c
@@ -188,11 +188,23 @@ ttypread (FILE * fp, Header * h, char **buf, int pread)
         {                       /* a user hits a character? */
           char c;
           read (STDIN_FILENO, &c, 1); /* drain the character */
+         static int stripped = NO_GRAPHICS;
+
           switch (c)
             {
             case 'q':
               return READ_EOF;
               break;
+           case 's':
+             switch (stripped)
+             {
+               case NO_GRAPHICS: populate_gfx_array ((stripped = DEC_GRAPHICS)); break;
+               case DEC_GRAPHICS: populate_gfx_array ((stripped = IBM_GRAPHICS)); break;
+               case IBM_GRAPHICS: populate_gfx_array ((stripped = NO_GRAPHICS)); break;
+             }
+             return READ_RESTART;
+             break;
+
             case 'm':
              if (!loggedin)
              {
@@ -219,13 +231,10 @@ ttywrite (char *buf, int len)
 {
   int i;
 
-  if (bstripgfx)
-    {
-      for (i = 0; i < len; i++)
-        {
-          buf[i] = strip_gfx (buf[i]);
-        }
-    }
+  for (i = 0; i < len; i++)
+  {
+    buf[i] = strip_gfx (buf[i]);
+  }
 
   fwrite (buf, 1, len, stdout);
 }
@@ -389,10 +398,7 @@ ttyplay_main (char *ttyfile, int mode, int rstripgfx)
   FILE *input = stdin;
   struct termios old, new;
 
-  /* strip graphics mode flag */
-  bstripgfx = rstripgfx;
-  if (bstripgfx)
-    populate_gfx_array (DEC_GRAPHICS);
+  populate_gfx_array (NO_GRAPHICS);
 
   seek_offset_clrscr = 0;