Rearange menu of mpegplayer. Add new menu with "settings" and "quit", and remove...
[kugel-rb.git] / apps / plugins / doom / w_wad.h
blobf505f42cb7fad040f3ba21a1bb43d88de9c264c8
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 * WAD I/O functions.
30 *-----------------------------------------------------------------------------*/
33 #ifndef __W_WAD__
34 #define __W_WAD__
36 #ifdef __GNUG__
37 #pragma interface
38 #endif
40 #include "m_fixed.h"
43 // TYPES
46 typedef struct
48 char identification[4]; // Should be "IWAD" or "PWAD".
49 int numlumps;
50 int infotableofs;
51 } wadinfo_t;
53 typedef struct
55 int filepos;
56 int size;
57 char name[8];
58 } filelump_t;
60 #ifndef ALL_IN_ONE
62 // NO_PREDEFINED_LUMPS causes none of the predefined lumps in info.c to be
63 // included, and removes all extra code which is only there for them
64 // Saves a little memory normally, lots if any were overridden, and makes
65 // the executable smaller
66 #define NO_PREDEFINED_LUMPS
68 #endif
71 // WADFILE I/O related stuff.
74 // CPhipps - defined enum in wider scope
75 // Ty 08/29/98 - add source field to identify where this lump came from
76 typedef enum {
77 // CPhipps - define elements in order of 'how new/unusual'
78 source_iwad=0, // iwad file load
79 source_pre, // predefined lump
80 source_auto_load, // lump auto-loaded by config file
81 source_pwad, // pwad file load
82 source_lmp, // lmp file load
83 source_net // CPhipps
84 } wad_source_t;
86 typedef struct
88 // WARNING: order of some fields important (see info.c).
90 char name[8];
91 int size;
92 #ifndef NO_PREDEFINED_LUMPS
93 const void *data; // killough 1/31/98: points to predefined lump data
94 #endif
96 // killough 1/31/98: hash table fields, used for ultra-fast hash table lookup
97 int index, next;
99 // killough 4/17/98: namespace tags, to prevent conflicts between resources
100 enum {
101 ns_global=0,
102 ns_sprites,
103 ns_flats,
104 ns_colormaps
105 } namespace;
107 int handle;
108 int position;
109 unsigned int locks; // CPhipps - wad lump locking
110 wad_source_t source;
111 } lumpinfo_t;
113 // killough 1/31/98: predefined lumps
114 extern const size_t num_predefined_lumps;
115 extern const lumpinfo_t predefined_lumps[];
117 extern void **lumpcache;
118 extern lumpinfo_t *lumpinfo;
119 extern int numlumps;
121 // CPhipps - changed wad init
122 // We _must_ have the wadfiles[] the same as those actually loaded, so there
123 // is no point having these separate entities. This belongs here.
124 struct wadfile_info {
125 const char* name;
126 wad_source_t src;
129 extern struct wadfile_info *wadfiles;
131 extern size_t numwadfiles; // CPhipps - size of the wadfiles array
133 void W_Init(void); // CPhipps - uses the above array
135 // killough 4/17/98: if W_CheckNumForName() called with only
136 // one argument, pass ns_global as the default namespace
138 #define W_CheckNumForName(name) (W_CheckNumForName)(name, ns_global)
139 int (W_CheckNumForName)(const char* name, int); // killough 4/17/98
140 int W_GetNumForName (const char* name);
141 int W_LumpLength (int lump);
142 void W_ReadLump (int lump, void *dest);
143 // CPhipps - modified for 'new' lump locking
144 void* W_CacheLumpNum (int lump, unsigned short locks);
145 void W_UnlockLumpNum(int lump, signed short unlocks);
147 /* cph - special version to return lump with padding, for sound lumps */
148 void * W_CacheLumpNumPadded(int lump, size_t len, unsigned char pad);
150 // CPhipps - convenience macros
151 #define W_CacheLumpNum(num) (W_CacheLumpNum)((num),1)
152 #define W_CacheLumpName(name) W_CacheLumpNum (W_GetNumForName(name))
154 #define W_UnlockLumpNum(num) (W_UnlockLumpNum)((num),1)
155 #define W_UnlockLumpName(name) W_UnlockLumpNum (W_GetNumForName(name))
157 char *AddDefaultExtension(char *, const char *); // killough 1/18/98
158 void ExtractFileBase(const char *, char *); // killough
159 unsigned W_LumpNameHash(const char *s); // killough 1/31/98
161 // Function to write all predefined lumps to a PWAD if requested
162 extern void WritePredefinedLumpWad(const char *filename); // jff 5/6/98
164 #endif