ControlBar.h 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: ControlBar.h /////////////////////////////////////////////////////////////////////////////
  24. // Author: Colin Day, March 2002
  25. // Desc: Context sensitive command interface
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #pragma once
  28. #ifndef __CONTROLBAR_H_
  29. #define __CONTROLBAR_H_
  30. // USER INCLUDES //////////////////////////////////////////////////////////////////////////////////
  31. #include "Common/AudioEventRTS.h"
  32. #include "Common/GameType.h"
  33. #include "Common/Overridable.h"
  34. #include "Common/Science.h"
  35. #include "GameClient/Color.h"
  36. // FORWARD REFERENCES /////////////////////////////////////////////////////////////////////////////
  37. class Drawable;
  38. class GameWindow;
  39. class Image;
  40. class Object;
  41. class ThingTemplate;
  42. class WeaponTemplate;
  43. class SpecialPowerTemplate;
  44. class WindowVideoManager;
  45. class WindowVideoManager;
  46. class AnimateWindowManager;
  47. class GameWindow;
  48. class WindowLayout;
  49. class Player;
  50. class PlayerTemplate;
  51. class AudioEventRTS;
  52. class ControlBarSchemeManager;
  53. class UpgradeTemplate;
  54. class ControlBarResizer;
  55. class GameWindowTransitionsHandler;
  56. class DisplayString;
  57. enum ProductionID;
  58. enum CommandSourceType;
  59. enum ProductionType;
  60. enum GadgetGameMessage;
  61. enum ScienceType;
  62. enum TimeOfDay;
  63. enum RadiusCursorType;
  64. //-------------------------------------------------------------------------------------------------
  65. /** Command options */
  66. //-------------------------------------------------------------------------------------------------
  67. enum CommandOption
  68. {
  69. COMMAND_OPTION_NONE = 0x00000000,
  70. NEED_TARGET_ENEMY_OBJECT = 0x00000001, // command now needs user to select enemy target
  71. NEED_TARGET_NEUTRAL_OBJECT = 0x00000002, // command now needs user to select neutral target
  72. NEED_TARGET_ALLY_OBJECT = 0x00000004, // command now needs user to select ally target
  73. #ifdef ALLOW_SURRENDER
  74. NEED_TARGET_PRISONER = 0x00000008, // needs user to now select prisoner object
  75. #endif
  76. ALLOW_SHRUBBERY_TARGET = 0x00000010, // allow neutral shrubbery as a target
  77. NEED_TARGET_POS = 0x00000020, // command now needs user to select target position
  78. NEED_UPGRADE = 0x00000040, // command requires upgrade to be enabled
  79. NEED_SPECIAL_POWER_SCIENCE = 0x00000080, // command requires a science in the special power specified
  80. OK_FOR_MULTI_SELECT = 0x00000100, // command is ok to show when multiple objects selected
  81. CONTEXTMODE_COMMAND = 0x00000200, // a context sensitive command mode that requires code to determine whether cursor is valid or not.
  82. CHECK_LIKE = 0x00000400, // dynamically change the UI element push button to be "check like"
  83. ALLOW_MINE_TARGET = 0x00000800, // allow (land)mines as a target
  84. ATTACK_OBJECTS_POSITION = 0x00001000, // for weapons that need an object target but attack the position indirectly (like burning trees)
  85. OPTION_ONE = 0x00002000, // User data -- option 1
  86. OPTION_TWO = 0x00004000, // User data -- option 2
  87. OPTION_THREE = 0x00008000, // User data -- option 3
  88. NOT_QUEUEABLE = 0x00010000, // Option not build queueable meaning you can only build it when queue is empty!
  89. SINGLE_USE_COMMAND = 0x00020000, // Once used, it can never be used again!
  90. COMMAND_FIRED_BY_SCRIPT = 0x00040000, // Used only by code to tell special powers that they have been fired by a script.
  91. SCRIPT_ONLY = 0x00080000, // Only a script can use this command (not by users)
  92. IGNORES_UNDERPOWERED = 0x00100000, // this button isn't disabled if its object is merely underpowered
  93. USES_MINE_CLEARING_WEAPONSET= 0x00200000, // uses the special mine-clearing weaponset, even if not current
  94. CAN_USE_WAYPOINTS = 0x00400000, // button has option to use a waypoint path
  95. MUST_BE_STOPPED = 0x00800000, // Unit must be stopped in order to be able to use button.
  96. NUM_COMMAND_OPTIONS // keep this last
  97. };
  98. #ifdef DEFINE_COMMAND_OPTION_NAMES
  99. static const char *TheCommandOptionNames[] =
  100. {
  101. "NEED_TARGET_ENEMY_OBJECT",
  102. "NEED_TARGET_NEUTRAL_OBJECT",
  103. "NEED_TARGET_ALLY_OBJECT",
  104. #ifdef ALLOW_SURRENDER
  105. "NEED_TARGET_PRISONER",
  106. #else
  107. "unused-reserved",
  108. #endif
  109. "ALLOW_SHRUBBERY_TARGET",
  110. "NEED_TARGET_POS",
  111. "NEED_UPGRADE",
  112. "NEED_SPECIAL_POWER_SCIENCE",
  113. "OK_FOR_MULTI_SELECT",
  114. "CONTEXTMODE_COMMAND",
  115. "CHECK_LIKE",
  116. "ALLOW_MINE_TARGET",
  117. "ATTACK_OBJECTS_POSITION",
  118. "OPTION_ONE",
  119. "OPTION_TWO",
  120. "OPTION_THREE",
  121. "NOT_QUEUEABLE",
  122. "SINGLE_USE_COMMAND",
  123. "---DO-NOT-USE---", //COMMAND_FIRED_BY_SCRIPT
  124. "SCRIPT_ONLY",
  125. "IGNORES_UNDERPOWERED",
  126. "USES_MINE_CLEARING_WEAPONSET",
  127. "CAN_USE_WAYPOINTS",
  128. "MUST_BE_STOPPED",
  129. NULL
  130. };
  131. #endif // end DEFINE_COMMAND_OPTION_NAMES
  132. // convenient bit masks to group some command options together
  133. const UnsignedInt COMMAND_OPTION_NEED_TARGET =
  134. NEED_TARGET_ENEMY_OBJECT |
  135. NEED_TARGET_NEUTRAL_OBJECT |
  136. NEED_TARGET_ALLY_OBJECT |
  137. NEED_TARGET_POS |
  138. CONTEXTMODE_COMMAND;
  139. const UnsignedInt COMMAND_OPTION_NEED_OBJECT_TARGET =
  140. NEED_TARGET_ENEMY_OBJECT |
  141. NEED_TARGET_NEUTRAL_OBJECT |
  142. NEED_TARGET_ALLY_OBJECT;
  143. //-------------------------------------------------------------------------------------------------
  144. /** These are the list of commands that can be assigned to buttons that will appear
  145. * in the context sensitive GUI for a selected unit. Not all commands are available
  146. * on all units, in fact, many commands are for a particular single command. It will
  147. * be up to the command GUI to translate the command assigned to a button into the
  148. * appropriate game command and get it across the network to the game logic to perform the
  149. * actual command logic
  150. *
  151. * IMPORTANT: Make sure the GUICommandType enum and the TheGuiCommandNames[] have the same
  152. * entries in the same order */
  153. //-------------------------------------------------------------------------------------------------
  154. enum GUICommandType
  155. {
  156. GUI_COMMAND_NONE = 0, ///< invalid command
  157. GUI_COMMAND_DOZER_CONSTRUCT, ///< dozer construct
  158. GUI_COMMAND_DOZER_CONSTRUCT_CANCEL, ///< cancel a dozer construction process
  159. GUI_COMMAND_UNIT_BUILD, ///< build a unit
  160. GUI_COMMAND_CANCEL_UNIT_BUILD, ///< cancel a unit build
  161. GUI_COMMAND_PLAYER_UPGRADE, ///< put an upgrade that applies to the player in the queue
  162. GUI_COMMAND_OBJECT_UPGRADE, ///< put an object upgrade in the queue
  163. GUI_COMMAND_CANCEL_UPGRADE, ///< cancel an upgrade
  164. GUI_COMMAND_ATTACK_MOVE, ///< attack move command
  165. GUI_COMMAND_GUARD, ///< guard command
  166. GUI_COMMAND_GUARD_WITHOUT_PURSUIT, ///< guard command, no pursuit out of guard area
  167. GUI_COMMAND_GUARD_FLYING_UNITS_ONLY, ///< guard command, ignore nonflyers
  168. GUI_COMMAND_STOP, ///< stop moving
  169. GUI_COMMAND_WAYPOINTS, ///< create a set of waypoints for this unit
  170. GUI_COMMAND_EXIT_CONTAINER, ///< an inventory box for a container like a structure or transport
  171. GUI_COMMAND_EVACUATE, ///< dump all our contents
  172. GUI_COMMAND_EXECUTE_RAILED_TRANSPORT, ///< execute railed transport sequence
  173. GUI_COMMAND_BEACON_DELETE, ///< delete a beacon
  174. GUI_COMMAND_SET_RALLY_POINT, ///< set rally point for a structure
  175. GUI_COMMAND_SELL, ///< sell a structure
  176. GUI_COMMAND_FIRE_WEAPON, ///< fire a weapon
  177. GUI_COMMAND_SPECIAL_POWER, ///< do a special power
  178. GUI_COMMAND_PURCHASE_SCIENCE, ///< purchase science
  179. GUI_COMMAND_HACK_INTERNET, ///< gain income from the ether (by hacking the internet)
  180. GUI_COMMAND_TOGGLE_OVERCHARGE, ///< Overcharge command for power plants
  181. #ifdef ALLOW_SURRENDER
  182. GUI_COMMAND_POW_RETURN_TO_PRISON, ///< POW Truck, return to prison
  183. #endif
  184. GUI_COMMAND_COMBATDROP, ///< rappel contents to ground or bldg
  185. GUI_COMMAND_SWITCH_WEAPON, ///< switch weapon use
  186. //Context senstive command modes
  187. GUICOMMANDMODE_HIJACK_VEHICLE,
  188. GUICOMMANDMODE_CONVERT_TO_CARBOMB,
  189. GUICOMMANDMODE_SABOTAGE_BUILDING,
  190. #ifdef ALLOW_SURRENDER
  191. GUICOMMANDMODE_PICK_UP_PRISONER, ///< POW Truck assigned to pick up a specific prisoner
  192. #endif
  193. // context-insensitive command mode(s)
  194. GUICOMMANDMODE_PLACE_BEACON,
  195. GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT, ///< do a special power from localPlayer's command center, regardless of selection
  196. GUI_COMMAND_SPECIAL_POWER_CONSTRUCT, ///< do a special power using the construct building interface
  197. GUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT, ///< do a shortcut special power using the construct building interface
  198. GUI_COMMAND_SELECT_ALL_UNITS_OF_TYPE,
  199. // add more commands here, don't forget to update the string command list below too ...
  200. GUI_COMMAND_NUM_COMMANDS // keep this last
  201. };
  202. #ifdef DEFINE_GUI_COMMMAND_NAMES
  203. static const char *TheGuiCommandNames[] =
  204. {
  205. "NONE",
  206. "DOZER_CONSTRUCT",
  207. "DOZER_CONSTRUCT_CANCEL",
  208. "UNIT_BUILD",
  209. "CANCEL_UNIT_BUILD",
  210. "PLAYER_UPGRADE",
  211. "OBJECT_UPGRADE",
  212. "CANCEL_UPGRADE",
  213. "ATTACK_MOVE",
  214. "GUARD",
  215. "GUARD_WITHOUT_PURSUIT",
  216. "GUARD_FLYING_UNITS_ONLY",
  217. "STOP",
  218. "WAYPOINTS",
  219. "EXIT_CONTAINER",
  220. "EVACUATE",
  221. "EXECUTE_RAILED_TRANSPORT",
  222. "BEACON_DELETE",
  223. "SET_RALLY_POINT",
  224. "SELL",
  225. "FIRE_WEAPON",
  226. "SPECIAL_POWER",
  227. "PURCHASE_SCIENCE",
  228. "HACK_INTERNET",
  229. "TOGGLE_OVERCHARGE",
  230. #ifdef ALLOW_SURRENDER
  231. "POW_RETURN_TO_PRISON",
  232. #endif
  233. "COMBATDROP",
  234. "SWITCH_WEAPON",
  235. "HIJACK_VEHICLE",
  236. "CONVERT_TO_CARBOMB",
  237. "SABOTAGE_BUILDING",
  238. #ifdef ALLOW_SURRENDER
  239. "PICK_UP_PRISONER",
  240. #endif
  241. "PLACE_BEACON",
  242. "SPECIAL_POWER_FROM_SHORTCUT",
  243. "SPECIAL_POWER_CONSTRUCT",
  244. "SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT",
  245. "SELECT_ALL_UNITS_OF_TYPE",
  246. NULL
  247. };
  248. #endif // end DEFINE_GUI_COMMAND_NAMES
  249. enum CommandButtonMappedBorderType
  250. {
  251. COMMAND_BUTTON_BORDER_NONE = 0,
  252. COMMAND_BUTTON_BORDER_BUILD,
  253. COMMAND_BUTTON_BORDER_UPGRADE,
  254. COMMAND_BUTTON_BORDER_ACTION,
  255. COMMAND_BUTTON_BORDER_SYSTEM,
  256. COMMAND_BUTTON_BORDER_COUNT // keep this last
  257. };
  258. static const LookupListRec CommandButtonMappedBorderTypeNames[] =
  259. {
  260. { "NONE", COMMAND_BUTTON_BORDER_NONE },
  261. { "BUILD", COMMAND_BUTTON_BORDER_BUILD },
  262. { "UPGRADE", COMMAND_BUTTON_BORDER_UPGRADE },
  263. { "ACTION", COMMAND_BUTTON_BORDER_ACTION },
  264. { "SYSTEM", COMMAND_BUTTON_BORDER_SYSTEM },
  265. { NULL, 0 }// keep this last!
  266. };
  267. //-------------------------------------------------------------------------------------------------
  268. /** Command buttons are used to load the buttons we place on throughout the command bar
  269. * interface in different context sensitive windows depending on the situation and
  270. * type of the object selected */
  271. //-------------------------------------------------------------------------------------------------
  272. class CommandButton : public Overridable
  273. {
  274. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( CommandButton, "CommandButton" );
  275. public:
  276. CommandButton( void );
  277. // virtual destructor prototype provided by MemoryPoolObject
  278. /// INI parsing
  279. const FieldParse *getFieldParse() const { return s_commandButtonFieldParseTable; }
  280. static const FieldParse s_commandButtonFieldParseTable[]; ///< the parse table
  281. static void parseCommand( INI* ini, void *instance, void *store, const void *userData );
  282. Bool isContextCommand() const; ///< determines if this is a context sensitive command.
  283. Bool isValidRelationshipTarget(Relationship r) const;
  284. Bool isValidObjectTarget(const Player* sourcePlayer, const Object* targetObj) const;
  285. Bool isValidObjectTarget(const Object* sourceObj, const Object* targetObj) const;
  286. Bool isValidObjectTarget(const Drawable* source, const Drawable* target) const;
  287. // Note: It is perfectly valid for either (or both!) of targetObj and targetLocation to be NULL.
  288. // This is a convenience function to make several calls to other functions.
  289. Bool isValidToUseOn(const Object *sourceObj, const Object *targetObj, const Coord3D *targetLocation, CommandSourceType commandSource) const;
  290. Bool isReady(const Object *sourceObj) const;
  291. const AsciiString& getName() const { return m_name; }
  292. const AsciiString& getCursorName() const { return m_cursorName; }
  293. const AsciiString& getInvalidCursorName() const { return m_invalidCursorName; }
  294. const AsciiString& getTextLabel() const { return m_textLabel; }
  295. const AsciiString& getDescriptionLabel() const { return m_descriptionLabel; }
  296. const AsciiString& getPurchasedLabel() const { return m_purchasedLabel; }
  297. const AsciiString& getConflictingLabel() const { return m_conflictingLabel; }
  298. const AudioEventRTS* getUnitSpecificSound() const { return &m_unitSpecificSound; }
  299. GUICommandType getCommandType() const { return m_command; }
  300. UnsignedInt getOptions() const { return m_options; }
  301. OVERRIDE<ThingTemplate> getThingTemplate() const { return m_thingTemplate; }
  302. const UpgradeTemplate* getUpgradeTemplate() const { return m_upgradeTemplate; }
  303. const SpecialPowerTemplate* getSpecialPowerTemplate() const { return m_specialPower; }
  304. RadiusCursorType getRadiusCursorType() const { return m_radiusCursor; }
  305. WeaponSlotType getWeaponSlot() const { return m_weaponSlot; }
  306. Int getMaxShotsToFire() const { return m_maxShotsToFire; }
  307. const ScienceVec& getScienceVec() const { return m_science; }
  308. CommandButtonMappedBorderType getCommandButtonMappedBorderType() const { return m_commandButtonBorder; }
  309. const Image* getButtonImage() const { return m_buttonImage; }
  310. void cacheButtonImage();
  311. GameWindow* getWindow() const { return m_window; }
  312. Int getFlashCount() const { return m_flashCount; }
  313. const CommandButton* getNext() const { return m_next; }
  314. void setName(const AsciiString& n) { m_name = n; }
  315. void setButtonImage( const Image *image ) { m_buttonImage = image; }
  316. // bleah. shouldn't be const, but is. sue me. (srj)
  317. void copyImagesFrom( const CommandButton *button, Bool markUIDirtyIfChanged ) const;
  318. // bleah. shouldn't be const, but is. sue me. (Kris) -snork!
  319. void copyButtonTextFrom( const CommandButton *button, Bool shortcutButton, Bool markUIDirtyIfChanged ) const;
  320. // bleah. shouldn't be const, but is. sue me. (srj)
  321. void setFlashCount(Int c) const { m_flashCount = c; }
  322. // only for ControlBar!
  323. void friend_addToList(CommandButton** list) { m_next = *list; *list = this; }
  324. CommandButton* friend_getNext() { return m_next; }
  325. private:
  326. AsciiString m_name; ///< template name
  327. GUICommandType m_command; ///< type of command this button
  328. CommandButton* m_next;
  329. UnsignedInt m_options; ///< command options (see CommandOption enum)
  330. const ThingTemplate* m_thingTemplate; ///< for commands that use thing templates in command data
  331. const UpgradeTemplate* m_upgradeTemplate; ///< for commands that use upgrade templates in command data
  332. const SpecialPowerTemplate* m_specialPower; ///< actual special power template
  333. RadiusCursorType m_radiusCursor; ///< radius cursor, if any
  334. AsciiString m_cursorName; ///< cursor name for placement (NEED_TARGET_POS) or valid version (CONTEXTMODE_COMMAND)
  335. AsciiString m_invalidCursorName; ///< cursor name for invalid version
  336. // bleah. shouldn't be mutable, but is. sue me. (Kris) -snork!
  337. mutable AsciiString m_textLabel; ///< string manager text label
  338. mutable AsciiString m_descriptionLabel; ///< The description of the current command, read in from the ini
  339. AsciiString m_purchasedLabel; ///< Description for the current command if it has already been purchased.
  340. AsciiString m_conflictingLabel; ///< Description for the current command if it can't be selected due to multually-exclusive choice.
  341. WeaponSlotType m_weaponSlot; ///< for commands that refer to a weapon slot
  342. Int m_maxShotsToFire; ///< for commands that fire weapons
  343. ScienceVec m_science; ///< actual science
  344. CommandButtonMappedBorderType m_commandButtonBorder;
  345. AsciiString m_buttonImageName;
  346. GameWindow* m_window; ///< used during the run-time assignment of a button to a gadget button window
  347. AudioEventRTS m_unitSpecificSound; ///< Unit sound played whenever button is clicked.
  348. // bleah. shouldn't be mutable, but is. sue me. (srj)
  349. mutable const Image* m_buttonImage; ///< button image
  350. // bleah. shouldn't be mutable, but is. sue me. (srj)
  351. mutable Int m_flashCount; ///< the number of times a cameo is supposed to flash
  352. };
  353. //-------------------------------------------------------------------------------------------------
  354. /** Command sets are collections of configurable command buttons. They are used in the
  355. * command context sensitive window in the battle user interface */
  356. //-------------------------------------------------------------------------------------------------
  357. enum { MAX_COMMANDS_PER_SET = 18 }; // user interface max is 14 (but internally it's 18 for script only buttons!)
  358. enum { MAX_RIGHT_HUD_UPGRADE_CAMEOS = 5};
  359. enum {
  360. MAX_PURCHASE_SCIENCE_RANK_1 = 4,
  361. MAX_PURCHASE_SCIENCE_RANK_3 = 15,
  362. MAX_PURCHASE_SCIENCE_RANK_8 = 4,
  363. };
  364. enum { MAX_STRUCTURE_INVENTORY_BUTTONS = 10 }; // there are this many physical buttons in "inventory" windows for structures
  365. enum { MAX_BUILD_QUEUE_BUTTONS = 9 };// physical button count for the build queue
  366. enum { MAX_SPECIAL_POWER_SHORTCUTS = 11};
  367. class CommandSet : public Overridable
  368. {
  369. MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( CommandSet, "CommandSet" )
  370. public:
  371. CommandSet( const AsciiString& name );
  372. // virtual destructor prototype provided by MemoryPoolObject
  373. const AsciiString& getName() const { return m_name; }
  374. const CommandButton* getCommandButton(Int i) const;
  375. // only for the control bar.
  376. CommandSet* friend_getNext() { return m_next; }
  377. const FieldParse* friend_getFieldParse() const { return m_commandSetFieldParseTable; }
  378. void friend_addToList(CommandSet** listHead);
  379. private:
  380. static const FieldParse m_commandSetFieldParseTable[]; ///< the parse table
  381. static void parseCommandButton( INI* ini, void *instance, void *store, const void *userData );
  382. AsciiString m_name; ///< name of this command set
  383. const CommandButton *m_command[ MAX_COMMANDS_PER_SET ]; ///< the set of command buttons that make this set
  384. CommandSet *m_next;
  385. };
  386. //-------------------------------------------------------------------------------------------------
  387. /** The Side selece window data is used to animate on the proper generals select */
  388. //-------------------------------------------------------------------------------------------------
  389. class SideSelectWindowData
  390. {
  391. public:
  392. SideSelectWindowData(void)
  393. {
  394. //Added By Sadullah Nader
  395. //Initializations
  396. generalSpeak = NULL;
  397. m_currColor = 0;
  398. m_gereralsNameWin = NULL;
  399. m_lastTime = 0;
  400. m_pTemplate = NULL;
  401. m_sideNameWin = NULL;
  402. m_startTime = 0;
  403. m_state = 0;
  404. m_upgradeImage1 = NULL;
  405. m_upgradeImage1Win = NULL;
  406. m_upgradeImage2 = NULL;
  407. m_upgradeImage2Win = NULL;
  408. m_upgradeImage3 = NULL;
  409. m_upgradeImage3Win = NULL;
  410. m_upgradeImage4 = NULL;
  411. m_upgradeImage4Win = NULL;
  412. m_upgradeImageSize.x = m_upgradeImageSize.y = 0;
  413. m_upgradeLabel1Win = NULL;
  414. m_upgradeLabel2Win = NULL;
  415. m_upgradeLabel3Win = NULL;
  416. m_upgradeLabel4Win = NULL;
  417. sideWindow = NULL;
  418. //
  419. }
  420. ~SideSelectWindowData(void);
  421. void init( ScienceType science, GameWindow *control );
  422. void reset( void );
  423. void update( void );
  424. void draw( void );
  425. GameWindow *sideWindow;
  426. GameWindow *m_animWindowWin;
  427. AudioEventRTS *generalSpeak;
  428. private:
  429. enum
  430. {
  431. STATE_NONE = 0,
  432. STATE_1,
  433. STATE_2,
  434. STATE_3,
  435. STATE_4,
  436. STATE_5,
  437. STATE_6
  438. };
  439. const PlayerTemplate *m_pTemplate;
  440. GameWindow *m_gereralsNameWin;
  441. GameWindow *m_sideNameWin;
  442. GameWindow *m_upgradeLabel1Win;
  443. GameWindow *m_upgradeLabel2Win;
  444. GameWindow *m_upgradeLabel3Win;
  445. GameWindow *m_upgradeLabel4Win;
  446. GameWindow *m_upgradeImage1Win;
  447. GameWindow *m_upgradeImage2Win;
  448. GameWindow *m_upgradeImage3Win;
  449. GameWindow *m_upgradeImage4Win;
  450. Image *m_upgradeImage1;
  451. Image *m_upgradeImage2;
  452. Image *m_upgradeImage3;
  453. Image *m_upgradeImage4;
  454. IRegion2D m_leftLineFromButton;
  455. IRegion2D m_rightLineFromButton;
  456. IRegion2D m_upgradeLine1a;
  457. IRegion2D m_upgradeLine2a;
  458. IRegion2D m_upgradeLine3a;
  459. IRegion2D m_upgradeLine4a;
  460. IRegion2D m_upgradeLine1;
  461. IRegion2D m_upgradeLine2;
  462. IRegion2D m_upgradeLine3;
  463. IRegion2D m_upgradeLine4;
  464. IRegion2D m_upgradeLine1MidReg;
  465. IRegion2D m_upgradeLine2MidReg;
  466. IRegion2D m_upgradeLine3MidReg;
  467. IRegion2D m_upgradeLine4MidReg;
  468. IRegion2D m_upgrade1Clip;
  469. IRegion2D m_upgrade2Clip;
  470. IRegion2D m_upgrade3Clip;
  471. IRegion2D m_upgrade4Clip;
  472. Color m_currColor;
  473. ICoord2D m_line1End;
  474. ICoord2D m_line2End;
  475. ICoord2D m_upgradeLine1Mid;
  476. ICoord2D m_upgradeLine2Mid;
  477. ICoord2D m_upgradeLine3Mid;
  478. ICoord2D m_upgradeLine4Mid;
  479. ICoord2D m_upgradeLine1End;
  480. ICoord2D m_upgradeLine2End;
  481. ICoord2D m_upgradeLine3End;
  482. ICoord2D m_upgradeLine4End;
  483. ICoord2D m_upgradeImagePos1;
  484. ICoord2D m_upgradeImagePos2;
  485. ICoord2D m_upgradeImagePos3;
  486. ICoord2D m_upgradeImagePos4;
  487. ICoord2D m_upgradeImageSize;
  488. Int m_state;
  489. UnsignedInt m_lastTime;
  490. UnsignedInt m_startTime;
  491. };
  492. //-------------------------------------------------------------------------------------------------
  493. /** A command bar context is a window or set of windows that make up a context sensitive
  494. * display of commands and information to the user based on what objects are selected
  495. * and their capabilities */
  496. //-------------------------------------------------------------------------------------------------
  497. enum ControlBarContext
  498. {
  499. CB_CONTEXT_NONE, ///< default view for center bar and portrait window
  500. // CB_CONTEXT_PURCHASE_SCIENCE,
  501. CB_CONTEXT_COMMAND, ///< set of commands (attack-move,stop,deploy etc)
  502. CB_CONTEXT_STRUCTURE_INVENTORY, ///< garrisonable building inventory interface
  503. CB_CONTEXT_BEACON, ///< beacon interface
  504. CB_CONTEXT_UNDER_CONSTRUCTION, ///< building under construction
  505. CB_CONTEXT_MULTI_SELECT, ///< for when we have multiple objects selected
  506. CB_CONTEXT_OBSERVER_INFO, ///< for when we want to populate the player info
  507. CB_CONTEXT_OBSERVER_LIST, ///< for when we want to update the observer list
  508. CB_CONTEXT_OCL_TIMER, ///< Countdown for OCL spewers
  509. NUM_CB_CONTEXTS
  510. };
  511. //-------------------------------------------------------------------------------------------------
  512. /** Context parents, are parent windows in the control bar interface that are the key
  513. * parts we care about to make the whole interface a context sensitive one. We will
  514. * hide and un-hide these windows and their interface controls in order to make
  515. * the control bar context sensitive to the object that is selected */
  516. //-------------------------------------------------------------------------------------------------
  517. enum ContextParent
  518. {
  519. CP_MASTER, ///< *The* control bar window as a whole
  520. CP_PURCHASE_SCIENCE,
  521. CP_COMMAND, ///< configurable command buttons parent
  522. CP_BUILD_QUEUE, ///< build queue parent
  523. CP_BEACON, ///< beacon parent
  524. CP_UNDER_CONSTRUCTION, ///< building under construction parent
  525. CP_OBSERVER_INFO, ///< Observer Info window parent
  526. CP_OBSERVER_LIST, ///< Observer player list parent
  527. CP_OCL_TIMER, ///< Countdown for OCL spewers
  528. NUM_CONTEXT_PARENTS
  529. };
  530. //-------------------------------------------------------------------------------------------------
  531. //-------------------------------------------------------------------------------------------------
  532. enum CBCommandStatus
  533. {
  534. CBC_COMMAND_NOT_USED = 0, ///< gui control message was *not* used
  535. CBC_COMMAND_USED ///< gui control message was used
  536. };
  537. // ------------------------------------------------------------------------------------------------
  538. /** Command availability is used during the context update so that we can set the
  539. * GUI button to be enabled/disabled/checked/unchecked to represent the current
  540. * state of that command availability */
  541. // ------------------------------------------------------------------------------------------------
  542. enum CommandAvailability
  543. {
  544. COMMAND_RESTRICTED,
  545. COMMAND_AVAILABLE,
  546. COMMAND_ACTIVE,
  547. COMMAND_HIDDEN,
  548. COMMAND_NOT_READY,
  549. COMMAND_CANT_AFFORD,
  550. };
  551. enum ControlBarStages
  552. {
  553. CONTROL_BAR_STAGE_DEFAULT = 0, ///< full view for the world to see
  554. CONTROL_BAR_STAGE_SQUISHED, ///< squished just for expeirenced players
  555. CONTROL_BAR_STAGE_LOW, ///< control bar a la minimalist
  556. CONTROL_BAR_STAGE_HIDDEN, ///< yo, where be da control bar at?
  557. MAX_CONTROL_BAR_STAGES
  558. };
  559. //-------------------------------------------------------------------------------------------------
  560. //-------------------------------------------------------------------------------------------------
  561. class ControlBar : public SubsystemInterface
  562. {
  563. public:
  564. ControlBar( void );
  565. virtual ~ControlBar( void );
  566. virtual void init( void ); ///< from subsystem interface
  567. virtual void reset( void ); ///< from subsystem interface
  568. virtual void update( void ); ///< from subsystem interface
  569. /// mark the UI as dirty so the context of everything is re-evaluated
  570. void markUIDirty( void );
  571. /// a drawable has just become selected
  572. void onDrawableSelected( Drawable *draw );
  573. /// a drawable has just become de-selected
  574. void onDrawableDeselected( Drawable *draw );
  575. void onPlayerRankChanged(const Player *p);
  576. void onPlayerSciencePurchasePointsChanged(const Player *p);
  577. /** if this button is part of the context sensitive command system, process a button click
  578. the gadgetMessage is either a GBM_SELECTED or GBM_SELECTED_RIGHT */
  579. CBCommandStatus processContextSensitiveButtonClick( GameWindow *button,
  580. GadgetGameMessage gadgetMessage );
  581. /** if this button is part of the context sensitive command system, process the Transition
  582. gadgetMessage is either a GBM_MOUSE_LEAVING or GBM_MOUSE_ENTERING */
  583. CBCommandStatus processContextSensitiveButtonTransition( GameWindow *button,
  584. GadgetGameMessage gadgetMessage );
  585. /// is the drawable the currently selected drawable for the context sensitive UI?
  586. Bool isDrivingContextUI( Drawable *draw ) const { return draw == m_currentSelectedDrawable; }
  587. //-----------------------------------------------------------------------------------------------
  588. // the remaining methods are used to construct the command buttons and command sets for
  589. // the command bar
  590. //-----------------------------------------------------------------------------------------------
  591. /// find existing command button if present
  592. const CommandButton *findCommandButton( const AsciiString& name );
  593. /// find existing command set
  594. const CommandSet *findCommandSet( const AsciiString& name );
  595. void showPurchaseScience( void );
  596. void hidePurchaseScience( void );
  597. void togglePurchaseScience( void );
  598. void showSpecialPowerShortcut( void );
  599. void hideSpecialPowerShortcut( void );
  600. void animateSpecialPowerShortcut( Bool isOn );
  601. /// set the control bar to the proper scheme based off a player template that's passed in
  602. ControlBarSchemeManager *getControlBarSchemeManager( void ) { return m_controlBarSchemeManager; }
  603. void setControlBarSchemeByPlayer(Player *p);
  604. void setControlBarSchemeByName(const AsciiString& name);
  605. void setControlBarSchemeByPlayerTemplate(const PlayerTemplate *pt);
  606. /// We need to sometime change what the images look like depending on what scheme we're using
  607. void updateBuildQueueDisabledImages( const Image *image );
  608. /// We need to sometime change what the images look like depending on what scheme we're using
  609. void updateRightHUDImage( const Image *image );
  610. /// We need to be able to update the command marker image based on which scheme we're using.
  611. void updateCommandMarkerImage( const Image *image );
  612. void updateSlotExitImage( const Image *image);
  613. void updateUpDownImages( const Image *toggleButtonUpIn, const Image *toggleButtonUpOn, const Image *toggleButtonUpPushed, const Image *toggleButtonDownIn, const Image *toggleButtonDownOn, const Image *toggleButtonDownPushed,const Image *generalButtonEnable, const Image *generalButtonHighlight );
  614. void preloadAssets( TimeOfDay timeOfDay ); ///< preload the assets
  615. /// We want to be able to have the control bar scheme set the color of the build up clock
  616. void updateBuildUpClockColor( Color color);
  617. WindowVideoManager *m_videoManager; ///< Video manager to take care of all animations on screen.
  618. AnimateWindowManager *m_animateWindowManager; ///< The animate window manager
  619. AnimateWindowManager *m_animateWindowManagerForGenShortcuts; ///< The animate window manager
  620. void updatePurchaseScience( void );
  621. AnimateWindowManager *m_generalsScreenAnimate; ///< The animate window manager
  622. // Initialize the Observer controls Must be called after we've already loaded the window
  623. void initObserverControls( void );
  624. void setObserverLookAtPlayer (Player *p) { m_observerLookAtPlayer = p;}
  625. Player *getObserverLookAtPlayer (void ) { return m_observerLookAtPlayer;}
  626. void populateObserverInfoWindow ( void );
  627. void populateObserverList( void );
  628. Bool isObserverControlBarOn( void ) { return m_isObserverCommandBar;}
  629. // ControlBarResizer *getControlBarResizer( void ) {return m_controlBarResizer;}
  630. // Functions for repositioning/resizing the control bar
  631. void switchControlBarStage( ControlBarStages stage );
  632. void toggleControlBarStage( void );
  633. const Image *getStarImage( void );
  634. Color getBorderColor( void ){return m_commandBarBorderColor;}
  635. void updateBorderColor( Color color) {m_commandBarBorderColor = color; }
  636. /// set the command data into the button
  637. void setControlCommand( GameWindow *button, const CommandButton *commandButton );
  638. void getForegroundMarkerPos(Int *x, Int *y);
  639. void getBackgroundMarkerPos(Int *x, Int *y);
  640. static void parseCommandSetDefinition( INI *ini );
  641. static void parseCommandButtonDefinition( INI *ini );
  642. void drawTransitionHandler( void );
  643. const Image *getArrowImage( void ){ return m_genArrow; }
  644. void setArrowImage( const Image *arrowImage ){ m_genArrow = arrowImage; }
  645. void initSpecialPowershortcutBar( Player *player);
  646. void triggerRadarAttackGlow( void );
  647. void drawSpecialPowerShortcutMultiplierText();
  648. Bool hasAnyShortcutSelection() const;
  649. protected:
  650. void updateRadarAttackGlow ( void );
  651. void setDefaultControlBarConfig( void );
  652. void setSquishedControlBarConfig( void );
  653. void setLowControlBarConfig( void );
  654. void setHiddenControlBar( void );
  655. /// find existing command button if present
  656. CommandButton* findNonConstCommandButton( const AsciiString& name );
  657. /// allocate a new command button, link to list, initialize to default, and return
  658. CommandButton *newCommandButton( const AsciiString& name );
  659. CommandButton *newCommandButtonOverride( CommandButton *buttonToOverride );
  660. /// allocate a new command set, link to list, initialize to default, and return it
  661. CommandSet *newCommandSet( const AsciiString& name );
  662. CommandSet *newCommandSetOverride( CommandSet *setToOverride );
  663. /// evaluate what the user should see based on what selected drawables we have in our UI
  664. void evaluateContextUI( void );
  665. /// add the common commands of this drawable to the common command set
  666. void addCommonCommands( Drawable *draw, Bool firstDrawable );
  667. /// switch the interface context to the new mode and populate as needed
  668. void switchToContext( ControlBarContext context, Drawable *draw );
  669. /// set the command data into the button
  670. void setControlCommand( const AsciiString& buttonWindowName, GameWindow *parent,
  671. const CommandButton *commandButton );
  672. /// show/hide the portrait window image using the image pointer to set
  673. void setPortraitByImage( const Image *image );
  674. /// show/hide the portrait window image using the image from the object
  675. void setPortraitByObject( Object *obj );
  676. /// show rally point at world location, a NULL location will hide any visible rally point marker
  677. void showRallyPoint( const Coord3D *loc );
  678. /// post process step, after all commands and command sets are loaded
  679. void postProcessCommands( void );
  680. // the following methods are for resetting data for vaious contexts
  681. void resetCommonCommandData( void ); /// reset shared command data
  682. void resetContainData( void ); /// reset container data we use to tie controls to objects IDs for containment
  683. void resetBuildQueueData( void ); /// reset the build queue data we use to die queue entires to control
  684. // the following methods are for populating the context GUI controls for a particular context
  685. static void populateButtonProc( Object *obj, void *userData );
  686. void populatePurchaseScience(Player* player);
  687. void populateCommand( Object *obj );
  688. void populateMultiSelect( void );
  689. void populateBuildQueue( Object *producer );
  690. void populateStructureInventory( Object *building );
  691. void populateBeacon( Object *beacon );
  692. void populateUnderConstruction( Object *objectUnderConstruction );
  693. void populateOCLTimer( Object *creatorObject );
  694. void doTransportInventoryUI( Object *transport, const CommandSet *commandSet );
  695. static void populateInvDataCallback( Object *obj, void *userData );
  696. // the following methods are for updating the currently showing context
  697. CommandAvailability getCommandAvailability( const CommandButton *command, Object *obj, GameWindow *win, GameWindow *applyToWin = NULL, Bool forceDisabledEvaluation = FALSE ) const;
  698. void updateContextMultiSelect( void );
  699. void updateContextPurchaseScience( void );
  700. void updateContextCommand( void );
  701. void updateContextStructureInventory( void );
  702. void updateContextBeacon( void );
  703. void updateContextUnderConstruction( void );
  704. void updateContextOCLTimer( void );
  705. // the following methods are for the special power shortcut window
  706. void populateSpecialPowerShortcut( Player *player);
  707. void updateSpecialPowerShortcut( void );
  708. static const Image* calculateVeterancyOverlayForThing( const ThingTemplate *thingTemplate );
  709. static const Image* calculateVeterancyOverlayForObject( const Object *obj );
  710. // the following methods do command processing for GUI selections
  711. CBCommandStatus processCommandUI( GameWindow *control, GadgetGameMessage gadgetMessage );
  712. CBCommandStatus processCommandTransitionUI( GameWindow *control, GadgetGameMessage gadgetMessage );
  713. // methods to help out with each context
  714. void updateConstructionTextDisplay( Object *obj );
  715. void updateOCLTimerTextDisplay( UnsignedInt totalSeconds, Real percent );
  716. void setUpDownImages( void );
  717. // methods for flashing cameos
  718. public:
  719. void setFlash( Bool b ) { m_flash = b; }
  720. // get method for list of commandbuttons
  721. const CommandButton *getCommandButtons( void ) { return m_commandButtons; }
  722. protected:
  723. ICoord2D m_defaultControlBarPosition; ///< Stored the original position of the control bar on the screen
  724. ControlBarStages m_currentControlBarStage;
  725. Bool m_UIDirty; ///< the context UI must be re-evaluated
  726. CommandButton *m_commandButtons; ///< list of possible commands to have
  727. CommandSet *m_commandSets; ///< list of all command sets defined
  728. ControlBarSchemeManager *m_controlBarSchemeManager; ///< The Scheme singleton
  729. GameWindow *m_contextParent[ NUM_CONTEXT_PARENTS ]; ///< "parent" window for buttons that are part of the context sensitive interface
  730. Drawable *m_currentSelectedDrawable; ///< currently selected drawable for the context sensitive interface
  731. ControlBarContext m_currContext; ///< our current displayed context
  732. DrawableID m_rallyPointDrawableID; ///< rally point drawable for visual rally point
  733. Real m_displayedConstructPercent; ///< construct percent last displayed to user
  734. UnsignedInt m_displayedOCLTimerSeconds; ///< OCL Timer seconds remaining last displayed to user
  735. UnsignedInt m_displayedQueueCount; ///< queue count last displayed to user
  736. UnsignedInt m_lastRecordedInventoryCount; ///< last known UI state of an inventory count
  737. GameWindow *m_rightHUDWindow; ///< window of the right HUD display
  738. GameWindow *m_rightHUDCameoWindow; ///< window of the right HUD display
  739. GameWindow *m_rightHUDUpgradeCameos[MAX_RIGHT_HUD_UPGRADE_CAMEOS];
  740. GameWindow *m_rightHUDUnitSelectParent;
  741. GameWindow *m_communicatorButton; ///< button for the communicator
  742. WindowLayout *m_scienceLayout; ///< the Science window layout
  743. GameWindow *m_sciencePurchaseWindowsRank1[ MAX_PURCHASE_SCIENCE_RANK_1 ]; ///< command window controls for easy access
  744. GameWindow *m_sciencePurchaseWindowsRank3[ MAX_PURCHASE_SCIENCE_RANK_3 ]; ///< command window controls for easy access
  745. GameWindow *m_sciencePurchaseWindowsRank8[ MAX_PURCHASE_SCIENCE_RANK_8 ]; ///< command window controls for easy access
  746. GameWindow *m_specialPowerShortcutButtons[ MAX_SPECIAL_POWER_SHORTCUTS ];
  747. GameWindow *m_specialPowerShortcutButtonParents[ MAX_SPECIAL_POWER_SHORTCUTS ];
  748. DisplayString *m_shortcutDisplayStrings[ MAX_SPECIAL_POWER_SHORTCUTS ];
  749. Int m_currentlyUsedSpecialPowersButtons; ///< Value will be <= MAX_SPECIAL_POWER_SHORTCUTS;
  750. WindowLayout *m_specialPowerLayout;
  751. GameWindow *m_specialPowerShortcutParent;
  752. GameWindow *m_commandWindows[ MAX_COMMANDS_PER_SET ]; ///< command window controls for easy access
  753. const CommandButton *m_commonCommands[ MAX_COMMANDS_PER_SET ]; ///< shared commands we will use for multi-selection
  754. // removed from multiplayer branch
  755. //GameWindow *m_commandMarkers[ MAX_COMMANDS_PER_SET ]; ///< When we don't have a command, they want to show an image
  756. // removed from multiplayer branch
  757. //void showCommandMarkers( void ); ///< function that compare's what's being shown in m_commandWindows and shows the ones that are hidden.
  758. public:
  759. // method for hiding communicator window CCB
  760. void hideCommunicator( Bool b );
  761. protected:
  762. struct ContainEntry
  763. {
  764. GameWindow *control;
  765. ObjectID objectID;
  766. };
  767. static ContainEntry m_containData[ MAX_COMMANDS_PER_SET ]; ///< inventory buttons integrated into the regular command set for buildings/transports
  768. struct QueueEntry
  769. {
  770. GameWindow *control; ///< window that the GUI control is tied to
  771. ProductionType type; ///< type of queue data
  772. union
  773. {
  774. ProductionID productionID; ///< production id for unit productions
  775. const UpgradeTemplate *upgradeToResearch; ///< upgrade template for upgrade productions
  776. };
  777. };
  778. QueueEntry m_queueData[ MAX_BUILD_QUEUE_BUTTONS ]; ///< what the build queue represents
  779. //cameo flash
  780. Bool m_flash; ///< tells update whether or not to check for flash
  781. Bool m_sideSelectAnimateDown;
  782. ICoord2D m_animateDownWin1Size;
  783. ICoord2D m_animateDownWin2Size;
  784. ICoord2D m_animateDownWin1Pos;
  785. ICoord2D m_animateDownWin2Pos;
  786. GameWindow *m_animateDownWindow;
  787. UnsignedInt m_animTime;
  788. Color m_buildUpClockColor;
  789. Bool m_isObserverCommandBar; ///< If this is true, the command bar behaves greatly differnt
  790. Player *m_observerLookAtPlayer; ///< The current player we're looking at, Null if we're not looking at anyone.
  791. WindowLayout *m_buildToolTipLayout; ///< The window that will slide on/display tooltips
  792. Bool m_showBuildToolTipLayout; ///< every frame we test to see if we aregoing to continue showing this or not.
  793. public:
  794. void showBuildTooltipLayout( GameWindow *cmdButton );
  795. void hideBuildTooltipLayout( void );
  796. void deleteBuildTooltipLayout( void );
  797. Bool getShowBuildTooltipLayout( void ){return m_showBuildToolTipLayout; }
  798. void populateBuildTooltipLayout( const CommandButton *commandButton, GameWindow *tooltipWin = NULL );
  799. void repopulateBuildTooltipLayout( void );
  800. private:
  801. // Command Bar button border bars stuff
  802. Color m_commandButtonBorderBuildColor;
  803. Color m_commandButtonBorderActionColor;
  804. Color m_commandButtonBorderUpgradeColor;
  805. Color m_commandButtonBorderSystemColor;
  806. Color m_commandBarBorderColor;
  807. void setCommandBarBorder( GameWindow *button, CommandButtonMappedBorderType type);
  808. public:
  809. void updateCommanBarBorderColors(Color build, Color action, Color upgrade, Color system );
  810. private:
  811. /// find existing command set
  812. CommandSet *findNonConstCommandSet( const AsciiString& name );
  813. const Image *m_genStarOn;
  814. const Image *m_genStarOff;
  815. const Image *m_toggleButtonUpIn;
  816. const Image *m_toggleButtonUpOn;
  817. const Image *m_toggleButtonUpPushed;
  818. const Image *m_toggleButtonDownIn;
  819. const Image *m_toggleButtonDownOn;
  820. const Image *m_toggleButtonDownPushed;
  821. GameWindowTransitionsHandler *m_transitionHandler;
  822. const Image *m_genArrow;
  823. static const Image *m_rankVeteranIcon;
  824. static const Image *m_rankEliteIcon;
  825. static const Image *m_rankHeroicIcon;
  826. const Image *m_generalButtonEnable;
  827. const Image *m_generalButtonHighlight;
  828. Bool m_genStarFlash;
  829. Int m_lastFlashedAtPointValue;
  830. ICoord2D m_controlBarForegroundMarkerPos;
  831. ICoord2D m_controlBarBackgroundMarkerPos;
  832. Bool m_radarAttackGlowOn;
  833. Int m_remainingRadarAttackGlowFrames;
  834. GameWindow *m_radarAttackGlowWindow;
  835. #if defined( _INTERNAL ) || defined( _DEBUG )
  836. UnsignedInt m_lastFrameMarkedDirty;
  837. UnsignedInt m_consecutiveDirtyFrames;
  838. #endif
  839. // ControlBarResizer *m_controlBarResizer;
  840. };
  841. // EXTERNALS //////////////////////////////////////////////////////////////////////////////////////
  842. extern ControlBar *TheControlBar;
  843. #endif // end __CONTROLBAR_H_