-
Notifications
You must be signed in to change notification settings - Fork 14
/
wadman.h
248 lines (194 loc) · 3.78 KB
/
wadman.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#pragma pack(1)
#pragma warning(disable:4200)
#include "resourcefile.h"
extern CWADFile *mainwad;
struct CVertex
{
short x;
short y;
};
struct CThing
{
short xpos; /* x position */
short ypos; /* y position */
short angle; /* facing angle */
short type; /* thing type */
short when; /* appears when? */
};
/*
this data structure contains the information about the LINEDEFS
*/
struct CLineDef
{
unsigned short start; /* from this vertex ... */
unsigned short end; /* ... to this vertex */
short flags; /* see NAMES.C for more info */
short type; /* see NAMES.C for more info */
short tag; /* crossing this linedef activates the sector wi*/
short sidedef1; /* sidedef */
short sidedef2; /* only if this line adjoins 2 sectors */
};
/*
this data structure contains the information about the SIDEDEFS
*/
struct CSideDef
{
short xoff; /* X offset for texture */
short yoff; /* Y offset for texture */
char texUpper[8]; /* texture name for the part above */
char texLower[8]; /* texture name for the part below */
char texNormal[8]; /* texture name for the regular part */
short sector; /* adjacent sector */
};
struct CSector
{
short floorh;
short ceilh;
char floort[8];
char ceilt[8];
short light;
short special;
short tag;
};
struct CWadFileHeader
{
char id[4];
long numEntries;
long DirOffset;
};
struct CWadFileEntry
{
long FileOffset;
long EntryLength;
char name[8];
};
struct CWad3FileEntry
{
long FileOffset;
long EntryLength;
long EntryLength2;
long type;
char name[16];
};
struct WadItemList;
struct CLevelInfo
{
CThing * pThings;
CLineDef * pLineDefs;
CSideDef * pSideDefs;
CVertex * pVertexes;
CSector * pSectors;
char * pNodes;
char * pSegs;
char * pSSector;
char * pBlockmap;
char * pReject;
char * pBehavior;
char * pScript;
int nThings;
int nLineDefs;
int nSideDefs;
int nVertexes;
int nSectors;
int nNodes;
int nSegs;
int nSSectors;
int cReject;
int cBlockmap;
int cBehavior;
int cScript;
char * pGLVerts;
char * pGLSegs;
char * pGLSSectors;
char * pGLNodes;
int nGLVertexes;
int nGLNodes;
int nGLSegs;
int nGLSSectors;
int NameTag;
CLevelInfo()
{
NameTag=0;
}
void Release();
~CLevelInfo()
{
Release();
}
bool HasBehavior()
{
return pBehavior!=NULL;
}
bool HasScript()
{
return pBehavior!=NULL;
}
};
/*
struct WadInfo
{
HANDLE hFile;
HANDLE hMapping;
CWadFileHeader * pwAddr;
union
{
CWadFileEntry * pwDir;
CWad3FileEntry * pw3Dir;
};
int wtype;
char filename[256];
};
struct WadList
{
WadInfo * pwInfo;
WadList * pNext;
};
struct WadItemList
{
CWadFileEntry * pwInfo;
int type;
WadInfo * pwWad;
WadItemList * pSuccessor; // the overloaded entry
WadItemList * pNext;
WadItemList * Next() { return pNext; }
void* PackedAddress() const { return (void*)(((char*)pwWad->pwAddr)+pwInfo->FileOffset); }
bool isPacked() const
{
return false;
}
char * Address()
{
return (char *)PackedAddress();
}
int Length() const
{
return pwInfo->EntryLength;
}
void Release()
{
}
char * Name() const { return pwInfo->name; }
char * WadFileName() { return pwWad->filename; }
WadItemList() { }
~WadItemList() { }
};
*/
struct ImportInf
{
char name[9];
int insX,insY;
int transparentCol;
};
//extern WadItemList * GlobalDirectory;
//void CloseWadFile(WadInfo * wi);
void OpenMainWad(char * filename);
void ClosePatchWad(const char * filename);
void * GetWadItem(char * name,int * pLength);
void FreeWadItem(char * name,char * blockstart=NULL);
void NameError(char * level,char * section);
bool GetLevelInfo(char * name,CLevelInfo * pLi);
//int GetLevelFileInfo(char * fn,CLevelInfo * pli,WadInfo **pp=NULL);
inline void CLevelInfo::Release()
{
NameTag=-1;
}