lcd-m6sp.c: remove \r
[kugel-rb.git] / apps / plugins / doom / m_misc.c
blob1e4b75d8e14425d26cb9e167d2113ff66c048f76
1 /* Emacs style mode select -*- C++ -*-
2 *-----------------------------------------------------------------------------
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
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.
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.
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.
27 * DESCRIPTION:
28 * Main loop menu stuff.
29 * Default Config File.
30 * PCX Screenshots.
32 *-----------------------------------------------------------------------------*/
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"
54 #include "rockmacros.h"
57 // M_DrawText
58 // Returns the final X coordinate
59 // HU_Init must have been called to init the font
61 extern patchnum_t hu_font[HU_FONTSIZE];
63 int M_DrawText(int x,int y,boolean direct,char* string)
65 (void)direct;
66 int c;
67 int w;
69 while (*string) {
70 c = toupper(*string) - HU_FONTSTART;
71 string++;
72 if (c < 0 || c> HU_FONTSIZE) {
73 x += 4;
74 continue;
77 w = SHORT (hu_font[c].width);
78 if (x+w > SCREENWIDTH)
79 break;
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;
87 return x;
91 // M_WriteFile
94 boolean M_WriteFile(char const* name,void* source,int length)
96 int handle;
97 int count;
99 handle = open ( name, O_WRONLY | O_CREAT | O_TRUNC);
101 if (handle == -1)
102 return false;
104 count = write (handle, source, length);
105 close (handle);
107 if (count < length) {
108 // unlink(name); // CPhipps - no corrupt data files around, they only confuse people.
109 return false;
112 return true;
117 // M_ReadFile
120 int M_ReadFile(char const* name,byte** buffer)
122 int handle, count, length;
123 // struct stat fileinfo;
124 byte *buf;
126 handle = open (name, O_RDONLY);
127 if ((handle < 0))
128 I_Error ("M_ReadFile: Couldn't read file %s", name);
130 length = filesize(handle);
131 buf = Z_Malloc (length, PU_STATIC, NULL);
132 count = read (handle, buf, length);
133 close (handle);
135 if (count < length)
136 I_Error ("M_ReadFile: Couldn't read file %s", name);
138 *buffer = buf;
139 return length;
143 // DEFAULTS
146 int usemouse;
147 boolean precache = true; /* if true, load all graphics at start */
149 extern int mousebfire;
150 extern int mousebstrafe;
151 extern int mousebforward;
153 extern int viewwidth;
154 extern int viewheight;
155 extern int fake_contrast;
156 extern int mouseSensitivity_horiz,mouseSensitivity_vert; // killough
158 extern int realtic_clock_rate; // killough 4/13/98: adjustable timer
159 extern int tran_filter_pct; // killough 2/21/98
161 extern int screenblocks;
162 extern int showMessages;
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
171 extern const char* chat_macros[];
173 extern int endoom_mode;
174 int X_opt;
176 extern const char* S_music_files[]; // cournia
178 /* cph - Some MBF stuff parked here for now
179 * killough 10/98
181 int map_point_coordinates;
183 default_t defaults[] =
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?
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},
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},
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},
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 {"enable_sound",{(void *)&enable_sound, NULL},{0, NULL},0,1, def_bool,ss_none, 0, 0},
295 {"sfx_volume",{&snd_SfxVolume, NULL},{8, NULL},0,15, def_int,ss_none, 0, 0},
296 {"music_volume",{&snd_MusicVolume, NULL},{8, NULL},0,15, def_int,ss_none, 0, 0},
297 {"mus_pause_opt",{&mus_pause_opt, NULL},{2, NULL},0,2, // CPhipps - music pausing
298 def_int, ss_none, 0, 0}, // 0 = kill music when paused, 1 = pause music, 2 = let music continue
299 {"sounddev", {NULL,&snd_device}, {0,"/dev/dsp"},UL,UL,
300 def_str,ss_none, 0, 0}, // sound output device (UNIX)
301 {"snd_channels",{&default_numChannels, NULL},{4, NULL},1,32,
302 def_int,ss_none, 0, 0}, // number of audio events simultaneously // killough
304 {"Video settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0},
305 // CPhipps - default screensize for targets that support high-res
306 /* {"screen_width",{&desired_screenwidth, NULL},{320, NULL}, 320, 1600,
307 def_int,ss_none, 0, 0},
308 {"screen_height",{&desired_screenheight, NULL},{200, NULL},200,1200,
309 def_int,ss_none, 0, 0},*/
310 #if(LCD_HEIGHT>LCD_WIDTH)
311 {"rotate_screen",{(void *)&rotate_screen, NULL},{0, NULL},0,1,
312 def_bool,ss_none, 0, 0}, /* kwk - rotate the screen 90 degrees */
313 #endif
314 {"fake_contrast",{&fake_contrast, NULL},{1, NULL},0,1,
315 def_bool,ss_none, 0, 0}, /* cph - allow crappy fake contrast to be disabled */
316 // {"use_fullscreen",{&use_fullscreen, NULL},{1, NULL},0,1, /* proff 21/05/2000 */
317 // def_bool,ss_none, 0, 0},
318 // {"use_doublebuffer",{&use_doublebuffer, NULL},{1, NULL},0,1, // proff 2001-7-4
319 // def_bool,ss_none, 0, 0}, // enable doublebuffer to avoid display tearing (fullscreen)
320 {"translucency",{&default_translucency, NULL},{1, NULL},0,1, // phares
321 def_bool,ss_none, 0, 0}, // enables translucency
322 {"tran_filter_pct",{&tran_filter_pct, NULL},{66, NULL},0,100, // killough 2/21/98
323 def_int,ss_none, 0, 0}, // set percentage of foreground/background translucency mix
324 {"screenblocks",{&screenblocks, NULL},{10, NULL},3,11,
325 def_int,ss_none, 0, 0},
326 {"usegamma",{&usegamma, NULL},{1, NULL},0,4, //jff 3/6/98 fix erroneous upper limit in range
327 def_int,ss_none, 0, 0}, // gamma correction level // killough 1/18/98
328 {"X_options",{&X_opt, NULL},{0, NULL},0,3, // CPhipps - misc X options
329 def_hex,ss_none, 0, 0}, // X options, see l_video_x.c
331 {"Mouse settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0},
332 {"use_mouse",{&usemouse, NULL},{1, NULL},0,1,
333 def_bool,ss_none, 0, 0}, // enables use of mouse with DOOM
334 //jff 4/3/98 allow unlimited sensitivity
335 // {"mouse_sensitivity_horiz",{&mouseSensitivity_horiz, NULL},{10, NULL},0,UL,
336 // def_int,ss_none, 0, 0}, /* adjust horizontal (x) mouse sensitivity killough/mead */
337 //jff 4/3/98 allow unlimited sensitivity
338 // {"mouse_sensitivity_vert",{&mouseSensitivity_vert, NULL},{10, NULL},0,UL,
339 // def_int,ss_none, 0, 0}, /* adjust vertical (y) mouse sensitivity killough/mead */
340 //jff 3/8/98 allow -1 in mouse bindings to disable mouse function
341 {"mouseb_fire",{&mousebfire, NULL},{0, NULL},-1,MAX_MOUSEB,
342 def_int,ss_keys, 0, 0}, // mouse button number to use for fire
343 {"mouseb_strafe",{&mousebstrafe, NULL},{1, NULL},-1,MAX_MOUSEB,
344 def_int,ss_keys, 0, 0}, // mouse button number to use for strafing
345 {"mouseb_forward",{&mousebforward, NULL},{2, NULL},-1,MAX_MOUSEB,
346 def_int,ss_keys, 0, 0}, // mouse button number to use for forward motion
347 //jff 3/8/98 end of lower range change for -1 allowed in mouse binding
349 // For key bindings, the values stored in the key_* variables // phares
350 // are the internal Doom Codes. The values stored in the default.cfg
351 // file are the keyboard codes.
352 // CPhipps - now they're the doom codes, so default.cfg can be portable
354 {"Key bindings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0},
355 {"key_right", {&key_right, NULL}, {KEY_RIGHTARROW, NULL},
356 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to turn right
357 {"key_left", {&key_left, NULL}, {KEY_LEFTARROW, NULL} ,
358 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to turn left
359 {"key_up", {&key_up, NULL}, {KEY_UPARROW, NULL} ,
360 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move forward
361 {"key_down", {&key_down, NULL}, {KEY_DOWNARROW, NULL},
362 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move backward
363 {"key_menu_right", {&key_menu_right, NULL}, {KEY_RIGHTARROW, NULL},// phares 3/7/98
364 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move right in a menu // |
365 {"key_menu_left", {&key_menu_left, NULL}, {KEY_LEFTARROW, NULL} ,// V
366 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move left in a menu
367 {"key_menu_up", {&key_menu_up, NULL}, {KEY_UPARROW,NULL} ,
368 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move up in a menu
369 {"key_menu_down", {&key_menu_down, NULL}, {KEY_DOWNARROW, NULL} ,
370 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to move down in a menu
371 {"key_menu_backspace",{&key_menu_backspace, NULL},{KEY_BACKSPACE, NULL} ,
372 0,MAX_KEY,def_key,ss_keys, 0, 0}, // delete key in a menu
373 {"key_menu_escape", {&key_menu_escape, NULL}, {KEY_ESCAPE, NULL} ,
374 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to leave a menu , // phares 3/7/98
375 {"key_menu_enter", {&key_menu_enter, NULL}, {KEY_ENTER, NULL} ,
376 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to select from menu
378 {"key_strafeleft", {&key_strafeleft, NULL}, {',', NULL},
379 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to strafe left
380 {"key_straferight", {&key_straferight, NULL}, {'.', NULL},
381 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to strafe right
383 {"key_fire", {&key_fire, NULL}, {KEY_RCTRL, NULL} ,
384 0,MAX_KEY,def_key,ss_keys, 0, 0}, // duh
385 {"key_use", {&key_use, NULL}, {' ', NULL},
386 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to open a door, use a switch
387 {"key_strafe", {&key_strafe, NULL}, {'s', NULL} ,
388 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to use with arrows to strafe
389 {"key_speed", {&key_speed, NULL}, {KEY_RSHIFT, NULL} ,
390 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to run
392 {"key_savegame", {&key_savegame, NULL}, {KEY_F2, NULL},
393 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to save current game
394 {"key_loadgame", {&key_loadgame, NULL}, {KEY_F3, NULL},
395 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to restore from saved games
396 {"key_soundvolume", {&key_soundvolume, NULL}, {KEY_F4, NULL},
397 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to bring up sound controls
398 {"key_hud", {&key_hud, NULL}, {KEY_F5, NULL},
399 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to adjust HUD
400 {"key_quicksave", {&key_quicksave, NULL}, {KEY_F6, NULL},
401 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to to quicksave
402 {"key_endgame", {&key_endgame, NULL}, {KEY_F7, NULL},
403 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to end the game
404 {"key_messages", {&key_messages, NULL}, {KEY_F8, NULL},
405 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle message enable
406 {"key_quickload", {&key_quickload, NULL}, {KEY_F9, NULL},
407 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to load from quicksave
408 {"key_quit", {&key_quit, NULL}, {KEY_F10, NULL},
409 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to quit game
410 {"key_gamma", {&key_gamma, NULL}, {KEY_F11, NULL},
411 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to adjust gamma correction
412 {"key_spy", {&key_spy, NULL}, {KEY_F12, NULL},
413 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to view from another coop player's view
414 {"key_pause", {&key_pause, NULL}, {KEY_PAUSE, NULL},
415 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to pause the game
416 {"key_autorun", {&key_autorun, NULL}, {KEY_CAPSLOCK, NULL},
417 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle always run mode
418 {"key_chat", {&key_chat, NULL}, {'t', NULL},
419 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to enter a chat message
420 {"key_backspace", {&key_backspace, NULL}, {KEY_BACKSPACE, NULL},
421 0,MAX_KEY,def_key,ss_keys, 0, 0}, // backspace key
422 {"key_enter", {&key_enter, NULL}, {0, NULL},
423 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to select from menu or see last message
424 {"key_map", {&key_map, NULL}, {KEY_TAB, NULL},
425 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle automap display
426 {"key_map_right", {&key_map_right, NULL}, {KEY_RIGHTARROW, NULL},// phares 3/7/98
427 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to shift automap right // |
428 {"key_map_left", {&key_map_left, NULL}, {KEY_LEFTARROW, NULL},// V
429 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to shift automap left
430 {"key_map_up", {&key_map_up, NULL}, {KEY_UPARROW, NULL},
431 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to shift automap up
432 {"key_map_down", {&key_map_down, NULL}, {KEY_DOWNARROW, NULL},
433 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to shift automap down
434 {"key_map_zoomin", {&key_map_zoomin, NULL}, {'=', NULL},
435 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to enlarge automap
436 {"key_map_zoomout", {&key_map_zoomout, NULL}, {'-', NULL},
437 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to reduce automap
438 {"key_map_gobig", {&key_map_gobig, NULL}, {'0', NULL},
439 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to get max zoom for automap
440 {"key_map_follow", {&key_map_follow, NULL}, {'f', NULL},
441 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle follow mode
442 {"key_map_mark", {&key_map_mark, NULL}, {'m', NULL},
443 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to drop a marker on automap
444 {"key_map_clear", {&key_map_clear, NULL}, {'c', NULL},
445 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to clear all markers on automap
446 {"key_map_grid", {&key_map_grid, NULL}, {'g', NULL},
447 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle grid display over automap
448 {"key_map_rotate", {&key_map_rotate, NULL}, {'r', NULL},
449 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle rotating the automap to match the player's orientation
450 {"key_map_overlay", {&key_map_overlay, NULL}, {'o', NULL},
451 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle overlaying the automap on the rendered display
452 {"key_reverse", {&key_reverse, NULL}, {'/', NULL},
453 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to spin 180 instantly
454 {"key_zoomin", {&key_zoomin, NULL}, {'=', NULL},
455 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to enlarge display
456 {"key_zoomout", {&key_zoomout, NULL}, {'-', NULL},
457 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to reduce display
458 {"key_chatplayer1", {&destination_keys[0], NULL}, {'g', NULL},
459 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to chat with player 1
460 // killough 11/98: fix 'i'/'b' reversal
461 {"key_chatplayer2", {&destination_keys[1], NULL}, {'i', NULL},
462 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to chat with player 2
463 {"key_chatplayer3", {&destination_keys[2], NULL}, {'b', NULL},
464 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to chat with player 3
465 {"key_chatplayer4", {&destination_keys[3], NULL}, {'r', NULL},
466 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to chat with player 4
467 {"key_weapon",{&key_weapon, NULL}, {'w', NULL},
468 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle between two most preferred weapons with ammo
469 {"key_weapontoggle",{&key_weapontoggle, NULL}, {'0', NULL},
470 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to toggle between two most preferred weapons with ammo
471 {"key_weapon1", {&key_weapon1, NULL}, {'1', NULL},
472 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 1 (fist/chainsaw)
473 {"key_weapon2", {&key_weapon2, NULL}, {'2', NULL},
474 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 2 (pistol)
475 {"key_weapon3", {&key_weapon3, NULL}, {'3', NULL},
476 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 3 (supershotgun/shotgun)
477 {"key_weapon4", {&key_weapon4, NULL}, {'4', NULL},
478 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 4 (chaingun)
479 {"key_weapon5", {&key_weapon5, NULL}, {'5', NULL},
480 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 5 (rocket launcher)
481 {"key_weapon6", {&key_weapon6, NULL}, {'6', NULL},
482 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 6 (plasma rifle)
483 {"key_weapon7", {&key_weapon7, NULL}, {'7', NULL},
484 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 7 (bfg9000) // ^
485 {"key_weapon8", {&key_weapon8, NULL}, {'8', NULL},
486 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 8 (chainsaw) // |
487 {"key_weapon9", {&key_weapon9, NULL}, {'9', NULL},
488 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to switch to weapon 9 (supershotgun) // phares
490 // killough 2/22/98: screenshot key
491 {"key_screenshot", {&key_screenshot, NULL}, {'*', NULL},
492 0,MAX_KEY,def_key,ss_keys, 0, 0}, // key to take a screenshot
494 /* {"Joystick settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0},
495 {"use_joystick",{&usejoystick, NULL},{0, NULL},0,2,
496 def_int,ss_none, 0, 0}, // number of joystick to use (0 for none)
497 {"joy_left",{&joyleft, NULL},{0, NULL}, UL,UL,def_int,ss_none, 0, 0},
498 {"joy_right",{&joyright, NULL},{0, NULL},UL,UL,def_int,ss_none, 0, 0},
499 {"joy_up", {&joyup, NULL}, {0, NULL}, UL,UL,def_int,ss_none, 0, 0},
500 {"joy_down",{&joydown, NULL},{0, NULL}, UL,UL,def_int,ss_none, 0, 0},
501 {"joyb_fire",{&joybfire, NULL},{0, NULL},0,UL,
502 def_int,ss_keys, 0, 0}, // joystick button number to use for fire
503 {"joyb_strafe",{&joybstrafe, NULL},{1, NULL},0,UL,
504 def_int,ss_keys, 0, 0}, // joystick button number to use for strafing
505 {"joyb_speed",{&joybspeed, NULL},{2, NULL},0,UL,
506 def_int,ss_keys, 0, 0}, // joystick button number to use for running
507 {"joyb_use",{&joybuse, NULL},{3, NULL},0,UL,
508 def_int,ss_keys, 0, 0}, // joystick button number to use for use/open
510 {"Chat macros",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0},
511 {"chatmacro0", {0,&chat_macros[0]}, {0,HUSTR_CHATMACRO0},UL,UL,
512 def_str,ss_chat, 0, 0}, // chat string associated with 0 key
513 {"chatmacro1", {0,&chat_macros[1]}, {0,HUSTR_CHATMACRO1},UL,UL,
514 def_str,ss_chat, 0, 0}, // chat string associated with 1 key
515 {"chatmacro2", {0,&chat_macros[2]}, {0,HUSTR_CHATMACRO2},UL,UL,
516 def_str,ss_chat, 0, 0}, // chat string associated with 2 key
517 {"chatmacro3", {0,&chat_macros[3]}, {0,HUSTR_CHATMACRO3},UL,UL,
518 def_str,ss_chat, 0, 0}, // chat string associated with 3 key
519 {"chatmacro4", {0,&chat_macros[4]}, {0,HUSTR_CHATMACRO4},UL,UL,
520 def_str,ss_chat, 0, 0}, // chat string associated with 4 key
521 {"chatmacro5", {0,&chat_macros[5]}, {0,HUSTR_CHATMACRO5},UL,UL,
522 def_str,ss_chat, 0, 0}, // chat string associated with 5 key
523 {"chatmacro6", {0,&chat_macros[6]}, {0,HUSTR_CHATMACRO6},UL,UL,
524 def_str,ss_chat, 0, 0}, // chat string associated with 6 key
525 {"chatmacro7", {0,&chat_macros[7]}, {0,HUSTR_CHATMACRO7},UL,UL,
526 def_str,ss_chat, 0, 0}, // chat string associated with 7 key
527 {"chatmacro8", {0,&chat_macros[8]}, {0,HUSTR_CHATMACRO8},UL,UL,
528 def_str,ss_chat, 0, 0}, // chat string associated with 8 key
529 {"chatmacro9", {0,&chat_macros[9]}, {0,HUSTR_CHATMACRO9},UL,UL,
530 def_str,ss_chat, 0, 0}, // chat string associated with 9 key
532 {"Automap settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0},
533 //jff 1/7/98 defaults for automap colors
534 //jff 4/3/98 remove -1 in lower range, 0 now disables new map features
535 {"mapcolor_back", {&mapcolor_back, NULL}, {247, NULL},0,255, // black //jff 4/6/98 new black
536 def_colour,ss_auto, 0, 0}, // color used as background for automap
537 {"mapcolor_grid", {&mapcolor_grid, NULL}, {104, NULL},0,255, // dk gray
538 def_colour,ss_auto, 0, 0}, // color used for automap grid lines
539 {"mapcolor_wall", {&mapcolor_wall, NULL}, {23, NULL},0,255, // red-brown
540 def_colour,ss_auto, 0, 0}, // color used for one side walls on automap
541 {"mapcolor_fchg", {&mapcolor_fchg, NULL}, {55, NULL},0,255, // lt brown
542 def_colour,ss_auto, 0, 0}, // color used for lines floor height changes across
543 {"mapcolor_cchg", {&mapcolor_cchg, NULL}, {215, NULL},0,255, // orange
544 def_colour,ss_auto, 0, 0}, // color used for lines ceiling height changes across
545 {"mapcolor_clsd", {&mapcolor_clsd, NULL}, {208, NULL},0,255, // white
546 def_colour,ss_auto, 0, 0}, // color used for lines denoting closed doors, objects
547 {"mapcolor_rkey", {&mapcolor_rkey, NULL}, {175, NULL},0,255, // red
548 def_colour,ss_auto, 0, 0}, // color used for red key sprites
549 {"mapcolor_bkey", {&mapcolor_bkey, NULL}, {204, NULL},0,255, // blue
550 def_colour,ss_auto, 0, 0}, // color used for blue key sprites
551 {"mapcolor_ykey", {&mapcolor_ykey, NULL}, {231, NULL},0,255, // yellow
552 def_colour,ss_auto, 0, 0}, // color used for yellow key sprites
553 {"mapcolor_rdor", {&mapcolor_rdor, NULL}, {175, NULL},0,255, // red
554 def_colour,ss_auto, 0, 0}, // color used for closed red doors
555 {"mapcolor_bdor", {&mapcolor_bdor, NULL}, {204, NULL},0,255, // blue
556 def_colour,ss_auto, 0, 0}, // color used for closed blue doors
557 {"mapcolor_ydor", {&mapcolor_ydor, NULL}, {231, NULL},0,255, // yellow
558 def_colour,ss_auto, 0, 0}, // color used for closed yellow doors
559 {"mapcolor_tele", {&mapcolor_tele, NULL}, {119, NULL},0,255, // dk green
560 def_colour,ss_auto, 0, 0}, // color used for teleporter lines
561 {"mapcolor_secr", {&mapcolor_secr, NULL}, {252, NULL},0,255, // purple
562 def_colour,ss_auto, 0, 0}, // color used for lines around secret sectors
563 {"mapcolor_exit", {&mapcolor_exit, NULL}, {0, NULL},0,255, // none
564 def_colour,ss_auto, 0, 0}, // color used for exit lines
565 {"mapcolor_unsn", {&mapcolor_unsn, NULL}, {104, NULL},0,255, // dk gray
566 def_colour,ss_auto, 0, 0}, // color used for lines not seen without computer map
567 {"mapcolor_flat", {&mapcolor_flat, NULL}, {88, NULL},0,255, // lt gray
568 def_colour,ss_auto, 0, 0}, // color used for lines with no height changes
569 {"mapcolor_sprt", {&mapcolor_sprt, NULL}, {112, NULL},0,255, // green
570 def_colour,ss_auto, 0, 0}, // color used as things
571 {"mapcolor_item", {&mapcolor_item, NULL}, {231, NULL},0,255, // yellow
572 def_colour,ss_auto, 0, 0}, // color used for counted items
573 {"mapcolor_hair", {&mapcolor_hair, NULL}, {208, NULL},0,255, // white
574 def_colour,ss_auto, 0, 0}, // color used for dot crosshair denoting center of map
575 {"mapcolor_sngl", {&mapcolor_sngl, NULL}, {208, NULL},0,255, // white
576 def_colour,ss_auto, 0, 0}, // color used for the single player arrow
577 /* {"mapcolor_me", {&mapcolor_me, NULL}, {112, NULL},0,255, // green
578 def_colour,ss_auto, 0, 0}, // your (player) colour*/
579 {"mapcolor_frnd", {&mapcolor_frnd, NULL}, {112, NULL},0,255,
580 def_colour,ss_auto, 0, 0},
581 //jff 3/9/98 add option to not show secrets til after found
582 {"map_secret_after", {&map_secret_after, NULL}, {0, NULL},0,1, // show secret after gotten
583 def_bool,ss_auto, 0, 0}, // prevents showing secret sectors till after entered
584 {"map_point_coord", {&map_point_coordinates, NULL}, {0, NULL},0,1,
585 def_bool,ss_auto, 0, 0},
586 //jff 1/7/98 end additions for automap
587 {"automapmode", {(void*)&automapmode, NULL}, {0, NULL}, 0, 31, // CPhipps - remember automap mode
588 def_hex,ss_none, 0, 0}, // automap mode
590 {"Heads-up display settings",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0},
591 //jff 2/16/98 defaults for color ranges in hud and status
592 {"hudcolor_titl", {&hudcolor_titl, NULL}, {5, NULL},0,9, // gold range
593 def_int,ss_auto, 0, 0}, // color range used for automap level title
594 {"hudcolor_xyco", {&hudcolor_xyco, NULL}, {3, NULL},0,9, // green range
595 def_int,ss_auto, 0, 0}, // color range used for automap coordinates
596 {"hudcolor_mesg", {&hudcolor_mesg, NULL}, {6, NULL},0,9, // red range
597 def_int,ss_mess, 0, 0}, // color range used for messages during play
598 {"hudcolor_chat", {&hudcolor_chat, NULL}, {5, NULL},0,9, // gold range
599 def_int,ss_mess, 0, 0}, // color range used for chat messages and entry
600 {"hudcolor_list", {&hudcolor_list, NULL}, {5, NULL},0,9, // gold range //jff 2/26/98
601 def_int,ss_mess, 0, 0}, // color range used for message review
602 {"hud_msg_lines", {&hud_msg_lines, NULL}, {1, NULL},1,16, // 1 line scrolling window
603 def_int,ss_mess, 0, 0}, // number of messages in review display (1=disable)
604 {"hud_list_bgon", {&hud_list_bgon, NULL}, {0, NULL},0,1, // solid window bg ena //jff 2/26/98
605 def_bool,ss_mess, 0, 0}, // enables background window behind message review
606 {"hud_distributed",{&hud_distributed, NULL},{0, NULL},0,1, // hud broken up into 3 displays //jff 3/4/98
607 def_bool,ss_none, 0, 0}, // splits HUD into three 2 line displays
609 {"health_red", {&health_red, NULL}, {25, NULL},0,200, // below is red
610 def_int,ss_stat, 0, 0}, // amount of health for red to yellow transition
611 {"health_yellow", {&health_yellow, NULL}, {50, NULL},0,200, // below is yellow
612 def_int,ss_stat, 0, 0}, // amount of health for yellow to green transition
613 {"health_green", {&health_green, NULL}, {100, NULL},0,200,// below is green, above blue
614 def_int,ss_stat, 0, 0}, // amount of health for green to blue transition
615 {"armor_red", {&armor_red, NULL}, {25, NULL},0,200, // below is red
616 def_int,ss_stat, 0, 0}, // amount of armor for red to yellow transition
617 {"armor_yellow", {&armor_yellow, NULL}, {50, NULL},0,200, // below is yellow
618 def_int,ss_stat, 0, 0}, // amount of armor for yellow to green transition
619 {"armor_green", {&armor_green, NULL}, {100, NULL},0,200,// below is green, above blue
620 def_int,ss_stat, 0, 0}, // amount of armor for green to blue transition
621 {"ammo_red", {&ammo_red, NULL}, {25, NULL},0,100, // below 25% is red
622 def_int,ss_stat, 0, 0}, // percent of ammo for red to yellow transition
623 {"ammo_yellow", {&ammo_yellow, NULL}, {50, NULL},0,100, // below 50% is yellow, above green
624 def_int,ss_stat, 0, 0}, // percent of ammo for yellow to green transition
626 //jff 2/16/98 HUD and status feature controls
627 {"hud_active", {&hud_active, NULL}, {1, NULL},0,2, // 0=off, 1=small, 2=full
628 def_int,ss_none, 0, 0}, // 0 for HUD off, 1 for HUD small, 2 for full HUD
629 //jff 2/23/98
630 {"hud_displayed", {&hud_displayed, NULL}, {0, NULL},0,1, // whether hud is displayed
631 def_bool,ss_none, 0, 0}, // enables display of HUD
632 {"hud_nosecrets", {&hud_nosecrets, NULL}, {0, NULL},0,1, // no secrets/items/kills HUD line
633 def_bool,ss_stat, 0, 0}, // disables display of kills/items/secrets on HUD
635 {"Weapon preferences",{NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0},
636 // killough 2/8/98: weapon preferences set by user:
637 {"weapon_choice_1", {&weapon_preferences[0][0], NULL}, {6, NULL}, 0,9,
638 def_int,ss_weap, 0, 0}, // first choice for weapon (best)
639 {"weapon_choice_2", {&weapon_preferences[0][1], NULL}, {9, NULL}, 0,9,
640 def_int,ss_weap, 0, 0}, // second choice for weapon
641 {"weapon_choice_3", {&weapon_preferences[0][2], NULL}, {4, NULL}, 0,9,
642 def_int,ss_weap, 0, 0}, // third choice for weapon
643 {"weapon_choice_4", {&weapon_preferences[0][3], NULL}, {3, NULL}, 0,9,
644 def_int,ss_weap, 0, 0}, // fourth choice for weapon
645 {"weapon_choice_5", {&weapon_preferences[0][4], NULL}, {2, NULL}, 0,9,
646 def_int,ss_weap, 0, 0}, // fifth choice for weapon
647 {"weapon_choice_6", {&weapon_preferences[0][5], NULL}, {8, NULL}, 0,9,
648 def_int,ss_weap, 0, 0}, // sixth choice for weapon
649 {"weapon_choice_7", {&weapon_preferences[0][6], NULL}, {5, NULL}, 0,9,
650 def_int,ss_weap, 0, 0}, // seventh choice for weapon
651 {"weapon_choice_8", {&weapon_preferences[0][7], NULL}, {7, NULL}, 0,9,
652 def_int,ss_weap, 0, 0}, // eighth choice for weapon
653 {"weapon_choice_9", {&weapon_preferences[0][8], NULL}, {1, NULL}, 0,9,
654 def_int,ss_weap, 0, 0}, // ninth choice for weapon (worst)
656 /* // cournia - support for arbitrary music file (defaults are mp3)
657 {"Music", {NULL, NULL},{0, NULL},UL,UL,def_none,ss_none, 0, 0},
658 {"mus_e1m1", {0,&S_music_files[mus_e1m1]}, {0,"e1m1.mp3"},UL,UL,
659 def_str,ss_none, 0, 0},
660 {"mus_e1m2", {0,&S_music_files[mus_e1m2]}, {0,"e1m2.mp3"},UL,UL,
661 def_str,ss_none, 0, 0},
662 {"mus_e1m3", {0,&S_music_files[mus_e1m3]}, {0,"e1m3.mp3"},UL,UL,
663 def_str,ss_none, 0, 0},
664 {"mus_e1m4", {0,&S_music_files[mus_e1m4]}, {0,"e1m4.mp3"},UL,UL,
665 def_str,ss_none, 0, 0},
666 {"mus_e1m5", {0,&S_music_files[mus_e1m5]}, {0,"e1m5.mp3"},UL,UL,
667 def_str,ss_none, 0, 0},
668 {"mus_e1m6", {0,&S_music_files[mus_e1m6]}, {0,"e1m6.mp3"},UL,UL,
669 def_str,ss_none, 0, 0},
670 {"mus_e1m7", {0,&S_music_files[mus_e1m7]}, {0,"e1m7.mp3"},UL,UL,
671 def_str,ss_none, 0, 0},
672 {"mus_e1m8", {0,&S_music_files[mus_e1m8]}, {0,"e1m8.mp3"},UL,UL,
673 def_str,ss_none, 0, 0},
674 {"mus_e1m9", {0,&S_music_files[mus_e1m9]}, {0,"e1m9.mp3"},UL,UL,
675 def_str,ss_none, 0, 0},
676 {"mus_e2m1", {0,&S_music_files[mus_e2m1]}, {0,"e2m1.mp3"},UL,UL,
677 def_str,ss_none, 0, 0},
678 {"mus_e2m2", {0,&S_music_files[mus_e2m2]}, {0,"e2m2.mp3"},UL,UL,
679 def_str,ss_none, 0, 0},
680 {"mus_e2m3", {0,&S_music_files[mus_e2m3]}, {0,"e2m3.mp3"},UL,UL,
681 def_str,ss_none, 0, 0},
682 {"mus_e2m4", {0,&S_music_files[mus_e2m4]}, {0,"e2m4.mp3"},UL,UL,
683 def_str,ss_none, 0, 0},
684 {"mus_e2m5", {0,&S_music_files[mus_e2m5]}, {0,"e1m7.mp3"},UL,UL,
685 def_str,ss_none, 0, 0},
686 {"mus_e2m6", {0,&S_music_files[mus_e2m6]}, {0,"e2m6.mp3"},UL,UL,
687 def_str,ss_none, 0, 0},
688 {"mus_e2m7", {0,&S_music_files[mus_e2m7]}, {0,"e2m7.mp3"},UL,UL,
689 def_str,ss_none, 0, 0},
690 {"mus_e2m8", {0,&S_music_files[mus_e2m8]}, {0,"e2m8.mp3"},UL,UL,
691 def_str,ss_none, 0, 0},
692 {"mus_e2m9", {0,&S_music_files[mus_e2m9]}, {0,"e3m1.mp3"},UL,UL,
693 def_str,ss_none, 0, 0},
694 {"mus_e3m1", {0,&S_music_files[mus_e3m1]}, {0,"e3m1.mp3"},UL,UL,
695 def_str,ss_none, 0, 0},
696 {"mus_e3m2", {0,&S_music_files[mus_e3m2]}, {0,"e3m2.mp3"},UL,UL,
697 def_str,ss_none, 0, 0},
698 {"mus_e3m3", {0,&S_music_files[mus_e3m3]}, {0,"e3m3.mp3"},UL,UL,
699 def_str,ss_none, 0, 0},
700 {"mus_e3m4", {0,&S_music_files[mus_e3m4]}, {0,"e1m8.mp3"},UL,UL,
701 def_str,ss_none, 0, 0},
702 {"mus_e3m5", {0,&S_music_files[mus_e3m5]}, {0,"e1m7.mp3"},UL,UL,
703 def_str,ss_none, 0, 0},
704 {"mus_e3m6", {0,&S_music_files[mus_e3m6]}, {0,"e1m6.mp3"},UL,UL,
705 def_str,ss_none, 0, 0},
706 {"mus_e3m7", {0,&S_music_files[mus_e3m7]}, {0,"e2m7.mp3"},UL,UL,
707 def_str,ss_none, 0, 0},
708 {"mus_e3m8", {0,&S_music_files[mus_e3m8]}, {0,"e3m8.mp3"},UL,UL,
709 def_str,ss_none, 0, 0},
710 {"mus_e3m9", {0,&S_music_files[mus_e3m9]}, {0,"e1m9.mp3"},UL,UL,
711 def_str,ss_none, 0, 0},
712 {"mus_inter", {0,&S_music_files[mus_inter]}, {0,"e2m3.mp3"},UL,UL,
713 def_str,ss_none, 0, 0},
714 {"mus_intro", {0,&S_music_files[mus_intro]}, {0,"intro.mp3"},UL,UL,
715 def_str,ss_none, 0, 0},
716 {"mus_bunny", {0,&S_music_files[mus_bunny]}, {0,"bunny.mp3"},UL,UL,
717 def_str,ss_none, 0, 0},
718 {"mus_victor", {0,&S_music_files[mus_victor]}, {0,"victor.mp3"},UL,UL,
719 def_str,ss_none, 0, 0},
720 {"mus_introa", {0,&S_music_files[mus_introa]}, {0,"intro.mp3"},UL,UL,
721 def_str,ss_none, 0, 0},
722 {"mus_runnin", {0,&S_music_files[mus_runnin]}, {0,"runnin.mp3"},UL,UL,
723 def_str,ss_none, 0, 0},
724 {"mus_stalks", {0,&S_music_files[mus_stalks]}, {0,"stalks.mp3"},UL,UL,
725 def_str,ss_none, 0, 0},
726 {"mus_countd", {0,&S_music_files[mus_countd]}, {0,"countd.mp3"},UL,UL,
727 def_str,ss_none, 0, 0},
728 {"mus_betwee", {0,&S_music_files[mus_betwee]}, {0,"betwee.mp3"},UL,UL,
729 def_str,ss_none, 0, 0},
730 {"mus_doom", {0,&S_music_files[mus_doom]}, {0,"doom.mp3"},UL,UL,
731 def_str,ss_none, 0, 0},
732 {"mus_the_da", {0,&S_music_files[mus_the_da]}, {0,"the_da.mp3"},UL,UL,
733 def_str,ss_none, 0, 0},
734 {"mus_shawn", {0,&S_music_files[mus_shawn]}, {0,"shawn.mp3"},UL,UL,
735 def_str,ss_none, 0, 0},
736 {"mus_ddtblu", {0,&S_music_files[mus_ddtblu]}, {0,"ddtblu.mp3"},UL,UL,
737 def_str,ss_none, 0, 0},
738 {"mus_in_cit", {0,&S_music_files[mus_in_cit]}, {0,"in_cit.mp3"},UL,UL,
739 def_str,ss_none, 0, 0},
740 {"mus_dead", {0,&S_music_files[mus_dead]}, {0,"dead.mp3"},UL,UL,
741 def_str,ss_none, 0, 0},
742 {"mus_stlks2", {0,&S_music_files[mus_stlks2]}, {0,"stalks.mp3"},UL,UL,
743 def_str,ss_none, 0, 0},
744 {"mus_theda2", {0,&S_music_files[mus_theda2]}, {0,"the_da.mp3"},UL,UL,
745 def_str,ss_none, 0, 0},
746 {"mus_doom2", {0,&S_music_files[mus_doom2]}, {0,"doom.mp3"},UL,UL,
747 def_str,ss_none, 0, 0},
748 {"mus_ddtbl2", {0,&S_music_files[mus_ddtbl2]}, {0,"ddtblu.mp3"},UL,UL,
749 def_str,ss_none, 0, 0},
750 {"mus_runni2", {0,&S_music_files[mus_runni2]}, {0,"runnin.mp3"},UL,UL,
751 def_str,ss_none, 0, 0},
752 {"mus_dead2", {0,&S_music_files[mus_dead2]}, {0,"dead.mp3"},UL,UL,
753 def_str,ss_none, 0, 0},
754 {"mus_stlks3", {0,&S_music_files[mus_stlks3]}, {0,"stalks.mp3"},UL,UL,
755 def_str,ss_none, 0, 0},
756 {"mus_romero", {0,&S_music_files[mus_romero]}, {0,"romero.mp3"},UL,UL,
757 def_str,ss_none, 0, 0},
758 {"mus_shawn2", {0,&S_music_files[mus_shawn2]}, {0,"shawn.mp3"},UL,UL,
759 def_str,ss_none, 0, 0},
760 {"mus_messag", {0,&S_music_files[mus_messag]}, {0,"messag.mp3"},UL,UL,
761 def_str,ss_none, 0, 0},
762 {"mus_count2", {0,&S_music_files[mus_count2]}, {0,"countd.mp3"},UL,UL,
763 def_str,ss_none, 0, 0},
764 {"mus_ddtbl3", {0,&S_music_files[mus_ddtbl3]}, {0,"ddtblu.mp3"},UL,UL,
765 def_str,ss_none, 0, 0},
766 {"mus_ampie", {0,&S_music_files[mus_ampie]}, {0,"ampie.mp3"},UL,UL,
767 def_str,ss_none, 0, 0},
768 {"mus_theda3", {0,&S_music_files[mus_theda3]}, {0,"the_da.mp3"},UL,UL,
769 def_str,ss_none, 0, 0},
770 {"mus_adrian", {0,&S_music_files[mus_adrian]}, {0,"adrian.mp3"},UL,UL,
771 def_str,ss_none, 0, 0},
772 {"mus_messg2", {0,&S_music_files[mus_messg2]}, {0,"messag.mp3"},UL,UL,
773 def_str,ss_none, 0, 0},
774 {"mus_romer2", {0,&S_music_files[mus_romer2]}, {0,"romero.mp3"},UL,UL,
775 def_str,ss_none, 0, 0},
776 {"mus_tense", {0,&S_music_files[mus_tense]}, {0,"tense.mp3"},UL,UL,
777 def_str,ss_none, 0, 0},
778 {"mus_shawn3", {0,&S_music_files[mus_shawn3]}, {0,"shawn.mp3"},UL,UL,
779 def_str,ss_none, 0, 0},
780 {"mus_openin", {0,&S_music_files[mus_openin]}, {0,"openin.mp3"},UL,UL,
781 def_str,ss_none, 0, 0},
782 {"mus_evil", {0,&S_music_files[mus_evil]}, {0,"evil.mp3"},UL,UL,
783 def_str,ss_none, 0, 0},
784 {"mus_ultima", {0,&S_music_files[mus_ultima]}, {0,"ultima.mp3"},UL,UL,
785 def_str,ss_none, 0, 0},
786 {"mus_read_m", {0,&S_music_files[mus_read_m]}, {0,"read_m.mp3"},UL,UL,
787 def_str,ss_none, 0, 0},
788 {"mus_dm2ttl", {0,&S_music_files[mus_dm2ttl]}, {0,"dm2ttl.mp3"},UL,UL,
789 def_str,ss_none, 0, 0},
790 {"mus_dm2int", {0,&S_music_files[mus_dm2int]}, {0,"dm2int.mp3"},UL,UL,
791 def_str,ss_none, 0, 0},
795 int numdefaults;
796 //static const char* defaultfile; // CPhipps - static, const
799 // M_SaveDefaults
802 void M_SaveDefaults (void)
804 int i,fd;
805 uint32_t magic = DOOM_CONFIG_MAGIC;
806 uint32_t ver = DOOM_CONFIG_VERSION;
808 fd = open (GAMEBASE"default.dfg", O_WRONLY|O_CREAT|O_TRUNC);
809 if (fd<0)
810 return; // can't write the file, but don't complain
812 write(fd,&magic,sizeof(magic));
813 write(fd,&ver,sizeof(ver));
815 for (i=0 ; i<numdefaults ; i++)
816 if(defaults[i].location.pi)
817 write(fd,defaults[i].location.pi, sizeof(int));
819 close (fd);
823 * M_LookupDefault
825 * cph - mimic MBF function for now. Yes it's crap.
828 struct default_s *M_LookupDefault(const char *name)
830 int i;
831 for (i = 0 ; i < numdefaults ; i++)
832 if ((defaults[i].type != def_none) && !strcmp(name, defaults[i].name))
833 return &defaults[i];
834 I_Error("M_LookupDefault: %s not found",name);
835 return NULL;
839 // M_LoadDefaults
842 #define NUMCHATSTRINGS 10 // phares 4/13/98
844 void M_LoadDefaults (void)
846 int i;
847 uint32_t magic = 0;
848 uint32_t ver;
849 int fd;
850 // set everything to base values
852 numdefaults = sizeof(defaults)/sizeof(defaults[0]);
853 for (i = 0 ; i < numdefaults ; i++) {
854 if (defaults[i].location.ppsz)
855 *defaults[i].location.ppsz = strdup(defaults[i].defaultvalue.psz);
856 if (defaults[i].location.pi)
857 *defaults[i].location.pi = defaults[i].defaultvalue.i;
860 fd = open (GAMEBASE"default.dfg", O_RDONLY);
861 if (fd<0)
862 return; // don't have anything to read
864 read(fd,&magic,sizeof(magic));
865 if (magic != DOOM_CONFIG_MAGIC) {
866 close(fd);
867 return;
870 read(fd,&ver,sizeof(ver));
871 if (ver != DOOM_CONFIG_VERSION) {
872 close(fd);
873 return;
876 for (i=0 ; i<numdefaults ; i++)
877 if(defaults[i].location.pi)
878 read(fd,defaults[i].location.pi, sizeof(int));
880 close (fd);
885 // SCREEN SHOTS
888 // CPhipps - nasty but better than nothing
889 static boolean screenshot_write_error;
891 // jff 3/30/98 types and data structures for BMP output of screenshots
893 // killough 5/2/98:
894 // Changed type names to avoid conflicts with endianess functions
896 #define BI_RGB 0L
898 typedef unsigned long dword_t;
899 typedef long long_t;
900 typedef unsigned char ubyte_t;
902 typedef struct tagBITMAPFILEHEADER
904 unsigned short bfType;
905 dword_t bfSize;
906 unsigned short bfReserved1;
907 unsigned short bfReserved2;
908 dword_t bfOffBits;
909 } PACKEDATTR BITMAPFILEHEADER;
911 typedef struct tagBITMAPINFOHEADER
913 dword_t biSize;
914 long_t biWidth;
915 long_t biHeight;
916 unsigned short biPlanes;
917 unsigned short biBitCount;
918 dword_t biCompression;
919 dword_t biSizeImage;
920 long_t biXPelsPerMeter;
921 long_t biYPelsPerMeter;
922 dword_t biClrUsed;
923 dword_t biClrImportant;
924 } PACKEDATTR BITMAPINFOHEADER;
925 #if 0
926 // jff 3/30/98 binary file write with error detection
927 // CPhipps - static, const on parameter
928 static void SafeWrite(const void *data, size_t size, size_t number, int st)
930 /* if (write(data,size,number,st)<number)
931 screenshot_write_error = true; // CPhipps - made non-fatal*/
933 #endif
935 // WriteBMPfile
936 // jff 3/30/98 Add capability to write a .BMP file (256 color uncompressed)
939 // CPhipps - static, const on parameters
940 static void WriteBMPfile(const char* filename, const byte* data,
941 const int width, const int height, const byte* palette)
943 (void)filename;
944 (void)data;
945 (void)width;
946 (void)height;
947 (void)palette;
948 /* int i,wid;
949 BITMAPFILEHEADER bmfh;
950 BITMAPINFOHEADER bmih;
951 int fhsiz,ihsiz;
952 FILE *st;
953 char zero=0;
954 ubyte_t c;
956 fhsiz = sizeof(BITMAPFILEHEADER);
957 ihsiz = sizeof(BITMAPINFOHEADER);
958 wid = 4*((width+3)/4);
959 //jff 4/22/98 add endian macros
960 bmfh.bfType = SHORT(19778);
961 bmfh.bfSize = LONG(fhsiz+ihsiz+256L*4+width*height);
962 bmfh.bfReserved1 = SHORT(0);
963 bmfh.bfReserved2 = SHORT(0);
964 bmfh.bfOffBits = LONG(fhsiz+ihsiz+256L*4);
966 bmih.biSize = LONG(ihsiz);
967 bmih.biWidth = LONG(width);
968 bmih.biHeight = LONG(height);
969 bmih.biPlanes = SHORT(1);
970 bmih.biBitCount = SHORT(8);
971 bmih.biCompression = LONG(BI_RGB);
972 bmih.biSizeImage = LONG(wid*height);
973 bmih.biXPelsPerMeter = LONG(0);
974 bmih.biYPelsPerMeter = LONG(0);
975 bmih.biClrUsed = LONG(256);
976 bmih.biClrImportant = LONG(256);
978 st = fopen(filename,"wb");
979 if (st!=NULL) {
980 // write the header
981 SafeWrite(&bmfh.bfType,sizeof(bmfh.bfType),1,st);
982 SafeWrite(&bmfh.bfSize,sizeof(bmfh.bfSize),1,st);
983 SafeWrite(&bmfh.bfReserved1,sizeof(bmfh.bfReserved1),1,st);
984 SafeWrite(&bmfh.bfReserved2,sizeof(bmfh.bfReserved2),1,st);
985 SafeWrite(&bmfh.bfOffBits,sizeof(bmfh.bfOffBits),1,st);
987 SafeWrite(&bmih.biSize,sizeof(bmih.biSize),1,st);
988 SafeWrite(&bmih.biWidth,sizeof(bmih.biWidth),1,st);
989 SafeWrite(&bmih.biHeight,sizeof(bmih.biHeight),1,st);
990 SafeWrite(&bmih.biPlanes,sizeof(bmih.biPlanes),1,st);
991 SafeWrite(&bmih.biBitCount,sizeof(bmih.biBitCount),1,st);
992 SafeWrite(&bmih.biCompression,sizeof(bmih.biCompression),1,st);
993 SafeWrite(&bmih.biSizeImage,sizeof(bmih.biSizeImage),1,st);
994 SafeWrite(&bmih.biXPelsPerMeter,sizeof(bmih.biXPelsPerMeter),1,st);
995 SafeWrite(&bmih.biYPelsPerMeter,sizeof(bmih.biYPelsPerMeter),1,st);
996 SafeWrite(&bmih.biClrUsed,sizeof(bmih.biClrUsed),1,st);
997 SafeWrite(&bmih.biClrImportant,sizeof(bmih.biClrImportant),1,st);
999 // write the palette, in blue-green-red order, gamma corrected
1000 for (i=0;i<768;i+=3) {
1001 c=gammatable[usegamma][palette[i+2]];
1002 SafeWrite(&c,sizeof(char),1,st);
1003 c=gammatable[usegamma][palette[i+1]];
1004 SafeWrite(&c,sizeof(char),1,st);
1005 c=gammatable[usegamma][palette[i+0]];
1006 SafeWrite(&c,sizeof(char),1,st);
1007 SafeWrite(&zero,sizeof(char),1,st);
1010 for (i = 0 ; i < height ; i++)
1011 SafeWrite(data+(height-1-i)*width,sizeof(byte),wid,st);
1013 fclose(st);
1018 // M_ScreenShot
1020 // Modified by Lee Killough so that any number of shots can be taken,
1021 // the code is faster, and no annoying "screenshot" message appears.
1023 // CPhipps - modified to use its own buffer for the image
1024 // - checks for the case where no file can be created (doesn't occur on POSIX systems, would on DOS)
1025 // - track errors better
1026 // - split into 2 functions
1029 // M_DoScreenShot
1030 // Takes a screenshot into the names file
1032 void M_DoScreenShot (const char* fname)
1034 byte *linear;
1035 #ifndef GL_DOOM
1036 const byte *pal;
1037 int pplump = W_GetNumForName("PLAYPAL");
1038 #endif
1040 screenshot_write_error = false;
1042 #ifdef GL_DOOM
1043 // munge planar buffer to linear
1044 // CPhipps - use a malloc()ed buffer instead of screens[2]
1045 gld_ReadScreen(linear = malloc(SCREENWIDTH * SCREENHEIGHT * 3));
1047 // save the bmp file
1049 WriteTGAfile
1050 (fname, linear, SCREENWIDTH, SCREENHEIGHT);
1051 #else
1052 // munge planar buffer to linear
1053 // CPhipps - use a malloc()ed buffer instead of screens[2]
1054 I_ReadScreen(linear = malloc(SCREENWIDTH * SCREENHEIGHT));
1056 // killough 4/18/98: make palette stay around (PU_CACHE could cause crash)
1057 pal = W_CacheLumpNum (pplump);
1059 // save the bmp file
1061 WriteBMPfile
1062 (fname, linear, SCREENWIDTH, SCREENHEIGHT, pal);
1064 // cph - free the palette
1065 W_UnlockLumpNum(pplump);
1066 #endif
1067 free(linear);
1068 // 1/18/98 killough: replace "SCREEN SHOT" acknowledgement with sfx
1070 if (screenshot_write_error)
1071 doom_printf("M_ScreenShot: Error writing screenshot");
1074 void M_ScreenShot(void)
1076 static int shot;
1077 char lbmname[32];
1078 int startshot;
1080 screenshot_write_error = false;
1082 if (fileexists(".")) screenshot_write_error = true;
1084 startshot = shot; // CPhipps - prevent infinite loop
1087 snprintf(lbmname,sizeof(lbmname),"DOOM%d.BMP", shot++);
1088 while (!fileexists(lbmname) && (shot != startshot) && (shot < 10000));
1090 if (!fileexists(lbmname)) screenshot_write_error = true;
1092 if (screenshot_write_error) {
1093 doom_printf ("M_ScreenShot: Couldn't create a BMP");
1094 // killough 4/18/98
1095 return;
1098 M_DoScreenShot(lbmname); // cph
1100 S_StartSound(NULL,gamemode==commercial ? sfx_radio : sfx_tink);