mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 12:10:48 +00:00
skip over any present colormap for non-colormap types
This commit is contained in:
parent
3e349ee52c
commit
7e0ce3d3df
1 changed files with 17 additions and 0 deletions
|
@ -231,6 +231,17 @@ setup_pixrow_span (TargaHeader *targa, tex_t *tex, byte **_pixrow, int *_span)
|
|||
*_span = span;
|
||||
}
|
||||
|
||||
static byte *
|
||||
skip_colormap (TargaHeader *targa, byte *data)
|
||||
{
|
||||
int bpe;
|
||||
if (!targa->colormap_type)
|
||||
return data;
|
||||
Sys_DPrintf ("LoadTGA: skipping colormap\n");
|
||||
bpe = (targa->pixel_size +7) / 8;
|
||||
return data + bpe * targa->colormap_length;
|
||||
}
|
||||
|
||||
static cmap_t *
|
||||
parse_colormap (TargaHeader *targa, byte **dataByte)
|
||||
{
|
||||
|
@ -502,6 +513,8 @@ decode_truecolor_32_rle (TargaHeader *targa, tex_t *tex, byte *dataByte)
|
|||
static void
|
||||
decode_truecolor (TargaHeader *targa, tex_t *tex, byte *dataByte)
|
||||
{
|
||||
dataByte = skip_colormap (targa, dataByte);
|
||||
|
||||
switch (targa->pixel_size) {
|
||||
case 24:
|
||||
tex->format = tex_rgb;
|
||||
|
@ -519,6 +532,8 @@ decode_truecolor (TargaHeader *targa, tex_t *tex, byte *dataByte)
|
|||
static void
|
||||
decode_truecolor_rle (TargaHeader *targa, tex_t *tex, byte *dataByte)
|
||||
{
|
||||
dataByte = skip_colormap (targa, dataByte);
|
||||
|
||||
switch (targa->pixel_size) {
|
||||
case 24:
|
||||
tex->format = tex_rgb;
|
||||
|
@ -539,6 +554,8 @@ decode_greyscale (TargaHeader *targa, tex_t *tex, byte *dataByte)
|
|||
byte *pixcol, *pixrow;
|
||||
int column, columns, rows, span;
|
||||
|
||||
dataByte = skip_colormap (targa, dataByte);
|
||||
|
||||
if (targa->pixel_size != 8)
|
||||
Sys_Error ("LoadTGA: unsupported truecolor pixel size");
|
||||
tex->format = tex_la;
|
||||
|
|
Loading…
Reference in a new issue