mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-28 04:00:41 +00:00
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:
parent
45922f80d1
commit
bc254d9cf7
1 changed files with 19 additions and 30 deletions
49
src/r_data.c
49
src/r_data.c
|
@ -484,42 +484,31 @@ 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,
|
//CONS_Printf("\n\"%s\" is a single patch, dimensions %d x %d",W_CheckNameForNumPwad((UINT16)w,texstart+j),patchlump->width, patchlump->height);
|
||||||
// and if it is, load it using dehacked instead.
|
texture = textures[i] = Z_Calloc(sizeof(texture_t) + sizeof(texpatch_t), PU_STATIC, NULL);
|
||||||
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);
|
|
||||||
|
|
||||||
// Set texture properties.
|
// Set texture properties.
|
||||||
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
|
M_Memcpy(texture->name, W_CheckNameForNumPwad((UINT16)w, texstart + j), sizeof(texture->name));
|
||||||
texture->width = SHORT(patchlump->width);
|
texture->width = SHORT(patchlump->width);
|
||||||
texture->height = SHORT(patchlump->height);
|
texture->height = SHORT(patchlump->height);
|
||||||
texture->patchcount = 1;
|
texture->patchcount = 1;
|
||||||
texture->holes = false;
|
texture->holes = false;
|
||||||
|
|
||||||
// Allocate information for the texture's patches.
|
// Allocate information for the texture's patches.
|
||||||
patch = &texture->patches[0];
|
patch = &texture->patches[0];
|
||||||
|
|
||||||
patch->originx = patch->originy = 0;
|
patch->originx = patch->originy = 0;
|
||||||
patch->wad = (UINT16)w;
|
patch->wad = (UINT16)w;
|
||||||
patch->lump = texstart + j;
|
patch->lump = texstart + j;
|
||||||
|
|
||||||
Z_Unlock(patchlump);
|
Z_Unlock(patchlump);
|
||||||
|
|
||||||
k = 1;
|
k = 1;
|
||||||
while (k << 1 <= texture->width)
|
while (k << 1 <= texture->width)
|
||||||
k <<= 1;
|
k <<= 1;
|
||||||
|
|
||||||
texturewidthmask[i] = k - 1;
|
texturewidthmask[i] = k - 1;
|
||||||
textureheight[i] = texture->height << FRACBITS;
|
textureheight[i] = texture->height << FRACBITS;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue