mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
W_LoadWadFile: Just use COM_LoadMallocFile(). Some minor cleanup.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@362 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
9aad4f2759
commit
087196844c
1 changed files with 6 additions and 12 deletions
18
Quake/wad.c
18
Quake/wad.c
|
@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
int wad_numlumps;
|
||||
lumpinfo_t *wad_lumps;
|
||||
byte *wad_base = NULL; //johnfitz -- set to null
|
||||
byte *wad_base = NULL;
|
||||
|
||||
void SwapPic (qpic_t *pic);
|
||||
|
||||
|
@ -68,28 +68,22 @@ void W_LoadWadFile (void) //johnfitz -- filename is now hard-coded for honesty
|
|||
{
|
||||
lumpinfo_t *lump_p;
|
||||
wadinfo_t *header;
|
||||
unsigned i;
|
||||
int infotableofs;
|
||||
int i;
|
||||
int infotableofs;
|
||||
const char *filename = WADFILENAME;
|
||||
|
||||
//johnfitz -- modified to use malloc
|
||||
//TODO: use cache_alloc
|
||||
int h, len;
|
||||
|
||||
if (wad_base)
|
||||
free (wad_base);
|
||||
len = COM_OpenFile (filename, &h);
|
||||
if (h == -1)
|
||||
wad_base = COM_LoadMallocFile (filename);
|
||||
if (!wad_base)
|
||||
Sys_Error ("W_LoadWadFile: couldn't load %s", filename);
|
||||
wad_base = (unsigned char *)malloc (len);
|
||||
Sys_FileRead (h, wad_base, len);
|
||||
COM_CloseFile (h);
|
||||
//johnfitz
|
||||
|
||||
header = (wadinfo_t *)wad_base;
|
||||
|
||||
if (header->identification[0] != 'W' || header->identification[1] != 'A'
|
||||
|| header->identification[2] != 'D' || header->identification[3] != '2')
|
||||
|| header->identification[2] != 'D' || header->identification[3] != '2')
|
||||
Sys_Error ("Wad file %s doesn't have WAD2 id\n",filename);
|
||||
|
||||
wad_numlumps = LittleLong(header->numlumps);
|
||||
|
|
Loading…
Reference in a new issue