Remove old-style save file format support.
authorDavid Griffith <dave@661.org>
Thu, 21 May 2015 07:25:35 +0000 (00:25 -0700)
committerDavid Griffith <dave@661.org>
Thu, 21 May 2015 07:25:35 +0000 (00:25 -0700)
src/common/fastmem.c
src/common/main.c
src/common/process.c
src/common/setup.h
src/curses/ux_init.c
src/dos/bcinit.c
src/dumb/dumb_init.c

index c1a0dfa53e0502c5359358a2cb4734b29a4d1c97..8e56bbcdd0ea5f8b69d23f8c7d6e8b77c0d6b45b 100644 (file)
@@ -660,60 +660,7 @@ void z_restore (void)
        if ((gfp = fopen (new_name, "rb")) == NULL)
            goto finished;
 
-       if (f_setup.save_quetzal) {
-           success = restore_quetzal (gfp, story_fp);
-
-       } else {
-           /* Load game file */
-
-           release = (unsigned) fgetc (gfp) << 8;
-           release |= fgetc (gfp);
-
-           (void) fgetc (gfp);
-           (void) fgetc (gfp);
-
-           /* Check the release number */
-
-           if (release == h_release) {
-
-               pc = (long) fgetc (gfp) << 16;
-               pc |= (unsigned) fgetc (gfp) << 8;
-               pc |= fgetc (gfp);
-
-               SET_PC (pc);
-
-               sp = stack + (fgetc (gfp) << 8);
-               sp += fgetc (gfp);
-               fp = stack + (fgetc (gfp) << 8);
-               fp += fgetc (gfp);
-
-               for (i = (int) (sp - stack); i < STACK_SIZE; i++) {
-                   stack[i] = (unsigned) fgetc (gfp) << 8;
-                   stack[i] |= fgetc (gfp);
-               }
-
-               os_storyfile_seek (story_fp, 0, SEEK_SET);
-
-               for (addr = 0; addr < h_dynamic_size; addr++) {
-                   int skip = fgetc (gfp);
-                   for (i = 0; i < skip; i++)
-                       zmp[addr++] = fgetc (story_fp);
-                   zmp[addr] = fgetc (gfp);
-                   (void) fgetc (story_fp);
-               }
-
-               /* Check for errors */
-
-               if (ferror (gfp) || ferror (story_fp) || addr != h_dynamic_size)
-                   success = -1;
-               else
-
-                   /* Success */
-
-                   success = 2;
-
-           } else print_string ("Invalid save file\n");
-       }
+       success = restore_quetzal (gfp, story_fp);
 
        if ((short) success >= 0) {
 
@@ -952,44 +899,7 @@ void z_save (void)
        if ((gfp = fopen (new_name, "wb")) == NULL)
            goto finished;
 
-       if (f_setup.save_quetzal) {
-           success = save_quetzal (gfp, story_fp);
-       } else {
-           /* Write game file */
-
-           fputc ((int) hi (h_release), gfp);
-           fputc ((int) lo (h_release), gfp);
-           fputc ((int) hi (h_checksum), gfp);
-           fputc ((int) lo (h_checksum), gfp);
-
-           GET_PC (pc);
-
-           fputc ((int) (pc >> 16) & 0xff, gfp);
-           fputc ((int) (pc >> 8) & 0xff, gfp);
-           fputc ((int) (pc) & 0xff, gfp);
-
-           nsp = (int) (sp - stack);
-           nfp = (int) (fp - stack);
-
-           fputc ((int) hi (nsp), gfp);
-           fputc ((int) lo (nsp), gfp);
-           fputc ((int) hi (nfp), gfp);
-           fputc ((int) lo (nfp), gfp);
-
-           for (i = nsp; i < STACK_SIZE; i++) {
-               fputc ((int) hi (stack[i]), gfp);
-               fputc ((int) lo (stack[i]), gfp);
-           }
-
-           os_storyfile_seek (story_fp, 0, SEEK_SET);
-
-           for (addr = 0, skip = 0; addr < h_dynamic_size; addr++)
-               if (zmp[addr] != fgetc (story_fp) || skip == 255 || addr + 1 == h_dynamic_size) {
-                   fputc (skip, gfp);
-                   fputc (zmp[addr], gfp);
-                   skip = 0;
-               } else skip++;
-       }
+       success = save_quetzal (gfp, story_fp);
 
        /* Close game file and check for errors */
 
index 84abdb0fce1dd523fe2c69588b729878786ff961..3320f8b435c6bbecc79e19509ea87c92bdea5c62 100644 (file)
@@ -132,7 +132,6 @@ int option_piracy = 0;
 int option_undo_slots = MAX_UNDO_SLOTS;
 int option_expand_abbreviations = 0;
 int option_script_cols = 80;
-int option_save_quetzal = 1;
 */
 
 int option_sound = 1;
index 99ad82ca8525ff378b6ead5ded00e8543ac73d07..aad752b5a4aa9e12c8a963a20db94e15d3c2161c 100644 (file)
@@ -338,7 +338,7 @@ void call (zword routine, int argc, zword *args, int ct)
     *--sp = (zword) (pc >> 9);
     *--sp = (zword) (pc & 0x1ff);
     *--sp = (zword) (fp - stack - 1);
-    *--sp = (zword) (argc | (ct << (f_setup.save_quetzal ? 12 : 8)));
+    *--sp = (zword) (argc | (ct << 12 ));
 
     fp = sp;
     frame_count++;
@@ -368,8 +368,7 @@ void call (zword routine, int argc, zword *args, int ct)
     if (sp - stack < count)
        runtime_error (ERR_STK_OVF);
 
-    if (f_setup.save_quetzal)
-       fp[0] |= (zword) count << 8;    /* Save local var count for Quetzal. */
+    fp[0] |= (zword) count << 8;       /* Save local var count for Quetzal. */
 
     value = 0;
 
@@ -409,7 +408,7 @@ void ret (zword value)
 
     sp = fp;
 
-    ct = *sp++ >> (f_setup.save_quetzal ? 12 : 8);
+    ct = *sp++ >> 12;
     frame_count--;
     fp = stack + 1 + *sp++;
     pc = *sp++;
@@ -603,7 +602,7 @@ static void __illegal__ (void)
 void z_catch (void)
 {
 
-    store (f_setup.save_quetzal ? frame_count : (zword) (fp - stack));
+    store (frame_count);
 
 }/* z_catch */
 
@@ -618,19 +617,12 @@ void z_catch (void)
 void z_throw (void)
 {
 
-    if (f_setup.save_quetzal) {
-       if (zargs[1] > frame_count)
-           runtime_error (ERR_BAD_FRAME);
+    if (zargs[1] > frame_count)
+       runtime_error (ERR_BAD_FRAME);
 
-       /* Unwind the stack a frame at a time. */
-       for (; frame_count > zargs[1]; --frame_count)
-           fp = stack + 1 + fp[1];
-    } else {
-       if (zargs[1] > STACK_SIZE)
-           runtime_error (ERR_BAD_FRAME);
-
-       fp = stack + zargs[1];
-    }
+    /* Unwind the stack a frame at a time. */
+    for (; frame_count > zargs[1]; --frame_count)
+       fp = stack + 1 + fp[1];
 
     ret (zargs[0]);
 
index 7fd7db18ab98a3b7a2e665bf8ea9a95616e8f60d..7fe3368f31eb67c6093e49013fd2de303d236614 100644 (file)
@@ -17,7 +17,6 @@ typedef struct frotz_setup_struct {
        int undo_slots;                 /* done */
        int expand_abbreviations;       /* done */
        int script_cols;                /* done */
-       int save_quetzal;               /* done */
        int sound;                      /* done */
        int err_report_mode;            /* done */
 
index 72a6ae22524287c1f5e7a1d0c4c92382a962a2e9..aba691b8596286eff3811983c446be92620ec74c 100644 (file)
@@ -56,14 +56,14 @@ Syntax: frotz [options] story-file\n\
   -A   watch attribute testing  \t -p   plain ASCII output only\n\
   -b # background color         \t -P   alter piracy opcode\n\
   -c # context lines            \t -q   quiet (disable sound effects)\n\
-  -d   disable color            \t -Q   use old-style save format\n\
-  -e   enable sound             \t -r # right margin\n\
-  -f # foreground color         \t -s # random number seed value\n\
-  -F   Force color mode         \t -S # transcript width\n\
-  -h # screen height            \t -t   set Tandy bit\n\
-  -i   ignore fatal errors      \t -u # slots for multiple undo\n\
-  -l # left margin              \t -w # screen width\n\
-  -o   watch object movement    \t -x   expand abbreviations g/x/z"
+  -d   disable color            \t -r # right margin\n\
+  -e   enable sound             \t -s # random number seed value\n\
+  -f # foreground color         \t -S # transcript width\n\
+  -F   Force color mode         \t -t   set Tandy bit\n\
+  -h # screen height            \t -u # slots for multiple undo\n\
+  -i   ignore fatal errors      \t -w # screen width\n\
+  -l # left margin              \t -x   expand abbreviations g/x/z\n\
+  -o   watch object movement"
 
 /*
 char stripped_story_name[FILENAME_MAX+1];
@@ -230,7 +230,7 @@ void os_process_arguments (int argc, char *argv[])
 
     /* Parse the options */
     do {
-       c = zgetopt(argc, argv, "aAb:c:def:Fh:il:oOpPQqr:s:S:tu:w:xZ:");
+       c = zgetopt(argc, argv, "aAb:c:def:Fh:il:oOpPqr:s:S:tu:w:xZ:");
        switch(c) {
          case 'a': f_setup.attribute_assignment = 1; break;
          case 'A': f_setup.attribute_testing = 1; break;
@@ -263,7 +263,6 @@ void os_process_arguments (int argc, char *argv[])
          case 'p': u_setup.plain_ascii = 1; break;
          case 'P': f_setup.piracy = 1; break;
          case 'q': f_setup.sound = 0; break;
-         case 'Q': f_setup.save_quetzal = 0; break;
          case 'r': f_setup.right_margin = atoi(zoptarg); break;
          case 's': u_setup.random_seed = atoi(zoptarg); break;
          case 'S': f_setup.script_cols = atoi(zoptarg); break;
@@ -756,9 +755,6 @@ static int getconfig(char *configfile)
                else if (strcmp(varname, "sound") == 0) {
                        f_setup.sound = getbool(value);
                }
-               else if (strcmp(varname, "quetzal") == 0) {
-                       f_setup.save_quetzal = getbool(value);
-               }
                else if (strcmp(varname, "tandy") == 0) {
                        u_setup.tandy_bit = getbool(value);
                }
@@ -975,7 +971,6 @@ void os_init_setup(void)
        f_setup.undo_slots = MAX_UNDO_SLOTS;
        f_setup.expand_abbreviations = 0;
        f_setup.script_cols = 80;
-       f_setup.save_quetzal = 1;
        f_setup.sound = 1;
        f_setup.err_report_mode = ERR_DEFAULT_REPORT_MODE;
 
index f81125a3487a739f738cd0c052d23d5aa3bd326b..41806bfa498cbac011e01016344b82aa48ecafc2 100644 (file)
@@ -24,17 +24,16 @@ static char information[] =
 "  -a   watch attribute setting  \t -o   watch object movement\n"\r
 "  -A   watch attribute testing  \t -O   watch object locating\n"\r
 "  -b # background colour        \t -p   alter piracy opcode\n"\r
-"  -B # reverse background colour\t -Q   use old-style save format\n"\r
-"  -c # context lines            \t -r # right margin\n"\r
-"  -d # display mode (see below) \t -s # random number seed value\n"\r
-"  -e # emphasis colour [mode 1] \t -S # transscript width\n"\r
-"  -f # foreground colour        \t -t   set Tandy bit\n"\r
-"  -F # reverse foreground colour\t -T   bold typing [modes 2+4+5]\n"\r
-"  -g # font [mode 5] (see below)\t -u # slots for multiple undo\n"\r
-"  -h # screen height            \t -w # screen width\n"\r
-"  -i   ignore runtime errors    \t -x   expand abbreviations g/x/z\n"\r
+"  -B # reverse background colour\t -r # right margin\n"\r
+"  -c # context lines            \t -s # random number seed value\n"\r
+"  -d # display mode (see below) \t -S # transscript width\n"\r
+"  -e # emphasis colour [mode 1] \t -t   set Tandy bit\n"\r
+"  -f # foreground colour        \t -T   bold typing [modes 2+4+5]\n"\r
+"  -F # reverse foreground colour\t -u # slots for multiple undo\n"\r
+"  -g # font [mode 5] (see below)\t -w # screen width\n"\r
+"  -h # screen height            \t -x   expand abbreviations g/x/z\n"\r
+"  -i   ignore runtime errors    \t -Z # error checking (see below)\n"\r
 "  -l # left margin"\r
-"              \t -Z # error checking (see below)"\r
 "\n"\r
 "Fonts are 0 (fixed), 1 (sans serif), 2 (comic), 3 (times), 4 (serif).\n"\r
 "Display modes are 0 (mono), 1 (text), 2 (CGA), 3 (MCGA), 4 (EGA), 5 (Amiga)."\r
@@ -105,7 +104,6 @@ void os_init_setup(void)
        f_setup.undo_slots = MAX_UNDO_SLOTS;\r
        f_setup.expand_abbreviations = 0;\r
        f_setup.script_cols = 80;\r
-       f_setup.save_quetzal = 1;\r
        f_setup.sound = 1;\r
        f_setup.err_report_mode = ERR_DEFAULT_REPORT_MODE;\r
 \r
@@ -261,7 +259,7 @@ static void parse_options (int argc, char **argv)
 \r
        int num = 0;\r
 \r
-       c = getopt (argc, argv, "aAb:B:c:d:e:f:F:g:h:il:oOpQr:s:S:tTu:w:xZ:");\r
+       c = getopt (argc, argv, "aAb:B:c:d:e:f:F:g:h:il:oOpr:s:S:tTu:w:xZ:");\r
 \r
        if (optarg != NULL)\r
            num = dectoi (optarg);\r
@@ -307,8 +305,6 @@ static void parse_options (int argc, char **argv)
            f_setup.object_locating = 1;\r
        if (c == 'p')\r
            f_setup.piracy = 1;\r
-       if (c == 'Q')\r
-           f_setup.save_quetzal = 0;\r
        if (c == 'r')\r
            f_setup.right_margin = num;\r
        if (c == 's')\r
index d20b540b2682aa90afec9af3570b617fc533cff9..58c262f5d08e487cec0c6b36b40657394faf3eaf 100644 (file)
@@ -14,15 +14,15 @@ An interpreter for all Infocom and other Z-Machine games.\n\
 Complies with standard 1.0 of Graham Nelson's specification.\n\
 \n\
 Syntax: dfrotz [options] story-file\n\
-  -a   watch attribute setting \t -Q   use old-style save format\n\
-  -A   watch attribute testing \t -R xxx  do runtime setting \\xxx\n\
-  -h # screen height           \t    before starting (can be used repeatedly)\n\
-  -i   ignore fatal errors     \t -s # random number seed value\n\
-  -I # interpreter number      \t -S # transcript width\n\
-  -o   watch object movement   \t -t   set Tandy bit\n\
-  -O   watch object locating   \t -u # slots for multiple undo\n\
-  -p   plain ASCII output only \t -w # screen width\n\
-  -P   alter piracy opcode     \t -x   expand abbreviations g/x/z"
+  -a   watch attribute setting \t  R xxx  do runtime setting \\xxx\n\
+  -A   watch attribute testing \t    before starting (can be used repeatedly)\n\
+  -h # screen height           \t -s # random number seed value\n\
+  -i   ignore fatal errors     \t -S # transcript width\n\
+  -I # interpreter number      \t -t   set Tandy bit\n\
+  -o   watch object movement   \t -u # slots for multiple undo\n\
+  -O   watch object locating   \t -w # screen width\n\
+  -p   plain ASCII output only \t -x   expand abbreviations g/x/z\n\
+  -P   alter piracy opcode"
 
 
 /* A unix-like getopt, but with the names changed to avoid any problems.  */
@@ -75,7 +75,7 @@ void os_process_arguments(int argc, char *argv[])
 
     /* Parse the options */
     do {
-       c = zgetopt(argc, argv, "aAh:iI:oOpPQs:R:S:tu:w:xZ:");
+       c = zgetopt(argc, argv, "aAh:iI:oOpPs:R:S:tu:w:xZ:");
        switch(c) {
          case 'a': f_setup.attribute_assignment = 1; break;
          case 'A': f_setup.attribute_testing = 1; break;
@@ -86,7 +86,6 @@ void os_process_arguments(int argc, char *argv[])
          case 'O': f_setup.object_locating = 1; break;
          case 'P': f_setup.piracy = 1; break;
        case 'p': plain_ascii = 1; break;
-         case 'Q': f_setup.save_quetzal = 0; break;
        case 'R': dumb_handle_setting(zoptarg, FALSE, TRUE); break;
        case 's': user_random_seed = atoi(zoptarg); break;
          case 'S': f_setup.script_cols = atoi(zoptarg); break;
@@ -206,7 +205,6 @@ void os_init_setup(void)
        f_setup.undo_slots = MAX_UNDO_SLOTS;
        f_setup.expand_abbreviations = 0;
        f_setup.script_cols = 80;
-       f_setup.save_quetzal = 1;
        f_setup.sound = 1;
        f_setup.err_report_mode = ERR_DEFAULT_REPORT_MODE;