mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
More doomtype.h cleaning up:
* Move the misc types in the file to bottom, so that ATTRPACK at least is usable for RGBA_t * Include endian.h, so that UINT2RGBA can be defined correctly for big endian builds * Add more comments to make clear the main sections of the file
This commit is contained in:
parent
5c61c40551
commit
fd20bbb54e
1 changed files with 44 additions and 33 deletions
|
@ -98,6 +98,8 @@ typedef long ssize_t;
|
||||||
#define NOIPX
|
#define NOIPX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Strings and some misc platform specific stuff */
|
||||||
|
|
||||||
#if defined (_MSC_VER) || defined (__OS2__)
|
#if defined (_MSC_VER) || defined (__OS2__)
|
||||||
// Microsoft VisualC++
|
// Microsoft VisualC++
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -179,6 +181,8 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
// not the number of bytes in the buffer.
|
// not the number of bytes in the buffer.
|
||||||
#define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst)
|
#define STRBUFCPY(dst,src) strlcpy(dst, src, sizeof dst)
|
||||||
|
|
||||||
|
/* Boolean type definition */
|
||||||
|
|
||||||
// \note __BYTEBOOL__ used to be set above if "macintosh" was defined,
|
// \note __BYTEBOOL__ used to be set above if "macintosh" was defined,
|
||||||
// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now?
|
// if macintosh's version of boolean type isn't needed anymore, then isn't this macro pointless now?
|
||||||
#ifndef __BYTEBOOL__
|
#ifndef __BYTEBOOL__
|
||||||
|
@ -241,39 +245,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz);
|
||||||
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
|
#define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
union FColorRGBA
|
/* Compiler-specific attributes and other macros */
|
||||||
{
|
|
||||||
UINT32 rgba;
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
UINT8 red;
|
|
||||||
UINT8 green;
|
|
||||||
UINT8 blue;
|
|
||||||
UINT8 alpha;
|
|
||||||
} s;
|
|
||||||
} ATTRPACK;
|
|
||||||
typedef union FColorRGBA RGBA_t;
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
postimg_none,
|
|
||||||
postimg_water,
|
|
||||||
postimg_motion,
|
|
||||||
postimg_flip,
|
|
||||||
postimg_heat
|
|
||||||
} postimg_t;
|
|
||||||
|
|
||||||
typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num)
|
|
||||||
#define LUMPERROR UINT32_MAX
|
|
||||||
|
|
||||||
typedef UINT32 tic_t;
|
|
||||||
#define INFTICS UINT32_MAX
|
|
||||||
|
|
||||||
#ifdef _BIG_ENDIAN
|
|
||||||
#define UINT2RGBA(a) a
|
|
||||||
#else
|
|
||||||
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __GNUC__ // __attribute__ ((X))
|
#ifdef __GNUC__ // __attribute__ ((X))
|
||||||
#define FUNCNORETURN __attribute__ ((noreturn))
|
#define FUNCNORETURN __attribute__ ((noreturn))
|
||||||
|
@ -391,4 +363,43 @@ typedef UINT32 tic_t;
|
||||||
#ifndef FILESTAMP
|
#ifndef FILESTAMP
|
||||||
#define FILESTAMP
|
#define FILESTAMP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Miscellaneous types that don't fit anywhere else (Can this be changed?) */
|
||||||
|
|
||||||
|
union FColorRGBA
|
||||||
|
{
|
||||||
|
UINT32 rgba;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
UINT8 red;
|
||||||
|
UINT8 green;
|
||||||
|
UINT8 blue;
|
||||||
|
UINT8 alpha;
|
||||||
|
} s;
|
||||||
|
} ATTRPACK;
|
||||||
|
typedef union FColorRGBA RGBA_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
postimg_none,
|
||||||
|
postimg_water,
|
||||||
|
postimg_motion,
|
||||||
|
postimg_flip,
|
||||||
|
postimg_heat
|
||||||
|
} postimg_t;
|
||||||
|
|
||||||
|
typedef UINT32 lumpnum_t; // 16 : 16 unsigned long (wad num: lump num)
|
||||||
|
#define LUMPERROR UINT32_MAX
|
||||||
|
|
||||||
|
typedef UINT32 tic_t;
|
||||||
|
#define INFTICS UINT32_MAX
|
||||||
|
|
||||||
|
#include "endian.h" // This is needed to make sure the below macro acts correctly in big endian builds
|
||||||
|
|
||||||
|
#ifdef SRB2_BIG_ENDIAN
|
||||||
|
#define UINT2RGBA(a) a
|
||||||
|
#else
|
||||||
|
#define UINT2RGBA(a) (UINT32)((a&0xff)<<24)|((a&0xff00)<<8)|((a&0xff0000)>>8)|(((UINT32)a&0xff000000)>>24)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif //__DOOMTYPE__
|
#endif //__DOOMTYPE__
|
||||||
|
|
Loading…
Reference in a new issue