home *** CD-ROM | disk | FTP | other *** search
/ Launch & Play / spustahrej2.iso / Egoboo / code / egobootypedef.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-12-03  |  2.6 KB  |  96 lines

  1. #ifndef _EGOBOOTYPEDEF_H_
  2. #define _EGOBOOTYPEDEF_H_
  3.  
  4. #pragma warning(disable : 4305)                     // Turn off silly warnings
  5. #pragma warning(disable : 4244)                     //
  6.  
  7. /* Make sure that _MACOS is defined in MetroWerks compilers */
  8. #if defined( __MWERKS__ ) && defined( macintosh )
  9. #define    _MACOS
  10. #define _BIG_ENDIAN
  11. // use SDL type 
  12. #include <SDL.h>
  13. #include <Endian.h>
  14.  
  15. typedef Uint32            BOOL;
  16. typedef Sint32            LONG;
  17. typedef Uint32            DWORD;
  18.  
  19. typedef struct lin_RECT { LONG left; LONG right; LONG top; LONG bottom; } RECT;
  20.  
  21. #define LE32bitToHost( pData, pNumByte ) pData
  22. #define BE32bitToHost( pData, pNumByte ) pData
  23. #define LE16bitToHost( pData, pNumByte ) pData
  24. #define BE16bitToHost( pData, pNumByte ) pData
  25. #define EndianChange32bit( pData, pNumByte ) pData
  26. #define EndianChange16bit( pData, pNumByte ) pData
  27.  
  28. float LoadFloatByteswapped( float *ptr );
  29. inline float LoadFloatByteswapped( float *ptr )
  30. {
  31.     union {
  32.         float f;
  33.         long l;
  34.     } data;
  35.  
  36.     /*Load byteswapped and store to the stack*/
  37.     data.l = __lwbrx( ptr, 0 ); 
  38.  
  39.     /*Return the result*/
  40.     return data.f;
  41. }
  42.  
  43. #endif
  44.  
  45. // Windows typedef
  46. #ifdef _WIN32  // (I.E. Visual C)
  47. #define WIN32_LEAN_AND_MEAN
  48. #pragma warning(disable : 4554)
  49. #pragma warning(disable : 4761)
  50.  
  51. // VisualC does not support the non-standard inline in C (they do it their way)
  52. #define inline __inline
  53.  
  54. #include <windows.h>
  55. #include <SDL.h>
  56. #define _LITTLE_ENDIAN
  57. // use SDL type 
  58. #define LE32bitToHost( pData, pNumByte ) pData
  59. #define BE32bitToHost( pData, pNumByte ) pData
  60. #define LE16bitToHost( pData, pNumByte ) pData
  61. #define BE16bitToHost( pData, pNumByte ) _swab( (char *)(pData ), (char *)(pData ), (pNumByte) )
  62. #define EndianChange32bit( pData, pNumByte ) pData
  63. #define EndianChange16bit( pData, pNumByte ) _swab( (char *)(pData ), (char *)(pData ), (pNumByte) )
  64. #endif
  65.  
  66. // LINUX typedef
  67. #ifdef _LINUX
  68. #include "SDL.h"
  69. // use SDL type 
  70. typedef Uint32            BOOL;
  71. typedef Sint32            LONG;
  72. typedef Uint32            DWORD;
  73. typedef struct lin_RECT { LONG left; LONG right; LONG top; LONG bottom; } RECT;
  74. #define _LITTLE_ENDIAN
  75. #define LE32bitToHost( pData, pNumByte ) pData
  76. #define BE32bitToHost( pData, pNumByte ) pData
  77. #define LE16bitToHost( pData, pNumByte ) pData
  78. #define BE16bitToHost( pData, pNumByte ) pData
  79. #define EndianChange32bit( pData, pNumByte ) pData
  80. #define EndianChange16bit( pData, pNumByte ) pData
  81. #endif
  82.  
  83.  
  84. #ifndef FALSE
  85. #define FALSE 0
  86. #endif
  87. #ifndef TRUE
  88. #define TRUE (!FALSE)    // nv20001128 -- standard definition. This may save us grief later on
  89. #endif
  90.  
  91.  
  92.  
  93.  
  94. #endif // #ifndef _EGOBOOTYPEDEF_H_
  95.  
  96.