From: David Griffith Date: Thu, 21 May 2015 07:25:35 +0000 (-0700) Subject: Remove old-style save file format support. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=337c1ac88fdb3cda24b895b106fd0313ef9473c0;p=liskon_frotz.git Remove old-style save file format support. --- diff --git a/src/common/fastmem.c b/src/common/fastmem.c index c1a0dfa..8e56bbc 100644 --- a/src/common/fastmem.c +++ b/src/common/fastmem.c @@ -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 */ diff --git a/src/common/main.c b/src/common/main.c index 84abdb0..3320f8b 100644 --- a/src/common/main.c +++ b/src/common/main.c @@ -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; diff --git a/src/common/process.c b/src/common/process.c index 99ad82c..aad752b 100644 --- a/src/common/process.c +++ b/src/common/process.c @@ -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]); diff --git a/src/common/setup.h b/src/common/setup.h index 7fd7db1..7fe3368 100644 --- a/src/common/setup.h +++ b/src/common/setup.h @@ -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 */ diff --git a/src/curses/ux_init.c b/src/curses/ux_init.c index 72a6ae2..aba691b 100644 --- a/src/curses/ux_init.c +++ b/src/curses/ux_init.c @@ -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; diff --git a/src/dos/bcinit.c b/src/dos/bcinit.c index f81125a..41806bf 100644 --- a/src/dos/bcinit.c +++ b/src/dos/bcinit.c @@ -24,17 +24,16 @@ static char information[] = " -a watch attribute setting \t -o watch object movement\n" " -A watch attribute testing \t -O watch object locating\n" " -b # background colour \t -p alter piracy opcode\n" -" -B # reverse background colour\t -Q use old-style save format\n" -" -c # context lines \t -r # right margin\n" -" -d # display mode (see below) \t -s # random number seed value\n" -" -e # emphasis colour [mode 1] \t -S # transscript width\n" -" -f # foreground colour \t -t set Tandy bit\n" -" -F # reverse foreground colour\t -T bold typing [modes 2+4+5]\n" -" -g # font [mode 5] (see below)\t -u # slots for multiple undo\n" -" -h # screen height \t -w # screen width\n" -" -i ignore runtime errors \t -x expand abbreviations g/x/z\n" +" -B # reverse background colour\t -r # right margin\n" +" -c # context lines \t -s # random number seed value\n" +" -d # display mode (see below) \t -S # transscript width\n" +" -e # emphasis colour [mode 1] \t -t set Tandy bit\n" +" -f # foreground colour \t -T bold typing [modes 2+4+5]\n" +" -F # reverse foreground colour\t -u # slots for multiple undo\n" +" -g # font [mode 5] (see below)\t -w # screen width\n" +" -h # screen height \t -x expand abbreviations g/x/z\n" +" -i ignore runtime errors \t -Z # error checking (see below)\n" " -l # left margin" -" \t -Z # error checking (see below)" "\n" "Fonts are 0 (fixed), 1 (sans serif), 2 (comic), 3 (times), 4 (serif).\n" "Display modes are 0 (mono), 1 (text), 2 (CGA), 3 (MCGA), 4 (EGA), 5 (Amiga)." @@ -105,7 +104,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; @@ -261,7 +259,7 @@ static void parse_options (int argc, char **argv) int num = 0; - c = getopt (argc, argv, "aAb:B:c:d:e:f:F:g:h:il:oOpQr:s:S:tTu:w:xZ:"); + c = getopt (argc, argv, "aAb:B:c:d:e:f:F:g:h:il:oOpr:s:S:tTu:w:xZ:"); if (optarg != NULL) num = dectoi (optarg); @@ -307,8 +305,6 @@ static void parse_options (int argc, char **argv) f_setup.object_locating = 1; if (c == 'p') f_setup.piracy = 1; - if (c == 'Q') - f_setup.save_quetzal = 0; if (c == 'r') f_setup.right_margin = num; if (c == 's') diff --git a/src/dumb/dumb_init.c b/src/dumb/dumb_init.c index d20b540..58c262f 100644 --- a/src/dumb/dumb_init.c +++ b/src/dumb/dumb_init.c @@ -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;