From: David Griffith Date: Fri, 28 Apr 2023 01:53:31 +0000 (-0700) Subject: Added -L option to xfrotz - supply a Quetzal file to load on command line. X-Git-Url: https://scope-eye.net/git/?a=commitdiff_plain;h=601815a331e622dccbc3d395a2dfef30a1386c64;p=liskon_frotz.git Added -L option to xfrotz - supply a Quetzal file to load on command line. Also converted underlines for parameters in xfrotz.6 to . --- diff --git a/ChangeLog b/ChangeLog index b1f6bd6..f82cc82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,10 @@ Summary of changes between Frotz 2.55 and Frotz 2.55: Frotz 2.55 is currently in development. +NEW FEATURES + +- Added -L option to xfrotz - supply a Quetzal file to load on command line. + BUG FIXES - Fixed compile failure of the SDL interface for GCC 12 and maybe GCC 11. diff --git a/doc/xfrotz.6 b/doc/xfrotz.6 index c163af1..447900c 100644 --- a/doc/xfrotz.6 +++ b/doc/xfrotz.6 @@ -38,7 +38,7 @@ Enables watching of attribute assignment. (class \fBWatchAttribute\fP, name \fBwatchAttrTest\fP) Enables watching of attribute testing. .TP -.BI \-bg " color" +.B \-bg (class \fBBackground\fP, name \fBbackground\fP) Sets the default background color. In addition to the standard X color specification formats, @@ -46,7 +46,7 @@ color specification formats, supports the format \fBz:\fP\fInum\fP, which refers to a z-machine color from 2 to 9. .TP -.BI \-c " number" +.B \-c (class \fBContextLines\fP, name \fBcontextLines\fP) Specifies the number of context lines used. When scrolling large amounts of text, @@ -56,11 +56,11 @@ specifies how many lines of a previous screen .I xfrotz will keep at the top of the next screen. .TP -.BI \-fg " color" +.B \-fg (class \fBForeground\fP, name \fBforeground\fP) Sets the default foreground color. See \fB\-bg\fP above. .TP -.BI \-fn[\-z|[f][b][i]] " font name" +.B \-fn[\-z|[f][b][i]] (class \fBFont\fP, name \fBfont[Z|[F][B][I]]\fP) Sets the fonts to be used for various styles. For example, \fB\-fn\-fbi\fP sets the font for fixed, bold, italic text, and @@ -73,10 +73,13 @@ Ignore runtime errors. This can be useful when running .I xfrotz with buggy story files which cause fatal errors. .TP -.BI \-lm " number" +.B \-lm (class \fBMargin\fP, name \fBleftMargin\fP) Sets the left margin. .TP +.B \-L +When the game starts, load this saved game file. +.TP .B \-ol (class \fBWatchObject\fP, name \fBwatchObjLocating\fP) Enables watching of testing the location of objects. @@ -91,18 +94,18 @@ Enable branching on the .I @piracy opcode. This opcode is seldom used. .TP -.BI \-rm " number" +.B \-rm (class \fBMargin\fP, name \fBrightMargin\fP) Sets the right margin. .TP -.BI \-rs " number" +.B \-rs (class \fBRandomSeed\fP, name \fBrandomSeed\fP) Set the random seed. By default, the random number generator is initialized based on the system clock; this allows you to make the random number generator predictable, for use in recorded scripts or debugging. .TP -.BI \-sc " number" +.B \-sc (class \fBScriptColumns\fP, name \fBscriptColumns\fP) Set the transcript width (default 80). Set to 0 to disable line splitting in transcripts. @@ -113,7 +116,7 @@ Set the z-machine's Tandy bit, which affects the behavior of certain Infocom games. For example, \fIZork I\fP pretends not to have sequels, and \fIWitness\fP has its language censored. .TP -.BI \-u " number" +.B \-u (class \fBUndoSlots\fP, name \fBundoSlots\fP) Set the number of undo slots available. The default number is 25. Note that many Infocom games do not support an ``undo'' command, and @@ -129,10 +132,10 @@ expands ``x'' to ``examine,'' ``o'' to ``oops,'' and ``g'' to ``again.'' This is convenient when running certain Infocom games which do not implement these abbreviations. .TP -.BI \-xrm " resources" +.B \-xrm This allows setting resources on the command line. .TP -.BI \-zs " level" +.B \-zs (class \fBZStrict\fP, name \fBzStrict\fP) Set the reporting level of ``Vile Zero Error From Hell'' bugs. The possible levels are: 0 to print no error messages, 1 to print just one diff --git a/src/x11/x_init.c b/src/x11/x_init.c index a4c3a8d..74f5bdf 100644 --- a/src/x11/x_init.c +++ b/src/x11/x_init.c @@ -209,7 +209,8 @@ void os_process_arguments(int argc, char *argv[]) {"-fn-fb", ".fontFB", XrmoptionSepArg, (void *)NULL}, {"-fn-fi", ".fontFI", XrmoptionSepArg, (void *)NULL}, {"-fn-fbi", ".fontFBI", XrmoptionSepArg, (void *)NULL}, - {"-fn-z", ".fontZ", XrmoptionSepArg, (void *)NULL} + {"-fn-z", ".fontZ", XrmoptionSepArg, (void *)NULL}, + {"-L", ".loadthis", XrmoptionSepArg, (void *)NULL} }; static struct { char *class; @@ -270,7 +271,9 @@ void os_process_arguments(int argc, char *argv[]) {".Font", ".fontFBI", parse_string, &font_names[7]}, {".Font", ".fontZ", parse_string, - &font_names[8]} + &font_names[8]}, + {".Loadthis", ".loadthis", parse_string, + &f_setup.tmp_save_name} }; XtAppContext app_context; char *str_type_return; @@ -328,6 +331,9 @@ void os_process_arguments(int argc, char *argv[]) os_quit(EXIT_SUCCESS); } + if (f_setup.tmp_save_name != NULL) + f_setup.restore_mode = 1; + f_setup.story_file = strdup(argv[1]); f_setup.story_name = strdup(basename(argv[1])); @@ -371,7 +377,7 @@ void os_process_arguments(int argc, char *argv[]) memcpy(f_setup.save_name, f_setup.tmp_save_name, (strlen(f_setup.tmp_save_name) + strlen(EXT_SAVE)) * sizeof(char)); - free(f_setup.tmp_save_name); + /* No need to free f_setup.tmp_save_name */ } f_setup.aux_name = @@ -627,6 +633,7 @@ int os_random_seed(void) void os_init_setup(void) { + memset(&f_setup, 0, sizeof(x_setup)); return; } diff --git a/src/x11/x_input.c b/src/x11/x_input.c index 5ae33f2..b7e4506 100644 --- a/src/x11/x_input.c +++ b/src/x11/x_input.c @@ -245,11 +245,15 @@ char *os_read_file_name(const char *default_name, int flag) istream_replay = 0; ostream_record = 0; - print_string("Enter a file name.\nDefault is \""); - print_string(default_name); - print_string("\": "); + if (f_setup.restore_mode) { + file_name[0] = 0; + } else { + print_string("Enter a file name.\nDefault is \""); + print_string(default_name); + print_string("\": "); - read_string(MAX_FILE_NAME, (zchar *) file_name); + read_string(MAX_FILE_NAME, (zchar *) file_name); + } /* Use the default name if nothing was typed */ if (file_name[0] == 0)