mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-23 12:22:42 +00:00
Added support for loading an alternate sort of sort of tga
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@730 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
d28993bd60
commit
444d40db67
1 changed files with 18 additions and 2 deletions
|
@ -182,7 +182,7 @@ qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey
|
|||
{
|
||||
return ReadGreyTargaFile(data, length, &tgaheader, asgrey);
|
||||
}
|
||||
else if (tgaheader.version == 10)
|
||||
else if (tgaheader.version == 10 || tgaheader.version == 11)
|
||||
{
|
||||
#undef getc
|
||||
#define getc(x) *data++
|
||||
|
@ -191,7 +191,8 @@ qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey
|
|||
|
||||
qbyte blue, red, green, alphabyte;
|
||||
|
||||
if (tgaheader.bpp == 8) return NULL;
|
||||
if (tgaheader.version == 10 && tgaheader.bpp == 8) return NULL;
|
||||
if (tgaheader.version == 11 && tgaheader.bpp != 8) return NULL;
|
||||
|
||||
for(row=rows-1; row>=0; row--)
|
||||
{
|
||||
|
@ -207,6 +208,11 @@ qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey
|
|||
{ // run-length packet
|
||||
switch (tgaheader.bpp)
|
||||
{
|
||||
case 8: //we made sure this was version 11
|
||||
blue = green = red = *data++;
|
||||
alphabyte = 255;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
inrow = data;
|
||||
data+=2;
|
||||
|
@ -287,6 +293,13 @@ qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey
|
|||
{
|
||||
switch (tgaheader.bpp)
|
||||
{
|
||||
case 8:
|
||||
blue = green = red = *data++;
|
||||
*pixbuf++ = red;
|
||||
*pixbuf++ = green;
|
||||
*pixbuf++ = blue;
|
||||
*pixbuf++ = 255;
|
||||
break;
|
||||
case 16:
|
||||
inrow = data;
|
||||
data+=2;
|
||||
|
@ -347,6 +360,9 @@ qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey
|
|||
{
|
||||
switch (tgaheader.bpp)
|
||||
{
|
||||
case 8:
|
||||
*pixbuf++ = *data++;
|
||||
break;
|
||||
case 16:
|
||||
inrow = data;
|
||||
data+=2;
|
||||
|
|
Loading…
Reference in a new issue