Removed size limit of 512x256 for .wal textures.

This commit is contained in:
Knightmare66 2020-02-09 16:27:23 -05:00
parent 2efcb5a672
commit f1b6052f15
2 changed files with 41 additions and 46 deletions

View file

@ -18,6 +18,8 @@ Changes as of v0.20 update 8:
- Screenshots now go up to 9999.
- Removed size limit of 512x256 for .wal textures. This fixes the "GL_Upload8: too large" error with 512x512 or larger .wal textures.
- Added cvar r_fog_skyratio, for proportional sky fog distance. Default is 10.
- Added basegame3 cvar to load data from up to 3 other other mods. Works in conjunction with basegame and basegame2,

View file

@ -1910,62 +1910,55 @@ Returns has_alpha
*/
qboolean GL_Upload8 (byte *data, int width, int height, imagetype_t type)
{
unsigned trans[512*256];
// unsigned trans[512*256];
unsigned *trans = NULL; // Knightmare- changed to dynamic allocation
int i, s;
int p;
qboolean has_alpha; // Knightmare added
s = width*height;
if (s > sizeof(trans)/4)
VID_Error (ERR_DROP, "GL_Upload8: too large");
// if (s > sizeof(trans)/4)
// VID_Error (ERR_DROP, "GL_Upload8: too large");
/*if ( qglColorTableEXT &&
gl_ext_palettedtexture->value &&
(type == it_sky) )
trans = (unsigned *)malloc(s*4); // Knightmare- changed to dynamic allocation
for (i=0 ; i<s ; i++)
{
qglTexImage2D( GL_TEXTURE_2D,
0,
GL_COLOR_INDEX8_EXT,
width,
height,
0,
GL_COLOR_INDEX,
GL_UNSIGNED_BYTE,
data );
p = data[i];
trans[i] = d_8to24table[p];
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
qglTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
else*/
{
for (i=0 ; i<s ; i++)
{
p = data[i];
trans[i] = d_8to24table[p];
if (p == 255)
{ // transparent, so scan around for another color
// to avoid alpha fringes
// FIXME: do a full flood fill so mips work...
if (i > width && data[i-width] != 255)
p = data[i-width];
else if (i < s-width && data[i+width] != 255)
p = data[i+width];
else if (i > 0 && data[i-1] != 255)
p = data[i-1];
else if (i < s-1 && data[i+1] != 255)
p = data[i+1];
else
p = 0;
// copy rgb components
((byte *)&trans[i])[0] = ((byte *)&d_8to24table[p])[0];
((byte *)&trans[i])[1] = ((byte *)&d_8to24table[p])[1];
((byte *)&trans[i])[2] = ((byte *)&d_8to24table[p])[2];
}
if (p == 255)
{ // transparent, so scan around for another color
// to avoid alpha fringes
// FIXME: do a full flood fill so mips work...
if (i > width && data[i-width] != 255)
p = data[i-width];
else if (i < s-width && data[i+width] != 255)
p = data[i+width];
else if (i > 0 && data[i-1] != 255)
p = data[i-1];
else if (i < s-1 && data[i+1] != 255)
p = data[i+1];
else
p = 0;
// copy rgb components
((byte *)&trans[i])[0] = ((byte *)&d_8to24table[p])[0];
((byte *)&trans[i])[1] = ((byte *)&d_8to24table[p])[1];
((byte *)&trans[i])[2] = ((byte *)&d_8to24table[p])[2];
}
return GL_Upload32 (trans, width, height, type);
}
// return GL_Upload32 (trans, width, height, type);
// Knightmare- changed to dynamic allocation
has_alpha = GL_Upload32 (trans, width, height, type);
free (trans);
trans = NULL;
return has_alpha;
// end Knightmare
}