CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

COMPAT.H (7966B)


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