Kill Texture SOC feature.

As far as I know it's basically unused, and the strstr is inherently unsafe because there's no guarantee that a patch's contents are NULL terminated.
This commit is contained in:
Sryder 2019-06-23 13:48:29 +01:00
parent 45922f80d1
commit bc254d9cf7
1 changed files with 19 additions and 30 deletions

View File

@ -484,42 +484,31 @@ void R_LoadTextures(void)
{
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);
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
//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);
// Set texture properties.
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
texture->width = SHORT(patchlump->width);
texture->height = SHORT(patchlump->height);
texture->patchcount = 1;
texture->holes = false;
// Set texture properties.
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
texture->width = SHORT(patchlump->width);
texture->height = SHORT(patchlump->height);
texture->patchcount = 1;
texture->holes = false;
// Allocate information for the texture's patches.
patch = &texture->patches[0];
// Allocate information for the texture's patches.
patch = &texture->patches[0];
patch->originx = patch->originy = 0;
patch->wad = (UINT16)w;
patch->lump = texstart + j;
patch->originx = patch->originy = 0;
patch->wad = (UINT16)w;
patch->lump = texstart + j;
Z_Unlock(patchlump);
Z_Unlock(patchlump);
k = 1;
while (k << 1 <= texture->width)
k <<= 1;
k = 1;
while (k << 1 <= texture->width)
k <<= 1;
texturewidthmask[i] = k - 1;
textureheight[i] = texture->height << FRACBITS;
}
texturewidthmask[i] = k - 1;
textureheight[i] = texture->height << FRACBITS;
}
}
}