diff options
author | Dave Chapman <dave@dchapman.com> | 2006-03-28 15:44:01 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2006-03-28 15:44:01 +0000 |
commit | 47f4a458d636a889e955e68f896708f1276febc0 (patch) | |
tree | 99f770c02ef606f0abbdcd332ac39e69830d8007 /apps/plugins/doom/w_wad.h | |
parent | fff7d6157d56f233cad5c2003475e47a5ff809a7 (diff) | |
download | rockbox-47f4a458d636a889e955e68f896708f1276febc0.tar.gz rockbox-47f4a458d636a889e955e68f896708f1276febc0.zip |
Patch #2969 - Doom! Currently only working on the H300.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9312 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/doom/w_wad.h')
-rw-r--r-- | apps/plugins/doom/w_wad.h | 164 |
1 files changed, 164 insertions, 0 deletions
diff --git a/apps/plugins/doom/w_wad.h b/apps/plugins/doom/w_wad.h new file mode 100644 index 0000000000..f505f42cb7 --- /dev/null +++ b/apps/plugins/doom/w_wad.h | |||
@@ -0,0 +1,164 @@ | |||
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 | * WAD I/O functions. | ||
29 | * | ||
30 | *-----------------------------------------------------------------------------*/ | ||
31 | |||
32 | |||
33 | #ifndef __W_WAD__ | ||
34 | #define __W_WAD__ | ||
35 | |||
36 | #ifdef __GNUG__ | ||
37 | #pragma interface | ||
38 | #endif | ||
39 | |||
40 | #include "m_fixed.h" | ||
41 | |||
42 | // | ||
43 | // TYPES | ||
44 | // | ||
45 | |||
46 | typedef struct | ||
47 | { | ||
48 | char identification[4]; // Should be "IWAD" or "PWAD". | ||
49 | int numlumps; | ||
50 | int infotableofs; | ||
51 | } wadinfo_t; | ||
52 | |||
53 | typedef struct | ||
54 | { | ||
55 | int filepos; | ||
56 | int size; | ||
57 | char name[8]; | ||
58 | } filelump_t; | ||
59 | |||
60 | #ifndef ALL_IN_ONE | ||
61 | |||
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 | ||
67 | |||
68 | #endif | ||
69 | |||
70 | // | ||
71 | // WADFILE I/O related stuff. | ||
72 | // | ||
73 | |||
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; | ||
85 | |||
86 | typedef struct | ||
87 | { | ||
88 | // WARNING: order of some fields important (see info.c). | ||
89 | |||
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 | ||
95 | |||
96 | // killough 1/31/98: hash table fields, used for ultra-fast hash table lookup | ||
97 | int index, next; | ||
98 | |||
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; | ||
106 | |||
107 | int handle; | ||
108 | int position; | ||
109 | unsigned int locks; // CPhipps - wad lump locking | ||
110 | wad_source_t source; | ||
111 | } lumpinfo_t; | ||
112 | |||
113 | // killough 1/31/98: predefined lumps | ||
114 | extern const size_t num_predefined_lumps; | ||
115 | extern const lumpinfo_t predefined_lumps[]; | ||
116 | |||
117 | extern void **lumpcache; | ||
118 | extern lumpinfo_t *lumpinfo; | ||
119 | extern int numlumps; | ||
120 | |||
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; | ||
127 | }; | ||
128 | |||
129 | extern struct wadfile_info *wadfiles; | ||
130 | |||
131 | extern size_t numwadfiles; // CPhipps - size of the wadfiles array | ||
132 | |||
133 | void W_Init(void); // CPhipps - uses the above array | ||
134 | |||
135 | // killough 4/17/98: if W_CheckNumForName() called with only | ||
136 | // one argument, pass ns_global as the default namespace | ||
137 | |||
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); | ||
146 | |||
147 | /* cph - special version to return lump with padding, for sound lumps */ | ||
148 | void * W_CacheLumpNumPadded(int lump, size_t len, unsigned char pad); | ||
149 | |||
150 | // CPhipps - convenience macros | ||
151 | #define W_CacheLumpNum(num) (W_CacheLumpNum)((num),1) | ||
152 | #define W_CacheLumpName(name) W_CacheLumpNum (W_GetNumForName(name)) | ||
153 | |||
154 | #define W_UnlockLumpNum(num) (W_UnlockLumpNum)((num),1) | ||
155 | #define W_UnlockLumpName(name) W_UnlockLumpNum (W_GetNumForName(name)) | ||
156 | |||
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 | ||
160 | |||
161 | // Function to write all predefined lumps to a PWAD if requested | ||
162 | extern void WritePredefinedLumpWad(const char *filename); // jff 5/6/98 | ||
163 | |||
164 | #endif | ||