mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 04:01:31 +00:00
- Replaced the use of autoconf's WORDS_BIGENDIAN with __BIG_ENDIAN__, since
latter comes predefined by GCC. SVN r1779 (trunk)
This commit is contained in:
parent
75920f2ed0
commit
3f003e06db
15 changed files with 22 additions and 28 deletions
|
@ -1,4 +1,8 @@
|
|||
August 29, 2009 (Changes by Graf Zahl)
|
||||
August 31, 2009
|
||||
- Replaced the use of autoconf's WORDS_BIGENDIAN with __BIG_ENDIAN__, since
|
||||
latter comes predefined by GCC.
|
||||
|
||||
August 29, 2009 (Changes by Graf Zahl)
|
||||
- fixed: R_InitColormaps was broken since the resource file code rewrite.
|
||||
- fixed: WIF_STAFF2_KICKBACK did not work anymore because it depended on conditions
|
||||
that were changed some time ago.
|
||||
|
|
|
@ -60,7 +60,7 @@ union QWORD_UNION
|
|||
QWORD AsOne;
|
||||
struct
|
||||
{
|
||||
#ifdef WORDS_BIG_ENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
unsigned int Hi, Lo;
|
||||
#else
|
||||
unsigned int Lo, Hi;
|
||||
|
|
|
@ -347,7 +347,7 @@ enum
|
|||
|
||||
#define BLINKTHRESHOLD (4*32)
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
#ifndef __BIG_ENDIAN__
|
||||
#define MAKE_ID(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24))
|
||||
#else
|
||||
#define MAKE_ID(a,b,c,d) ((d)|((c)<<8)|((b)<<16)|((a)<<24))
|
||||
|
|
|
@ -159,7 +159,7 @@ struct PalEntry
|
|||
operator uint32 () const { return d; }
|
||||
PalEntry &operator= (uint32 other) { d = other; return *this; }
|
||||
PalEntry InverseColor() const { PalEntry nc; nc.a = a; nc.r = 255 - r; nc.g = 255 - g; nc.b = 255 - b; return nc; }
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
PalEntry (BYTE ir, BYTE ig, BYTE ib) : a(0), r(ir), g(ig), b(ib) {}
|
||||
PalEntry (BYTE ia, BYTE ir, BYTE ig, BYTE ib) : a(ia), r(ir), g(ig), b(ib) {}
|
||||
union
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
#define NEW_SPRITE ((BYTE)11) // A new sprite name follows
|
||||
#define OLD_SPRITE ((BYTE)12) // Reference to an old sprite name follows
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
static inline WORD SWAP_WORD(x) { return x; }
|
||||
static inline DWORD SWAP_DWORD(x) { return x; }
|
||||
static inline QWORD SWAP_QWORD(x) { return x; }
|
||||
|
|
|
@ -172,7 +172,7 @@ void FHealthBar::MakeTexture ()
|
|||
|
||||
void FHealthBar::FillBar (int min, int max, BYTE light, BYTE dark)
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
SDWORD fill = (light << 24) | (dark << 16) | (light << 8) | dark;
|
||||
#else
|
||||
SDWORD fill = light | (dark << 8) | (light << 16) | (dark << 24);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
// Endianess handling.
|
||||
// WAD files are stored little endian.
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
|
||||
// Swap 16bit, that is, MSB and LSB byte.
|
||||
// No masking with 0xFF should be necessary.
|
||||
|
@ -122,6 +122,6 @@ inline int BigLong (int x)
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // WORDS_BIGENDIAN
|
||||
#endif // __BIG_ENDIAN__
|
||||
|
||||
#endif // __M_SWAP_H__
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "md5.h"
|
||||
#include "templates.h"
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
void byteSwap(DWORD *buf, unsigned words)
|
||||
{
|
||||
BYTE *p = (BYTE *)buf;
|
||||
|
|
|
@ -231,7 +231,7 @@ FTexture *DDSTexture_TryCreate (FileReader &data, int lumpnum)
|
|||
data.Seek (4, SEEK_SET);
|
||||
data.Read (&surfdesc, sizeof(surfdesc));
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
// Every single element of the header is a DWORD
|
||||
for (unsigned int i = 0; i < sizeof(DDSURFACEDESC2) / 4; ++i)
|
||||
{
|
||||
|
|
|
@ -125,11 +125,9 @@ FTexture * PCXTexture_TryCreate(FileReader & file, int lumpnum)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
hdr.xmin = LittleShort(hdr.xmin);
|
||||
hdr.xmax = LittleShort(hdr.xmax);
|
||||
hdr.bytesPerScanLine = LittleShort(hdr.bytesPerScanLine);
|
||||
#endif
|
||||
|
||||
if (hdr.manufacturer != 10 || hdr.encoding != 1) return NULL;
|
||||
if (hdr.version != 0 && hdr.version != 2 && hdr.version != 3 && hdr.version != 4 && hdr.version != 5) return NULL;
|
||||
|
|
|
@ -114,10 +114,8 @@ FTexture *TGATexture_TryCreate(FileReader & file, int lumpnum)
|
|||
|
||||
file.Seek(0, SEEK_SET);
|
||||
file.Read(&hdr, sizeof(hdr));
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
hdr.width = LittleShort(hdr.width);
|
||||
hdr.height = LittleShort(hdr.height);
|
||||
#endif
|
||||
|
||||
// Not much that can be done here because TGA does not have a proper
|
||||
// header to be identified with.
|
||||
|
@ -130,10 +128,8 @@ FTexture *TGATexture_TryCreate(FileReader & file, int lumpnum)
|
|||
|
||||
file.Seek(0, SEEK_SET);
|
||||
file.Read(&hdr, sizeof(hdr));
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
hdr.width = LittleShort(hdr.width);
|
||||
hdr.height = LittleShort(hdr.height);
|
||||
#endif
|
||||
|
||||
return new FTGATexture(lumpnum, &hdr);
|
||||
}
|
||||
|
@ -303,12 +299,10 @@ void FTGATexture::MakeTexture ()
|
|||
lump.Read(&hdr, sizeof(hdr));
|
||||
lump.Seek(hdr.id_len, SEEK_CUR);
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
hdr.width = LittleShort(hdr.width);
|
||||
hdr.height = LittleShort(hdr.height);
|
||||
hdr.cm_first = LittleShort(hdr.cm_first);
|
||||
hdr.cm_length = LittleShort(hdr.cm_length);
|
||||
#endif
|
||||
|
||||
if (hdr.has_cm)
|
||||
{
|
||||
|
@ -507,12 +501,10 @@ int FTGATexture::CopyTrueColorPixels(FBitmap *bmp, int x, int y, int w, int h, i
|
|||
if (w < 0 || w > Width) w = Width;
|
||||
if (h < 0 || h > Height) h = Height;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
hdr.width = LittleShort(hdr.width);
|
||||
hdr.height = LittleShort(hdr.height);
|
||||
hdr.cm_first = LittleShort(hdr.cm_first);
|
||||
hdr.cm_length = LittleShort(hdr.cm_length);
|
||||
#endif
|
||||
|
||||
if (hdr.has_cm)
|
||||
{
|
||||
|
|
|
@ -587,7 +587,7 @@ static void ParseGen(SFFile *sf2, FileReader *f, DWORD chunkid, DWORD chunklen)
|
|||
{
|
||||
gen->Oper = read_uword(f);
|
||||
gen->uAmount = read_uword(f);
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
if (gen->Oper == GEN_keyRange || gen->Oper == GEN_velRange)
|
||||
{
|
||||
// Reswap range generators
|
||||
|
|
|
@ -360,7 +360,7 @@ static void Scale8 (BYTE *src, int srcpitch,
|
|||
{
|
||||
DWORD work;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
work = src[xf >> FRACBITS] << 24; xf += xstep;
|
||||
work |= src[xf >> FRACBITS] << 16; xf += xstep;
|
||||
work |= src[xf >> FRACBITS] << 8; xf += xstep;
|
||||
|
@ -416,7 +416,7 @@ static void Convert8 (BYTE *src, int srcpitch,
|
|||
for (savedx = x, x >>= 2; x != 0; x--)
|
||||
{
|
||||
*(DWORD *)dest =
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
(GPfxPal.Pal8[src[0]] << 24) |
|
||||
(GPfxPal.Pal8[src[1]] << 16) |
|
||||
(GPfxPal.Pal8[src[2]] << 8) |
|
||||
|
@ -454,7 +454,7 @@ static void Convert8 (BYTE *src, int srcpitch,
|
|||
{
|
||||
DWORD work;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
work = GPfxPal.Pal8[src[xf >> FRACBITS]] << 24; xf += xstep;
|
||||
work |= GPfxPal.Pal8[src[xf >> FRACBITS]] << 16; xf += xstep;
|
||||
work |= GPfxPal.Pal8[src[xf >> FRACBITS]] << 8; xf += xstep;
|
||||
|
@ -510,7 +510,7 @@ static void Convert16 (BYTE *src, int srcpitch,
|
|||
for (savedx = x, x >>= 1; x != 0; x--)
|
||||
{
|
||||
*(DWORD *)dest =
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
(GPfxPal.Pal16[src[0]] << 16) |
|
||||
(GPfxPal.Pal16[src[1]]);
|
||||
#else
|
||||
|
@ -544,7 +544,7 @@ static void Convert16 (BYTE *src, int srcpitch,
|
|||
{
|
||||
DWORD work;
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
#ifdef __BIG_ENDIAN__
|
||||
work = GPfxPal.Pal16[src[xf >> FRACBITS]] << 16; xf += xstep;
|
||||
work |= GPfxPal.Pal16[src[xf >> FRACBITS]]; xf += xstep;
|
||||
#else
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
// Maximum number of files that might appear in a crash report.
|
||||
#define MAX_FILES 5
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
#ifndef __BIG_ENDIAN__
|
||||
#define MAKE_ID(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24))
|
||||
#else
|
||||
#define MAKE_ID(a,b,c,d) ((d)|((c)<<8)|((b)<<16)|((a)<<24))
|
||||
|
|
|
@ -58,7 +58,7 @@
|
|||
#define __cdecl
|
||||
#endif
|
||||
|
||||
#ifndef WORDS_BIGENDIAN
|
||||
#ifndef __BIG_ENDIAN__
|
||||
#define MAKE_ID(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24))
|
||||
#define LittleShort(x) (x)
|
||||
#define LittleLong(x) (x)
|
||||
|
|
Loading…
Reference in a new issue