VERSION.H 9.6 KB

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