GLOBALS.CPP 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035
  1. /*
  2. ** Command & Conquer(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: F:\projects\c&c\vcs\code\globals.cpv 2.17 16 Oct 1995 16:52:22 JOE_BOSTIC $ */
  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. #ifdef JAPANESE
  37. bool ForceEnglish = false;
  38. #endif
  39. bool Debug_Quiet = false;
  40. bool Debug_Cheat = false;
  41. bool Debug_Remap = false;
  42. bool Debug_Icon = false;
  43. bool Debug_Flag = false;
  44. bool Debug_Lose = false;
  45. bool Debug_Win = false;
  46. bool Debug_Map = false; // true = map editor mode
  47. bool Debug_Passable = false; // true = show passable/impassable terrain
  48. bool Debug_Unshroud = false; // true = hide the shroud
  49. bool Debug_Threat = false;
  50. bool Debug_Find_Path = false;
  51. bool Debug_Check_Map = false; // true = validate the map each frame
  52. bool Debug_Playtest = false;
  53. int In_Debugger = 0;
  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_Instant_Build = false;
  58. TFixedIHeapClass<UnitClass> Units;
  59. TFixedIHeapClass<FactoryClass> Factories;
  60. TFixedIHeapClass<TerrainClass> Terrains;
  61. TFixedIHeapClass<TemplateClass> Templates;
  62. TFixedIHeapClass<SmudgeClass> Smudges;
  63. TFixedIHeapClass<OverlayClass> Overlays;
  64. TFixedIHeapClass<InfantryClass> Infantry;
  65. TFixedIHeapClass<BulletClass> Bullets;
  66. TFixedIHeapClass<BuildingClass> Buildings;
  67. TFixedIHeapClass<AnimClass> Anims;
  68. TFixedIHeapClass<AircraftClass> Aircraft;
  69. TFixedIHeapClass<TriggerClass> Triggers;
  70. TFixedIHeapClass<TeamTypeClass> TeamTypes;
  71. TFixedIHeapClass<TeamClass> Teams;
  72. TFixedIHeapClass<HouseClass> Houses;
  73. #ifdef PATCH
  74. /***************************************************************************
  75. ** Compatibility with version 1.07 flag.
  76. */
  77. bool IsV107 = false;
  78. char OverridePath[128]=".";
  79. #endif
  80. /***************************************************************************
  81. ** This is a list of all selected objects (for this map). The support functions
  82. ** are used to control access to this list. Do not modify it directly.
  83. */
  84. DynamicVectorClass<ObjectClass *> CurrentObject;
  85. /***************************************************************************
  86. ** This holds the custom version text that is fetched from the version
  87. ** text file. This version is displayed on the options dialog.
  88. */
  89. char VersionText[16];
  90. /***************************************************************************
  91. ** This is the VQ animation controller structure. It is filled in by reading
  92. ** the PLAYER.INI and overridden through program control.
  93. */
  94. VQAConfig AnimControl;
  95. int PreserveVQAScreen; // Used for screen mode transition control.
  96. bool BreakoutAllowed = true; // "true" if aborting of movies is allowed.
  97. bool Brokeout; // Was the movie broken out of?
  98. bool SlowPalette = true; // Slow palette flag set?
  99. /***************************************************************************
  100. ** These are the movie names to use for mission briefing, winning, and losing
  101. ** sequences. They are read from the INI file.
  102. */
  103. char IntroMovie[_MAX_FNAME+_MAX_EXT];
  104. char BriefMovie[_MAX_FNAME+_MAX_EXT];
  105. char WinMovie[_MAX_FNAME+_MAX_EXT];
  106. char LoseMovie[_MAX_FNAME+_MAX_EXT];
  107. char ActionMovie[_MAX_FNAME+_MAX_EXT];
  108. char BriefingText[512];
  109. ThemeType TransitTheme = THEME_NONE;
  110. /***************************************************************************
  111. ** This records the view hotspots for the player. These are the cell numbers
  112. ** of the upper left corner for the view position.
  113. */
  114. CELL Views[4];
  115. /***************************************************************************
  116. ** This is the pending speech sample to play. This sample will be played
  117. ** at the first opportunity.
  118. */
  119. VoxType SpeakQueue = VOX_NONE;
  120. /***************************************************************************
  121. ** This records if the score (music) file is present. If not, then much of
  122. ** the streaming score system can be disabled.
  123. */
  124. bool ScoresPresent;
  125. /***************************************************************************
  126. ** This flag will control whether there is a response from game units.
  127. ** By carefully controlling this global, multiple responses are supressed
  128. ** when a large group of infantry is given the movement order.
  129. */
  130. bool AllowVoice = true;
  131. /***************************************************************************
  132. ** This counts the number of crates on the map. When this value reaches zero,
  133. ** then a timer is started that will control crate creation.
  134. */
  135. int CrateCount;
  136. TCountDownTimerClass CrateTimer;
  137. bool CrateMaker = false;
  138. /***************************************************************************
  139. ** This is the current frame number. This number is guaranteed to count
  140. ** upward at the rate of one per game logic process. The target rate is 15
  141. ** per second. This value is saved and restored with the saved game.
  142. */
  143. long Frame = 0;
  144. /***************************************************************************
  145. ** These globals are constantly monitored to determine if the player
  146. ** has won or lost. They get set according to the trigger events associated
  147. ** with the scenario.
  148. */
  149. bool PlayerWins;
  150. bool PlayerLoses;
  151. bool PlayerRestarts;
  152. /*
  153. ** This flag is set if the player neither wins nor loses; it's mostly for
  154. ** multiplayer mode.
  155. */
  156. bool PlayerAborts;
  157. /***************************************************************************
  158. ** This is the pointer for the speech staging buffer. This buffer is used
  159. ** to hold the currently speaking voice data. Since only one speech sample
  160. ** is played at a time, this buffer is only as big as the largest speech
  161. ** sample that can be played.
  162. */
  163. void * SpeechBuffer;
  164. /***************************************************************************
  165. ** This is a running accumulation of the number of ticks that were unused.
  166. ** This accumulates into a useful value that contributes to a
  167. ** histogram of game performance.
  168. */
  169. long SpareTicks;
  170. /***************************************************************************
  171. ** This is a special scenario count down value. End of game condition will
  172. ** not be checked until this value reaches zero.
  173. */
  174. int EndCountDown;
  175. /***************************************************************************
  176. ** When the player sabotages a building (scenario #6 GDI only) then when
  177. ** the next scenario starts, that building will already be destroyed.
  178. */
  179. StructType SabotagedType;
  180. /***************************************************************************
  181. ** If the Nod temple was destroyed by the ion cannon, then this flag will
  182. ** be set to true.
  183. */
  184. bool TempleIoned = false;
  185. /***************************************************************************
  186. ** This is the monochrome debug page array. The various monochrome data
  187. ** screens are located here.
  188. */
  189. MonoClass MonoArray[MonoClass::MAX_MONO_PAGES];
  190. int MonoPage; // The current page.
  191. /***************************************************************************
  192. ** This is true if the game is the currently in focus windows app
  193. **
  194. */
  195. bool GameInFocus;
  196. /***************************************************************************
  197. ** This holds the theater specific mixfiles.
  198. */
  199. MixFileClass *TheaterData = NULL;
  200. MixFileClass *TheaterIcons = NULL;
  201. MixFileClass *LowTheaterData;
  202. MixFileClass *MoviesMix = 0;
  203. MixFileClass *GeneralMix = 0;
  204. MixFileClass *ScoreMix = 0;
  205. /***************************************************************************
  206. ** This is the options control class. The options control such things as
  207. ** game speed, visual controls, and other user settings.
  208. */
  209. GameOptionsClass Options;
  210. /***************************************************************************
  211. ** Logic processing is controlled by this element. It handles both graphic
  212. ** and AI logic.
  213. */
  214. LogicClass Logic;
  215. /***************************************************************************
  216. ** This handles the background music.
  217. */
  218. ThemeClass Theme;
  219. /***************************************************************************
  220. ** This is the main control class for the map.
  221. */
  222. #ifdef SCENARIO_EDITOR
  223. MapEditClass Map;
  224. #else
  225. MouseClass Map;
  226. #endif
  227. /**************************************************************************
  228. ** The running game score is handled by this class (and member functions).
  229. */
  230. ScoreClass Score;
  231. /***************************************************************************
  232. ** The running credit display is controlled by this class (and member
  233. ** functions.
  234. */
  235. CreditClass CreditDisplay;
  236. /***************************************************************************
  237. ** These are the bits that are set when the appropriate tutor message
  238. ** has been displayed. Once the message has been displayed, it will not be
  239. ** displayed again.
  240. */
  241. long TutorFlags[2];
  242. /**************************************************************************
  243. ** This class records the special command override options that C&C
  244. ** supports.
  245. */
  246. SpecialClass Special;
  247. /***************************************************************************
  248. ** This is the scenario data for the currently loaded scenario.
  249. ** These variables should all be set together.
  250. */
  251. HousesType Whom; // Initial command line house choice.
  252. unsigned Scenario; // Scenario #
  253. ScenarioPlayerType ScenPlayer; // GDI, NOD, 2-Player, Multi-Player
  254. ScenarioDirType ScenDir; // East/West
  255. ScenarioVarType ScenVar; // variation A/B/C
  256. char ScenarioName[_MAX_FNAME+_MAX_EXT]; // name of scenario
  257. int CarryOverMoney; // Carry over money from last scenario.
  258. int CarryOverPercent; // Carry over money percentage control.
  259. int CarryOverCap; // Maxmimum carry over money allowed.
  260. bool ScenarioInit;
  261. bool SpecialFlag = false;
  262. /***************************************************************************
  263. ** This value tells the sidebar what items it's allowed to add. The
  264. ** lower the value, the simpler the sidebar will be.
  265. */
  266. unsigned BuildLevel = 3; // Buildable level (1 = simplest)
  267. /***************************************************************************
  268. ** This value is computed every time a new scenario is loaded; it's a
  269. ** CRC of the INI and binary map files.
  270. */
  271. unsigned long ScenarioCRC;
  272. /***************************************************************************
  273. ** The various tutor and dialog messages are located in the data block
  274. ** referenced by this pointer.
  275. */
  276. char const * SystemStrings;
  277. /***************************************************************************
  278. ** The game plays as long as this var is true.
  279. */
  280. bool GameActive;
  281. /***************************************************************************
  282. ** This is a scratch variable that is used to when a reference is needed to
  283. ** a long, but the value wasn't supplied to a function. This is used
  284. ** specifically for the default reference value. As such, it is not stable.
  285. */
  286. long LParam;
  287. #ifdef SCENARIO_EDITOR
  288. /***************************************************************************
  289. ** The currently-selected cell for the Scenario Editor
  290. */
  291. CELL CurrentCell = 0;
  292. #endif
  293. /***************************************************************************
  294. ** Most of the text in the game will use the six point font. These are the
  295. ** pointers to the fonts. If it is NULL, then the font hasn't been loaded
  296. ** yet.
  297. */
  298. void const *Green12FontPtr; // Green font for pressed in tabs
  299. void const *Green12GradFontPtr; // Graduated green font for tabs
  300. void const *MapFontPtr; // Standard very small font.
  301. void const *Font3Ptr; // Standard very small font.
  302. void const *Font6Ptr; // Standard small font.
  303. void const *Font8Ptr; // 8 point proportional.
  304. void const *FontLEDPtr; // LED fixed point font.
  305. void const *VCRFontPtr; // VCR font pointer.
  306. void const *ScoreFontPtr; // font for score & map selection screens
  307. void const *GradFont6Ptr; // gradient 6 point font pointer.
  308. /***************************************************************************
  309. ** This is the house that the human player is currently playing.
  310. */
  311. HouseClass * PlayerPtr;
  312. /***************************************************************************
  313. ** Special palettes for MCGA mode goes here. These palette buffers are used
  314. ** for pictures that do not use the game palette or are used for fading to
  315. ** black.
  316. */
  317. unsigned char *GamePalette;
  318. unsigned char *BlackPalette;
  319. unsigned char *WhitePalette;
  320. unsigned char *OriginalPalette;
  321. unsigned char *Palette;
  322. /***************************************************************************
  323. ** These are the event queues. One is for holding events until they are ready to be
  324. ** sent to the remote computer for processing. The other list is for incoming events
  325. ** that need to be executed when the correct frame has been reached.
  326. */
  327. QueueClass<EventClass, MAX_EVENTS> OutList;
  328. QueueClass<EventClass, (MAX_EVENTS * 8)> DoList;
  329. /***************************************************************************
  330. ** These are arrays/lists of trigger pointers for each cell & the houses.
  331. */
  332. DynamicVectorClass<TriggerClass *> CellTriggers;
  333. DynamicVectorClass<TriggerClass *> HouseTriggers[HOUSE_COUNT];
  334. /***************************************************************************
  335. ** This is an array of waypoints; each waypoint corresponds to a letter of
  336. ** the alphabet, and points to a cell number. -1 means unassigned.
  337. ** The CellClass has a bit that tells if that cell has a waypoint attached to
  338. ** it; the only way to find which waypoint it is, is to scan this array. This
  339. ** shouldn't be needed often; usually, you know the waypoint & you want the CELL.
  340. */
  341. CELL Waypoint[WAYPT_COUNT];
  342. /***************************************************************************
  343. ** This is the list of BuildingTypes that define the AI's base.
  344. */
  345. BaseClass Base;
  346. /***************************************************************************
  347. ** This value tells what type of multiplayer game we're playing.
  348. */
  349. GameType GameToPlay = GAME_NORMAL;
  350. /***************************************************************************
  351. ** This is the current communications protocol
  352. */
  353. CommProtocolType CommProtocol;
  354. /***************************************************************************
  355. ** These values are used for recording & playing back a game.
  356. */
  357. CCFileClass RecordFile ("RECORD.BIN");
  358. int RecordGame = 0; // 1 = record a game
  359. int SuperRecord = 0; // 1 = reopen record file with every write
  360. int PlaybackGame= 0; // 1 = play back a game
  361. int AllowAttract = 0; // 1 = allow attract mode
  362. /***************************************************************************
  363. ** This is the null modem manager class. Declaring this class doesn't
  364. ** perform any allocations;
  365. ** the class itself is ?? bytes.
  366. */
  367. bool ModemService = true; // When false disable servicing modem.
  368. NullModemClass NullModem (
  369. 16, // number of send entries
  370. 64, // number of receive entries
  371. // sizeof (EventClass) * MAX_EVENTS, // maxlen of entry buffer
  372. (200 / sizeof(EventClass) ) * sizeof(EventClass) + sizeof( CommHeaderType ),
  373. 0x1234); // Magic number must have each digit unique
  374. // and different from the queue magic number
  375. DynamicVectorClass <PhoneEntryClass *> PhoneBook;
  376. int CurPhoneIdx; // current phonebook index, for dialing
  377. DynamicVectorClass <char *> InitStrings;
  378. SerialSettingsType SerialDefaults; // serial port default settings
  379. ModemGameType ModemGameToPlay; // type of modem play Dialer, answerer, null
  380. char *DialMethodCheck[ DIAL_METHODS ] = {
  381. "T",
  382. "P"
  383. };
  384. char *CallWaitStrings[ CALL_WAIT_STRINGS_NUM ] = {
  385. "*70,",
  386. "70#,",
  387. "1170,",
  388. "CUSTOM - "
  389. };
  390. /***************************************************************************
  391. ** Index into scenario description list box
  392. */
  393. int ScenarioIdx;
  394. /***************************************************************************
  395. ** This array of flags tells if the given colors have been used, or are
  396. */
  397. int ColorUsed[MAX_MPLAYER_COLORS];
  398. /***************************************************************************
  399. ** This string stores the player's name.
  400. */
  401. char MPlayerName[MPLAYER_NAME_MAX];
  402. /***************************************************************************
  403. ** This is the array of remap colors. Each player in a network game is
  404. ** assigned one of these colors. The 'G' is for graphics drawing; the 'T'
  405. ** is for text printing (indicates a remap table for the font to use).
  406. */
  407. int MPlayerGColors[MAX_MPLAYER_COLORS] = {
  408. 5, // Yellow
  409. 127, // Red
  410. 135, // BlueGreen
  411. 26, // Orange
  412. 4, // Green
  413. 202 // Blue-Grey
  414. };
  415. int MPlayerTColors[MAX_MPLAYER_COLORS] = {
  416. CC_GDI_COLOR, // Yellow
  417. CC_NOD_COLOR, // Red
  418. CC_BLUE_GREEN, // BlueGreen
  419. CC_ORANGE, // Orange //26
  420. CC_GREEN, // Green
  421. CC_BLUE_GREY, // Blue
  422. };
  423. /***************************************************************************
  424. ** This is a list of all the names of the multiplayer scenarios that use
  425. ** bases (production), and those that don't. There is a list for
  426. ** descriptions, and another for actual filenames.
  427. */
  428. char MPlayerDescriptions[100][40];
  429. DynamicVectorClass <char *> MPlayerScenarios;
  430. DynamicVectorClass <int> MPlayerFilenum;
  431. /***************************************************************************
  432. ** This value determines the max allowable # of players.
  433. */
  434. int MPlayerMax = 4;
  435. /***************************************************************************
  436. ** Multiplayer game options
  437. */
  438. int MPlayerPrefColor; // preferred color index for this player
  439. int MPlayerColorIdx; // actual color index of this player
  440. HousesType MPlayerHouse; // House of this player (GDI/NOD)
  441. unsigned char MPlayerLocalID; // ID of this player
  442. int MPlayerCount; // # of human players in this game
  443. int MPlayerBases; // 1 = bases are on for this scenario
  444. int MPlayerCredits; // # credits everyone gets
  445. int MPlayerTiberium; // 1 = tiberium enabled for this scenario
  446. int MPlayerGoodies; // 1 = goodies enabled for this scenario
  447. int MPlayerGhosts; // 1 = houses with no players will still play
  448. int MPlayerSolo = 0; // 1 = allows a single-player net game
  449. int MPlayerUnitCount = 10; // # units for non-base multiplayer scenarios
  450. /*---------------------------------------------------------------------------
  451. Min & Max unit count values; index0 = bases OFF, index1 = bases ON
  452. ---------------------------------------------------------------------------*/
  453. int MPlayerCountMin[2] = {1,0};
  454. int MPlayerCountMax[2] = {50,12};
  455. /*---------------------------------------------------------------------------
  456. MPlayerMaxAhead is the number of frames ahead of this one to execute a given
  457. packet. It's set by the RESPONSE_TIME event.
  458. ---------------------------------------------------------------------------*/
  459. unsigned long MPlayerMaxAhead = 3;
  460. /*---------------------------------------------------------------------------
  461. 'FrameSendRate' is the # frames between data packets
  462. 'FrameRateDelay' is the time ticks to wait between frames, for smoothing.
  463. ---------------------------------------------------------------------------*/
  464. unsigned long FrameSendRate;
  465. /***************************************************************************
  466. ** Multiplayer ID's, stored in order of event execution.
  467. ** Format:
  468. ** bits 0-3: the "preferred" house of the player (GDI/NOD)
  469. ** bits 4-7: the player's Color Index
  470. ** These values are used as the IPX connection ID's.
  471. */
  472. unsigned char MPlayerID [MAX_PLAYERS];
  473. /***************************************************************************
  474. ** This array stores the actual HousesType for all players (MULT1, etc).
  475. */
  476. HousesType MPlayerHouses [MAX_PLAYERS];
  477. /***************************************************************************
  478. ** This array stores the names of all players in a multiplayer game.
  479. */
  480. char MPlayerNames [MAX_PLAYERS][MPLAYER_NAME_MAX];
  481. /***************************************************************************
  482. ** This is a list of the messages received from / sent to other players,
  483. ** the address to send to (IPX only), and the last message received or
  484. ** sent (for the computer's messages).
  485. */
  486. MessageListClass Messages;
  487. IPXAddressClass MessageAddress;
  488. char LastMessage[MAX_MESSAGE_LENGTH];
  489. /***************************************************************************
  490. ** If this flag is set, computer AI will blitz the humans all at once;
  491. ** otherwise, the computer units trickle gradually out.
  492. */
  493. int MPlayerBlitz = 0;
  494. /***************************************************************************
  495. ** If this flag is set, we can move around the map, but we can't do anything.
  496. ** It means we've been defeated, but we're still allowed to watch the action.
  497. */
  498. int MPlayerObiWan = 0;
  499. /***************************************************************************
  500. ** These variables keep track of the multiplayer game scores.
  501. */
  502. MPlayerScoreType MPlayerScore[MAX_MULTI_NAMES];
  503. int MPlayerGamesPlayed; // # games played this run
  504. int MPlayerNumScores; // # active entries in MPlayerScore
  505. int MPlayerWinner; // index of winner of last game
  506. int MPlayerCurGame; // index of current game being played
  507. //
  508. // This array stores the processing time required by all multiplayer systems.
  509. // The values are stored in the same order as the 'MPlayerID' array.
  510. //
  511. int TheirProcessTime[MAX_PLAYERS - 1];
  512. int DesiredFrameRate;
  513. /***************************************************************************
  514. ** These values are used purely for the Mono debug display. They show the
  515. ** names of the Global Channel packet types, and the event types.
  516. */
  517. char *GlobalPacketNames[] = {
  518. "Game?",
  519. "Game!",
  520. "Player?",
  521. "Player!",
  522. "Join?",
  523. "Join!",
  524. "Reject",
  525. "GameOptions",
  526. "Sign Off",
  527. "GO!",
  528. "Message",
  529. "Ping"
  530. };
  531. // yeah, there's 100 empty names here, because the SerialCommandType starts at 100.
  532. char *SerialPacketNames[] = {
  533. "",
  534. "",
  535. "",
  536. "",
  537. "",
  538. "",
  539. "",
  540. "",
  541. "",
  542. "",
  543. "",
  544. "",
  545. "",
  546. "",
  547. "",
  548. "",
  549. "",
  550. "",
  551. "",
  552. "",
  553. "",
  554. "",
  555. "",
  556. "",
  557. "",
  558. "",
  559. "",
  560. "",
  561. "",
  562. "",
  563. "",
  564. "",
  565. "",
  566. "",
  567. "",
  568. "",
  569. "",
  570. "",
  571. "",
  572. "",
  573. "",
  574. "",
  575. "",
  576. "",
  577. "",
  578. "",
  579. "",
  580. "",
  581. "",
  582. "",
  583. "",
  584. "",
  585. "",
  586. "",
  587. "",
  588. "",
  589. "",
  590. "",
  591. "",
  592. "",
  593. "",
  594. "",
  595. "",
  596. "",
  597. "",
  598. "",
  599. "",
  600. "",
  601. "",
  602. "",
  603. "",
  604. "",
  605. "",
  606. "",
  607. "",
  608. "",
  609. "",
  610. "",
  611. "",
  612. "",
  613. "",
  614. "",
  615. "",
  616. "",
  617. "",
  618. "",
  619. "",
  620. "",
  621. "",
  622. "",
  623. "",
  624. "",
  625. "",
  626. "",
  627. "",
  628. "",
  629. "",
  630. "",
  631. "",
  632. "",
  633. "CONNECT",
  634. "GAME_OPTIONS",
  635. "SIGN_OFF",
  636. "GO",
  637. "MESSAGE",
  638. "TIMING",
  639. "SCORE_SCREEN",
  640. "LAST_COMMAND",
  641. };
  642. /***************************************************************************
  643. ** These variables are just to help find sync bugs.
  644. */
  645. long TrapFrame = 0x7fffffff; // frame to start trapping object values at
  646. RTTIType TrapObjType = RTTI_NONE; // type of object to trap
  647. TrapObjectType TrapObject = {NULL}; // ptr to object being trapped
  648. COORDINATE TrapCoord = 0; // COORD of object to trap
  649. void *TrapThis = NULL; // 'this' ptr of object to trap
  650. CellClass *TrapCell = NULL; // for trapping a cell
  651. int TrapCheckHeap = 0; // start checking the Heap
  652. /***************************************************************************
  653. ** This is the network IPX manager class. It handles multiple remote
  654. ** connections. Declaring this class doesn't perform any allocations;
  655. ** the class itself is 140 bytes.
  656. */
  657. IPXManagerClass Ipx (
  658. sizeof (GlobalPacketType), // size of Global Channel packets
  659. ((546 - sizeof(CommHeaderType)) / sizeof(EventClass) ) * sizeof(EventClass),
  660. 10, // # entries in Global Queue
  661. 8, // # entries in Private Queues
  662. VIRGIN_SOCKET, // Socket ID #
  663. IPXGlobalConnClass::COMMAND_AND_CONQUER); // Product ID #
  664. //#if(TIMING_FIX)
  665. //
  666. // These values store the min & max frame #'s for when MaxAhead >>increases<<.
  667. // If MaxAhead increases, and the other systems free-run to the new MaxAhead
  668. // value, they may miss an event generated after the MaxAhead event was sent,
  669. // but before it executed, since it will have been scheduled with the older,
  670. // shorter MaxAhead value. This will cause a Packet_Received_Too_Late error.
  671. // The frames from the point where the new MaxAhead takes effect, up to that
  672. // frame Plus the new MaxAhead, represent a "period of vulnerability"; any
  673. // events received that are scheduled to execute during this period should
  674. // be re-scheduled for after that period.
  675. //
  676. int NewMaxAheadFrame1;
  677. int NewMaxAheadFrame2;
  678. //#endif
  679. /***************************************************************************
  680. ** This is the user-specified IPX address of a desired game owner machine.
  681. ** Use this to cross a bridge. Only the 1st 4 numbers in the address are
  682. ** used; the rest are set to ff's, for broadcasting. 'IsBridge' is set
  683. ** if this address should be used.
  684. */
  685. int IsBridge = 0;
  686. IPXAddressClass BridgeNet;
  687. /***************************************************************************
  688. ** This flag is true if the user has requested that this game be "secret"
  689. ** (The game will not appear to other systems just starting up.)
  690. */
  691. bool NetStealth = false;
  692. /***************************************************************************
  693. ** If this flag is true, the user won't receive messages from any player
  694. ** other than those in his own game. It defaults to protected mode.
  695. */
  696. bool NetProtect = true;
  697. /***************************************************************************
  698. ** This flag indicates whether the game is "open" or not to other network players.
  699. */
  700. bool NetOpen = false;
  701. /***************************************************************************
  702. ** This string stores the game's network name.
  703. ** GameName does not include the "'s Game"; comparing GameName to
  704. ** PlayerName can determine if this player is the originator of the game.
  705. */
  706. char MPlayerGameName[MPLAYER_NAME_MAX];
  707. /***************************************************************************
  708. ** These variables are for servicing the Global Channel.
  709. */
  710. GlobalPacketType GPacket; // Global Channel packet
  711. int GPacketlen; // length of incoming packet
  712. IPXAddressClass GAddress; // address of sender
  713. unsigned short GProductID; // sender's Product ID
  714. /***************************************************************************
  715. ** This is the "meta-packet"; it's a bunch of events lumped together.
  716. ** The packet's size is IPX's max size (546), rounded down to accommodate
  717. ** the max number of events possible.
  718. */
  719. char *MetaPacket = 0;
  720. int MetaSize = ((546 - sizeof(CommHeaderType)) / sizeof(EventClass) ) * sizeof(EventClass);
  721. /***************************************************************************
  722. ** This is the random-number seed; it's synchronized between systems for
  723. ** multiplayer games.
  724. */
  725. int Seed = 0;
  726. long *RandSeedPtr;
  727. /***************************************************************************
  728. ** If this value is non-zero, use it as the random # seed instead; this should
  729. ** help reproduce some bugs.
  730. */
  731. int CustomSeed = 0;
  732. int WindowList[][8] = {
  733. /* xbyte, ypixel, bytewid, pixelht, cursor color, bkgd color, cursor x, cursor y */
  734. /* do not change the first 2 entries!! they are necc. to the system */
  735. {0,0,40,200,WHITE,BLACK,0,0}, /* screen window */
  736. {1,75,38,100,WHITE,BLACK,0,0}, /* DOS Error window */
  737. // Tactical map.
  738. {0, 0, 40, 200, WHITE,LTGREY,0,0},
  739. // Initial menu window.
  740. {12, 199-42, 16, 42, LTGREY, DKGREY, 0, 0},
  741. // Sidebar clipping window.
  742. {0,0,0,0,0,0,0,0},
  743. // Scenario editor window.
  744. {5, 30, 30, 140, 0, 0, 0, 0},
  745. // Custom window.
  746. {0, 0, 0, 0, 0, 0, 0, 0},
  747. };
  748. /* X,Y,Item Width,Items High,Selected,Norm Color,Sel Color,zero */
  749. int MenuList[][8]={
  750. {1, 3, 12, 3, 0, WHITE, PINK, 0},
  751. };
  752. GraphicBufferClass VisiblePage;
  753. GraphicBufferClass HiddenPage;
  754. GraphicViewPortClass SeenBuff(&VisiblePage, 0,0,640,480);
  755. GraphicBufferClass ModeXBuff;
  756. GraphicViewPortClass HidPage(&HiddenPage, 0,0,640,480);
  757. GraphicBufferClass SysMemPage(DEFAULT_SCREEN_WIDTH, 200, (void*)NULL);
  758. int SoundOn;
  759. CountDownTimerClass FrameTimer(BT_SYSTEM, 0L);
  760. CountDownTimerClass DebugTimer(BT_SYSTEM, 0L);
  761. CountDownTimerClass CountDownTimer(BT_SYSTEM, 0L);
  762. NewConfigType NewConfig;
  763. /***************************************************************************
  764. ** This timer measures how long (in ticks) it takes to process the game's
  765. ** logic, with no packet processing or artificial delays.
  766. */
  767. TimerClass ProcessTimer;
  768. int ProcessTicks; // accumulated ticks
  769. int ProcessFrames; // # frames used to measure 'ProcessTicks'
  770. /***************************************************************************
  771. ** This flag is for popping up dialogs that call the main loop.
  772. */
  773. SpecialDialogType SpecialDialog = SDLG_NONE;
  774. /*
  775. ** This flags if used to tell can enter cell that we are in a find path
  776. ** check and thus should not uncloak units via Can_Enter_Cell.
  777. */
  778. //bool IsFindPath = false;
  779. /***************************************************************************
  780. ** Globals for the network Dialogs.
  781. */
  782. /*
  783. ** List of all games out there, & the address of the game's owner
  784. */
  785. DynamicVectorClass <NodeNameType *> Games;
  786. /*
  787. ** List of names & addresses of all the players in the game I'm joining.
  788. ** This is the really critical list, since it's used to form connections with
  789. ** all other players in my game. It's updated when I get a response to my
  790. ** outgoing query, or when I get a query from another system in my game asking
  791. ** who I am. This double-insurance means that if any system knows about me,
  792. ** I know about them too. The only catch is that if the game is started very,
  793. ** very soon after a player joins, not everyone may know about him; to prevent
  794. ** this, a timer restriction is put on the New Game dialog's GO button.
  795. */
  796. DynamicVectorClass <NodeNameType *> Players;
  797. char *DebugFname; // for stoopid debugging purposes
  798. int DebugLine; // for stoopid debugging purposes
  799. #ifdef DEMO
  800. int RequiredCD = -2;
  801. #else
  802. int RequiredCD = -1;
  803. #endif
  804. int MouseInstalled;
  805. /*
  806. ** Certain options must be enabled by both a command-line option, and an
  807. ** an entry in an INI file. If this flag is 'true', those options have been
  808. ** enabled by the INI file.
  809. */
  810. int AreThingiesEnabled = false;
  811. /*
  812. ** Pointer to windows timer object
  813. **
  814. **
  815. */
  816. WinTimerClass *WindowsTimer=NULL;
  817. /*
  818. ** Command line arguments
  819. **
  820. **
  821. */
  822. char * Argv[20]; //Pointers to command line arguments
  823. int Argc; //Command line argument count
  824. WWKeyboardClass Kbd;
  825. int ScreenWidth=640;
  826. int ScreenHeight=400;
  827. WWMouseClass *WWMouse = NULL;
  828. HANDLE hInstance;
  829. int AllDone;
  830. BOOL InMovie = FALSE; //Are we currently playing a VQ movie?
  831. bool MMXAvailable = false; //Does this CPU support MMX extensions?
  832. GetCDClass CDList;
  833. bool GameStatisticsPacketSent;
  834. bool ConnectionLost;
  835. TheaterType LastTheater = THEATER_NONE;