1 //**************************************************************************
2 //**
3 //**	##   ##    ##    ##   ##   ####     ####   ###     ###
4 //**	##   ##  ##  ##  ##   ##  ##  ##   ##  ##  ####   ####
5 //**	 ## ##  ##    ##  ## ##  ##    ## ##    ## ## ## ## ##
6 //**	 ## ##  ########  ## ##  ##    ## ##    ## ##  ###  ##
7 //**	  ###   ##    ##   ###    ##  ##   ##  ##  ##       ##
8 //**	   #    ##    ##    #      ####     ####   ##       ##
9 //**
10 //**	$Id: wad.h 3863 2008-11-13 21:47:26Z dj_jl $
11 //**
12 //**	Copyright (C) 1999-2006 Jānis Legzdiņš
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 //**************************************************************************
25 //**
26 //**	WAD I/O functions.
27 //**
28 //**************************************************************************
29 
30 //	Boom namespaces.
31 enum EWadNamespace
32 {
33 	WADNS_Global,
34 	WADNS_Sprites,
35 	WADNS_Flats,
36 	WADNS_ColourMaps,
37 	WADNS_ACSLibrary,
38 	WADNS_NewTextures,
39 	WADNS_Voices,
40 	WADNS_HiResTextures,
41 
42 	//	Special namespaces for zip files, in wad file they will be searched
43 	// in global namespace.
44 	WADNS_ZipSpecial,
45 	WADNS_Patches,
46 	WADNS_Graphics,
47 	WADNS_Sounds,
48 	WADNS_Music,
49 };
50 
51 void W_AddFile(const VStr& FileName, const VStr& GwaDir, bool FixVoices);
52 void W_Shutdown();
53 
54 int W_OpenAuxiliary(const VStr& FileName);
55 void W_CloseAuxiliary();
56 
57 void W_BuildGLNodes(int lump);
58 void W_BuildPVS(int lump, int gllump);
59 
60 int W_CheckNumForName(VName Name, EWadNamespace NS = WADNS_Global);
61 int W_GetNumForName(VName Name, EWadNamespace NS = WADNS_Global);
62 int W_CheckNumForNameInFile(VName Name, int File, EWadNamespace NS = WADNS_Global);
63 
64 int W_CheckNumForFileName(VStr Name);
65 int W_GetNumForFileName(VStr Name);
66 int W_FindLumpByFileNameWithExts(VStr BaseName, const char** Exts);
67 
68 int W_LumpLength(int lump);
69 VName W_LumpName(int lump);
70 int W_LumpFile(int lump);
71 
72 void W_ReadFromLump(int lump, void *dest, int pos, int size);
73 VStr W_LoadTextLump(VName name);
74 void W_LoadLumpIntoArray(VName Lump, TArray<vuint8>& Array);
75 VStream* W_CreateLumpReaderNum(int lump);
76 VStream* W_CreateLumpReaderName(VName Name, EWadNamespace NS = WADNS_Global);
77 
78 int W_IterateNS(int Prev, EWadNamespace NS);
79 int W_IterateFile(int Prev, const VStr& Name);
80