mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 22:01:50 +00:00
fix the bmp loader
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4099 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
e465bf7030
commit
7135c3ee19
1 changed files with 21 additions and 21 deletions
|
@ -1776,7 +1776,7 @@ qbyte *ReadPCXPalette(qbyte *buf, int len, qbyte *out)
|
||||||
|
|
||||||
typedef struct bmpheader_s
|
typedef struct bmpheader_s
|
||||||
{
|
{
|
||||||
unsigned short Type;
|
/* unsigned short Type;*/
|
||||||
unsigned long Size;
|
unsigned long Size;
|
||||||
unsigned short Reserved1;
|
unsigned short Reserved1;
|
||||||
unsigned short Reserved2;
|
unsigned short Reserved2;
|
||||||
|
@ -1797,28 +1797,28 @@ typedef struct bmpheader_s
|
||||||
qbyte *ReadBMPFile(qbyte *buf, int length, int *width, int *height)
|
qbyte *ReadBMPFile(qbyte *buf, int length, int *width, int *height)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
bmpheader_t h, *in;
|
bmpheader_t h;
|
||||||
qbyte *data;
|
qbyte *data;
|
||||||
|
|
||||||
in = (bmpheader_t *)buf;
|
if (buf[0] != 'B' || buf[1] != 'M')
|
||||||
h.Type = LittleShort(in->Type);
|
|
||||||
if (h.Type != 'B' + ('M'<<8))
|
|
||||||
return NULL;
|
return NULL;
|
||||||
h.Size = LittleLong(in->Size);
|
|
||||||
h.Reserved1 = LittleShort(in->Reserved1);
|
memcpy(&h, (bmpheader_t *)(buf+2), sizeof(h));
|
||||||
h.Reserved2 = LittleShort(in->Reserved2);
|
h.Size = LittleLong(h.Size);
|
||||||
h.OffsetofBMPBits = LittleLong(in->OffsetofBMPBits);
|
h.Reserved1 = LittleShort(h.Reserved1);
|
||||||
h.SizeofBITMAPINFOHEADER = LittleLong(in->SizeofBITMAPINFOHEADER);
|
h.Reserved2 = LittleShort(h.Reserved2);
|
||||||
h.Width = LittleLong(in->Width);
|
h.OffsetofBMPBits = LittleLong(h.OffsetofBMPBits);
|
||||||
h.Height = LittleLong(in->Height);
|
h.SizeofBITMAPINFOHEADER = LittleLong(h.SizeofBITMAPINFOHEADER);
|
||||||
h.Planes = LittleShort(in->Planes);
|
h.Width = LittleLong(h.Width);
|
||||||
h.BitCount = LittleShort(in->BitCount);
|
h.Height = LittleLong(h.Height);
|
||||||
h.Compression = LittleLong(in->Compression);
|
h.Planes = LittleShort(h.Planes);
|
||||||
h.ImageSize = LittleLong(in->ImageSize);
|
h.BitCount = LittleShort(h.BitCount);
|
||||||
h.TargetDeviceXRes = LittleLong(in->TargetDeviceXRes);
|
h.Compression = LittleLong(h.Compression);
|
||||||
h.TargetDeviceYRes = LittleLong(in->TargetDeviceYRes);
|
h.ImageSize = LittleLong(h.ImageSize);
|
||||||
h.NumofColorIndices = LittleLong(in->NumofColorIndices);
|
h.TargetDeviceXRes = LittleLong(h.TargetDeviceXRes);
|
||||||
h.NumofImportantColorIndices = LittleLong(in->NumofImportantColorIndices);
|
h.TargetDeviceYRes = LittleLong(h.TargetDeviceYRes);
|
||||||
|
h.NumofColorIndices = LittleLong(h.NumofColorIndices);
|
||||||
|
h.NumofImportantColorIndices = LittleLong(h.NumofImportantColorIndices);
|
||||||
|
|
||||||
if (h.Compression) //probably RLE?
|
if (h.Compression) //probably RLE?
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2393,7 +2393,7 @@ texid_t R_LoadHiResTexture(char *name, char *subpath, unsigned int flags)
|
||||||
int j;
|
int j;
|
||||||
char *suf[] =
|
char *suf[] =
|
||||||
{
|
{
|
||||||
// "rt", "lf", "ft", "bk", "up", "dn",
|
"rt", "lf", "ft", "bk", "up", "dn",
|
||||||
"px", "nx", "py", "ny", "pz", "nz",
|
"px", "nx", "py", "ny", "pz", "nz",
|
||||||
"posx", "negx", "posy", "negy", "posz", "negz"
|
"posx", "negx", "posy", "negy", "posz", "negz"
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue