COMPAT.H 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: /CounterStrike/COMPAT.H 1 3/03/97 10:24a Joe_bostic $ */
  19. /***********************************************************************************************
  20. *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : COMPAT.H *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : 03/02/95 *
  30. * *
  31. * Last Update : March 2, 1995 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef COMPAT_H
  37. #define COMPAT_H
  38. #define BuffType BufferClass
  39. //#define movmem(a,b,c) memmove(b,a,c)
  40. #define ShapeBufferSize _ShapeBufferSize
  41. /*=========================================================================*/
  42. /* Define some equates for the different graphic routines we will install */
  43. /* later. */
  44. /*=========================================================================*/
  45. #define HIDBUFF ((void *)(0xA0000))
  46. #define Size_Of_Region(a, b) ((a)*(b))
  47. /*=========================================================================*/
  48. /* Define some Graphic Routines which will only be fixed by these defines */
  49. /*=========================================================================*/
  50. #define Set_Font_Palette(a) Set_Font_Palette_Range(a, 0, 15)
  51. /*
  52. ** These are the Open_File, Read_File, and Seek_File constants.
  53. */
  54. #define READ 1 // Read access.
  55. #define WRITE 2 // Write access.
  56. #ifndef SEEK_SET
  57. #define SEEK_SET 0 // Seek from start of file.
  58. #define SEEK_CUR 1 // Seek relative from current location.
  59. #define SEEK_END 2 // Seek from end of file.
  60. #endif
  61. #define ERROR_WINDOW 1
  62. #define ErrorWindow 1
  63. //extern unsigned char *Palette;
  64. extern unsigned char MDisabled; // Is mouse disabled?
  65. extern WORD Hard_Error_Occured;
  66. /*
  67. ** This is the menu control structures.
  68. */
  69. typedef enum MenuIndexType {
  70. MENUX,
  71. MENUY,
  72. ITEMWIDTH,
  73. ITEMSHIGH,
  74. MSELECTED,
  75. NORMCOL,
  76. HILITE,
  77. MENUPADDING=0x1000
  78. } MenuIndexType;
  79. #ifdef NEVER
  80. #define BITSPERBYTE 8
  81. #define MAXSHORT 0x7FFF
  82. #define HIBITS 0x8000
  83. #define MAXLONG 0x7FFFFFFFL
  84. #define HIBITL 0x80000000
  85. #define MAXINT MAXLONG
  86. #define HIBITI HIBITL
  87. #define DMAXEXP 308
  88. #define FMAXEXP 38
  89. #define DMINEXP -307
  90. #define FMINEXP -37
  91. #define MAXDOUBLE 1.797693E+308
  92. #define MAXFLOAT 3.37E+38F
  93. #define MINDOUBLE 2.225074E-308
  94. #define MINFLOAT 8.43E-37F
  95. #define DSIGNIF 53
  96. #define FSIGNIF 24
  97. #define DMAXPOWTWO 0x3FF
  98. #define FMAXPOWTWO 0x7F
  99. #define DEXPLEN 11
  100. #define FEXPLEN 8
  101. #define EXPBASE 2
  102. #define IEEE 1
  103. #define LENBASE 1
  104. #define HIDDENBIT 1
  105. #define LN_MAXDOUBLE 7.0978E+2
  106. #define LN_MINDOUBLE -7.0840E+2
  107. #endif
  108. /* These defines handle the various names given to the same color. */
  109. #define DKGREEN GREEN
  110. #define DKBLUE BLUE
  111. #define GRAY GREY
  112. #define DKGREY GREY
  113. #define DKGRAY GREY
  114. #define LTGRAY LTGREY
  115. class IconsetClass;
  116. #ifndef WIN32
  117. typedef struct {
  118. short Width; // Width of icons (pixels).
  119. short Height; // Height of icons (pixels).
  120. short Count; // Number of (logical) icons in this set.
  121. short Allocated; // Was this iconset allocated?
  122. short MapWidth; // Width of map (in icons).
  123. short MapHeight; // Height of map (in icons).
  124. long Size; // Size of entire iconset memory block.
  125. long Icons; // Offset from buffer start to icon data.
  126. // unsigned char * Icons; // Offset from buffer start to icon data.
  127. long Palettes; // Offset from buffer start to palette data.
  128. long Remaps; // Offset from buffer start to remap index data.
  129. long TransFlag; // Offset for transparency flag table.
  130. long ColorMap; // Offset for color control value table.
  131. long Map; // Icon map offset (if present).
  132. // unsigned char * Map; // Icon map offset (if present).
  133. } IControl_Type;
  134. #endif
  135. inline int Get_IconSet_MapWidth(void const * data)
  136. {
  137. if (data) {
  138. return(((IControl_Type *)data)->MapWidth);
  139. }
  140. return(0);
  141. }
  142. inline int Get_IconSet_MapHeight(void const * data)
  143. {
  144. if (data) {
  145. return(((IControl_Type *)data)->MapHeight);
  146. }
  147. return(0);
  148. }
  149. inline unsigned char const * Get_IconSet_ControlMap(void const * data)
  150. {
  151. if (data) {
  152. return((unsigned char const *)((char *)data + ((IControl_Type *)data)->ColorMap));
  153. }
  154. return(0);
  155. }
  156. class IconsetClass : protected IControl_Type
  157. {
  158. public:
  159. /*
  160. ** Query functions.
  161. */
  162. int Map_Width(void) const {return(MapWidth);};
  163. int Map_Height(void) const {return(MapHeight);};
  164. unsigned char * Control_Map(void) {return((unsigned char *)this + ColorMap);};
  165. unsigned char const * Control_Map(void) const {return((unsigned char const *)this + ColorMap);};
  166. int Icon_Count(void) const {return(Count);};
  167. int Pixel_Width(void) const {return(Width);};
  168. int Pixel_Height(void) const {return(Height);};
  169. int Total_Size(void) const {return(Size);};
  170. unsigned char const * Palette_Data(void) const {return((unsigned char const *)this + Palettes);};
  171. unsigned char * Palette_Data(void) {return((unsigned char *)this + Palettes);};
  172. unsigned char const * Icon_Data(void) const {return((unsigned char const *)this + Icons);};
  173. unsigned char * Icon_Data(void) {return((unsigned char *)this + Icons);};
  174. unsigned char const * Map_Data(void) const {return((unsigned char const *)this + Map);};
  175. unsigned char * Map_Data(void) {return((unsigned char *)this + Map);};
  176. unsigned char const * Remap_Data(void) const {return((unsigned char const *)this + Remaps);};
  177. unsigned char * Remap_Data(void) {return((unsigned char *)this + Remaps);};
  178. unsigned char const * Trans_Data(void) const {return((unsigned char const *)this + TransFlag);};
  179. unsigned char * Trans_Data(void) {return((unsigned char *)this + TransFlag);};
  180. /*
  181. ** Disallow these operations with an IconsetClass object.
  182. */
  183. private:
  184. IconsetClass & operator = (IconsetClass const &);
  185. IconsetClass(void);
  186. static void * operator new(size_t);
  187. };
  188. #endif