CnC_Remastered_Collection

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

GLOBALS.CPP (28478B)


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