mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-12-16 07:40:57 +00:00
Merge branch 'master' of http://git.magicalgirl.moe/STJr/SRB2 into fix-fixedrem
This commit is contained in:
commit
cfc9e23c43
2 changed files with 46 additions and 40 deletions
24
src/r_data.c
24
src/r_data.c
|
@ -484,16 +484,6 @@ void R_LoadTextures(void)
|
||||||
{
|
{
|
||||||
patchlump = W_CacheLumpNumPwad((UINT16)w, texstart + j, PU_CACHE);
|
patchlump = W_CacheLumpNumPwad((UINT16)w, texstart + j, PU_CACHE);
|
||||||
|
|
||||||
// Then, check the lump directly to see if it's a texture SOC,
|
|
||||||
// and if it is, load it using dehacked instead.
|
|
||||||
if (strstr((const char *)patchlump, "TEXTURE"))
|
|
||||||
{
|
|
||||||
CONS_Alert(CONS_WARNING, "%s is a Texture SOC.\n", W_CheckNameForNumPwad((UINT16)w,texstart+j));
|
|
||||||
Z_Unlock(patchlump);
|
|
||||||
DEH_LoadDehackedLumpPwad((UINT16)w, texstart + j);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
|
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
|
||||||
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||||
|
|
||||||
|
@ -522,7 +512,6 @@ void R_LoadTextures(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch)
|
||||||
{
|
{
|
||||||
|
@ -1065,6 +1054,7 @@ void R_ReInitColormaps(UINT16 num)
|
||||||
{
|
{
|
||||||
char colormap[9] = "COLORMAP";
|
char colormap[9] = "COLORMAP";
|
||||||
lumpnum_t lump;
|
lumpnum_t lump;
|
||||||
|
const lumpnum_t basecolormaplump = W_GetNumForName(colormap);
|
||||||
|
|
||||||
if (num > 0 && num <= 10000)
|
if (num > 0 && num <= 10000)
|
||||||
snprintf(colormap, 8, "CLM%04u", num-1);
|
snprintf(colormap, 8, "CLM%04u", num-1);
|
||||||
|
@ -1072,8 +1062,16 @@ void R_ReInitColormaps(UINT16 num)
|
||||||
// Load in the light tables, now 64k aligned for smokie...
|
// Load in the light tables, now 64k aligned for smokie...
|
||||||
lump = W_GetNumForName(colormap);
|
lump = W_GetNumForName(colormap);
|
||||||
if (lump == LUMPERROR)
|
if (lump == LUMPERROR)
|
||||||
lump = W_GetNumForName("COLORMAP");
|
lump = basecolormaplump;
|
||||||
W_ReadLump(lump, colormaps);
|
else
|
||||||
|
{
|
||||||
|
if (W_LumpLength(lump) != W_LumpLength(basecolormaplump))
|
||||||
|
{
|
||||||
|
CONS_Alert(CONS_WARNING, "%s lump size does not match COLORMAP, results may be unexpected.\n", colormap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
W_ReadLumpHeader(lump, colormaps, W_LumpLength(basecolormaplump), 0U);
|
||||||
|
|
||||||
// Init Boom colormaps.
|
// Init Boom colormaps.
|
||||||
R_ClearColormaps();
|
R_ClearColormaps();
|
||||||
|
|
18
src/w_wad.c
18
src/w_wad.c
|
@ -149,9 +149,15 @@ FILE *W_OpenWadFile(const char **filename, boolean useerrors)
|
||||||
{
|
{
|
||||||
FILE *handle;
|
FILE *handle;
|
||||||
|
|
||||||
|
// Officially, strncpy should not have overlapping buffers, since W_VerifyNMUSlumps is called after this, and it
|
||||||
|
// changes filename to point at filenamebuf, it would technically be doing that. I doubt any issue will occur since
|
||||||
|
// they point to the same location, but it's better to be safe and this is a simple change.
|
||||||
|
if (filenamebuf != *filename)
|
||||||
|
{
|
||||||
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
strncpy(filenamebuf, *filename, MAX_WADPATH);
|
||||||
filenamebuf[MAX_WADPATH - 1] = '\0';
|
filenamebuf[MAX_WADPATH - 1] = '\0';
|
||||||
*filename = filenamebuf;
|
*filename = filenamebuf;
|
||||||
|
}
|
||||||
|
|
||||||
// open wad file
|
// open wad file
|
||||||
if ((handle = fopen(*filename, "rb")) == NULL)
|
if ((handle = fopen(*filename, "rb")) == NULL)
|
||||||
|
@ -334,7 +340,6 @@ static restype_t ResourceFileDetect (const char* filename)
|
||||||
static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const char* lumpname)
|
static lumpinfo_t* ResGetLumpsStandalone (FILE* handle, UINT16* numlumps, const char* lumpname)
|
||||||
{
|
{
|
||||||
lumpinfo_t* lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
|
lumpinfo_t* lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
|
||||||
lumpinfo = Z_Calloc(sizeof (*lumpinfo), PU_STATIC, NULL);
|
|
||||||
lumpinfo->position = 0;
|
lumpinfo->position = 0;
|
||||||
fseek(handle, 0, SEEK_END);
|
fseek(handle, 0, SEEK_END);
|
||||||
lumpinfo->size = ftell(handle);
|
lumpinfo->size = ftell(handle);
|
||||||
|
@ -566,14 +571,14 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", strerror(ferror(handle)));
|
CONS_Alert(CONS_ERROR, "Failed to read central directory (%s)\n", strerror(ferror(handle)));
|
||||||
Z_Free(lumpinfo);
|
Z_Free(lumpinfo);
|
||||||
free(zentry);
|
free(zentries);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (memcmp(zentry->signature, pat_central, 4))
|
if (memcmp(zentry->signature, pat_central, 4))
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "Central directory is corrupt\n");
|
CONS_Alert(CONS_ERROR, "Central directory is corrupt\n");
|
||||||
Z_Free(lumpinfo);
|
Z_Free(lumpinfo);
|
||||||
free(zentry);
|
free(zentries);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -586,7 +591,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
||||||
{
|
{
|
||||||
CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", strerror(ferror(handle)));
|
CONS_Alert(CONS_ERROR, "Unable to read lumpname (%s)\n", strerror(ferror(handle)));
|
||||||
Z_Free(lumpinfo);
|
Z_Free(lumpinfo);
|
||||||
free(zentry);
|
free(zentries);
|
||||||
free(fullname);
|
free(fullname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -628,6 +633,8 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(zentries);
|
||||||
|
|
||||||
*nlmp = numlumps;
|
*nlmp = numlumps;
|
||||||
return lumpinfo;
|
return lumpinfo;
|
||||||
}
|
}
|
||||||
|
@ -1327,8 +1334,9 @@ size_t W_ReadLumpHeaderPwad(UINT16 wad, UINT16 lump, void *dest, size_t size, si
|
||||||
{
|
{
|
||||||
size = 0;
|
size = 0;
|
||||||
zerr(zErr);
|
zerr(zErr);
|
||||||
(void)inflateEnd(&strm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void)inflateEnd(&strm);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue