COMPAT.H 7.8 KB

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