1
/* main.c - Frotz V2.40 main function
2
* Copyright (c) 1995-1997 Stefan Jokisch
4
* This file is part of Frotz.
6
* Frotz is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* Frotz is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
22
* This is an interpreter for Infocom V1 to V6 games. It also supports
23
* the recently defined V7 and V8 games. Please report bugs to
35
extern void interpret (void);
36
extern void init_memory (void);
37
extern void init_undo (void);
38
extern void reset_memory (void);
40
/* Story file name, id number and size */
44
enum story story_id = UNKNOWN;
47
/* Story file header data */
52
zword h_resident_size = 0;
54
zword h_dictionary = 0;
57
zword h_dynamic_size = 0;
59
zbyte h_serial[6] = { 0, 0, 0, 0, 0, 0 };
60
zword h_abbreviations = 0;
61
zword h_file_size = 0;
63
zbyte h_interpreter_number = 0;
64
zbyte h_interpreter_version = 0;
65
zbyte h_screen_rows = 0;
66
zbyte h_screen_cols = 0;
67
zword h_screen_width = 0;
68
zword h_screen_height = 0;
69
zbyte h_font_height = 1;
70
zbyte h_font_width = 1;
71
zword h_functions_offset = 0;
72
zword h_strings_offset = 0;
73
zbyte h_default_background = 0;
74
zbyte h_default_foreground = 0;
75
zword h_terminating_keys = 0;
76
zword h_line_width = 0;
77
zbyte h_standard_high = 1;
78
zbyte h_standard_low = 0;
80
zword h_extension_table = 0;
81
zbyte h_user_name[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
83
zword hx_table_size = 0;
86
zword hx_unicode_table = 0;
90
zword stack[STACK_SIZE];
93
zword frame_count = 0;
97
bool ostream_screen = TRUE;
98
bool ostream_script = FALSE;
99
bool ostream_memory = FALSE;
100
bool ostream_record = FALSE;
101
bool istream_replay = FALSE;
102
bool message = FALSE;
104
/* Current window and mouse data */
112
/* Window attributes */
114
bool enable_wrapping = FALSE;
115
bool enable_scripting = TRUE;
116
bool enable_scrolling = FALSE;
117
bool enable_buffering = FALSE;
122
int option_attribute_assignment = 0;
123
int option_attribute_testing = 0;
124
int option_context_lines = 0;
125
int option_object_locating = 0;
126
int option_object_movement = 0;
127
int option_left_margin = 0;
128
int option_right_margin = 0;
129
int option_ignore_errors = 0;
130
int option_piracy = 0;
131
int option_undo_slots = MAX_UNDO_SLOTS;
132
int option_expand_abbreviations = 0;
133
int option_script_cols = 80;
134
int option_save_quetzal = 1;
137
int option_sound = 1;
138
char *option_zcode_path;
141
/* Size of memory to reserve (in bytes) */
143
long reserve_mem = 0;
146
* z_piracy, branch if the story file is a legal copy.
155
branch (!f_setup.piracy);
162
* Prepare and run the game.
167
#include "glkstart.h"
170
static char **myargv;
172
glkunix_argumentlist_t glkunix_arguments[] =
174
{ "-a", glkunix_arg_NoValue, "-a: watch attribute setting" },
175
{ "-A", glkunix_arg_NoValue, "-A: watch attribute testing" },
176
{ "-i", glkunix_arg_NoValue, "-i: ignore fatal errors" },
177
{ "-o", glkunix_arg_NoValue, "-o: watch object movement" },
178
{ "-O", glkunix_arg_NoValue, "-O: watch object locating" },
179
{ "-P", glkunix_arg_NoValue, "-P: alter piracy opcode" },
180
{ "-Q", glkunix_arg_NoValue, "-Q: use old-style save format" },
181
{ "-t", glkunix_arg_NoValue, "-t: set Tandy bit" },
182
{ "-x", glkunix_arg_NoValue, "-x: expand abbreviations g/x/z" },
183
{ "-I", glkunix_arg_NumberValue, "-I: interpreter number" },
184
{ "-s", glkunix_arg_NumberValue, "-s: random number seed value" },
185
{ "-S", glkunix_arg_NumberValue, "-S: transcript width" },
186
{ "-u", glkunix_arg_NumberValue, "-u: slots for multiple undo" },
187
{ "-Z", glkunix_arg_NumberValue, "-Z: error checking mode" },
188
{ "", glkunix_arg_ValueFollows, "filename: The game file to load." },
189
{ NULL, glkunix_arg_End, NULL }
192
int glkunix_startup_code(glkunix_startup_t *data)
198
os_process_arguments (myargc, myargv);