VERSION.H 9.5 KB

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