Merge branch 'optimizewadlumps' into Saturn-Testing
This commit is contained in:
commit
80ffa12848
14 files changed
+88
-106
No files matched your search
@@ -20,7 +20,7 @@ $(foreach v,$(join $(wordlist 2,$(_n),- $(gcc_versions)),\
|
||||
CXXFLAGS+= -Wno-aggregate-return
|
||||
|
||||
# -W -Wno-unused
|
||||
WFLAGS:=-Wall -Wno-trigraphs
|
||||
WFLAGS:=-Wall -Wno-trigraphs -Wshadow -Wnull-dereference
|
||||
ifndef GCC295
|
||||
#WFLAGS+=-Wno-packed
|
||||
endif
|
||||
@@ -37,9 +37,6 @@ WFLAGS+=-Wfloat-equal
|
||||
ifndef GCC295
|
||||
WFLAGS+=-Wendif-labels
|
||||
endif
|
||||
ifdef GCC41
|
||||
WFLAGS+=-Wshadow
|
||||
endif
|
||||
#WFLAGS+=-Wlarger-than-%len%
|
||||
WFLAGS+=-Wpointer-arith
|
||||
CWFLAGS+=-Wbad-function-cast
|
||||
|
||||
@@ -619,7 +619,6 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
// lookup for flats that may´ve been already loaded
|
||||
// too lazy to make a hashtable or smth so unordered set will do :carbuncle:
|
||||
std::unordered_set<UINT32> flatpresent;
|
||||
lumpnum_t lump;
|
||||
size_t i, j;
|
||||
INT32 k;
|
||||
|
||||
@@ -649,9 +648,8 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
const INT32 pic = ceiling ? sec->ceilingpic : sec->floorpic;
|
||||
|
||||
const levelflat_t *levelflat = &levelflats[pic];
|
||||
lump = levelflat->lumpnum;
|
||||
|
||||
load_flat(lump, R_NoEncore(sec, ceiling));
|
||||
load_flat(levelflat->lumpnum, R_NoEncore(sec, ceiling));
|
||||
|
||||
if (levelflat->speed) // is it an animated flat ?
|
||||
{
|
||||
@@ -672,9 +670,8 @@ static void HWR_PrecacheLevelFlats(void)
|
||||
for (i = 0; i < numlevelflats; i++)
|
||||
{
|
||||
const levelflat_t *levelflat = &levelflats[i];
|
||||
lump = levelflat->lumpnum;
|
||||
|
||||
load_flat(lump, false);
|
||||
load_flat(levelflat->lumpnum, false);
|
||||
|
||||
if (levelflat->speed) // is it an animated flat ?
|
||||
{
|
||||
|
||||
@@ -5545,7 +5545,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
|
||||
player_t *viewplayer = &players[displayplayers[viewssnum]];
|
||||
const float fpov = FixedToFloat(R_GetPlayerFov(viewplayer));
|
||||
|
||||
auto reset_viewstate = [&](const float fpov)
|
||||
auto reset_viewstate = [&]()
|
||||
{
|
||||
HWR_SetTransform(fpov);
|
||||
HWR_ClearSprites();
|
||||
@@ -5565,7 +5565,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
|
||||
currentportallist = &portallist;
|
||||
HWR_SetPortalState(GLPORTAL_SEARCH);
|
||||
|
||||
reset_viewstate(fpov);
|
||||
reset_viewstate();
|
||||
|
||||
if (rootportal)
|
||||
{
|
||||
@@ -5591,7 +5591,7 @@ static void HWR_RenderViewpoint(gl_portal_t *rootportal, int stencil_level, bool
|
||||
// draw normal things in current frame in current incremented stencil buffer area
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, stencil_level);
|
||||
|
||||
reset_viewstate(fpov);
|
||||
reset_viewstate();
|
||||
|
||||
if constexpr (Type == RenderViewpointType::kPortal)
|
||||
{
|
||||
|
||||
+20
-17
@@ -1064,9 +1064,13 @@ static void ArchiveTables(UINT8 **p)
|
||||
{
|
||||
// Write key
|
||||
e = ArchiveValue(p, TABLESINDEX, -2); // key should be either a number or a string, ArchiveValue can handle this.
|
||||
if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
|
||||
if (e == 1)
|
||||
n++; // the table contained a new table we'll have to archive. :(
|
||||
else if (e == 2) // invalid key type (function, thread, lightuserdata, or anything we don't recognise)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Index '%s' (%s) of table %d could not be archived!\n", lua_tostring(gL, -2), luaL_typename(gL, -2), i);
|
||||
lua_pop(gL, 1);
|
||||
continue;
|
||||
}
|
||||
else if (e == 3) // nil key due to invalid userdata. NOT an error.
|
||||
{
|
||||
@@ -1077,15 +1081,12 @@ static void ArchiveTables(UINT8 **p)
|
||||
// Write value
|
||||
e = ArchiveValue(p, TABLESINDEX, -1);
|
||||
if (e == 1)
|
||||
{
|
||||
n++; // the table contained a new table we'll have to archive. :(
|
||||
}
|
||||
else if (e == 2) // invalid value type
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "Type of value for table %d entry '%s' (%s) could not be archived!\n", i, lua_tostring(gL, -2), luaL_typename(gL, -1));
|
||||
}
|
||||
|
||||
lua_pop(gL, 1);
|
||||
|
||||
}
|
||||
lua_pop(gL, 1);
|
||||
WRITEUINT8(*p, ARCH_TEND);
|
||||
@@ -1276,13 +1277,21 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
||||
UINT8 ret;
|
||||
|
||||
ret = UnArchiveValue(p, TABLESINDEX, network);
|
||||
if (ret == 3)
|
||||
if (ret == 1) // End of table
|
||||
break;
|
||||
else if (ret == 2) // Key contains a new table
|
||||
n++;
|
||||
else if (ret == 3)
|
||||
{
|
||||
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||
lua_pushnil(gL);
|
||||
}
|
||||
else if (ret == 1) // read key
|
||||
break;
|
||||
|
||||
if (lua_isnil(gL, -1)) // If key is nil, skip this entry
|
||||
{
|
||||
lua_pop(gL, 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = UnArchiveValue(p, TABLESINDEX, network);
|
||||
if (ret == 1)
|
||||
@@ -1291,21 +1300,15 @@ static void UnArchiveTables(UINT8 **p, boolean network)
|
||||
lua_pop(gL, 1); // Pop key
|
||||
break;
|
||||
}
|
||||
else if (ret == 2) // read value
|
||||
n++;
|
||||
else if (ret == 3)
|
||||
{
|
||||
//CONS_Alert(CONS_WARNING,"Couldn't read mobj_t\n");
|
||||
lua_pushnil(gL);
|
||||
}
|
||||
else if (ret == 2) // read value
|
||||
n++;
|
||||
|
||||
if (lua_isnil(gL, -2)) // if key is nil (if a function etc was accidentally saved)
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, "A nil key in table %d was found! (Invalid key type or corrupted save?)\n", i);
|
||||
lua_pop(gL, 2); // pop key and value instead of setting them in the table, to prevent Lua panic errors
|
||||
}
|
||||
else
|
||||
lua_rawset(gL, -3);
|
||||
lua_rawset(gL, -3);
|
||||
}
|
||||
|
||||
lua_pop(gL, 1);
|
||||
|
||||
+5
-4
@@ -1346,14 +1346,15 @@ void M_MinimapGenerate(void)
|
||||
minigen = AM_MinimapGenerate(mul);
|
||||
|
||||
if (minigen == NULL || minigen->buf == NULL)
|
||||
goto failure;
|
||||
{
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create %s\n"), filepath);
|
||||
return;
|
||||
}
|
||||
|
||||
M_CreateScreenShotPalette();
|
||||
ret = M_SavePNG(filepath, minigen->buf, minigen->w, minigen->h, screenshot_palette);
|
||||
|
||||
failure:
|
||||
if (minigen->buf != NULL)
|
||||
free(minigen->buf);
|
||||
free(minigen->buf);
|
||||
|
||||
if (ret)
|
||||
{
|
||||
|
||||
+1
-2
@@ -1385,8 +1385,7 @@ static void Polyobj_rotateThings(polyobj_t *po, vector2_t origin, angle_t delta,
|
||||
|
||||
if (mo->player)
|
||||
{
|
||||
angle_t localangle = P_GetLocalAngle(mo->player);
|
||||
P_ForceLocalAngle(mo->player, localangle + delta);
|
||||
P_ForceLocalAngle(mo->player, P_GetLocalAngle(mo->player) + delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
-5
@@ -2229,12 +2229,12 @@ void R_StoreWallRange(INT32 start, INT32 stop)
|
||||
lowcutslope = std::max(worldbottomslope, worldlowslope) + viewz;
|
||||
highcutslope = std::min(worldtopslope, worldhighslope) + viewz;
|
||||
|
||||
auto check_fof_offscreen = [&](ffloor_t* rover, INT32 bottom, INT32 bottomslope, INT32 top, INT32 topslope)
|
||||
auto check_fof_offscreen = [&](ffloor_t* rrover, INT32 bottom, INT32 bottomslope, INT32 top, INT32 topslope)
|
||||
{
|
||||
return ((P_GetFFloorTopZAt (rover, segleft .x, segleft .y) <= bottom + viewz
|
||||
&& P_GetFFloorTopZAt (rover, segright.x, segright.y) <= bottomslope + viewz)
|
||||
|| ( P_GetFFloorBottomZAt (rover, segleft .x, segleft .y) >= top + viewz
|
||||
&& P_GetFFloorBottomZAt (rover, segright.x, segright.y) >= topslope + viewz));
|
||||
return ((P_GetFFloorTopZAt (rrover, segleft .x, segleft .y) <= bottom + viewz
|
||||
&& P_GetFFloorTopZAt (rrover, segright.x, segright.y) <= bottomslope + viewz)
|
||||
|| ( P_GetFFloorBottomZAt (rrover, segleft .x, segleft .y) >= top + viewz
|
||||
&& P_GetFFloorBottomZAt (rrover, segright.x, segright.y) >= topslope + viewz));
|
||||
};
|
||||
|
||||
if (frontsector->ffloors && backsector->ffloors)
|
||||
|
||||
+1
-1
@@ -1577,7 +1577,7 @@ static void R_ProjectSprite(mobj_t *thing)
|
||||
else
|
||||
blendmode = thing->blendmode;
|
||||
|
||||
if (thing->flags2 & MF2_SHADOW || thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
|
||||
if (thing->flags2 & MF2_SHADOW) // actually only the player should use this (temporary invisibility)
|
||||
trans = tr_trans80; // because now the translucency is set through FF_TRANSMASK
|
||||
else if (thing->frame & FF_TRANSMASK)
|
||||
{
|
||||
|
||||
@@ -1491,6 +1491,9 @@ musicdef_t *S_FindMusicCredit(const char *musname)
|
||||
{
|
||||
def = S_GetMusicCredit(i);
|
||||
|
||||
if (!def)
|
||||
continue;
|
||||
|
||||
if (hash != def->hash)
|
||||
continue;
|
||||
|
||||
|
||||
+7
-7
@@ -1411,7 +1411,7 @@ void I_FinishUpdate(void)
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
OglSdlFinishUpdate(cv_vidwait.value);
|
||||
OglSdlFinishUpdate();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@@ -2198,17 +2198,17 @@ UINT32 I_GetRefreshRate(void)
|
||||
|
||||
static void Impl_SetVsync(void)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2,0,18)
|
||||
if (renderer)
|
||||
SDL_RenderSetVSync(renderer, cv_vidwait.value);
|
||||
#endif
|
||||
#ifdef HWRENDER
|
||||
if (!renderer && rendermode == render_opengl &&
|
||||
sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
if (rendermode == render_opengl &&
|
||||
sdlglcontext != NULL && SDL_GL_GetCurrentContext() == sdlglcontext)
|
||||
{
|
||||
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||
}
|
||||
#endif
|
||||
#if SDL_VERSION_ATLEAST(2,0,18)
|
||||
if (renderer)
|
||||
SDL_RenderSetVSync(renderer, cv_vidwait.value);
|
||||
#endif
|
||||
}
|
||||
|
||||
void I_SetBorderlessWindow(void)
|
||||
|
||||
+2
-37
@@ -63,18 +63,9 @@ PFNglGetString pglGetString;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
|
||||
#if defined (__unix__)
|
||||
static boolean xwaylandcrap = false;
|
||||
#endif
|
||||
|
||||
boolean UseScreenFBO(void)
|
||||
{
|
||||
return ((supportFBO && cv_glframebuffer.value && downsample)
|
||||
#if defined (__unix__)
|
||||
|| (supportFBO && xwaylandcrap)
|
||||
#endif
|
||||
);
|
||||
return (supportFBO && cv_glframebuffer.value && downsample);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -201,17 +192,6 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
supportNPO2tex = true;
|
||||
|
||||
glanisotropicmode_cons_t[1].value = maximumAnisotropy;
|
||||
|
||||
#if defined (__unix__)
|
||||
#ifdef USE_FBO_OGL
|
||||
// TODO: delet this since nvidia fixed their shit on 575
|
||||
char videodriver[4] = {'S','D','L',0};
|
||||
if (supportFBO && strstr((const char*)gl_renderer, "NVIDIA")
|
||||
&& (*strncpy(videodriver, SDL_GetCurrentVideoDriver(), sizeof(videodriver)-1) != '\0')
|
||||
&& (strncasecmp("x11", videodriver, 4) == 0))
|
||||
xwaylandcrap = true;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
SDL_GL_SetSwapInterval(cv_vidwait.value ? 1 : 0);
|
||||
@@ -241,22 +221,14 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
|
||||
\return void
|
||||
*/
|
||||
void OglSdlFinishUpdate(boolean waitvbl)
|
||||
void OglSdlFinishUpdate(void)
|
||||
{
|
||||
static boolean oldwaitvbl = false;
|
||||
int sdlw, sdlh;
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
const boolean usefbo = UseScreenFBO();
|
||||
#endif
|
||||
|
||||
if (oldwaitvbl != waitvbl)
|
||||
{
|
||||
SDL_GL_SetSwapInterval(waitvbl ? 1 : 0);
|
||||
}
|
||||
|
||||
oldwaitvbl = waitvbl;
|
||||
|
||||
SDL_GetWindowSize(window, &sdlw, &sdlh);
|
||||
HWR_MakeScreenFinalTexture();
|
||||
|
||||
@@ -289,13 +261,6 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
if (!I_CheckNativeRes() || WipeInAction)
|
||||
#endif
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight, false);
|
||||
|
||||
#if defined (__unix__)
|
||||
#ifdef USE_FBO_OGL
|
||||
if (loaded_config)
|
||||
xwaylandcrap = false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
|
||||
boolean OglSdlSurface(INT32 w, INT32 h);
|
||||
|
||||
void OglSdlFinishUpdate(boolean vidwait);
|
||||
void OglSdlFinishUpdate(void);
|
||||
boolean VID_LoadOGLAPI(void);
|
||||
|
||||
extern SDL_Renderer *renderer;
|
||||
|
||||
+31
-14
@@ -144,7 +144,7 @@ void W_Shutdown(void)
|
||||
Z_Free(wad->filename);
|
||||
while (wad->numlumps--)
|
||||
{
|
||||
Z_Free(wad->lumpinfo[wad->numlumps].longname);
|
||||
//Z_Free(wad->lumpinfo[wad->numlumps].longname);
|
||||
Z_Free(wad->lumpinfo[wad->numlumps].fullname);
|
||||
}
|
||||
|
||||
@@ -418,11 +418,11 @@ static lumpinfo_t* ResGetLumpsStandalone(FILE* handle, UINT16* numlumps, const c
|
||||
lumpinfo->hash.name = W_HashLumpName(lumpname);
|
||||
|
||||
// Allocate the lump's long name.
|
||||
lumpinfo->longname = static_cast<char *>(Z_Malloc((lumpinfo->namelength + 1) * sizeof(char), PU_STATIC, NULL));
|
||||
/*lumpinfo->longname = static_cast<char *>(Z_Malloc((lumpinfo->namelength + 1) * sizeof(char), PU_STATIC, NULL));
|
||||
strcpy(lumpinfo->longname, lumpname);
|
||||
lumpinfo->longname[lumpinfo->namelength] = '\0';
|
||||
lumpinfo->longnamelength = lumpinfo->namelength;
|
||||
lumpinfo->hash.longname = lumpinfo->hash.name;
|
||||
lumpinfo->hash.longname = lumpinfo->hash.name;*/
|
||||
|
||||
// Allocate the lump's full name.
|
||||
lumpinfo->fullname = static_cast<char *>(Z_Malloc((lumpinfo->namelength + 1) * sizeof(char), PU_STATIC, NULL));
|
||||
@@ -529,11 +529,11 @@ static lumpinfo_t* ResGetLumpsWad(FILE* handle, UINT16* nlmp, const char* filena
|
||||
lump_p->hash.name = W_HashLumpName(lump_p->name);
|
||||
|
||||
// Allocate the lump's long name.
|
||||
lump_p->longname = static_cast<char *>(Z_Malloc(9 * sizeof(char), PU_STATIC, NULL));
|
||||
/*lump_p->longname = static_cast<char *>(Z_Malloc(9 * sizeof(char), PU_STATIC, NULL));
|
||||
strncpy(lump_p->longname, fileinfo->name, 8);
|
||||
lump_p->longname[8] = '\0';
|
||||
lump_p->longnamelength = lump_p->namelength;
|
||||
lump_p->hash.longname = lump_p->hash.name;
|
||||
lump_p->hash.longname = lump_p->hash.name;*/
|
||||
|
||||
// Allocate the lump's full name.
|
||||
lump_p->fullname = static_cast<char *>(Z_Malloc(9 * sizeof(char), PU_STATIC, NULL));
|
||||
@@ -729,10 +729,10 @@ static lumpinfo_t* ResGetLumpsZip(FILE* handle, UINT16* nlmp)
|
||||
lump_p->namelength = strlen(lump_p->name);
|
||||
lump_p->hash.name = W_HashLumpName(lump_p->name);
|
||||
|
||||
lump_p->longname = static_cast<char *>(Z_Calloc(dotpos - trimname + 1, PU_STATIC, NULL));
|
||||
/*lump_p->longname = static_cast<char *>(Z_Calloc(dotpos - trimname + 1, PU_STATIC, NULL));
|
||||
strlcpy(lump_p->longname, trimname, dotpos - trimname + 1);
|
||||
lump_p->longnamelength = strlen(lump_p->longname);
|
||||
lump_p->hash.longname = W_HashLumpName(lump_p->longname);
|
||||
lump_p->hash.longname = W_HashLumpName(lump_p->longname);*/
|
||||
|
||||
lump_p->fullname = static_cast<char *>(Z_Calloc(SHORT(zentry->namelen) + 1, PU_STATIC, NULL));
|
||||
strncpy(lump_p->fullname, fullname, SHORT(zentry->namelen));
|
||||
@@ -1124,7 +1124,7 @@ UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
// Should be the only version, but that's not possible until we fix
|
||||
// all the instances of non null-terminated strings in the codebase...
|
||||
//
|
||||
UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
/*UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
{
|
||||
UINT16 i;
|
||||
UINT32 hash;
|
||||
@@ -1156,7 +1156,7 @@ UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
|
||||
// not found.
|
||||
return INT16_MAX;
|
||||
}
|
||||
}*/
|
||||
|
||||
UINT16 W_CheckNumForMarkerStartPwad(const char *name, UINT16 wad, UINT16 startlump)
|
||||
{
|
||||
@@ -1306,7 +1306,7 @@ lumpnum_t W_CheckNumForName(const char *name)
|
||||
// Should be the only version, but that's not possible until we fix
|
||||
// all the instances of non null-terminated strings in the codebase...
|
||||
//
|
||||
lumpnum_t W_CheckNumForLongName(const char *name)
|
||||
/*lumpnum_t W_CheckNumForLongName(const char *name)
|
||||
{
|
||||
INT32 i;
|
||||
lumpnum_t check = INT16_MAX;
|
||||
@@ -1340,7 +1340,7 @@ lumpnum_t W_CheckNumForLongName(const char *name)
|
||||
|
||||
return lumpnum;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//
|
||||
// W_GetNumForName
|
||||
@@ -1365,7 +1365,7 @@ lumpnum_t W_GetNumForName(const char *name)
|
||||
// Should be the only version, but that's not possible until we fix
|
||||
// all the instances of non null-terminated strings in the codebase...
|
||||
//
|
||||
lumpnum_t W_GetNumForLongName(const char *name)
|
||||
/*lumpnum_t W_GetNumForLongName(const char *name)
|
||||
{
|
||||
lumpnum_t i;
|
||||
|
||||
@@ -1375,7 +1375,7 @@ lumpnum_t W_GetNumForLongName(const char *name)
|
||||
I_Error("W_GetNumForLongName: %s not found!\n", name);
|
||||
|
||||
return i;
|
||||
}
|
||||
}*/
|
||||
|
||||
//
|
||||
// W_CheckNumForNameInBlock
|
||||
@@ -2011,6 +2011,9 @@ void *W_CachePatchNameRotated(const char *name, INT32 rotationangle, INT32 tag)
|
||||
|
||||
rspr = static_cast<rotsprite_t *>(W_GetCachedRotPatchPwad(WADFILENUM(num), LUMPNUM(num)));
|
||||
|
||||
if (rspr == NULL)
|
||||
return W_CachePatchNum(W_GetNumForName("MISSING"), tag);
|
||||
|
||||
if (rspr->patches[idx] == NULL)
|
||||
{
|
||||
INT32 xpivot = 0, ypivot = 0;
|
||||
@@ -2626,6 +2629,9 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
|
||||
|
||||
// Remember that we're assuming that the WAD will have a specific set of lumps in a specific order.
|
||||
UINT8 *wadData = static_cast<UINT8 *>(W_CacheLumpNum(lumpnum, PU_LEVEL));
|
||||
if (wadData == NULL)
|
||||
I_Error("vres_GetMap: Invalid WadData!\n");
|
||||
|
||||
filelump_t *fileinfo = reinterpret_cast<filelump_t *>(wadData + LONG((reinterpret_cast<wadinfo_t *>(wadData))->infotableofs));
|
||||
|
||||
i = LONG((reinterpret_cast<wadinfo_t *>(wadData))->numlumps);
|
||||
@@ -2642,6 +2648,8 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
|
||||
}
|
||||
|
||||
vlumps = static_cast<virtlump_t *>(Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL));
|
||||
if (vlumps == NULL)
|
||||
I_Error("vres_GetMap: Out of memory!\n");
|
||||
|
||||
// Build the lumps, skipping over empty entries.
|
||||
for (i = 0, realentry = 0; i < numlumps; realentry++)
|
||||
@@ -2677,7 +2685,11 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
|
||||
lumpnum_t lumppos = lumpnum + 1;
|
||||
for (i = LUMPNUM(lumppos); i < wadfiles[WADFILENUM(lumpnum)]->numlumps; i++, lumppos++, numlumps++)
|
||||
{
|
||||
if (memcmp(W_CheckNameForNum(lumppos), "MAP", 3) == 0 || W_LumpLength(lumppos) == 0)
|
||||
const char *name = W_CheckNameForNum(lumppos);
|
||||
if (name == NULL)
|
||||
continue;
|
||||
|
||||
if (memcmp(name, "MAP", 3) == 0 || W_LumpLength(lumppos) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2685,10 +2697,15 @@ virtres_t* vres_GetMap(lumpnum_t lumpnum)
|
||||
numlumps++;
|
||||
|
||||
vlumps = static_cast<virtlump_t *>(Z_Malloc(sizeof(virtlump_t)*numlumps, PU_LEVEL, NULL));
|
||||
if (vlumps == NULL)
|
||||
I_Error("vres_GetMap: Out of memory!\n");
|
||||
|
||||
for (i = 0; i < numlumps; i++, lumpnum++)
|
||||
{
|
||||
// Check if it is map marker. It is not always first lump sadly, so we need to expect it anywhere
|
||||
const char *name = W_CheckNameForNum(lumpnum);
|
||||
if (name == NULL)
|
||||
continue;
|
||||
|
||||
if (strlen(name) == 5 && memcmp(name, "MAP", 3) == 0)
|
||||
{
|
||||
|
||||
+6
-6
@@ -68,11 +68,11 @@ typedef struct
|
||||
unsigned long position; // filelump_t filepos
|
||||
unsigned long disksize; // filelump_t size
|
||||
char name[9]; // filelump_t name[] e.g. "LongEntr"
|
||||
char *longname; // e.g. "LongEntryName"
|
||||
//char *longname; // e.g. "LongEntryName"
|
||||
char *fullname; // e.g. "Folder/Subfolder/LongEntryName.extension"
|
||||
|
||||
size_t namelength; // length of name
|
||||
size_t longnamelength; // length of longname
|
||||
//size_t longnamelength; // length of longname
|
||||
size_t fullnamelength; // length of fullname
|
||||
|
||||
size_t size; // real (uncompressed) size
|
||||
@@ -80,7 +80,7 @@ typedef struct
|
||||
|
||||
struct {
|
||||
UINT32 name; // hash of name
|
||||
UINT32 longname; // hash of longname
|
||||
//UINT32 longname; // hash of longname
|
||||
//UINT32 fullname; // hash of fullname
|
||||
} hash;
|
||||
} lumpinfo_t;
|
||||
@@ -180,7 +180,7 @@ const char *W_CheckNameForNumPwad(UINT16 wad, UINT16 lump);
|
||||
const char *W_CheckNameForNum(lumpnum_t lumpnum);
|
||||
|
||||
UINT16 W_CheckNumForNamePwad(const char *name, UINT16 wad, UINT16 startlump); // checks only in one pwad
|
||||
UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump);
|
||||
//UINT16 W_CheckNumForLongNamePwad(const char *name, UINT16 wad, UINT16 startlump);
|
||||
|
||||
/* Find the first lump after F_START for instance. */
|
||||
UINT16 W_CheckNumForMarkerStartPwad(const char *name, UINT16 wad, UINT16 startlump);
|
||||
@@ -190,9 +190,9 @@ UINT16 W_CheckNumForFolderStartPK3(const char *name, UINT16 wad, UINT16 startlum
|
||||
UINT16 W_CheckNumForFolderEndPK3(const char *name, UINT16 wad, UINT16 startlump);
|
||||
|
||||
lumpnum_t W_CheckNumForName(const char *name);
|
||||
lumpnum_t W_CheckNumForLongName(const char *name);
|
||||
//lumpnum_t W_CheckNumForLongName(const char *name);
|
||||
lumpnum_t W_GetNumForName(const char *name); // like W_CheckNumForName but I_Error on LUMPERROR
|
||||
lumpnum_t W_GetNumForLongName(const char *name);
|
||||
//lumpnum_t W_GetNumForLongName(const char *name);
|
||||
lumpnum_t W_CheckNumForNameInBlock(const char *name, const char *blockstart, const char *blockend);
|
||||
UINT8 W_LumpExists(const char *name); // Lua uses this.
|
||||
UINT8 W_CheckMultipleLumps(const char* lump, ...); // variadic version of above lmao
|
||||
|
||||
Reference in new issue
Block a user