mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
pcx: show developer warning for uncommon pcx files
https://github.com/yquake2/yquake2/pull/1130#issuecomment-2259254531
This commit is contained in:
parent
9e303a8044
commit
f6e8aeab38
2 changed files with 18 additions and 2 deletions
|
@ -141,7 +141,8 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
|
|||
}
|
||||
|
||||
full_size = (pcx_height + 1) * (pcx_width + 1);
|
||||
if (pcx->color_planes == 3 && pcx->bits_per_pixel == 8)
|
||||
if ((pcx->color_planes == 3 || pcx->color_planes == 4)
|
||||
&& pcx->bits_per_pixel == 8)
|
||||
{
|
||||
full_size *= 4;
|
||||
*bitsPerPixel = 32;
|
||||
|
@ -351,6 +352,13 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
|
|||
*pic = NULL;
|
||||
}
|
||||
|
||||
if (pcx->color_planes != 1 || pcx->bits_per_pixel != 8)
|
||||
{
|
||||
Com_DPrintf("%s: %s has uncommon flags, "
|
||||
"could be unsupported by other engines\n",
|
||||
__func__, name);
|
||||
}
|
||||
|
||||
if (data - (byte *)pcx > len)
|
||||
{
|
||||
Com_DPrintf("%s: %s file was malformed\n", __func__, name);
|
||||
|
|
|
@ -216,7 +216,8 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
|
|||
}
|
||||
|
||||
full_size = (pcx_height + 1) * (pcx_width + 1);
|
||||
if (pcx->color_planes == 3 && pcx->bits_per_pixel == 8)
|
||||
if ((pcx->color_planes == 3 || pcx->color_planes == 4) &&
|
||||
pcx->bits_per_pixel == 8)
|
||||
{
|
||||
full_size *= 4;
|
||||
*bitsPerPixel = 32;
|
||||
|
@ -426,6 +427,13 @@ PCX_Decode(const char *name, const byte *raw, int len, byte **pic, byte **palett
|
|||
*pic = NULL;
|
||||
}
|
||||
|
||||
if (pcx->color_planes != 1 || pcx->bits_per_pixel != 8)
|
||||
{
|
||||
R_Printf(PRINT_DEVELOPER, "%s: %s has uncommon flags, "
|
||||
"could be unsupported by other engines\n",
|
||||
__func__, name);
|
||||
}
|
||||
|
||||
if (data - (byte *)pcx > len)
|
||||
{
|
||||
R_Printf(PRINT_DEVELOPER, "%s: %s file was malformed\n",
|
||||
|
|
Loading…
Reference in a new issue