aboutsummaryrefslogtreecommitdiff
path: root/src/w_wad.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/w_wad.h')
-rw-r--r--src/w_wad.h146
1 files changed, 146 insertions, 0 deletions
diff --git a/src/w_wad.h b/src/w_wad.h
new file mode 100644
index 0000000..399869e
--- /dev/null
+++ b/src/w_wad.h
@@ -0,0 +1,146 @@
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 * Copyright 2005, 2006 by
12 * Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
13 *
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License
16 * as published by the Free Software Foundation; either version 2
17 * of the License, or (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 * 02111-1307, USA.
28 *
29 * DESCRIPTION:
30 * WAD I/O functions.
31 *
32 *-----------------------------------------------------------------------------*/
33
34
35#ifndef __W_WAD__
36#define __W_WAD__
37
38#ifdef __GNUG__
39#pragma interface
40#endif
41
42//
43// TYPES
44//
45
46typedef struct
47{
48 char identification[4]; // Should be "IWAD" or "PWAD".
49 int numlumps;
50 int infotableofs;
51} wadinfo_t;
52
53typedef struct
54{
55 int filepos;
56 int size;
57 char name[8];
58} filelump_t;
59
60//
61// WADFILE I/O related stuff.
62//
63
64// CPhipps - defined enum in wider scope
65// Ty 08/29/98 - add source field to identify where this lump came from
66typedef enum {
67 // CPhipps - define elements in order of 'how new/unusual'
68 source_iwad=0, // iwad file load
69 source_pre, // predefined lump
70 source_auto_load, // lump auto-loaded by config file
71 source_pwad, // pwad file load
72 source_lmp, // lmp file load
73 source_net // CPhipps
74} wad_source_t;
75
76// CPhipps - changed wad init
77// We _must_ have the wadfiles[] the same as those actually loaded, so there
78// is no point having these separate entities. This belongs here.
79typedef struct {
80 const char* name;
81 wad_source_t src;
82 int handle;
83} wadfile_info_t;
84
85extern wadfile_info_t *wadfiles;
86
87extern size_t numwadfiles; // CPhipps - size of the wadfiles array
88
89void W_Init(void); // CPhipps - uses the above array
90void W_ReleaseAllWads(void); // Proff - Added for iwad switching
91void W_InitCache(void);
92void W_DoneCache(void);
93
94typedef struct
95{
96 // WARNING: order of some fields important (see info.c).
97
98 char name[9];
99 int size;
100
101 // killough 1/31/98: hash table fields, used for ultra-fast hash table lookup
102 int index, next;
103
104 // killough 4/17/98: namespace tags, to prevent conflicts between resources
105 enum {
106 ns_global=0,
107 ns_sprites,
108 ns_flats,
109 ns_colormaps,
110 ns_prboom
111 } li_namespace; // haleyjd 05/21/02: renamed from "namespace"
112
113 wadfile_info_t *wadfile;
114 int position;
115 wad_source_t source;
116} lumpinfo_t;
117
118extern lumpinfo_t *lumpinfo;
119extern int numlumps;
120
121// killough 4/17/98: if W_CheckNumForName() called with only
122// one argument, pass ns_global as the default namespace
123
124#define W_CheckNumForName(name) (W_CheckNumForName)(name, ns_global)
125int (W_CheckNumForName)(const char* name, int); // killough 4/17/98
126int W_GetNumForName (const char* name);
127int W_LumpLength (int lump);
128void W_ReadLump (int lump, void *dest);
129// CPhipps - modified for 'new' lump locking
130const void* W_CacheLumpNum (int lump);
131const void* W_LockLumpNum(int lump);
132void W_UnlockLumpNum(int lump);
133
134// CPhipps - convenience macros
135//#define W_CacheLumpNum(num) (W_CacheLumpNum)((num),1)
136#define W_CacheLumpName(name) W_CacheLumpNum (W_GetNumForName(name))
137
138//#define W_UnlockLumpNum(num) (W_UnlockLumpNum)((num),1)
139#define W_UnlockLumpName(name) W_UnlockLumpNum (W_GetNumForName(name))
140
141char *AddDefaultExtension(char *, const char *); // killough 1/18/98
142void ExtractFileBase(const char *, char *); // killough
143unsigned W_LumpNameHash(const char *s); // killough 1/31/98
144void W_HashLumps(void); // cph 2001/07/07 - made public
145
146#endif