diff options
Diffstat (limited to 'apps/plugins/doom/m_misc.c')
-rw-r--r-- | apps/plugins/doom/m_misc.c | 1077 |
1 files changed, 1077 insertions, 0 deletions
diff --git a/apps/plugins/doom/m_misc.c b/apps/plugins/doom/m_misc.c new file mode 100644 index 0000000000..2cde2102e6 --- /dev/null +++ b/apps/plugins/doom/m_misc.c | |||
@@ -0,0 +1,1077 @@ | |||
1 | /* Emacs style mode select -*- C++ -*- | ||
2 | *----------------------------------------------------------------------------- | ||
3 | * | ||
4 | * | ||
5 | * PrBoom a Doom port merged with LxDoom and LSDLDoom | ||
6 | * based on BOOM, a modified and improved DOOM engine | ||
7 | * Copyright (C) 1999 by | ||
8 | * id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman | ||
9 | * Copyright (C) 1999-2000 by | ||
10 | * Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
25 | * 02111-1307, USA. | ||
26 | * | ||
27 | * DESCRIPTION: | ||
28 | * Main loop menu stuff. | ||
29 | * Default Config File. | ||
30 | * PCX Screenshots. | ||
31 | * | ||
32 | *-----------------------------------------------------------------------------*/ | ||
33 | |||
34 | #include "doomstat.h" | ||
35 | #include "m_argv.h" | ||
36 | #include "g_game.h" | ||
37 | #include "m_menu.h" | ||
38 | #include "am_map.h" | ||
39 | #include "w_wad.h" | ||
40 | #include "i_sound.h" | ||
41 | #include "i_video.h" | ||
42 | #include "v_video.h" | ||
43 | #include "hu_stuff.h" | ||
44 | #include "st_stuff.h" | ||
45 | #include "dstrings.h" | ||
46 | #include "m_misc.h" | ||
47 | #include "s_sound.h" | ||
48 | #include "sounds.h" | ||
49 | #include "i_system.h" | ||
50 | #include "d_main.h" | ||
51 | #include "m_swap.h" | ||
52 | #include "p_pspr.h" | ||
53 | |||
54 | #include "rockmacros.h" | ||
55 | |||
56 | // | ||
57 | // M_DrawText | ||
58 | // Returns the final X coordinate | ||
59 | // HU_Init must have been called to init the font | ||
60 | // | ||
61 | extern patchnum_t hu_font[HU_FONTSIZE]; | ||
62 | |||
63 | int M_DrawText(int x,int y,boolean direct,char* string) | ||
64 | { | ||
65 | (void)direct; | ||
66 | int c; | ||
67 | int w; | ||
68 | |||
69 | while (*string) { | ||
70 | c = toupper(*string) - HU_FONTSTART; | ||
71 | string++; | ||
72 | if (c < 0 || c> HU_FONTSIZE) { | ||
73 | x += 4; | ||
74 | continue; | ||
75 | } | ||
76 | |||
77 | w = SHORT (hu_font[c].width); | ||
78 | if (x+w > SCREENWIDTH) | ||
79 | break; | ||
80 | |||
81 | // proff/nicolas 09/20/98 -- changed for hi-res | ||
82 | // CPhipps - patch drawing updated, reformatted | ||
83 | V_DrawNumPatch(x, y, 0, hu_font[c].lumpnum, CR_DEFAULT, VPT_STRETCH); | ||
84 | x+=w; | ||
85 | } | ||
86 | |||
87 | return x; | ||
88 | } | ||
89 | |||
90 | // | ||
91 | // M_WriteFile | ||
92 | // | ||
93 | |||
94 | boolean M_WriteFile(char const* name,void* source,int length) | ||
95 | { | ||
96 | int handle; | ||
97 | int count; | ||
98 | |||
99 | handle = open ( name, O_WRONLY | O_CREAT | O_TRUNC); | ||
100 | |||
101 | if (handle == -1) | ||
102 | return false; | ||
103 | |||
104 | count = write (handle, source, length); | ||
105 | close (handle); | ||
106 | |||
107 | if (count < length) { | ||
108 | // unlink(name); // CPhipps - no corrupt data files around, they only confuse people. | ||
109 | return false; | ||
110 | } | ||
111 | |||
112 | return true; | ||
113 | } | ||
114 | |||
115 | |||
116 | // | ||
117 | // M_ReadFile | ||
118 | // | ||
119 | |||
120 | int M_ReadFile(char const* name,byte** buffer) | ||
121 | { | ||
122 | int handle, count, length; | ||
123 | // struct stat fileinfo; | ||
124 | byte *buf; | ||
125 | |||
126 | handle = open (name, O_RDONLY); | ||
127 | if ((handle < 0)) | ||
128 | I_Error ("M_ReadFile: Couldn't read file %s", name); | ||
129 | |||
130 | length = filesize(handle); | ||
131 | buf = Z_Malloc (length, PU_STATIC, NULL); | ||
132 | count = read (handle, buf, length); | ||
133 | close (handle); | ||
134 | |||
135 | if (count < length) | ||
136 | I_Error ("M_ReadFile: Couldn't read file %s", name); | ||
137 | |||
138 | *buffer = buf; | ||
139 | return length; | ||
140 | } | ||
141 | |||
142 | // | ||
143 | // DEFAULTS | ||
144 | // | ||
145 | |||
146 | int usemouse; | ||
147 | boolean precache = true; /* if true, load all graphics at start */ | ||
148 | |||
149 | extern int mousebfire; | ||
150 | extern int mousebstrafe; | ||
151 | extern int mousebforward; | ||
152 | |||
153 | extern int viewwidth; | ||
154 | extern int viewheight; | ||
155 | extern int fake_contrast; | ||
156 | extern int mouseSensitivity_horiz,mouseSensitivity_vert; // killough | ||
157 | |||
158 | extern int realtic_clock_rate; // killough 4/13/98: adjustable timer | ||
159 | extern int tran_filter_pct; // killough 2/21/98 | ||
160 | |||
161 | extern int screenblocks; | ||
162 | extern int showMessages; | ||
163 | |||
164 | #ifndef DJGPP | ||
165 | const char* musserver_filename; | ||
166 | const char* sndserver_filename; | ||
167 | const char* snd_device; | ||
168 | int mus_pause_opt; // 0 = kill music, 1 = pause, 2 = continue | ||
169 | #endif | ||
170 | |||
171 | extern const char* chat_macros[]; | ||
172 | |||
173 | extern int endoom_mode; | ||
174 | int X_opt; | ||
175 | |||
176 | extern const char* S_music_files[]; // cournia | ||
177 | |||
178 | /* cph - Some MBF stuff parked here for now | ||
179 | * killough 10/98 | ||
180 | */ | ||
181 | int map_point_coordinates; | ||
182 | |||
183 | default_t defaults[] = | ||
184 | { | ||
185 | {"Misc settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
186 | {"default_compatibility_level",{(void *)&default_compatibility_level, NULL}, | ||
187 | {-1, NULL},-1,MAX_COMPATIBILITY_LEVEL-1, | ||
188 | def_int,ss_none, 0, 0}, // compatibility level" - CPhipps | ||
189 | // {"realtic_clock_rate",{&realtic_clock_rate, NULL},{100, NULL},0,UL, | ||
190 | // def_int,ss_none, 0, 0}, // percentage of normal speed (35 fps) realtic clock runs at | ||
191 | {"max_player_corpse", {&bodyquesize, NULL}, {32, NULL},-1,UL, // killough 2/8/98 | ||
192 | def_int,ss_none, 0, 0}, // number of dead bodies in view supported (-1 = no limit) | ||
193 | {"flashing_hom",{&flashing_hom, NULL},{0, NULL},0,1, | ||
194 | def_bool,ss_none, 0, 0}, // killough 10/98 - enable flashing HOM indicator | ||
195 | {"demo_insurance",{&default_demo_insurance, NULL},{2, NULL},0,2, // killough 3/31/98 | ||
196 | def_int,ss_none, 0, 0}, // 1=take special steps ensuring demo sync, 2=only during recordings | ||
197 | // {"endoom_mode", {&endoom_mode, NULL},{5, NULL},0,7, // CPhipps - endoom flags | ||
198 | // def_hex, ss_none, 0, 0}, // 0, +1 for colours, +2 for non-ascii chars, +4 for skip-last-line | ||
199 | {"level_precache",{(void*)&precache, NULL},{1, NULL},0,1, | ||
200 | def_bool,ss_none, 0, 0}, // precache level data? | ||
201 | |||
202 | {"Files",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
203 | /* cph - MBF-like wad/deh/bex autoload code | ||
204 | * POSIX targets need to get lumps from prboom.wad */ | ||
205 | // {"wadfile_1",{NULL,&wad_files[0]},{0, | ||
206 | #ifdef ALL_IN_ONE | ||
207 | // "" | ||
208 | #else | ||
209 | // "prboom.wad" | ||
210 | #endif | ||
211 | // },UL,UL,def_str,ss_none, 0, 0}, | ||
212 | // {"wadfile_2",{NULL,&wad_files[1]},{0,""},UL,UL,def_str,ss_none, 0, 0}, | ||
213 | // {"dehfile_1",{NULL,&deh_files[0]},{0,""},UL,UL,def_str,ss_none, 0, 0}, | ||
214 | // {"dehfile_2",{NULL,&deh_files[1]},{0,""},UL,UL,def_str,ss_none, 0, 0}, | ||
215 | |||
216 | {"Game settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
217 | {"default_skill",{&defaultskill, NULL},{3, NULL},1,5, // jff 3/24/98 allow default skill setting | ||
218 | def_int,ss_none, 0, 0}, // selects default skill 1=TYTD 2=NTR 3=HMP 4=UV 5=NM | ||
219 | {"weapon_recoil",{&default_weapon_recoil, NULL},{0, NULL},0,1, | ||
220 | def_bool,ss_weap, &weapon_recoil, 0}, | ||
221 | /* killough 10/98 - toggle between SG/SSG and Fist/Chainsaw */ | ||
222 | {"doom_weapon_toggles",{&doom_weapon_toggles, NULL}, {1, NULL}, 0, 1, | ||
223 | def_bool, ss_weap , 0, 0}, | ||
224 | {"player_bobbing",{&default_player_bobbing, NULL},{1, NULL},0,1, // phares 2/25/98 | ||
225 | def_bool,ss_weap, &player_bobbing, 0}, | ||
226 | {"monsters_remember",{&default_monsters_remember, NULL},{1, NULL},0,1, // killough 3/1/98 | ||
227 | def_bool,ss_enem, &monsters_remember, 0}, | ||
228 | /* MBF AI enhancement options */ | ||
229 | {"monster_infighting",{&default_monster_infighting, NULL}, {1, NULL}, 0, 1, | ||
230 | def_bool, ss_enem, &monster_infighting, 0}, | ||
231 | {"monster_backing",{&default_monster_backing, NULL}, {0, NULL}, 0, 1, | ||
232 | def_bool, ss_enem, &monster_backing, 0}, | ||
233 | {"monster_avoid_hazards",{&default_monster_avoid_hazards, NULL}, {1, NULL}, 0, 1, | ||
234 | def_bool, ss_enem, &monster_avoid_hazards, 0}, | ||
235 | {"monkeys",{&default_monkeys, NULL}, {0, NULL}, 0, 1, | ||
236 | def_bool, ss_enem, &monkeys, 0}, | ||
237 | {"monster_friction",{&default_monster_friction, NULL}, {1, NULL}, 0, 1, | ||
238 | def_bool, ss_enem, &monster_friction, 0}, | ||
239 | {"help_friends",{&default_help_friends, NULL}, {1, NULL}, 0, 1, | ||
240 | def_bool, ss_enem, &help_friends, 0}, | ||
241 | #ifdef DOGS | ||
242 | {"player_helpers",{&default_dogs, NULL}, {0, NULL}, 0, 3, | ||
243 | def_bool, ss_enem , 0, 0}, | ||
244 | {"friend_distance",{&default_distfriend, NULL}, {128, NULL}, 0, 999, | ||
245 | def_int, ss_enem, &distfriend, 0}, | ||
246 | {"dog_jumping",{&default_dog_jumping, NULL}, {1, NULL}, 0, 1, | ||
247 | def_bool, ss_enem, &dog_jumping, 0}, | ||
248 | #endif | ||
249 | /* End of MBF AI extras */ | ||
250 | {"sts_always_red",{&sts_always_red, NULL},{1, NULL},0,1, // no color changes on status bar | ||
251 | def_bool,ss_stat, 0, 0}, | ||
252 | {"sts_pct_always_gray",{&sts_pct_always_gray, NULL},{0, NULL},0,1, // 2/23/98 chg default | ||
253 | def_bool,ss_stat, 0, 0}, // makes percent signs on status bar always gray | ||
254 | {"sts_traditional_keys",{&sts_traditional_keys, NULL},{0, NULL},0,1, // killough 2/28/98 | ||
255 | def_bool,ss_stat,0,0}, // disables doubled card and skull key display on status bar | ||
256 | // {"traditional_menu",{&traditional_menu, NULL},{1, NULL},0,1, | ||
257 | // def_bool,ss_none, 0, 0}, // force use of Doom's main menu ordering // killough 4/17/98 | ||
258 | {"show_messages",{&showMessages, NULL},{1, NULL},0,1, | ||
259 | def_bool,ss_none,0,0}, // enables message display | ||
260 | {"autorun",{&autorun, NULL},{0, NULL},0,1, // killough 3/6/98: preserve autorun across games | ||
261 | def_bool,ss_none,0,0}, | ||
262 | |||
263 | {"Compatibility settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
264 | {"comp_zombie",{&default_comp[comp_zombie], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_zombie], 0}, | ||
265 | {"comp_infcheat",{&default_comp[comp_infcheat], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_infcheat], 0}, | ||
266 | {"comp_stairs",{&default_comp[comp_stairs], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_stairs], 0}, | ||
267 | {"comp_telefrag",{&default_comp[comp_telefrag], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_telefrag], 0}, | ||
268 | {"comp_dropoff",{&default_comp[comp_dropoff], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_dropoff], 0}, | ||
269 | {"comp_falloff",{&default_comp[comp_falloff], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_falloff], 0}, | ||
270 | {"comp_staylift",{&default_comp[comp_staylift], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_staylift], 0}, | ||
271 | {"comp_doorstuck",{&default_comp[comp_doorstuck], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_doorstuck], 0}, | ||
272 | {"comp_pursuit",{&default_comp[comp_pursuit], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_pursuit], 0}, | ||
273 | {"comp_vile",{&default_comp[comp_vile], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_vile], 0}, | ||
274 | {"comp_pain",{&default_comp[comp_pain], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_pain], 0}, | ||
275 | {"comp_skull",{&default_comp[comp_skull], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_skull], 0}, | ||
276 | {"comp_blazing",{&default_comp[comp_blazing], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_blazing], 0}, | ||
277 | {"comp_doorlight",{&default_comp[comp_doorlight], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_doorlight], 0}, | ||
278 | {"comp_god",{&default_comp[comp_god], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_god], 0}, | ||
279 | {"comp_skymap",{&default_comp[comp_skymap], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_skymap], 0}, | ||
280 | {"comp_floors",{&default_comp[comp_floors], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_floors], 0}, | ||
281 | {"comp_model",{&default_comp[comp_model], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_model], 0}, | ||
282 | {"comp_zerotags",{&default_comp[comp_zerotags], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_zerotags], 0}, | ||
283 | {"comp_moveblock",{&default_comp[comp_moveblock], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_moveblock], 0}, | ||
284 | {"comp_sound",{&default_comp[comp_sound], NULL},{0, NULL},0,1,def_bool,ss_comp,&comp[comp_sound], 0}, | ||
285 | |||
286 | {"Sound settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
287 | // {"sound_card",{&snd_card, NULL},{-1, NULL},-1,7, // jff 1/18/98 allow Allegro drivers | ||
288 | // def_int,ss_none, 0, 0}, // select sounds driver (DOS), -1 is autodetect, 0 is none; in Linux, non-zero enables sound | ||
289 | // {"music_card",{&mus_card, NULL},{-1, NULL},-1,9, // to be set, -1 = autodetect | ||
290 | // def_int,ss_none, 0, 0}, // select music driver (DOS), -1 is autodetect, 0 is none"; in Linux, non-zero enables music | ||
291 | {"pitched_sounds",{&pitched_sounds, NULL},{0, NULL},0,1, // killough 2/21/98 | ||
292 | def_bool,ss_none, 0, 0}, // enables variable pitch in sound effects (from id's original code) | ||
293 | // {"samplerate",{&snd_samplerate, NULL},{22050, NULL},11025,48000, def_int,ss_none, 0, 0}, | ||
294 | {"sfx_volume",{&snd_SfxVolume, NULL},{8, NULL},0,15, def_int,ss_none, 0, 0}, | ||
295 | {"music_volume",{&snd_MusicVolume, NULL},{8, NULL},0,15, def_int,ss_none, 0, 0}, | ||
296 | {"mus_pause_opt",{&mus_pause_opt, NULL},{2, NULL},0,2, // CPhipps - music pausing | ||
297 | def_int, ss_none, 0, 0}, // 0 = kill music when paused, 1 = pause music, 2 = let music continue | ||
298 | {"sounddev", {NULL,&snd_device}, {0,"/dev/dsp"},UL,UL, | ||
299 | def_str,ss_none, 0, 0}, // sound output device (UNIX) | ||
300 | {"snd_channels",{&default_numChannels, NULL},{4, NULL},1,32, | ||
301 | def_int,ss_none, 0, 0}, // number of audio events simultaneously // killough | ||
302 | |||
303 | {"Video settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
304 | // CPhipps - default screensize for targets that support high-res | ||
305 | /* {"screen_width",{&desired_screenwidth, NULL},{320, NULL}, 320, 1600, | ||
306 | def_int,ss_none, 0, 0}, | ||
307 | {"screen_height",{&desired_screenheight, NULL},{200, NULL},200,1200, | ||
308 | def_int,ss_none, 0, 0},*/ | ||
309 | {"fake_contrast",{&fake_contrast, NULL},{1, NULL},0,1, | ||
310 | def_bool,ss_none, 0, 0}, /* cph - allow crappy fake contrast to be disabled */ | ||
311 | // {"use_fullscreen",{&use_fullscreen, NULL},{1, NULL},0,1, /* proff 21/05/2000 */ | ||
312 | // def_bool,ss_none, 0, 0}, | ||
313 | // {"use_doublebuffer",{&use_doublebuffer, NULL},{1, NULL},0,1, // proff 2001-7-4 | ||
314 | // def_bool,ss_none, 0, 0}, // enable doublebuffer to avoid display tearing (fullscreen) | ||
315 | {"translucency",{&default_translucency, NULL},{1, NULL},0,1, // phares | ||
316 | def_bool,ss_none, 0, 0}, // enables translucency | ||
317 | {"tran_filter_pct",{&tran_filter_pct, NULL},{66, NULL},0,100, // killough 2/21/98 | ||
318 | def_int,ss_none, 0, 0}, // set percentage of foreground/background translucency mix | ||
319 | {"screenblocks",{&screenblocks, NULL},{9, NULL},3,11, | ||
320 | def_int,ss_none, 0, 0}, | ||
321 | {"usegamma",{&usegamma, NULL},{1, NULL},0,4, //jff 3/6/98 fix erroneous upper limit in range | ||
322 | def_int,ss_none, 0, 0}, // gamma correction level // killough 1/18/98 | ||
323 | {"X_options",{&X_opt, NULL},{0, NULL},0,3, // CPhipps - misc X options | ||
324 | def_hex,ss_none, 0, 0}, // X options, see l_video_x.c | ||
325 | |||
326 | {"Mouse settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
327 | {"use_mouse",{&usemouse, NULL},{1, NULL},0,1, | ||
328 | def_bool,ss_none, 0, 0}, // enables use of mouse with DOOM | ||
329 | //jff 4/3/98 allow unlimited sensitivity | ||
330 | // {"mouse_sensitivity_horiz",{&mouseSensitivity_horiz, NULL},{10, NULL},0,UL, | ||
331 | // def_int,ss_none, 0, 0}, /* adjust horizontal (x) mouse sensitivity killough/mead */ | ||
332 | //jff 4/3/98 allow unlimited sensitivity | ||
333 | // {"mouse_sensitivity_vert",{&mouseSensitivity_vert, NULL},{10, NULL},0,UL, | ||
334 | // def_int,ss_none, 0, 0}, /* adjust vertical (y) mouse sensitivity killough/mead */ | ||
335 | //jff 3/8/98 allow -1 in mouse bindings to disable mouse function | ||
336 | {"mouseb_fire",{&mousebfire, NULL},{0, NULL},-1,MAX_MOUSEB, | ||
337 | def_int,ss_keys, 0, 0}, // mouse button number to use for fire | ||
338 | {"mouseb_strafe",{&mousebstrafe, NULL},{1, NULL},-1,MAX_MOUSEB, | ||
339 | def_int,ss_keys, 0, 0}, // mouse button number to use for strafing | ||
340 | {"mouseb_forward",{&mousebforward, NULL},{2, NULL},-1,MAX_MOUSEB, | ||
341 | def_int,ss_keys, 0, 0}, // mouse button number to use for forward motion | ||
342 | //jff 3/8/98 end of lower range change for -1 allowed in mouse binding | ||
343 | |||
344 | // For key bindings, the values stored in the key_* variables // phares | ||
345 | // are the internal Doom Codes. The values stored in the default.cfg | ||
346 | // file are the keyboard codes. | ||
347 | // CPhipps - now they're the doom codes, so default.cfg can be portable | ||
348 | |||
349 | {"Key bindings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
350 | {"key_right", {&key_right, NULL}, {KEY_RIGHTARROW, NULL}, | ||
351 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to turn right | ||
352 | {"key_left", {&key_left, NULL}, {KEY_LEFTARROW, NULL} , | ||
353 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to turn left | ||
354 | {"key_up", {&key_up, NULL}, {KEY_RCTRL, NULL} , | ||
355 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move forward | ||
356 | {"key_down", {&key_down, NULL}, {KEY_DOWNARROW, NULL}, | ||
357 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move backward | ||
358 | /* {"key_menu_right", {&key_menu_right, NULL}, {KEY_RIGHTARROW, NULL},// phares 3/7/98 | ||
359 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move right in a menu // | | ||
360 | {"key_menu_left", {&key_menu_left, NULL}, {KEY_LEFTARROW} ,// V | ||
361 | 0,MAX_KEY,def_key,ss_keys, NULL}, // key to move left in a menu | ||
362 | {"key_menu_up", {&key_menu_up, NULL}, {KEY_UPARROW,NULL} , | ||
363 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move up in a menu | ||
364 | {"key_menu_down", {&key_menu_down, NULL}, {KEY_DOWNARROW, NULL} , | ||
365 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move down in a menu | ||
366 | {"key_menu_backspace",{&key_menu_backspace, NULL},{KEY_BACKSPACE, NULL} , | ||
367 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // delete key in a menu | ||
368 | {"key_menu_escape", {&key_menu_escape, NULL}, {KEY_ESCAPE, NULL} , | ||
369 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to leave a menu , // phares 3/7/98 | ||
370 | {"key_menu_enter", {&key_menu_enter, NULL}, {KEY_ENTER, NULL} , | ||
371 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to select from menu | ||
372 | */ | ||
373 | {"key_strafeleft", {&key_strafeleft, NULL}, {',', NULL}, | ||
374 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to strafe left | ||
375 | {"key_straferight", {&key_straferight, NULL}, {'.', NULL}, | ||
376 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to strafe right | ||
377 | |||
378 | {"key_fire", {&key_fire, NULL}, {' ', NULL} , | ||
379 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // duh | ||
380 | {"key_use", {&key_use, NULL}, {KEY_DOWNARROW, NULL}, | ||
381 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to open a door, use a switch | ||
382 | {"key_strafe", {&key_strafe, NULL}, {'w', NULL} , | ||
383 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to use with arrows to strafe | ||
384 | {"key_speed", {&key_speed, NULL}, {KEY_RSHIFT, NULL} , | ||
385 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to run | ||
386 | |||
387 | {"key_savegame", {&key_savegame, NULL}, {KEY_F2, NULL}, | ||
388 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to save current game | ||
389 | {"key_loadgame", {&key_loadgame, NULL}, {KEY_F3, NULL}, | ||
390 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to restore from saved games | ||
391 | {"key_soundvolume", {&key_soundvolume, NULL}, {KEY_F4, NULL}, | ||
392 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to bring up sound controls | ||
393 | {"key_hud", {&key_hud, NULL}, {KEY_F5, NULL}, | ||
394 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to adjust HUD | ||
395 | {"key_quicksave", {&key_quicksave, NULL}, {KEY_F6, NULL}, | ||
396 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to to quicksave | ||
397 | {"key_endgame", {&key_endgame, NULL}, {KEY_F7, NULL}, | ||
398 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to end the game | ||
399 | {"key_messages", {&key_messages, NULL}, {KEY_F8, NULL}, | ||
400 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle message enable | ||
401 | {"key_quickload", {&key_quickload, NULL}, {KEY_F9, NULL}, | ||
402 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to load from quicksave | ||
403 | {"key_quit", {&key_quit, NULL}, {KEY_F10, NULL}, | ||
404 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to quit game | ||
405 | {"key_gamma", {&key_gamma, NULL}, {KEY_F11, NULL}, | ||
406 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to adjust gamma correction | ||
407 | {"key_spy", {&key_spy, NULL}, {KEY_F12, NULL}, | ||
408 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to view from another coop player's view | ||
409 | {"key_pause", {&key_pause, NULL}, {KEY_PAUSE, NULL}, | ||
410 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to pause the game | ||
411 | {"key_autorun", {&key_autorun, NULL}, {KEY_CAPSLOCK, NULL}, | ||
412 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle always run mode | ||
413 | {"key_chat", {&key_chat, NULL}, {'t', NULL}, | ||
414 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to enter a chat message | ||
415 | {"key_backspace", {&key_backspace, NULL}, {KEY_BACKSPACE, NULL}, | ||
416 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // backspace key | ||
417 | {"key_enter", {&key_enter, NULL}, {KEY_ENTER, NULL}, | ||
418 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to select from menu or see last message | ||
419 | {"key_map", {&key_map, NULL}, {KEY_TAB, NULL}, | ||
420 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle automap display | ||
421 | {"key_map_right", {&key_map_right, NULL}, {KEY_RIGHTARROW, NULL},// phares 3/7/98 | ||
422 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to shift automap right // | | ||
423 | {"key_map_left", {&key_map_left, NULL}, {KEY_LEFTARROW, NULL},// V | ||
424 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to shift automap left | ||
425 | {"key_map_up", {&key_map_up, NULL}, {KEY_UPARROW, NULL}, | ||
426 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to shift automap up | ||
427 | {"key_map_down", {&key_map_down, NULL}, {KEY_DOWNARROW, NULL}, | ||
428 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to shift automap down | ||
429 | {"key_map_zoomin", {&key_map_zoomin, NULL}, {'=', NULL}, | ||
430 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to enlarge automap | ||
431 | {"key_map_zoomout", {&key_map_zoomout, NULL}, {'-', NULL}, | ||
432 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to reduce automap | ||
433 | {"key_map_gobig", {&key_map_gobig, NULL}, {'0', NULL}, | ||
434 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to get max zoom for automap | ||
435 | {"key_map_follow", {&key_map_follow, NULL}, {'f', NULL}, | ||
436 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle follow mode | ||
437 | {"key_map_mark", {&key_map_mark, NULL}, {'m', NULL}, | ||
438 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to drop a marker on automap | ||
439 | {"key_map_clear", {&key_map_clear, NULL}, {'c', NULL}, | ||
440 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to clear all markers on automap | ||
441 | {"key_map_grid", {&key_map_grid, NULL}, {'g', NULL}, | ||
442 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle grid display over automap | ||
443 | {"key_map_rotate", {&key_map_rotate, NULL}, {'r', NULL}, | ||
444 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle rotating the automap to match the player's orientation | ||
445 | {"key_map_overlay", {&key_map_overlay, NULL}, {'o', NULL}, | ||
446 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle overlaying the automap on the rendered display | ||
447 | {"key_reverse", {&key_reverse, NULL}, {'/', NULL}, | ||
448 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to spin 180 instantly | ||
449 | {"key_zoomin", {&key_zoomin, NULL}, {'=', NULL}, | ||
450 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to enlarge display | ||
451 | {"key_zoomout", {&key_zoomout, NULL}, {'-', NULL}, | ||
452 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to reduce display | ||
453 | {"key_chatplayer1", {&destination_keys[0], NULL}, {'g', NULL}, | ||
454 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to chat with player 1 | ||
455 | // killough 11/98: fix 'i'/'b' reversal | ||
456 | {"key_chatplayer2", {&destination_keys[1], NULL}, {'i', NULL}, | ||
457 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to chat with player 2 | ||
458 | {"key_chatplayer3", {&destination_keys[2], NULL}, {'b', NULL}, | ||
459 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to chat with player 3 | ||
460 | {"key_chatplayer4", {&destination_keys[3], NULL}, {'r', NULL}, | ||
461 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to chat with player 4 | ||
462 | {"key_weapon",{&key_weapon, NULL}, {KEY_UPARROW, NULL}, | ||
463 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle between two most preferred weapons with ammo | ||
464 | {"key_weapontoggle",{&key_weapontoggle, NULL}, {'0', NULL}, | ||
465 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle between two most preferred weapons with ammo | ||
466 | {"key_weapon1", {&key_weapon1, NULL}, {'1', NULL}, | ||
467 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 1 (fist/chainsaw) | ||
468 | {"key_weapon2", {&key_weapon2, NULL}, {'2', NULL}, | ||
469 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 2 (pistol) | ||
470 | {"key_weapon3", {&key_weapon3, NULL}, {'3', NULL}, | ||
471 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 3 (supershotgun/shotgun) | ||
472 | {"key_weapon4", {&key_weapon4, NULL}, {'4', NULL}, | ||
473 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 4 (chaingun) | ||
474 | {"key_weapon5", {&key_weapon5, NULL}, {'5', NULL}, | ||
475 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 5 (rocket launcher) | ||
476 | {"key_weapon6", {&key_weapon6, NULL}, {'6', NULL}, | ||
477 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 6 (plasma rifle) | ||
478 | {"key_weapon7", {&key_weapon7, NULL}, {'7', NULL}, | ||
479 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 7 (bfg9000) // ^ | ||
480 | {"key_weapon8", {&key_weapon8, NULL}, {'8', NULL}, | ||
481 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 8 (chainsaw) // | | ||
482 | {"key_weapon9", {&key_weapon9, NULL}, {'9', NULL}, | ||
483 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 9 (supershotgun) // phares | ||
484 | |||
485 | // killough 2/22/98: screenshot key | ||
486 | {"key_screenshot", {&key_screenshot, NULL}, {'*', NULL}, | ||
487 | 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to take a screenshot | ||
488 | |||
489 | /* {"Joystick settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
490 | {"use_joystick",{&usejoystick, NULL},{0, NULL},0,2, | ||
491 | def_int,ss_none, 0, 0}, // number of joystick to use (0 for none) | ||
492 | {"joy_left",{&joyleft, NULL},{0, NULL}, UL,UL,def_int,ss_none, 0, 0}, | ||
493 | {"joy_right",{&joyright, NULL},{0, NULL},UL,UL,def_int,ss_none, 0, 0}, | ||
494 | {"joy_up", {&joyup, NULL}, {0, NULL}, UL,UL,def_int,ss_none, 0, 0}, | ||
495 | {"joy_down",{&joydown, NULL},{0, NULL}, UL,UL,def_int,ss_none, 0, 0}, | ||
496 | {"joyb_fire",{&joybfire, NULL},{0, NULL},0,UL, | ||
497 | def_int,ss_keys, 0, 0}, // joystick button number to use for fire | ||
498 | {"joyb_strafe",{&joybstrafe, NULL},{1, NULL},0,UL, | ||
499 | def_int,ss_keys, 0, 0}, // joystick button number to use for strafing | ||
500 | {"joyb_speed",{&joybspeed, NULL},{2, NULL},0,UL, | ||
501 | def_int,ss_keys, 0, 0}, // joystick button number to use for running | ||
502 | {"joyb_use",{&joybuse, NULL},{3, NULL},0,UL, | ||
503 | def_int,ss_keys, 0, 0}, // joystick button number to use for use/open | ||
504 | */ | ||
505 | {"Chat macros",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
506 | {"chatmacro0", {0,&chat_macros[0]}, {0,HUSTR_CHATMACRO0},UL,UL, | ||
507 | def_str,ss_chat, 0, 0}, // chat string associated with 0 key | ||
508 | {"chatmacro1", {0,&chat_macros[1]}, {0,HUSTR_CHATMACRO1},UL,UL, | ||
509 | def_str,ss_chat, 0, 0}, // chat string associated with 1 key | ||
510 | {"chatmacro2", {0,&chat_macros[2]}, {0,HUSTR_CHATMACRO2},UL,UL, | ||
511 | def_str,ss_chat, 0, 0}, // chat string associated with 2 key | ||
512 | {"chatmacro3", {0,&chat_macros[3]}, {0,HUSTR_CHATMACRO3},UL,UL, | ||
513 | def_str,ss_chat, 0, 0}, // chat string associated with 3 key | ||
514 | {"chatmacro4", {0,&chat_macros[4]}, {0,HUSTR_CHATMACRO4},UL,UL, | ||
515 | def_str,ss_chat, 0, 0}, // chat string associated with 4 key | ||
516 | {"chatmacro5", {0,&chat_macros[5]}, {0,HUSTR_CHATMACRO5},UL,UL, | ||
517 | def_str,ss_chat, 0, 0}, // chat string associated with 5 key | ||
518 | {"chatmacro6", {0,&chat_macros[6]}, {0,HUSTR_CHATMACRO6},UL,UL, | ||
519 | def_str,ss_chat, 0, 0}, // chat string associated with 6 key | ||
520 | {"chatmacro7", {0,&chat_macros[7]}, {0,HUSTR_CHATMACRO7},UL,UL, | ||
521 | def_str,ss_chat, 0, 0}, // chat string associated with 7 key | ||
522 | {"chatmacro8", {0,&chat_macros[8]}, {0,HUSTR_CHATMACRO8},UL,UL, | ||
523 | def_str,ss_chat, 0, 0}, // chat string associated with 8 key | ||
524 | {"chatmacro9", {0,&chat_macros[9]}, {0,HUSTR_CHATMACRO9},UL,UL, | ||
525 | def_str,ss_chat, 0, 0}, // chat string associated with 9 key | ||
526 | |||
527 | {"Automap settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
528 | //jff 1/7/98 defaults for automap colors | ||
529 | //jff 4/3/98 remove -1 in lower range, 0 now disables new map features | ||
530 | {"mapcolor_back", {&mapcolor_back, NULL}, {247, NULL},0,255, // black //jff 4/6/98 new black | ||
531 | def_colour,ss_auto, 0, 0}, // color used as background for automap | ||
532 | {"mapcolor_grid", {&mapcolor_grid, NULL}, {104, NULL},0,255, // dk gray | ||
533 | def_colour,ss_auto, 0, 0}, // color used for automap grid lines | ||
534 | {"mapcolor_wall", {&mapcolor_wall, NULL}, {23, NULL},0,255, // red-brown | ||
535 | def_colour,ss_auto, 0, 0}, // color used for one side walls on automap | ||
536 | {"mapcolor_fchg", {&mapcolor_fchg, NULL}, {55, NULL},0,255, // lt brown | ||
537 | def_colour,ss_auto, 0, 0}, // color used for lines floor height changes across | ||
538 | {"mapcolor_cchg", {&mapcolor_cchg, NULL}, {215, NULL},0,255, // orange | ||
539 | def_colour,ss_auto, 0, 0}, // color used for lines ceiling height changes across | ||
540 | {"mapcolor_clsd", {&mapcolor_clsd, NULL}, {208, NULL},0,255, // white | ||
541 | def_colour,ss_auto, 0, 0}, // color used for lines denoting closed doors, objects | ||
542 | {"mapcolor_rkey", {&mapcolor_rkey, NULL}, {175, NULL},0,255, // red | ||
543 | def_colour,ss_auto, 0, 0}, // color used for red key sprites | ||
544 | {"mapcolor_bkey", {&mapcolor_bkey, NULL}, {204, NULL},0,255, // blue | ||
545 | def_colour,ss_auto, 0, 0}, // color used for blue key sprites | ||
546 | {"mapcolor_ykey", {&mapcolor_ykey, NULL}, {231, NULL},0,255, // yellow | ||
547 | def_colour,ss_auto, 0, 0}, // color used for yellow key sprites | ||
548 | {"mapcolor_rdor", {&mapcolor_rdor, NULL}, {175, NULL},0,255, // red | ||
549 | def_colour,ss_auto, 0, 0}, // color used for closed red doors | ||
550 | {"mapcolor_bdor", {&mapcolor_bdor, NULL}, {204, NULL},0,255, // blue | ||
551 | def_colour,ss_auto, 0, 0}, // color used for closed blue doors | ||
552 | {"mapcolor_ydor", {&mapcolor_ydor, NULL}, {231, NULL},0,255, // yellow | ||
553 | def_colour,ss_auto, 0, 0}, // color used for closed yellow doors | ||
554 | {"mapcolor_tele", {&mapcolor_tele, NULL}, {119, NULL},0,255, // dk green | ||
555 | def_colour,ss_auto, 0, 0}, // color used for teleporter lines | ||
556 | {"mapcolor_secr", {&mapcolor_secr, NULL}, {252, NULL},0,255, // purple | ||
557 | def_colour,ss_auto, 0, 0}, // color used for lines around secret sectors | ||
558 | {"mapcolor_exit", {&mapcolor_exit, NULL}, {0, NULL},0,255, // none | ||
559 | def_colour,ss_auto, 0, 0}, // color used for exit lines | ||
560 | {"mapcolor_unsn", {&mapcolor_unsn, NULL}, {104, NULL},0,255, // dk gray | ||
561 | def_colour,ss_auto, 0, 0}, // color used for lines not seen without computer map | ||
562 | {"mapcolor_flat", {&mapcolor_flat, NULL}, {88, NULL},0,255, // lt gray | ||
563 | def_colour,ss_auto, 0, 0}, // color used for lines with no height changes | ||
564 | {"mapcolor_sprt", {&mapcolor_sprt, NULL}, {112, NULL},0,255, // green | ||
565 | def_colour,ss_auto, 0, 0}, // color used as things | ||
566 | {"mapcolor_item", {&mapcolor_item, NULL}, {231, NULL},0,255, // yellow | ||
567 | def_colour,ss_auto, 0, 0}, // color used for counted items | ||
568 | {"mapcolor_hair", {&mapcolor_hair, NULL}, {208, NULL},0,255, // white | ||
569 | def_colour,ss_auto, 0, 0}, // color used for dot crosshair denoting center of map | ||
570 | {"mapcolor_sngl", {&mapcolor_sngl, NULL}, {208, NULL},0,255, // white | ||
571 | def_colour,ss_auto, 0, 0}, // color used for the single player arrow | ||
572 | /* {"mapcolor_me", {&mapcolor_me, NULL}, {112, NULL},0,255, // green | ||
573 | def_colour,ss_auto, 0, 0}, // your (player) colour*/ | ||
574 | {"mapcolor_frnd", {&mapcolor_frnd, NULL}, {112, NULL},0,255, | ||
575 | def_colour,ss_auto, 0, 0}, | ||
576 | //jff 3/9/98 add option to not show secrets til after found | ||
577 | {"map_secret_after", {&map_secret_after, NULL}, {0, NULL},0,1, // show secret after gotten | ||
578 | def_bool,ss_auto, 0, 0}, // prevents showing secret sectors till after entered | ||
579 | {"map_point_coord", {&map_point_coordinates, NULL}, {0, NULL},0,1, | ||
580 | def_bool,ss_auto, 0, 0}, | ||
581 | //jff 1/7/98 end additions for automap | ||
582 | {"automapmode", {(void*)&automapmode, NULL}, {0, NULL}, 0, 31, // CPhipps - remember automap mode | ||
583 | def_hex,ss_none, 0, 0}, // automap mode | ||
584 | |||
585 | {"Heads-up display settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
586 | //jff 2/16/98 defaults for color ranges in hud and status | ||
587 | {"hudcolor_titl", {&hudcolor_titl, NULL}, {5, NULL},0,9, // gold range | ||
588 | def_int,ss_auto, 0, 0}, // color range used for automap level title | ||
589 | {"hudcolor_xyco", {&hudcolor_xyco, NULL}, {3, NULL},0,9, // green range | ||
590 | def_int,ss_auto, 0, 0}, // color range used for automap coordinates | ||
591 | {"hudcolor_mesg", {&hudcolor_mesg, NULL}, {6, NULL},0,9, // red range | ||
592 | def_int,ss_mess, 0, 0}, // color range used for messages during play | ||
593 | {"hudcolor_chat", {&hudcolor_chat, NULL}, {5, NULL},0,9, // gold range | ||
594 | def_int,ss_mess, 0, 0}, // color range used for chat messages and entry | ||
595 | {"hudcolor_list", {&hudcolor_list, NULL}, {5, NULL},0,9, // gold range //jff 2/26/98 | ||
596 | def_int,ss_mess, 0, 0}, // color range used for message review | ||
597 | {"hud_msg_lines", {&hud_msg_lines, NULL}, {1, NULL},1,16, // 1 line scrolling window | ||
598 | def_int,ss_mess, 0, 0}, // number of messages in review display (1=disable) | ||
599 | {"hud_list_bgon", {&hud_list_bgon, NULL}, {0, NULL},0,1, // solid window bg ena //jff 2/26/98 | ||
600 | def_bool,ss_mess, 0, 0}, // enables background window behind message review | ||
601 | {"hud_distributed",{&hud_distributed, NULL},{0, NULL},0,1, // hud broken up into 3 displays //jff 3/4/98 | ||
602 | def_bool,ss_none, 0, 0}, // splits HUD into three 2 line displays | ||
603 | |||
604 | {"health_red", {&health_red, NULL}, {25, NULL},0,200, // below is red | ||
605 | def_int,ss_stat, 0, 0}, // amount of health for red to yellow transition | ||
606 | {"health_yellow", {&health_yellow, NULL}, {50, NULL},0,200, // below is yellow | ||
607 | def_int,ss_stat, 0, 0}, // amount of health for yellow to green transition | ||
608 | {"health_green", {&health_green, NULL}, {100, NULL},0,200,// below is green, above blue | ||
609 | def_int,ss_stat, 0, 0}, // amount of health for green to blue transition | ||
610 | {"armor_red", {&armor_red, NULL}, {25, NULL},0,200, // below is red | ||
611 | def_int,ss_stat, 0, 0}, // amount of armor for red to yellow transition | ||
612 | {"armor_yellow", {&armor_yellow, NULL}, {50, NULL},0,200, // below is yellow | ||
613 | def_int,ss_stat, 0, 0}, // amount of armor for yellow to green transition | ||
614 | {"armor_green", {&armor_green, NULL}, {100, NULL},0,200,// below is green, above blue | ||
615 | def_int,ss_stat, 0, 0}, // amount of armor for green to blue transition | ||
616 | {"ammo_red", {&ammo_red, NULL}, {25, NULL},0,100, // below 25% is red | ||
617 | def_int,ss_stat, 0, 0}, // percent of ammo for red to yellow transition | ||
618 | {"ammo_yellow", {&ammo_yellow, NULL}, {50, NULL},0,100, // below 50% is yellow, above green | ||
619 | def_int,ss_stat, 0, 0}, // percent of ammo for yellow to green transition | ||
620 | |||
621 | //jff 2/16/98 HUD and status feature controls | ||
622 | {"hud_active", {&hud_active, NULL}, {1, NULL},0,2, // 0=off, 1=small, 2=full | ||
623 | def_int,ss_none, 0, 0}, // 0 for HUD off, 1 for HUD small, 2 for full HUD | ||
624 | //jff 2/23/98 | ||
625 | {"hud_displayed", {&hud_displayed, NULL}, {0, NULL},0,1, // whether hud is displayed | ||
626 | def_bool,ss_none, 0, 0}, // enables display of HUD | ||
627 | {"hud_nosecrets", {&hud_nosecrets, NULL}, {0, NULL},0,1, // no secrets/items/kills HUD line | ||
628 | def_bool,ss_stat, 0, 0}, // disables display of kills/items/secrets on HUD | ||
629 | |||
630 | {"Weapon preferences",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
631 | // killough 2/8/98: weapon preferences set by user: | ||
632 | {"weapon_choice_1", {&weapon_preferences[0][0], NULL}, {6, NULL}, 0,9, | ||
633 | def_int,ss_weap, 0, 0}, // first choice for weapon (best) | ||
634 | {"weapon_choice_2", {&weapon_preferences[0][1], NULL}, {9, NULL}, 0,9, | ||
635 | def_int,ss_weap, 0, 0}, // second choice for weapon | ||
636 | {"weapon_choice_3", {&weapon_preferences[0][2], NULL}, {4, NULL}, 0,9, | ||
637 | def_int,ss_weap, 0, 0}, // third choice for weapon | ||
638 | {"weapon_choice_4", {&weapon_preferences[0][3], NULL}, {3, NULL}, 0,9, | ||
639 | def_int,ss_weap, 0, 0}, // fourth choice for weapon | ||
640 | {"weapon_choice_5", {&weapon_preferences[0][4], NULL}, {2, NULL}, 0,9, | ||
641 | def_int,ss_weap, 0, 0}, // fifth choice for weapon | ||
642 | {"weapon_choice_6", {&weapon_preferences[0][5], NULL}, {8, NULL}, 0,9, | ||
643 | def_int,ss_weap, 0, 0}, // sixth choice for weapon | ||
644 | {"weapon_choice_7", {&weapon_preferences[0][6], NULL}, {5, NULL}, 0,9, | ||
645 | def_int,ss_weap, 0, 0}, // seventh choice for weapon | ||
646 | {"weapon_choice_8", {&weapon_preferences[0][7], NULL}, {7, NULL}, 0,9, | ||
647 | def_int,ss_weap, 0, 0}, // eighth choice for weapon | ||
648 | {"weapon_choice_9", {&weapon_preferences[0][8], NULL}, {1, NULL}, 0,9, | ||
649 | def_int,ss_weap, 0, 0}, // ninth choice for weapon (worst) | ||
650 | |||
651 | /* // cournia - support for arbitrary music file (defaults are mp3) | ||
652 | {"Music", {NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0}, | ||
653 | {"mus_e1m1", {0,&S_music_files[mus_e1m1]}, {0,"e1m1.mp3"},UL,UL, | ||
654 | def_str,ss_none, 0, 0}, | ||
655 | {"mus_e1m2", {0,&S_music_files[mus_e1m2]}, {0,"e1m2.mp3"},UL,UL, | ||
656 | def_str,ss_none, 0, 0}, | ||
657 | {"mus_e1m3", {0,&S_music_files[mus_e1m3]}, {0,"e1m3.mp3"},UL,UL, | ||
658 | def_str,ss_none, 0, 0}, | ||
659 | {"mus_e1m4", {0,&S_music_files[mus_e1m4]}, {0,"e1m4.mp3"},UL,UL, | ||
660 | def_str,ss_none, 0, 0}, | ||
661 | {"mus_e1m5", {0,&S_music_files[mus_e1m5]}, {0,"e1m5.mp3"},UL,UL, | ||
662 | def_str,ss_none, 0, 0}, | ||
663 | {"mus_e1m6", {0,&S_music_files[mus_e1m6]}, {0,"e1m6.mp3"},UL,UL, | ||
664 | def_str,ss_none, 0, 0}, | ||
665 | {"mus_e1m7", {0,&S_music_files[mus_e1m7]}, {0,"e1m7.mp3"},UL,UL, | ||
666 | def_str,ss_none, 0, 0}, | ||
667 | {"mus_e1m8", {0,&S_music_files[mus_e1m8]}, {0,"e1m8.mp3"},UL,UL, | ||
668 | def_str,ss_none, 0, 0}, | ||
669 | {"mus_e1m9", {0,&S_music_files[mus_e1m9]}, {0,"e1m9.mp3"},UL,UL, | ||
670 | def_str,ss_none, 0, 0}, | ||
671 | {"mus_e2m1", {0,&S_music_files[mus_e2m1]}, {0,"e2m1.mp3"},UL,UL, | ||
672 | def_str,ss_none, 0, 0}, | ||
673 | {"mus_e2m2", {0,&S_music_files[mus_e2m2]}, {0,"e2m2.mp3"},UL,UL, | ||
674 | def_str,ss_none, 0, 0}, | ||
675 | {"mus_e2m3", {0,&S_music_files[mus_e2m3]}, {0,"e2m3.mp3"},UL,UL, | ||
676 | def_str,ss_none, 0, 0}, | ||
677 | {"mus_e2m4", {0,&S_music_files[mus_e2m4]}, {0,"e2m4.mp3"},UL,UL, | ||
678 | def_str,ss_none, 0, 0}, | ||
679 | {"mus_e2m5", {0,&S_music_files[mus_e2m5]}, {0,"e1m7.mp3"},UL,UL, | ||
680 | def_str,ss_none, 0, 0}, | ||
681 | {"mus_e2m6", {0,&S_music_files[mus_e2m6]}, {0,"e2m6.mp3"},UL,UL, | ||
682 | def_str,ss_none, 0, 0}, | ||
683 | {"mus_e2m7", {0,&S_music_files[mus_e2m7]}, {0,"e2m7.mp3"},UL,UL, | ||
684 | def_str,ss_none, 0, 0}, | ||
685 | {"mus_e2m8", {0,&S_music_files[mus_e2m8]}, {0,"e2m8.mp3"},UL,UL, | ||
686 | def_str,ss_none, 0, 0}, | ||
687 | {"mus_e2m9", {0,&S_music_files[mus_e2m9]}, {0,"e3m1.mp3"},UL,UL, | ||
688 | def_str,ss_none, 0, 0}, | ||
689 | {"mus_e3m1", {0,&S_music_files[mus_e3m1]}, {0,"e3m1.mp3"},UL,UL, | ||
690 | def_str,ss_none, 0, 0}, | ||
691 | {"mus_e3m2", {0,&S_music_files[mus_e3m2]}, {0,"e3m2.mp3"},UL,UL, | ||
692 | def_str,ss_none, 0, 0}, | ||
693 | {"mus_e3m3", {0,&S_music_files[mus_e3m3]}, {0,"e3m3.mp3"},UL,UL, | ||
694 | def_str,ss_none, 0, 0}, | ||
695 | {"mus_e3m4", {0,&S_music_files[mus_e3m4]}, {0,"e1m8.mp3"},UL,UL, | ||
696 | def_str,ss_none, 0, 0}, | ||
697 | {"mus_e3m5", {0,&S_music_files[mus_e3m5]}, {0,"e1m7.mp3"},UL,UL, | ||
698 | def_str,ss_none, 0, 0}, | ||
699 | {"mus_e3m6", {0,&S_music_files[mus_e3m6]}, {0,"e1m6.mp3"},UL,UL, | ||
700 | def_str,ss_none, 0, 0}, | ||
701 | {"mus_e3m7", {0,&S_music_files[mus_e3m7]}, {0,"e2m7.mp3"},UL,UL, | ||
702 | def_str,ss_none, 0, 0}, | ||
703 | {"mus_e3m8", {0,&S_music_files[mus_e3m8]}, {0,"e3m8.mp3"},UL,UL, | ||
704 | def_str,ss_none, 0, 0}, | ||
705 | {"mus_e3m9", {0,&S_music_files[mus_e3m9]}, {0,"e1m9.mp3"},UL,UL, | ||
706 | def_str,ss_none, 0, 0}, | ||
707 | {"mus_inter", {0,&S_music_files[mus_inter]}, {0,"e2m3.mp3"},UL,UL, | ||
708 | def_str,ss_none, 0, 0}, | ||
709 | {"mus_intro", {0,&S_music_files[mus_intro]}, {0,"intro.mp3"},UL,UL, | ||
710 | def_str,ss_none, 0, 0}, | ||
711 | {"mus_bunny", {0,&S_music_files[mus_bunny]}, {0,"bunny.mp3"},UL,UL, | ||
712 | def_str,ss_none, 0, 0}, | ||
713 | {"mus_victor", {0,&S_music_files[mus_victor]}, {0,"victor.mp3"},UL,UL, | ||
714 | def_str,ss_none, 0, 0}, | ||
715 | {"mus_introa", {0,&S_music_files[mus_introa]}, {0,"intro.mp3"},UL,UL, | ||
716 | def_str,ss_none, 0, 0}, | ||
717 | {"mus_runnin", {0,&S_music_files[mus_runnin]}, {0,"runnin.mp3"},UL,UL, | ||
718 | def_str,ss_none, 0, 0}, | ||
719 | {"mus_stalks", {0,&S_music_files[mus_stalks]}, {0,"stalks.mp3"},UL,UL, | ||
720 | def_str,ss_none, 0, 0}, | ||
721 | {"mus_countd", {0,&S_music_files[mus_countd]}, {0,"countd.mp3"},UL,UL, | ||
722 | def_str,ss_none, 0, 0}, | ||
723 | {"mus_betwee", {0,&S_music_files[mus_betwee]}, {0,"betwee.mp3"},UL,UL, | ||
724 | def_str,ss_none, 0, 0}, | ||
725 | {"mus_doom", {0,&S_music_files[mus_doom]}, {0,"doom.mp3"},UL,UL, | ||
726 | def_str,ss_none, 0, 0}, | ||
727 | {"mus_the_da", {0,&S_music_files[mus_the_da]}, {0,"the_da.mp3"},UL,UL, | ||
728 | def_str,ss_none, 0, 0}, | ||
729 | {"mus_shawn", {0,&S_music_files[mus_shawn]}, {0,"shawn.mp3"},UL,UL, | ||
730 | def_str,ss_none, 0, 0}, | ||
731 | {"mus_ddtblu", {0,&S_music_files[mus_ddtblu]}, {0,"ddtblu.mp3"},UL,UL, | ||
732 | def_str,ss_none, 0, 0}, | ||
733 | {"mus_in_cit", {0,&S_music_files[mus_in_cit]}, {0,"in_cit.mp3"},UL,UL, | ||
734 | def_str,ss_none, 0, 0}, | ||
735 | {"mus_dead", {0,&S_music_files[mus_dead]}, {0,"dead.mp3"},UL,UL, | ||
736 | def_str,ss_none, 0, 0}, | ||
737 | {"mus_stlks2", {0,&S_music_files[mus_stlks2]}, {0,"stalks.mp3"},UL,UL, | ||
738 | def_str,ss_none, 0, 0}, | ||
739 | {"mus_theda2", {0,&S_music_files[mus_theda2]}, {0,"the_da.mp3"},UL,UL, | ||
740 | def_str,ss_none, 0, 0}, | ||
741 | {"mus_doom2", {0,&S_music_files[mus_doom2]}, {0,"doom.mp3"},UL,UL, | ||
742 | def_str,ss_none, 0, 0}, | ||
743 | {"mus_ddtbl2", {0,&S_music_files[mus_ddtbl2]}, {0,"ddtblu.mp3"},UL,UL, | ||
744 | def_str,ss_none, 0, 0}, | ||
745 | {"mus_runni2", {0,&S_music_files[mus_runni2]}, {0,"runnin.mp3"},UL,UL, | ||
746 | def_str,ss_none, 0, 0}, | ||
747 | {"mus_dead2", {0,&S_music_files[mus_dead2]}, {0,"dead.mp3"},UL,UL, | ||
748 | def_str,ss_none, 0, 0}, | ||
749 | {"mus_stlks3", {0,&S_music_files[mus_stlks3]}, {0,"stalks.mp3"},UL,UL, | ||
750 | def_str,ss_none, 0, 0}, | ||
751 | {"mus_romero", {0,&S_music_files[mus_romero]}, {0,"romero.mp3"},UL,UL, | ||
752 | def_str,ss_none, 0, 0}, | ||
753 | {"mus_shawn2", {0,&S_music_files[mus_shawn2]}, {0,"shawn.mp3"},UL,UL, | ||
754 | def_str,ss_none, 0, 0}, | ||
755 | {"mus_messag", {0,&S_music_files[mus_messag]}, {0,"messag.mp3"},UL,UL, | ||
756 | def_str,ss_none, 0, 0}, | ||
757 | {"mus_count2", {0,&S_music_files[mus_count2]}, {0,"countd.mp3"},UL,UL, | ||
758 | def_str,ss_none, 0, 0}, | ||
759 | {"mus_ddtbl3", {0,&S_music_files[mus_ddtbl3]}, {0,"ddtblu.mp3"},UL,UL, | ||
760 | def_str,ss_none, 0, 0}, | ||
761 | {"mus_ampie", {0,&S_music_files[mus_ampie]}, {0,"ampie.mp3"},UL,UL, | ||
762 | def_str,ss_none, 0, 0}, | ||
763 | {"mus_theda3", {0,&S_music_files[mus_theda3]}, {0,"the_da.mp3"},UL,UL, | ||
764 | def_str,ss_none, 0, 0}, | ||
765 | {"mus_adrian", {0,&S_music_files[mus_adrian]}, {0,"adrian.mp3"},UL,UL, | ||
766 | def_str,ss_none, 0, 0}, | ||
767 | {"mus_messg2", {0,&S_music_files[mus_messg2]}, {0,"messag.mp3"},UL,UL, | ||
768 | def_str,ss_none, 0, 0}, | ||
769 | {"mus_romer2", {0,&S_music_files[mus_romer2]}, {0,"romero.mp3"},UL,UL, | ||
770 | def_str,ss_none, 0, 0}, | ||
771 | {"mus_tense", {0,&S_music_files[mus_tense]}, {0,"tense.mp3"},UL,UL, | ||
772 | def_str,ss_none, 0, 0}, | ||
773 | {"mus_shawn3", {0,&S_music_files[mus_shawn3]}, {0,"shawn.mp3"},UL,UL, | ||
774 | def_str,ss_none, 0, 0}, | ||
775 | {"mus_openin", {0,&S_music_files[mus_openin]}, {0,"openin.mp3"},UL,UL, | ||
776 | def_str,ss_none, 0, 0}, | ||
777 | {"mus_evil", {0,&S_music_files[mus_evil]}, {0,"evil.mp3"},UL,UL, | ||
778 | def_str,ss_none, 0, 0}, | ||
779 | {"mus_ultima", {0,&S_music_files[mus_ultima]}, {0,"ultima.mp3"},UL,UL, | ||
780 | def_str,ss_none, 0, 0}, | ||
781 | {"mus_read_m", {0,&S_music_files[mus_read_m]}, {0,"read_m.mp3"},UL,UL, | ||
782 | def_str,ss_none, 0, 0}, | ||
783 | {"mus_dm2ttl", {0,&S_music_files[mus_dm2ttl]}, {0,"dm2ttl.mp3"},UL,UL, | ||
784 | def_str,ss_none, 0, 0}, | ||
785 | {"mus_dm2int", {0,&S_music_files[mus_dm2int]}, {0,"dm2int.mp3"},UL,UL, | ||
786 | def_str,ss_none, 0, 0}, | ||
787 | */ | ||
788 | }; | ||
789 | |||
790 | int numdefaults; | ||
791 | //static const char* defaultfile; // CPhipps - static, const | ||
792 | |||
793 | // | ||
794 | // M_SaveDefaults | ||
795 | // | ||
796 | |||
797 | void M_SaveDefaults (void) | ||
798 | { | ||
799 | int i,fd; | ||
800 | |||
801 | fd = open (GAMEBASE"default.dfg", O_WRONLY|O_CREAT|O_TRUNC); | ||
802 | if (fd<0) | ||
803 | return; // can't write the file, but don't complain | ||
804 | |||
805 | for (i=0 ; i<numdefaults ; i++) | ||
806 | if(defaults[i].location.pi) | ||
807 | write(fd,defaults[i].location.pi, sizeof(int)); | ||
808 | |||
809 | close (fd); | ||
810 | } | ||
811 | |||
812 | /* | ||
813 | * M_LookupDefault | ||
814 | * | ||
815 | * cph - mimic MBF function for now. Yes it's crap. | ||
816 | */ | ||
817 | |||
818 | struct default_s *M_LookupDefault(const char *name) | ||
819 | { | ||
820 | int i; | ||
821 | for (i = 0 ; i < numdefaults ; i++) | ||
822 | if ((defaults[i].type != def_none) && !strcmp(name, defaults[i].name)) | ||
823 | return &defaults[i]; | ||
824 | I_Error("M_LookupDefault: %s not found",name); | ||
825 | return NULL; | ||
826 | } | ||
827 | |||
828 | // | ||
829 | // M_LoadDefaults | ||
830 | // | ||
831 | |||
832 | #define NUMCHATSTRINGS 10 // phares 4/13/98 | ||
833 | |||
834 | void M_LoadDefaults (void) | ||
835 | { | ||
836 | int i; | ||
837 | int fd; | ||
838 | // set everything to base values | ||
839 | |||
840 | numdefaults = sizeof(defaults)/sizeof(defaults[0]); | ||
841 | for (i = 0 ; i < numdefaults ; i++) { | ||
842 | if (defaults[i].location.ppsz) | ||
843 | *defaults[i].location.ppsz = strdup(defaults[i].defaultvalue.psz); | ||
844 | if (defaults[i].location.pi) | ||
845 | *defaults[i].location.pi = defaults[i].defaultvalue.i; | ||
846 | } | ||
847 | |||
848 | fd = open (GAMEBASE"default.dfg", O_RDONLY); | ||
849 | if (fd<0) | ||
850 | return; // don't have anything to read | ||
851 | |||
852 | for (i=0 ; i<numdefaults ; i++) | ||
853 | if(defaults[i].location.pi) | ||
854 | read(fd,defaults[i].location.pi, sizeof(int)); | ||
855 | |||
856 | close (fd); | ||
857 | } | ||
858 | |||
859 | |||
860 | // | ||
861 | // SCREEN SHOTS | ||
862 | // | ||
863 | |||
864 | // CPhipps - nasty but better than nothing | ||
865 | static boolean screenshot_write_error; | ||
866 | |||
867 | // jff 3/30/98 types and data structures for BMP output of screenshots | ||
868 | // | ||
869 | // killough 5/2/98: | ||
870 | // Changed type names to avoid conflicts with endianess functions | ||
871 | |||
872 | #define BI_RGB 0L | ||
873 | |||
874 | typedef unsigned long dword_t; | ||
875 | typedef long long_t; | ||
876 | typedef unsigned char ubyte_t; | ||
877 | |||
878 | typedef struct tagBITMAPFILEHEADER | ||
879 | { | ||
880 | unsigned short bfType; | ||
881 | dword_t bfSize; | ||
882 | unsigned short bfReserved1; | ||
883 | unsigned short bfReserved2; | ||
884 | dword_t bfOffBits; | ||
885 | } PACKEDATTR BITMAPFILEHEADER; | ||
886 | |||
887 | typedef struct tagBITMAPINFOHEADER | ||
888 | { | ||
889 | dword_t biSize; | ||
890 | long_t biWidth; | ||
891 | long_t biHeight; | ||
892 | unsigned short biPlanes; | ||
893 | unsigned short biBitCount; | ||
894 | dword_t biCompression; | ||
895 | dword_t biSizeImage; | ||
896 | long_t biXPelsPerMeter; | ||
897 | long_t biYPelsPerMeter; | ||
898 | dword_t biClrUsed; | ||
899 | dword_t biClrImportant; | ||
900 | } PACKEDATTR BITMAPINFOHEADER; | ||
901 | #if 0 | ||
902 | // jff 3/30/98 binary file write with error detection | ||
903 | // CPhipps - static, const on parameter | ||
904 | static void SafeWrite(const void *data, size_t size, size_t number, int st) | ||
905 | { | ||
906 | /* if (write(data,size,number,st)<number) | ||
907 | screenshot_write_error = true; // CPhipps - made non-fatal*/ | ||
908 | } | ||
909 | #endif | ||
910 | // | ||
911 | // WriteBMPfile | ||
912 | // jff 3/30/98 Add capability to write a .BMP file (256 color uncompressed) | ||
913 | // | ||
914 | |||
915 | // CPhipps - static, const on parameters | ||
916 | static void WriteBMPfile(const char* filename, const byte* data, | ||
917 | const int width, const int height, const byte* palette) | ||
918 | { | ||
919 | (void)filename; | ||
920 | (void)data; | ||
921 | (void)width; | ||
922 | (void)height; | ||
923 | (void)palette; | ||
924 | /* int i,wid; | ||
925 | BITMAPFILEHEADER bmfh; | ||
926 | BITMAPINFOHEADER bmih; | ||
927 | int fhsiz,ihsiz; | ||
928 | FILE *st; | ||
929 | char zero=0; | ||
930 | ubyte_t c; | ||
931 | |||
932 | fhsiz = sizeof(BITMAPFILEHEADER); | ||
933 | ihsiz = sizeof(BITMAPINFOHEADER); | ||
934 | wid = 4*((width+3)/4); | ||
935 | //jff 4/22/98 add endian macros | ||
936 | bmfh.bfType = SHORT(19778); | ||
937 | bmfh.bfSize = LONG(fhsiz+ihsiz+256L*4+width*height); | ||
938 | bmfh.bfReserved1 = SHORT(0); | ||
939 | bmfh.bfReserved2 = SHORT(0); | ||
940 | bmfh.bfOffBits = LONG(fhsiz+ihsiz+256L*4); | ||
941 | |||
942 | bmih.biSize = LONG(ihsiz); | ||
943 | bmih.biWidth = LONG(width); | ||
944 | bmih.biHeight = LONG(height); | ||
945 | bmih.biPlanes = SHORT(1); | ||
946 | bmih.biBitCount = SHORT(8); | ||
947 | bmih.biCompression = LONG(BI_RGB); | ||
948 | bmih.biSizeImage = LONG(wid*height); | ||
949 | bmih.biXPelsPerMeter = LONG(0); | ||
950 | bmih.biYPelsPerMeter = LONG(0); | ||
951 | bmih.biClrUsed = LONG(256); | ||
952 | bmih.biClrImportant = LONG(256); | ||
953 | |||
954 | st = fopen(filename,"wb"); | ||
955 | if (st!=NULL) { | ||
956 | // write the header | ||
957 | SafeWrite(&bmfh.bfType,sizeof(bmfh.bfType),1,st); | ||
958 | SafeWrite(&bmfh.bfSize,sizeof(bmfh.bfSize),1,st); | ||
959 | SafeWrite(&bmfh.bfReserved1,sizeof(bmfh.bfReserved1),1,st); | ||
960 | SafeWrite(&bmfh.bfReserved2,sizeof(bmfh.bfReserved2),1,st); | ||
961 | SafeWrite(&bmfh.bfOffBits,sizeof(bmfh.bfOffBits),1,st); | ||
962 | |||
963 | SafeWrite(&bmih.biSize,sizeof(bmih.biSize),1,st); | ||
964 | SafeWrite(&bmih.biWidth,sizeof(bmih.biWidth),1,st); | ||
965 | SafeWrite(&bmih.biHeight,sizeof(bmih.biHeight),1,st); | ||
966 | SafeWrite(&bmih.biPlanes,sizeof(bmih.biPlanes),1,st); | ||
967 | SafeWrite(&bmih.biBitCount,sizeof(bmih.biBitCount),1,st); | ||
968 | SafeWrite(&bmih.biCompression,sizeof(bmih.biCompression),1,st); | ||
969 | SafeWrite(&bmih.biSizeImage,sizeof(bmih.biSizeImage),1,st); | ||
970 | SafeWrite(&bmih.biXPelsPerMeter,sizeof(bmih.biXPelsPerMeter),1,st); | ||
971 | SafeWrite(&bmih.biYPelsPerMeter,sizeof(bmih.biYPelsPerMeter),1,st); | ||
972 | SafeWrite(&bmih.biClrUsed,sizeof(bmih.biClrUsed),1,st); | ||
973 | SafeWrite(&bmih.biClrImportant,sizeof(bmih.biClrImportant),1,st); | ||
974 | |||
975 | // write the palette, in blue-green-red order, gamma corrected | ||
976 | for (i=0;i<768;i+=3) { | ||
977 | c=gammatable[usegamma][palette[i+2]]; | ||
978 | SafeWrite(&c,sizeof(char),1,st); | ||
979 | c=gammatable[usegamma][palette[i+1]]; | ||
980 | SafeWrite(&c,sizeof(char),1,st); | ||
981 | c=gammatable[usegamma][palette[i+0]]; | ||
982 | SafeWrite(&c,sizeof(char),1,st); | ||
983 | SafeWrite(&zero,sizeof(char),1,st); | ||
984 | } | ||
985 | |||
986 | for (i = 0 ; i < height ; i++) | ||
987 | SafeWrite(data+(height-1-i)*width,sizeof(byte),wid,st); | ||
988 | |||
989 | fclose(st); | ||
990 | }*/ | ||
991 | } | ||
992 | |||
993 | // | ||
994 | // M_ScreenShot | ||
995 | // | ||
996 | // Modified by Lee Killough so that any number of shots can be taken, | ||
997 | // the code is faster, and no annoying "screenshot" message appears. | ||
998 | |||
999 | // CPhipps - modified to use its own buffer for the image | ||
1000 | // - checks for the case where no file can be created (doesn't occur on POSIX systems, would on DOS) | ||
1001 | // - track errors better | ||
1002 | // - split into 2 functions | ||
1003 | |||
1004 | // | ||
1005 | // M_DoScreenShot | ||
1006 | // Takes a screenshot into the names file | ||
1007 | |||
1008 | void M_DoScreenShot (const char* fname) | ||
1009 | { | ||
1010 | byte *linear; | ||
1011 | #ifndef GL_DOOM | ||
1012 | const byte *pal; | ||
1013 | int pplump = W_GetNumForName("PLAYPAL"); | ||
1014 | #endif | ||
1015 | |||
1016 | screenshot_write_error = false; | ||
1017 | |||
1018 | #ifdef GL_DOOM | ||
1019 | // munge planar buffer to linear | ||
1020 | // CPhipps - use a malloc()ed buffer instead of screens[2] | ||
1021 | gld_ReadScreen(linear = malloc(SCREENWIDTH * SCREENHEIGHT * 3)); | ||
1022 | |||
1023 | // save the bmp file | ||
1024 | |||
1025 | WriteTGAfile | ||
1026 | (fname, linear, SCREENWIDTH, SCREENHEIGHT); | ||
1027 | #else | ||
1028 | // munge planar buffer to linear | ||
1029 | // CPhipps - use a malloc()ed buffer instead of screens[2] | ||
1030 | I_ReadScreen(linear = malloc(SCREENWIDTH * SCREENHEIGHT)); | ||
1031 | |||
1032 | // killough 4/18/98: make palette stay around (PU_CACHE could cause crash) | ||
1033 | pal = W_CacheLumpNum (pplump); | ||
1034 | |||
1035 | // save the bmp file | ||
1036 | |||
1037 | WriteBMPfile | ||
1038 | (fname, linear, SCREENWIDTH, SCREENHEIGHT, pal); | ||
1039 | |||
1040 | // cph - free the palette | ||
1041 | W_UnlockLumpNum(pplump); | ||
1042 | #endif | ||
1043 | free(linear); | ||
1044 | // 1/18/98 killough: replace "SCREEN SHOT" acknowledgement with sfx | ||
1045 | |||
1046 | if (screenshot_write_error) | ||
1047 | doom_printf("M_ScreenShot: Error writing screenshot"); | ||
1048 | } | ||
1049 | |||
1050 | void M_ScreenShot(void) | ||
1051 | { | ||
1052 | static int shot; | ||
1053 | char lbmname[32]; | ||
1054 | int startshot; | ||
1055 | |||
1056 | screenshot_write_error = false; | ||
1057 | |||
1058 | if (fileexists(".")) screenshot_write_error = true; | ||
1059 | |||
1060 | startshot = shot; // CPhipps - prevent infinite loop | ||
1061 | |||
1062 | do | ||
1063 | snprintf(lbmname,sizeof(lbmname),"DOOM%d.BMP", shot++); | ||
1064 | while (!fileexists(lbmname) && (shot != startshot) && (shot < 10000)); | ||
1065 | |||
1066 | if (!fileexists(lbmname)) screenshot_write_error = true; | ||
1067 | |||
1068 | if (screenshot_write_error) { | ||
1069 | doom_printf ("M_ScreenShot: Couldn't create a BMP"); | ||
1070 | // killough 4/18/98 | ||
1071 | return; | ||
1072 | } | ||
1073 | |||
1074 | M_DoScreenShot(lbmname); // cph | ||
1075 | |||
1076 | S_StartSound(NULL,gamemode==commercial ? sfx_radio : sfx_tink); | ||
1077 | } | ||