Move c/h files implementing/defining standard library stuff into a new libc directory...
[kugel-rb.git] / apps / plugins / doom / m_misc.h
blob25eb8540c05223b7669217a83bfa1ec7b30d76dd
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 * External non-system-specific stuff, like storing config settings,
29 * simple file handling, and saving screnshots.
31 *-----------------------------------------------------------------------------*/
34 #ifndef __M_MISC__
35 #define __M_MISC__
38 #include "doomtype.h"
40 // MISC
43 boolean M_WriteFile (char const* name,void* source,int length);
45 int M_ReadFile (char const* name,byte** buffer);
47 void M_ScreenShot (void);
48 void M_DoScreenShot (const char*); // cph
50 void M_LoadDefaults (void);
52 void M_SaveDefaults (void);
55 int M_DrawText (int x,int y,boolean direct,char* string);
57 struct default_s *M_LookupDefault(const char *name); /* killough 11/98 */
59 // phares 4/21/98:
60 // Moved from m_misc.c so m_menu.c could see it.
62 // CPhipps - struct to hold a value in a config file
63 // Cannot be a union, as it must be initialised
64 typedef struct default_s
66 const char* name;
67 /* cph -
68 * The location struct holds the pointer to the variable holding the
69 * setting. For int's we do nothing special.
70 * For strings, the string is actually stored on our heap with Z_Strdup()
71 * BUT we don't want the rest of the program to be able to modify them,
72 * so we declare it const. It's not really const though, and m_misc.c and
73 * m_menu.c cast it back when they need to change it. Possibly this is
74 * more trouble than it's worth.
76 struct {
77 int* pi;
78 const char** ppsz;
79 } location;
80 struct {
81 int i;
82 const char* psz;
83 } defaultvalue; // CPhipps - default value
84 // Limits (for an int)
85 int minvalue; // jff 3/3/98 minimum allowed value
86 int maxvalue; // jff 3/3/98 maximum allowed value
87 enum {
88 def_none, // Dummy entry
89 def_str, // A string
90 def_int, // Integer
91 def_hex, // Integer (write in hex)
92 def_bool = def_int, // Boolean
93 def_key = def_hex, // Key code (byte)
94 def_mouseb = def_int,// Mouse button
95 def_colour = def_hex // Colour (256 colour palette entry)
96 } type; // CPhipps - type of entry
97 int setupscreen; // phares 4/19/98: setup screen where this appears
98 int *current; /* cph - MBF-like pointer to current value */
99 // cph - removed the help strings from the config file
100 // const char* help; // jff 3/3/98 description of parameter
101 // CPhipps - remove unused "lousy hack" code
102 struct setup_menu_s *setup_menu; /* Xref to setup menu item, if any */
103 } default_t;
105 #define IS_STRING(dv) ((dv).type == def_str)
106 // CPhipps - What is the max. key code that X will send us?
107 #define MAX_KEY 65536
108 #define MAX_MOUSEB 2
110 #define UL (-123456789) /* magic number for no min or max for parameter */
112 #endif