GLOBALS.CPP 28 KB

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