GLOBALS.CPP 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  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/GLOBALS.CPP 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. * *
  23. * Project Name : Command & Conquer *
  24. * *
  25. * File Name : GLOBALS.CPP *
  26. * *
  27. * Programmer : Joe L. Bostic *
  28. * *
  29. * Start Date : September 10, 1993 *
  30. * *
  31. * Last Update : September 10, 1993 [JLB] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  35. #include "function.h"
  36. bool IsVQ640 = false;
  37. unsigned long GameVersion = 0;
  38. bool Debug_MotionCapture = false;
  39. bool Debug_Rotate = false; // Rotation algorithm control.
  40. bool Debug_Quiet = false;
  41. bool Debug_Cheat = false;
  42. bool Debug_Remap = false;
  43. bool Debug_Icon = false;
  44. bool Debug_Flag = false;
  45. bool Debug_Lose = false;
  46. bool Debug_Win = false;
  47. bool Debug_Map = false; // true = map editor mode
  48. bool Debug_Passable = false; // true = show passable/impassable terrain
  49. bool Debug_Unshroud = false; // true = hide the shroud
  50. bool Debug_Threat = false;
  51. bool Debug_Find_Path = false;
  52. bool Debug_Check_Map = false; // true = validate the map each frame
  53. bool Debug_Playtest = false;
  54. bool Debug_Heap_Dump = false; // true = print the Heap Dump
  55. bool Debug_Smart_Print = false; // true = print everything that calls Smart_Printf
  56. bool Debug_Trap_Check_Heap = false; // true = check the Heap
  57. bool Debug_Modem_Dump = false; // true = print the Modem Stuff
  58. bool Debug_Print_Events = false; // true = print event & packet processing
  59. TFixedIHeapClass<AircraftClass> Aircraft;
  60. TFixedIHeapClass<AnimClass> Anims;
  61. TFixedIHeapClass<BuildingClass> Buildings;
  62. TFixedIHeapClass<BulletClass> Bullets;
  63. TFixedIHeapClass<FactoryClass> Factories;
  64. TFixedIHeapClass<HouseClass> Houses;
  65. TFixedIHeapClass<InfantryClass> Infantry;
  66. TFixedIHeapClass<OverlayClass> Overlays;
  67. TFixedIHeapClass<SmudgeClass> Smudges;
  68. TFixedIHeapClass<TeamClass> Teams;
  69. TFixedIHeapClass<TeamTypeClass> TeamTypes;
  70. TFixedIHeapClass<TemplateClass> Templates;
  71. TFixedIHeapClass<TerrainClass> Terrains;
  72. TFixedIHeapClass<TriggerClass> Triggers;
  73. TFixedIHeapClass<UnitClass> Units;
  74. TFixedIHeapClass<VesselClass> Vessels;
  75. TFixedIHeapClass<TriggerTypeClass> TriggerTypes;
  76. TFixedIHeapClass<HouseTypeClass> HouseTypes;
  77. TFixedIHeapClass<BuildingTypeClass> BuildingTypes;
  78. TFixedIHeapClass<AircraftTypeClass> AircraftTypes;
  79. TFixedIHeapClass<InfantryTypeClass> InfantryTypes;
  80. TFixedIHeapClass<BulletTypeClass> BulletTypes;
  81. TFixedIHeapClass<AnimTypeClass> AnimTypes;
  82. TFixedIHeapClass<UnitTypeClass> UnitTypes;
  83. TFixedIHeapClass<VesselTypeClass> VesselTypes;
  84. TFixedIHeapClass<TemplateTypeClass> TemplateTypes;
  85. TFixedIHeapClass<TerrainTypeClass> TerrainTypes;
  86. TFixedIHeapClass<OverlayTypeClass> OverlayTypes;
  87. TFixedIHeapClass<SmudgeTypeClass> SmudgeTypes;
  88. /*
  89. ** These are the instantiate static heap pointers for the various
  90. ** CCPtr class objects that are allowed to exist. If the linker generates
  91. ** an error about a missing heap pointer, then this indicates that CCPtr objects
  92. ** for that type are not allowed. For every case of a TFixedIHeap manager of
  93. ** game objects, then a CCPtr can be instantiated for it.
  94. */
  95. template<class T> FixedIHeapClass * CCPtr<AircraftClass>::Heap = &Aircraft;
  96. template<class T> FixedIHeapClass * CCPtr<AnimClass>::Heap = &Anims;
  97. template<class T> FixedIHeapClass * CCPtr<BuildingClass>::Heap = &Buildings;
  98. template<class T> FixedIHeapClass * CCPtr<BulletClass>::Heap = &Bullets;
  99. template<class T> FixedIHeapClass * CCPtr<FactoryClass>::Heap = &Factories;
  100. template<class T> FixedIHeapClass * CCPtr<HouseClass>::Heap = &Houses;
  101. template<class T> FixedIHeapClass * CCPtr<InfantryClass>::Heap = &Infantry;
  102. template<class T> FixedIHeapClass * CCPtr<OverlayClass>::Heap = &Overlays;
  103. template<class T> FixedIHeapClass * CCPtr<SmudgeClass>::Heap = &Smudges;
  104. template<class T> FixedIHeapClass * CCPtr<TeamClass>::Heap = &Teams;
  105. template<class T> FixedIHeapClass * CCPtr<TeamTypeClass>::Heap = &TeamTypes;
  106. template<class T> FixedIHeapClass * CCPtr<TemplateClass>::Heap = &Templates;
  107. template<class T> FixedIHeapClass * CCPtr<TerrainClass>::Heap = &Terrains;
  108. template<class T> FixedIHeapClass * CCPtr<TriggerClass>::Heap = &Triggers;
  109. template<class T> FixedIHeapClass * CCPtr<TriggerTypeClass>::Heap = &TriggerTypes;
  110. template<class T> FixedIHeapClass * CCPtr<HouseTypeClass>::Heap = &HouseTypes;
  111. template<class T> FixedIHeapClass * CCPtr<BuildingTypeClass>::Heap = &BuildingTypes;
  112. template<class T> FixedIHeapClass * CCPtr<AircraftTypeClass>::Heap = &AircraftTypes;
  113. template<class T> FixedIHeapClass * CCPtr<InfantryTypeClass>::Heap = &InfantryTypes;
  114. template<class T> FixedIHeapClass * CCPtr<BulletTypeClass>::Heap = &BulletTypes;
  115. template<class T> FixedIHeapClass * CCPtr<AnimTypeClass>::Heap = &AnimTypes;
  116. template<class T> FixedIHeapClass * CCPtr<UnitTypeClass>::Heap = &UnitTypes;
  117. template<class T> FixedIHeapClass * CCPtr<VesselTypeClass>::Heap = &VesselTypes;
  118. template<class T> FixedIHeapClass * CCPtr<TemplateTypeClass>::Heap = &TemplateTypes;
  119. template<class T> FixedIHeapClass * CCPtr<TerrainTypeClass>::Heap = &TerrainTypes;
  120. template<class T> FixedIHeapClass * CCPtr<OverlayTypeClass>::Heap = &OverlayTypes;
  121. template<class T> FixedIHeapClass * CCPtr<SmudgeTypeClass>::Heap = &SmudgeTypes;
  122. /* These variables are used to keep track of the slowest speed of a team */
  123. MPHType TeamMaxSpeed[10];
  124. SpeedType TeamSpeed[10];
  125. bool FormMove;
  126. SpeedType FormSpeed;
  127. MPHType FormMaxSpeed;
  128. char _staging_buffer[32000];
  129. /*
  130. ** Global flag for the life of Tanya. If this flag is set, she is
  131. ** no longer available.
  132. */
  133. bool IsTanyaDead;
  134. bool SaveTanya;
  135. #ifdef FIXIT_ANTS
  136. bool AntsEnabled = false;
  137. #endif
  138. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  139. bool NewUnitsEnabled = false;
  140. bool SecretUnitsEnabled = false;
  141. int MTankDistance = 15;
  142. #ifdef FIXIT_CARRIER // checked - ajw 9/28/98
  143. int CarrierLaunchDelay = 60;
  144. #endif
  145. #endif
  146. int NewINIFormat = 0;
  147. bool TimeQuake;
  148. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  149. bool PendingTimeQuake;
  150. TARGET TimeQuakeCenter;
  151. fixed QuakeUnitDamage=0x300;
  152. fixed QuakeBuildingDamage=0x300;
  153. int QuakeInfantryDamage=25;
  154. int QuakeDelay;
  155. fixed ChronoTankDuration=0x300; // chrono override for chrono tanks
  156. #ifdef FIXIT_ENGINEER // checked - ajw 9/28/98
  157. fixed EngineerDamage=0x55; // Amount of damage an engineer does
  158. fixed EngineerCaptureLevel=0x40; // Building damage level before engineer can capture
  159. #endif
  160. #endif
  161. #ifdef WIN32
  162. unsigned short Hard_Error_Occured = 0;
  163. WWMouseClass * WWMouse = NULL;
  164. GraphicBufferClass SysMemPage(DEFAULT_SCREEN_WIDTH, 200, (void*)NULL);
  165. WinTimerClass * WindowsTimer=NULL;
  166. int ScreenWidth=640;
  167. int ScreenHeight=400;
  168. GraphicBufferClass ModeXBuff;
  169. bool InMovie = FALSE; //Are we currently playing a VQ movie?
  170. HANDLE hInstance;
  171. int AllDone;
  172. /***************************************************************************
  173. ** This is true if the game is the currently in focus windows app
  174. **
  175. */
  176. bool GameInFocus = false;
  177. #endif
  178. /***************************************************************************
  179. ** Encryption keys.
  180. */
  181. PKey FastKey;
  182. #ifdef CHEAT_KEYS
  183. PKey SlowKey;
  184. #endif
  185. #ifdef FIXIT_NAME_OVERRIDE
  186. /***************************************************************************
  187. ** This is where the name overrides for the units will reside.
  188. */
  189. char const * NameOverride[25];
  190. int NameIDOverride[25];
  191. #endif
  192. /***************************************************************************
  193. ** These are the mission control structures. They hold the information about
  194. ** how the missions should behave in the system.
  195. */
  196. MissionControlClass MissionControl[MISSION_COUNT];
  197. /***************************************************************************
  198. ** There are various tutorial messages that can appear in the game. These
  199. ** are called upon by number and pointed to by this array.
  200. */
  201. char const * TutorialText[225];
  202. /***************************************************************************
  203. ** This holds the rules database. The rules database won't change during the
  204. ** program's run, but may need to be referenced intermitently.
  205. */
  206. CCINIClass RuleINI;
  207. #ifdef FIXIT_CSII // checked - ajw 9/28/98
  208. CCINIClass AftermathINI;
  209. #endif
  210. /***************************************************************************
  211. ** This points to the benchmark objects that are allocated only if the
  212. ** machine is running on a Pentium and this is a debug version.
  213. */
  214. Benchmark * Benches;
  215. /***************************************************************************
  216. ** General rules that control the game.
  217. */
  218. RulesClass Rule;
  219. /***************************************************************************
  220. ** All keyboard input is routed through the object pointed to by this
  221. ** keyboard class pointer.
  222. */
  223. KeyboardClass * Keyboard;
  224. /***************************************************************************
  225. ** Remap control array. This is used to hold the remap
  226. ** tables for the various possible player colors, and the color schemes
  227. ** for dialogs.
  228. */
  229. RemapControlType ColorRemaps[PCOLOR_COUNT];
  230. /*
  231. ** Special remap scheme for font that hs to print over metallic tabs
  232. */
  233. RemapControlType MetalScheme;
  234. /*
  235. ** This remap table is for special purposes. It consists of dark grey shades,
  236. ** and is used for dimming things out.
  237. */
  238. RemapControlType GreyScheme;
  239. /***************************************************************************
  240. ** This is the source of the random numbers used in the game. This controls
  241. ** the game logic and thus must be in sync with any networked machines.
  242. */
  243. RandomClass NonCriticalRandomNumber;
  244. RandomStraw CryptRandom;
  245. /***************************************************************************
  246. ** This is a list of all selected objects (for this map). The support functions
  247. ** are used to control access to this list. Do not modify it directly.
  248. */
  249. DynamicVectorClass<ObjectClass *> CurrentObject;
  250. /***************************************************************************
  251. ** This is the game version.
  252. */
  253. VersionClass VerNum;
  254. /***************************************************************************
  255. ** This is the VQ animation controller structure. It is filled in by reading
  256. ** the PLAYER.INI and overridden through program control.
  257. */
  258. VQAConfig AnimControl;
  259. int PreserveVQAScreen; // Used for screen mode transition control.
  260. bool BreakoutAllowed = true; // "true" if aborting of movies is allowed.
  261. bool Brokeout; // Was the movie broken out of?
  262. bool SlowPalette = false; // Slow palette flag set?
  263. /***************************************************************************
  264. ** These are the movie names to use for mission briefing, winning, and losing
  265. ** sequences. They are read from the INI file.
  266. */
  267. ScenarioClass Scen;
  268. /***************************************************************************
  269. ** This is the pending speech sample to play. This sample will be played
  270. ** at the first opportunity.
  271. */
  272. VoxType SpeakQueue = VOX_NONE;
  273. /***************************************************************************
  274. ** This records if the score (music) file is present. If not, then much of
  275. ** the streaming score system can be disabled.
  276. */
  277. bool ScoresPresent;
  278. /***************************************************************************
  279. ** This flag will control whether there is a response from game units.
  280. ** By carefully controlling this global, multiple responses are suppressed
  281. ** when a large group of infantry is given the movement order.
  282. */
  283. bool AllowVoice = true;
  284. /***************************************************************************
  285. ** This is the current frame number. This number is guaranteed to count
  286. ** upward at the rate of one per game logic process. The target rate is 15
  287. ** per second. This value is saved and restored with the saved game.
  288. */
  289. long Frame = 0;
  290. /***************************************************************************
  291. ** These globals are constantly monitored to determine if the player
  292. ** has won or lost. They get set according to the trigger events associated
  293. ** with the scenario.
  294. */
  295. bool PlayerWins;
  296. bool PlayerLoses;
  297. bool PlayerRestarts;
  298. /*
  299. ** This flag is set if the player neither wins nor loses; it's mostly for
  300. ** multiplayer mode.
  301. */
  302. bool PlayerAborts;
  303. /***************************************************************************
  304. ** This is the pointer for the speech staging buffer. This buffer is used
  305. ** to hold the currently speaking voice data. Since only one speech sample
  306. ** is played at a time, this buffer is only as big as the largest speech
  307. ** sample that can be played.
  308. */
  309. void * SpeechBuffer[2];
  310. VoxType SpeechRecord[2];
  311. /***************************************************************************
  312. ** The theater specific mixfiles are cached into the buffer pointed to by
  313. ** this global.
  314. */
  315. Buffer * TheaterBuffer;
  316. /***************************************************************************
  317. ** This is a running accumulation of the number of ticks that were unused.
  318. ** This accumulates into a useful value that contributes to a
  319. ** histogram of game performance.
  320. */
  321. long SpareTicks;
  322. long PathCount; // Number of findpaths called.
  323. long CellCount; // Number of cells redrawn.
  324. long TargetScan; // Number of target scans.
  325. long SidebarRedraws; // Number of sidebar redraws.
  326. /***************************************************************************
  327. ** This is the monochrome debug page array. The various monochrome data
  328. ** screens are located here.
  329. */
  330. MonoClass MonoArray[DMONO_COUNT];
  331. DMonoType MonoPage = DMONO_STRESS; // The current page.
  332. /***************************************************************************
  333. ** This holds the theater specific mixfiles.
  334. */
  335. MFCD * TheaterData = 0;
  336. MFCD * MoviesMix = 0;
  337. MFCD * GeneralMix = 0;
  338. MFCD * ScoreMix = 0;
  339. MFCD * MainMix = 0;
  340. MFCD * ConquerMix = 0;
  341. /***************************************************************************
  342. ** This is the options control class. The options control such things as
  343. ** game speed, visual controls, and other user settings.
  344. */
  345. GameOptionsClass Options;
  346. /***************************************************************************
  347. ** Logic processing is controlled by this element. It handles both graphic
  348. ** and AI logic.
  349. */
  350. LogicClass Logic;
  351. /***************************************************************************
  352. ** This handles the background music.
  353. */
  354. ThemeClass Theme;
  355. /***************************************************************************
  356. ** This is the main control class for the map.
  357. */
  358. #ifdef SCENARIO_EDITOR
  359. MapEditClass Map;
  360. #else
  361. MouseClass Map;
  362. #endif
  363. /**************************************************************************
  364. ** The running game score is handled by this class (and member functions).
  365. */
  366. ScoreClass Score;
  367. /***************************************************************************
  368. ** The running credit display is controlled by this class (and member
  369. ** functions.
  370. */
  371. CreditClass CreditDisplay;
  372. /**************************************************************************
  373. ** This class records the special command override options that C&C
  374. ** supports.
  375. */
  376. SpecialClass Special;
  377. bool PassedProximity; // used in display.cpp
  378. /***************************************************************************
  379. ** This is the scenario data for the currently loaded scenario.
  380. ** These variables should all be set together.
  381. */
  382. HousesType Whom; // Initial command line house choice.
  383. bool ScenarioInit;
  384. bool SpecialFlag = false;
  385. /***************************************************************************
  386. ** This value tells the sidebar what items it's allowed to add. The
  387. ** lower the value, the simpler the sidebar will be. This value is the
  388. ** displayed value for tech level in the multiplay dialogs. It remaps to
  389. ** the in-game rules.ini tech levels.
  390. */
  391. int BuildLevel = 10; // Buildable level (1 = simplest)
  392. /***************************************************************************
  393. ** The various tutor and dialog messages are located in the data block
  394. ** referenced by this pointer.
  395. */
  396. char const * SystemStrings;
  397. char const * DebugStrings;
  398. /***************************************************************************
  399. ** The game plays as long as this var is true.
  400. */
  401. bool GameActive;
  402. /***************************************************************************
  403. ** This is a scratch variable that is used to when a reference is needed to
  404. ** a long, but the value wasn't supplied to a function. This is used
  405. ** specifically for the default reference value. As such, it is not stable.
  406. */
  407. long LParam;
  408. #ifdef SCENARIO_EDITOR
  409. /***************************************************************************
  410. ** The currently-selected cell for the Scenario Editor
  411. */
  412. CELL CurrentCell = 0;
  413. #endif
  414. /***************************************************************************
  415. ** Most of the text in the game will use the six point font. These are the
  416. ** pointers to the fonts. If it is NULL, then the font hasn't been loaded
  417. ** yet.
  418. */
  419. void const * Metal12FontPtr; //Font for use on in-game tabs in hires
  420. void const * MapFontPtr; // Standard very small font.
  421. void const * TypeFontPtr; // Teletype font for mission briefings.
  422. void const * Font3Ptr; // Standard very small font.
  423. void const * Font6Ptr; // Standard small font.
  424. void const * EditorFont; // Font used for scenario editor.
  425. void const * Font8Ptr; // 8 point proportional.
  426. void const * FontLEDPtr; // LED fixed point font.
  427. void const * VCRFontPtr; // VCR font pointer.
  428. void const * ScoreFontPtr; // font for score & map selection screens
  429. void const * GradFont6Ptr; // gradient 6 point font pointer.
  430. /***************************************************************************
  431. ** This is the house that the human player is currently playing.
  432. */
  433. HouseClass * PlayerPtr;
  434. /***************************************************************************
  435. ** Special palettes for MCGA mode goes here. These palette buffers are used
  436. ** for pictures that do not use the game palette or are used for fading to
  437. ** black.
  438. */
  439. PaletteClass CCPalette;
  440. PaletteClass GamePalette;
  441. //PaletteClass InGamePalette;
  442. PaletteClass BlackPalette(RGBClass(0, 0, 0));
  443. PaletteClass WhitePalette(RGBClass(RGBClass::MAX_VALUE, RGBClass::MAX_VALUE, RGBClass::MAX_VALUE));
  444. PaletteClass OriginalPalette;
  445. PaletteClass ScorePalette;
  446. /***************************************************************************
  447. ** These are the event queues. One is for holding events until they are ready to be
  448. ** sent to the remote computer for processing. The other list is for incoming events
  449. ** that need to be executed when the correct frame has been reached.
  450. */
  451. QueueClass<EventClass, MAX_EVENTS> OutList;
  452. QueueClass<EventClass, (MAX_EVENTS * 64)> DoList;
  453. #ifdef MIRROR_QUEUE
  454. QueueClass<EventClass, (MAX_EVENTS * 64)> MirrorList;
  455. #endif
  456. /***************************************************************************
  457. ** These are arrays/lists of trigger pointers for each cell & the houses.
  458. */
  459. DynamicVectorClass<TriggerClass *> HouseTriggers[HOUSE_COUNT];
  460. DynamicVectorClass<TriggerClass *> MapTriggers;
  461. int MapTriggerID;
  462. DynamicVectorClass<TriggerClass *> LogicTriggers;
  463. int LogicTriggerID;
  464. /***************************************************************************
  465. ** This is the list of BuildingTypes that define the AI's base.
  466. */
  467. BaseClass Base;
  468. /***************************************************************************
  469. ** This is the list of carry over objects. These objects are part of the
  470. ** pseudo saved game that might be carried along with the current saved
  471. ** game.
  472. */
  473. CarryoverClass * Carryover;
  474. /***************************************************************************
  475. ** This value is computed every time a new scenario is loaded; it's a
  476. ** CRC of the INI and binary map files.
  477. */
  478. unsigned long ScenarioCRC;
  479. /***************************************************************************
  480. ** This class manages data specific to multiplayer games.
  481. */
  482. SessionClass Session;
  483. #if(TIMING_FIX)
  484. //
  485. // These values store the min & max frame #'s for when MaxAhead >>increases<<.
  486. // If MaxAhead increases, and the other systems free-run to the new MaxAhead
  487. // value, they may miss an event generated after the MaxAhead event was sent,
  488. // but before it executed, since it will have been scheduled with the older,
  489. // shorter MaxAhead value. This will cause a Packet_Received_Too_Late error.
  490. // The frames from the point where the new MaxAhead takes effect, up to that
  491. // frame Plus the new MaxAhead, represent a "period of vulnerability"; any
  492. // events received that are scheduled to execute during this period should
  493. // be re-scheduled for after that period.
  494. //
  495. int NewMaxAheadFrame1;
  496. int NewMaxAheadFrame2;
  497. #endif
  498. #ifdef FIXIT_VERSION_3
  499. bool bAftermathMultiplayer; // Is multiplayer game being played with Aftermath rules?
  500. #else
  501. unsigned long PlayingAgainstVersion; // Negotiated version number
  502. bool Version107InMix; // Is there a v1.07 in the game
  503. #endif
  504. /***************************************************************************
  505. ** This is the null modem manager class. Declaring this class doesn't
  506. ** perform any allocations;
  507. */
  508. NullModemClass NullModem (
  509. 16, // number of send entries
  510. 16, // number of receive entries
  511. (MAX_SERIAL_PACKET_SIZE / sizeof(EventClass) ) * sizeof(EventClass) + sizeof( CommHeaderType ),
  512. 0x1234); // Magic number must have each digit unique
  513. // and different from the queue magic number
  514. /***************************************************************************
  515. ** This is the network IPX manager class. It handles multiple remote
  516. ** connections. Declaring this class doesn't perform any allocations;
  517. ** the class itself is 140 bytes.
  518. */
  519. //IPXManagerClass Ipx (
  520. // MAX (sizeof (GlobalPacketType), sizeof(RemoteFileTransferType)), // size of Global Channel packets
  521. // ((546 - sizeof(CommHeaderType)) / sizeof(EventClass) ) * sizeof(EventClass),
  522. // 10, // # entries in Global Queue
  523. // 8, // # entries in Private Queues
  524. // VIRGIN_SOCKET, // Socket ID #
  525. // IPXGlobalConnClass::COMMAND_AND_CONQUER0);// Product ID #
  526. IPXManagerClass Ipx (
  527. MAX (sizeof (GlobalPacketType), sizeof(RemoteFileTransferType)), // size of Global Channel packets
  528. ((546 - sizeof(CommHeaderType)) / sizeof(EventClass) ) * sizeof(EventClass),
  529. 160, // # entries in Global Queue
  530. 32, // # entries in Private Queues
  531. VIRGIN_SOCKET, // Socket ID #
  532. IPXGlobalConnClass::COMMAND_AND_CONQUER0);// Product ID #
  533. #if(TEN)
  534. /***************************************************************************
  535. ** This is the connection manager for Ten. Special Ten notes:
  536. ** - TEN connection ID's are equal to the HousesType for that player.
  537. ** - The TEN internal player ID is used to determine the player's color.
  538. ** - Ten's broadcast destination address -1
  539. */
  540. TenConnManClass *Ten = NULL;
  541. #endif
  542. #if(MPATH)
  543. /***************************************************************************
  544. ** This is the connection manager for Ten. Special Ten notes:
  545. ** - MPATH connection ID's are equal to the HousesType for that player.
  546. ** - The player's color is read from the OPTIONS.INI file
  547. ** - MPath's broadcast destination address is 0
  548. */
  549. MPlayerManClass *MPath = NULL;
  550. #endif
  551. /***************************************************************************
  552. ** This is the random-number seed; it's synchronized between systems for
  553. ** multiplayer games.
  554. */
  555. int Seed = 0;
  556. /***************************************************************************
  557. ** If this value is non-zero, use it as the random # seed instead; this should
  558. ** help reproduce some bugs.
  559. */
  560. int CustomSeed = 0;
  561. int WindowList[][8] = {
  562. /* xbyte, ypixel, bytewid, pixelht, cursor color, bkgd color, cursor x, cursor y */
  563. /* do not change the first 2 entries!! they are necc. to the system */
  564. {0,0,40*8*RESFACTOR,200*RESFACTOR,WHITE,BLACK,0,0}, /* screen window */
  565. {1*8,75,38*8,100,WHITE,BLACK,0,0}, /* DOS Error window */
  566. // Tactical map.
  567. {0, 0, 40*8*RESFACTOR, 200*RESFACTOR, WHITE,LTGREY,0,0},
  568. // Initial menu window.
  569. {12*8, 199-42, 16*8, 42, LTGREY, DKGREY, 0, 0},
  570. // Sidebar clipping window.
  571. {0,0,0,0,0,0,0,0},
  572. // Scenario editor window.
  573. {5*8, 30, 30*8, 140, 0, 0, 0, 0},
  574. // Partial object draw sub-window.
  575. {0,0,0,0,WHITE,BLACK,0,0}
  576. };
  577. /* X,Y,Item Width,Items High,Selected,Norm Color,Sel Color,zero */
  578. int MenuList[][8]={
  579. {1, 3, 12, 3, 0, WHITE, PINK, 0},
  580. };
  581. #ifdef WIN32
  582. GraphicBufferClass VisiblePage;
  583. GraphicBufferClass HiddenPage;
  584. GraphicViewPortClass SeenBuff(&VisiblePage, 0, 0, 640, 480);
  585. GraphicViewPortClass HidPage(&HiddenPage, 0, 0, 640, 480);
  586. #else
  587. GraphicBufferClass HidPage(DEFAULT_SCREEN_WIDTH, 201, (void*)NULL);
  588. GraphicBufferClass SeenBuff(320, 200, (void *)0xA0000L);
  589. VideoBufferClass SeenPage;
  590. GraphicBufferClass & VisiblePage = SeenBuff;
  591. #endif
  592. #ifdef WIN32
  593. #else
  594. #endif
  595. int SoundOn;
  596. CDTimerClass<SystemTimerClass> FrameTimer;
  597. CDTimerClass<SystemTimerClass> CountDownTimer;
  598. NewConfigType NewConfig;
  599. TheaterType LastTheater = THEATER_NONE; //Lets us know when theater type changes.
  600. /***************************************************************************
  601. ** This flag is for popping up dialogs that call the main loop.
  602. */
  603. SpecialDialogType SpecialDialog = SDLG_NONE;
  604. int RequiredCD = -1;
  605. int CurrentCD = -1;
  606. int MouseInstalled;
  607. //
  608. // Variables for helping track how much time goes bye in routines
  609. //
  610. int LogLevel = 0;
  611. unsigned long LogLevelTime[ MAX_LOG_LEVEL ] = { 0 };
  612. unsigned long LogLastTime = 0;
  613. bool LogDump_Print = false; // true = print the Log time Stuff
  614. /***************************************************************************
  615. ** Tick Count global timer object.
  616. */
  617. TTimerClass<SystemTimerClass> TickCount = 0;
  618. /***************************************************************************
  619. ** Win32 specific globals
  620. */
  621. #ifdef WIN32
  622. bool InDebugger = false;
  623. bool ReadyToQuit = false;
  624. #else
  625. bool IsTheaterShape = false; // must be defined only if not Win32
  626. #endif //WIN32
  627. GetCDClass CDList;
  628. int UnitBuildPenalty = 100;
  629. #ifdef MPEGMOVIE // Denzil 6/15/98
  630. #ifdef MCIMPEG
  631. #include "mcimovie.h"
  632. MCIMovie* MciMovie = NULL;
  633. #endif
  634. #include "mpgset.h"
  635. MPGSettings* MpgSettings = NULL;
  636. #endif
  637. #ifdef FIXIT_VERSION_3 // For endgame auto-sonar pulse.
  638. bool bAutoSonarPulse = false;
  639. #endif