1 /* main.c - Frotz V2.40 main function
2 * Copyright (c) 1995-1997 Stefan Jokisch
4 * Changes for Rockbox copyright 2009 Torne Wuff
6 * This file is part of Frotz.
8 * Frotz is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Frotz is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
24 * This is an interpreter for Infocom V1 to V6 games. It also supports
25 * the recently defined V7 and V8 games. Please report bugs to
37 extern void interpret (void);
38 extern void init_memory (void);
39 extern void init_undo (void);
40 extern void reset_memory (void);
41 extern void init_buffer (void);
42 extern void init_sound (void);
43 extern void init_process (void);
44 extern void script_close (void);
45 extern void record_close (void);
46 extern void replay_close (void);
48 /* Story file name, id number and size */
50 const char *story_name
= 0;
52 enum story story_id
= UNKNOWN
;
55 /* Story file header data */
60 zword h_resident_size
= 0;
62 zword h_dictionary
= 0;
65 zword h_dynamic_size
= 0;
67 zbyte h_serial
[6] = { 0, 0, 0, 0, 0, 0 };
68 zword h_abbreviations
= 0;
69 zword h_file_size
= 0;
71 zbyte h_interpreter_number
= 0;
72 zbyte h_interpreter_version
= 0;
73 zbyte h_screen_rows
= 0;
74 zbyte h_screen_cols
= 0;
75 zword h_screen_width
= 0;
76 zword h_screen_height
= 0;
77 zbyte h_font_height
= 1;
78 zbyte h_font_width
= 1;
79 zword h_functions_offset
= 0;
80 zword h_strings_offset
= 0;
81 zbyte h_default_background
= 0;
82 zbyte h_default_foreground
= 0;
83 zword h_terminating_keys
= 0;
84 zword h_line_width
= 0;
85 zbyte h_standard_high
= 1;
86 zbyte h_standard_low
= 0;
88 zword h_extension_table
= 0;
89 zbyte h_user_name
[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
91 zword hx_table_size
= 0;
94 zword hx_unicode_table
= 0;
98 zword stack
[STACK_SIZE
];
101 zword frame_count
= 0;
105 bool ostream_screen
= TRUE
;
106 bool ostream_script
= FALSE
;
107 bool ostream_memory
= FALSE
;
108 bool ostream_record
= FALSE
;
109 bool istream_replay
= FALSE
;
110 bool message
= FALSE
;
112 /* Current window and mouse data */
120 /* Window attributes */
122 bool enable_wrapping
= FALSE
;
123 bool enable_scripting
= FALSE
;
124 bool enable_scrolling
= FALSE
;
125 bool enable_buffering
= FALSE
;
130 int option_attribute_assignment = 0;
131 int option_attribute_testing = 0;
132 int option_context_lines = 0;
133 int option_object_locating = 0;
134 int option_object_movement = 0;
135 int option_left_margin = 0;
136 int option_right_margin = 0;
137 int option_ignore_errors = 0;
138 int option_piracy = 0;
139 int option_undo_slots = MAX_UNDO_SLOTS;
140 int option_expand_abbreviations = 0;
141 int option_script_cols = 80;
142 int option_save_quetzal = 1;
145 int option_sound
= 1;
146 char *option_zcode_path
;
150 * z_piracy, branch if the story file is a legal copy.
159 branch (!f_setup
.piracy
);
166 * Prepare and run the game.
170 int cdecl frotz_main (void)