1 /* Nitfol - z-machine interpreter using Glk for output.
2 Copyright (C) 1999 Evin Robertson
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
18 The author can be reached at nitfol@deja.com
22 #include <libchimara/gi_blorb.h>
25 static void set_zfile(strid_t file)
27 glk_stream_set_position(file, 0, seekmode_End);
28 total_size = glk_stream_get_position(file);
29 glk_stream_set_position(file, 0, seekmode_Start);
34 if(!load_header(file, total_size, FALSE)) {
35 /* FIMXE: add code to check to see if it's a jzexe product, and perhaps
36 even code to grab it out of disk images */
41 glk_stream_set_position(file, zfile_offset, seekmode_Start);
45 static strid_t savefile;
47 int game_use_file(strid_t file)
52 if(wrap_gib_create_map(file, &map) == giblorb_err_None) {
54 if(wrap_gib_load_resource(map, giblorb_method_FilePos, &res,
55 giblorb_ID_Exec, 0) == giblorb_err_None) {
57 zfile_offset = res.data.startpos;
58 total_size = res.length;
62 wrap_gib_count_resources(map, giblorb_ID_Pict, &imagecount, NULL, NULL);
63 wrap_gib_destroy_map(map);
66 if(wrap_gib_set_resource_map(file) == giblorb_err_None) {
73 if((z = quetzal_findgamefile(file)) != 0) {
93 tempwin = glk_window_open(0, 0, 100, wintype_TextBuffer, 0);
94 glk_set_window(tempwin);
95 glk_set_style(style_Preformatted);
97 "Usage: nitfol [OPTIONS] gamefile\n"
98 " -i, -ignore Ignore Z-machine strictness errors\n"
99 " -f, -fullname For running under Emacs or DDD\n"
100 " -x, -command Read commands from this file\n"
101 " -P, -pirate Aye, matey\n"
102 " -spell Perform spelling correction\n"
103 " -expand Expand one letter abbreviations\n"
104 " -s, -symbols Specify symbol file for game\n"
105 " -t, -tandy Censors some Infocom games\n"
106 " -T, -transcript Write transcript to this file\n"
107 " -d, -debug Enter debugger immediatly\n"
108 " -prompt Specify debugging prompt\n"
109 " -autoundo Ensure '@save_undo' is called every turn\n"
110 " -S, -stacklimit Exit when the stack is this deep\n"
111 " -a, -alias Specify an alias\n"
112 " -ralias Specify an recursive alias\n"
113 " -unalias Remove an alias\n"
114 " -r, -random Set random seed\n"
115 " -mapsym Specify mapping glyphs\n"
116 " -mapsize Specify map size\n"
117 " -maploc Specify map location\n"
118 " -terpnum Specify interpreter number\n"
119 " -terpver Specify interpreter version\n");
122 z_init(current_zfile);
124 if(restorequetzal(savefile)) {