CnC_Remastered_Collection

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

VERSION.H (9874B)


      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/VERSION.H 2     3/10/97 6:22p Steve_tall $ */
     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  *                 Project Name : Command & Conquer                        *
     21  *                                                                         *
     22  *                    File Name : VERSION.H                                *
     23  *                                                                         *
     24  *                   Programmer : Bill R. Randolph                         *
     25  *                                                                         *
     26  *                   Start Date : 10/26/95                                 *
     27  *                                                                         *
     28  *                  Last Update : October 26, 1995 [BRR]                   *
     29  *                                                                         *
     30  * This class maintains version information, and communications protocol	*
     31  * information.																				*
     32  *                                                                         *
     33  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     34 #ifndef VERSION_H
     35 #define VERSION_H
     36 
     37 #define	VERSION_RED_ALERT_104		0x00010000	//Shipped US version number
     38 #define	VERSION_RED_ALERT_107		0x00011000	//Shipped Counterstrike number
     39 #define	VERSION_RED_ALERT_106		0x00010500	//Patch without CS installed
     40 #define	VERSION_RED_ALERT_108		0x00011500	//Patch with CS installed
     41 #define	VERSION_AFTERMATH_CS			0x00011FFF	//Aftermath with CS installed
     42 #define	VERSION_AFTERMATH				0x00012000	//Aftermath
     43 
     44 //	Aftermath has, in a sense, used version 2.00. (Because of the text on title screen.) Call ourselves version 3.
     45 #define VERSION_RA_300				0x00030000	//	RA, CS, AM executables unified into one. All are now the same version. -ajw
     46 //	It seems that extra information, that didn't belong there, was being stuffed into version number. Namely, whether or not
     47 //	Counterstrike is installed. I'm going to change things back to the way they should be, as I see it. Version will describe
     48 //	the version of the executable only. When it comes to communicating whether or not a player has expansions present, separate
     49 //	data will be transmitted.
     50 
     51 //	However, having said that, a caveat. I'm going to have to use the same communication method that was used previously, because
     52 //	I need to have prior versions of the game recognize that they can't play against this version. What I'll do is encode
     53 //	"does player have aftermath" (which is actually the only fact that matters, in multiplayer) in the communicated version
     54 //	number, as a high bit set/unset. This version of the game will receive this communicated value and pull out the Aftermath
     55 //	bit. Older version will reject us as a possible opponent, because, whether or not AM is installed, our version number will
     56 //	be too high for them.
     57 
     58 //	These horrible things are no longer used. ajw
     59 #define	CS_MAJOR_VERSION_MODIFIER	0x0000
     60 #define	CS_MINOR_VERSION_MODIFIER	0x1000
     61 
     62 //---------------------------------------------------------------------------
     63 //
     64 //---------------------------------------------------------------------------
     65 typedef enum CommProtocolEnum {
     66 	COMM_PROTOCOL_SINGLE_NO_COMP = 0,	// single frame with no compression
     67 	COMM_PROTOCOL_SINGLE_E_COMP,			// single frame with event compression
     68 	COMM_PROTOCOL_MULTI_E_COMP,			// multiple frame with event compression
     69 	COMM_PROTOCOL_COUNT,
     70 	DEFAULT_COMM_PROTOCOL = COMM_PROTOCOL_MULTI_E_COMP
     71 } CommProtocolType;
     72 
     73 typedef struct {
     74 	unsigned long Version;
     75 	CommProtocolType Protocol;
     76 } VersionProtocolType;
     77 
     78 class VersionClass {
     79 	public:
     80 		//.....................................................................
     81 		// Constructor/Destructor
     82 		//.....................................................................
     83 		VersionClass(void);
     84 		virtual ~VersionClass() {};
     85 
     86 		//.....................................................................
     87 		// These routines return the current version number.  The long version
     88 		// number contains the major version in the high word, and the minor
     89 		// version in the low word.  They should be interpreted in hex.
     90 		//.....................................................................
     91 		unsigned long Version_Number(void);
     92 		unsigned short Major_Version(void);
     93 		unsigned short Minor_Version(void);
     94 
     95 		//.....................................................................
     96 		// Retrieves a pointer to the version # as a text string (#.#), with
     97 		// the trailing 0's trimmed off.
     98 		//.....................................................................
     99 		char *Version_Name(void);
    100 
    101 		//.....................................................................
    102 		// Retrieves a pointer to the current version text.
    103 		//.....................................................................
    104 		char *Version_Text() {return (VersionText);}
    105 
    106 		//.....................................................................
    107 		// Returns the default comm protocol for a given version number.
    108 		//.....................................................................
    109 		CommProtocolType Version_Protocol(unsigned long version);
    110 
    111 		//.....................................................................
    112 		// These routines support "version clipping".
    113 		//.....................................................................
    114 		void Init_Clipping(void);
    115 		unsigned long Clip_Version(unsigned long minver, unsigned long maxver);
    116 		unsigned long Get_Clipped_Version(void) {return (MaxClipVer);}
    117 
    118 		//.....................................................................
    119 		// These routines return the theoretical lowest & highest version #'s
    120 		// that this program will connect to; this does not take any previous
    121 		// version clipping into account.
    122 		//.....................................................................
    123 		unsigned long Min_Version(void);
    124 		unsigned long Max_Version(void);
    125 
    126 	private:
    127 		//.....................................................................
    128 		// Fills in a 'VersionText' with a descriptive version name.
    129 		//.....................................................................
    130 		void Read_Text_String(void);
    131 
    132 		//.....................................................................
    133 		// These values define the major & minor version #'s for the current
    134 		// version.  Change these values to change the game's version #!
    135 		//.....................................................................
    136 		enum VersionEnum {
    137 #ifdef FIXIT_VERSION_3
    138 			MAJOR_VERSION = 0x0003,
    139 			MINOR_VERSION = 0x0000
    140 #else
    141 			MAJOR_VERSION = 0x0001,
    142 			MINOR_VERSION = 0x2000
    143 #endif
    144 		};
    145 
    146 		//.....................................................................
    147 		// These values control which other versions this program will connect
    148 		// to.  Keep them current!
    149 		// If CHEAT is defined, the program will only connect to itself; these
    150 		// values aren't used.
    151 		//.....................................................................
    152 		enum VersionRangeEnum {
    153 #ifdef FIXIT_VERSION_3
    154 			//	ajw - We can only play against same version.
    155 			MIN_VERSION = VERSION_RA_300,
    156 			MAX_VERSION = VERSION_RA_300
    157 #else
    158 			MIN_VERSION = VERSION_RED_ALERT_104, //0x00010000,	// Version: 1.0
    159 			MAX_VERSION = VERSION_AFTERMATH		 //0x00012000	// Version: 1.2
    160 #endif
    161 		};
    162 
    163 		//.....................................................................
    164 		// This is the program's version number, stored internally.
    165 		//.....................................................................
    166 		unsigned long Version;
    167 		unsigned short MajorVer;
    168 		unsigned short MinorVer;
    169 
    170 		//.....................................................................
    171 		// This array is used for formatting the version # as a string
    172 		//.....................................................................
    173 		char VersionName[30];
    174 
    175 		//.....................................................................
    176 		// This array contains special version labels (such as "Beta"), stored
    177 		// in the file VERSION.TXT.  If the file isn't present, no label is
    178 		// shown.
    179 		//.....................................................................
    180 		char VersionText[16];
    181 
    182 		//.....................................................................
    183 		// Values used for "Version Clipping"
    184 		//.....................................................................
    185 		unsigned long MinClipVer;
    186 		unsigned long MaxClipVer;
    187 
    188 		//.....................................................................
    189 		// Bitfield Flags
    190 		// IsInitialized: is set if the VERSION.TXT file has been read
    191 		//.....................................................................
    192 		unsigned VersionInit :		1;
    193 		unsigned MajorInit :		1;
    194 		unsigned MinorInit :		1;
    195 		unsigned TextInit :			1;
    196 };
    197 #endif
    198 /************************** end of version.h *******************************/
    199