X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=wad.c;h=a07f87bb135560c919b9564c038cc8b337b85eaf;hb=cf74e01c006d2937bf1e3a522efc7b2dd0f40ba2;hp=8e4c767bea1a0ba7a378bf44b187f241e48252c0;hpb=fd091d66e2673b19eb9c7d73d95160ef874de5e6;p=xonotic%2Fdarkplaces.git diff --git a/wad.c b/wad.c index 8e4c767b..a07f87bb 100644 --- a/wad.c +++ b/wad.c @@ -95,7 +95,7 @@ void W_UnloadAll(void) // close all hlwad files and free their lumps data for (i = 0;i < Mem_ExpandableArray_IndexRange(&wad.hlwads);i++) { - w = Mem_ExpandableArray_RecordAtIndex(&wad.hlwads, i); + w = (mwad_t *) Mem_ExpandableArray_RecordAtIndex(&wad.hlwads, i); if (!w) continue; if (w->file) @@ -148,11 +148,6 @@ unsigned char *W_GetLumpName(const char *name) for (lump = wad.gfx.lumps, i = 0;i < wad.gfx.numlumps;i++, lump++) if (!strcmp(clean, lump->name)) return (wad.gfx_base + lump->filepos); - - if (wad.gfx_base) - Con_DPrintf("W_GetLumpByName(\"%s\"): couldn't find file in gfx.wad\n", name); - else - Con_DPrintf("W_GetLumpByName(\"%s\"): couldn't load gfx.wad\n", name); return NULL; } @@ -169,7 +164,7 @@ void W_LoadTextureWadFile (char *filename, int complain) int numlumps; mwad_t *w; - file = FS_Open (filename, "rb", false, false); + file = FS_OpenVirtualFile(filename, false); if (!file) { if (complain) @@ -192,10 +187,10 @@ void W_LoadTextureWadFile (char *filename, int complain) if (!wad.hlwads.mempool) Mem_ExpandableArray_NewArray(&wad.hlwads, cls.permanentmempool, sizeof(mwad_t), 16); - w = Mem_ExpandableArray_AllocRecord(&wad.hlwads); + w = (mwad_t *) Mem_ExpandableArray_AllocRecord(&wad.hlwads); w->file = file; w->numlumps = numlumps; - w->lumps = Mem_Alloc(cls.permanentmempool, w->numlumps * sizeof(lumpinfo_t)); + w->lumps = (lumpinfo_t *) Mem_Alloc(cls.permanentmempool, w->numlumps * sizeof(lumpinfo_t)); if (!w->lumps) { @@ -260,12 +255,14 @@ unsigned char *W_GetTextureBGRA(char *name) unsigned char *data; mwad_t *w; char texname[17]; + size_t range; texname[16] = 0; W_CleanupName(name, texname); if (!wad.hlwads.mempool) Mem_ExpandableArray_NewArray(&wad.hlwads, cls.permanentmempool, sizeof(mwad_t), 16); - for (k = 0;k < Mem_ExpandableArray_IndexRange(&wad.hlwads);k++) + range = Mem_ExpandableArray_IndexRange(&wad.hlwads); + for (k = 0;k < range;k++) { w = (mwad_t *)Mem_ExpandableArray_RecordAtIndex(&wad.hlwads, k); if (!w)