ControlBarCallback.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  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: ControlBarCallback.cpp ///////////////////////////////////////////////////////////////////
  24. // Author: Colin Day - October 2001
  25. // Desc: GUI Control bar at the bottom of the screen that houses the
  26. // the build buttons, radar etc.
  27. ///////////////////////////////////////////////////////////////////////////////////////////////////
  28. // INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
  29. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  30. #include "Common/NameKeyGenerator.h"
  31. #include "Common/Player.h"
  32. #include "Common/PlayerList.h"
  33. #include "Common/MessageStream.h"
  34. #include "Common/ThingFactory.h"
  35. #include "Common/ThingTemplate.h"
  36. #include "Common/Radar.h"
  37. #include "GameClient/AnimateWindowManager.h"
  38. #include "GameClient/Drawable.h"
  39. #include "GameClient/GameWindow.h"
  40. #include "GameClient/Gadget.h"
  41. #include "GameClient/GadgetTextEntry.h"
  42. #include "GameClient/GameClient.h"
  43. #include "GameClient/GUICallbacks.h"
  44. #include "GameClient/InGameUI.h"
  45. #include "GameClient/ControlBar.h"
  46. #include "GameClient/GameWindowManager.h"
  47. #include "GameClient/LanguageFilter.h"
  48. #include "GameClient/CommandXlat.h"
  49. #include "GameLogic/GameLogic.h"
  50. #include "GameLogic/ScriptEngine.h"
  51. //external declarations of the Gadgets the callbacks can use
  52. WindowLayout *popupCommunicatorLayout = NULL;
  53. //-------------------------------------------------------------------------------------------------
  54. /** Input procedure for the left HUD */
  55. //-------------------------------------------------------------------------------------------------
  56. WindowMsgHandledType LeftHUDInput( GameWindow *window, UnsignedInt msg,
  57. WindowMsgData mData1, WindowMsgData mData2 )
  58. {
  59. // get player
  60. Player *player = ThePlayerList->getLocalPlayer();
  61. //
  62. // if the player doesn't have a radar, or the radar is hidden, and the radar is not being
  63. // forced to on, we just eat input over the radar window
  64. //
  65. if( !TheRadar->isRadarForced() && (TheRadar->isRadarHidden() || !player->hasRadar()) )
  66. return MSG_HANDLED;
  67. // If the middle mouse button is depressed, then just let the message fall all the
  68. // way back to the usual middle mouse button processing.
  69. // jkmcd
  70. if( TheMouse->getMouseStatus()->middleState == MBS_Down )
  71. return MSG_IGNORED;
  72. switch( msg )
  73. {
  74. /** @todo
  75. This is wrong. The radar should be in the message stream, and eat all messages and propagate them
  76. as a new message with the coords converted to world coords and the message flagged as being from
  77. the radar. This would let all of the normal processing occur, and allow individual commands to easily
  78. reject being used on the radar.
  79. */
  80. // ------------------------------------------------------------------------
  81. case GWM_NONE:
  82. case GWM_MOUSE_ENTERING:
  83. case GWM_MOUSE_LEAVING:
  84. {
  85. //
  86. // consider changing the mouse cursor if we are not in the process of firing
  87. // targeted "superweapons" which we can use the radar itself to fire
  88. //
  89. Bool targeting = FALSE;
  90. const CommandButton *command = TheInGameUI->getGUICommand();
  91. if( command
  92. && (command->getCommandType() == GUI_COMMAND_SPECIAL_POWER || command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT)
  93. && BitTest( command->getOptions(), NEED_TARGET_POS ) )
  94. targeting = TRUE;
  95. if( targeting == FALSE )
  96. {
  97. const DrawableList *drawableList = TheInGameUI->getAllSelectedLocalDrawables();
  98. Mouse::MouseCursor cur = Mouse::ARROW;
  99. if (!(drawableList->empty() || msg == GWM_MOUSE_LEAVING))
  100. {
  101. if (command && command->getCommandType() == GUI_COMMAND_ATTACK_MOVE)
  102. {
  103. cur = Mouse::ATTACKMOVETO;
  104. }
  105. else
  106. {
  107. cur = Mouse::MOVETO;
  108. }
  109. }
  110. // Groovy
  111. TheMouse->setCursor(cur);
  112. } // end if
  113. return MSG_HANDLED;
  114. }
  115. // --------------------------------------------------------------------------------------------
  116. case GWM_MOUSE_POS:
  117. {
  118. // get mouse position
  119. ICoord2D mouse;
  120. mouse.x = mData1 & 0xFFFF;
  121. mouse.y = mData1 >> 16;
  122. // get window screen position
  123. ICoord2D screenPos;
  124. window->winGetScreenPosition( &screenPos.x, &screenPos.y );
  125. // set mouse position to be relative to this window
  126. mouse.x -= screenPos.x;
  127. mouse.y -= screenPos.y;
  128. // is the mouse in the radar window
  129. ICoord2D radar;
  130. if( (TheRadar->isRadarHidden() == FALSE || TheRadar->isRadarForced()) &&
  131. TheRadar->localPixelToRadar( &mouse, &radar ) )
  132. {
  133. /*
  134. //
  135. // this is an example piece of code to find the object under the pixel position
  136. // of the radar ... should we in the future wish to allow commands to be executed
  137. // on objects throught he radar. note tho that this is extremely hard to do because
  138. // the pixels on the radar are very small and it's hard to do accurate targeting
  139. //
  140. Object *obj = TheRadar->objectUnderRadarPixel( &mouse );
  141. UnicodeString msg;
  142. if( obj )
  143. msg.format( L"Object under mouse on radar '%S'(%d)",
  144. obj->getTemplate()->getName().str(), obj->getID() );
  145. else
  146. msg.format( L"Mouse (%d,%d) in Radar window L(%d,%d)", mouse.x, mouse.y, radar.x, radar.y );
  147. TheInGameUI->message( msg );
  148. */
  149. // keep the cursor for any context commands
  150. const CommandButton *command = TheInGameUI->getGUICommand();
  151. if( command
  152. && (command->getCommandType() == GUI_COMMAND_SPECIAL_POWER || command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT)
  153. && BitTest( command->getOptions(), NEED_TARGET_POS ) )
  154. {
  155. Int index = TheMouse->getCursorIndex( command->getCursorName() );
  156. if( index != Mouse::INVALID_MOUSE_CURSOR )
  157. TheMouse->setCursor( (Mouse::MouseCursor)index );
  158. else
  159. TheMouse->setCursor( Mouse::CROSS );
  160. } // end if
  161. else
  162. {
  163. // Else we are not super targeting, so we have to try to refresh the move cursor.
  164. // We can't just do this on Enter and Exit, because hotkeys allow state to change
  165. // while we are in the radar.
  166. const DrawableList *drawableList = TheInGameUI->getAllSelectedLocalDrawables();
  167. Mouse::MouseCursor cur = Mouse::ARROW;
  168. if (!(drawableList->empty() || msg == GWM_MOUSE_LEAVING))
  169. {
  170. if (command && command->getCommandType() == GUI_COMMAND_ATTACK_MOVE)
  171. {
  172. cur = Mouse::ATTACKMOVETO;
  173. }
  174. else
  175. {
  176. cur = Mouse::MOVETO;
  177. }
  178. }
  179. // Groovy
  180. TheMouse->setCursor(cur);
  181. }
  182. } // end if
  183. break;
  184. } // end case mouse position
  185. // ------------------------------------------------------------------------
  186. case GWM_RIGHT_UP:// Here to eat
  187. case GWM_LEFT_UP:// Here to eat
  188. break;
  189. case GWM_RIGHT_DOWN:
  190. case GWM_LEFT_DOWN:
  191. {
  192. ICoord2D mouse;
  193. ICoord2D radar;
  194. ICoord2D size;
  195. ICoord2D screenPos;
  196. Coord3D world;
  197. // get window size
  198. window->winGetSize( &size.x, &size.y );
  199. // get mouse position
  200. mouse.x = mData1 & 0xFFFF;
  201. mouse.y = mData1 >> 16;
  202. // get window screen position
  203. window->winGetScreenPosition( &screenPos.x, &screenPos.y );
  204. // set mouse position to be relative to this window
  205. mouse.x -= screenPos.x;
  206. mouse.y -= screenPos.y;
  207. //
  208. // translate mouse position to radar position ... we know that the mouse
  209. // location given to us here is relative to the HUD window, which is
  210. // completely drawn with the radar ... so it's just a translation from
  211. // our window size we're drawing into to the radar cell size
  212. //
  213. if( (TheRadar->isRadarHidden() == FALSE || TheRadar->isRadarForced()) &&
  214. TheRadar->localPixelToRadar( &mouse, &radar ) &&
  215. TheRadar->radarToWorld( &radar, &world ) )
  216. {
  217. // No drawables, or a right click automatically means its a look at.
  218. // Having drawables and being in attack move mode means that we should attack move.
  219. // Having drawables and not being in attack move mode means that we should move.
  220. const DrawableList *drawableList = TheInGameUI->getAllSelectedLocalDrawables(); // locally-owned only
  221. // see if the user wants to move the tactical view
  222. if ( drawableList->empty()
  223. || (! TheGlobalData->m_useAlternateMouse && msg == GWM_RIGHT_DOWN)
  224. || (TheGlobalData->m_useAlternateMouse && msg == GWM_LEFT_DOWN) )
  225. {
  226. TheTacticalView->lookAt( &world );
  227. break;
  228. }
  229. // evaluate any special powers that can be executed from the radar
  230. const CommandButton *command = TheInGameUI->getGUICommand();
  231. if( command
  232. && (command->getCommandType() == GUI_COMMAND_SPECIAL_POWER || command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT)
  233. && BitTest( command->getOptions(), NEED_TARGET_POS )
  234. )
  235. {
  236. // do the command
  237. TheGameClient->evaluateContextCommand( NULL, &world, CommandTranslator::DO_COMMAND );
  238. } // end if
  239. else if( command && command->getCommandType() == GUI_COMMAND_ATTACK_MOVE)
  240. {
  241. // Attack move has changed from a modifier to a command, so it moves up here.
  242. GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_DO_ATTACKMOVETO );
  243. msg->appendLocationArgument( world );
  244. // Play the unit voice response
  245. pickAndPlayUnitVoiceResponse(TheInGameUI->getAllSelectedDrawables(), GameMessage::MSG_DO_ATTACKMOVETO);
  246. }
  247. else
  248. {
  249. GameMessage *newMsg = NULL;
  250. // Do the superweapon stuff here, before issuing these other messages
  251. // GS Leaving commented out to show that isInAttackMoveToMode is NEVER SET. It's a command now, not a modifier.
  252. // if (TheInGameUI->isInAttackMoveToMode())
  253. // {
  254. // newMsg = TheMessageStream->appendMessage(GameMessage::MSG_DO_ATTACKMOVETO);
  255. // newMsg->appendLocationArgument(world);
  256. // // Play the unit voice response
  257. // pickAndPlayUnitVoiceResponse(drawableList, GameMessage::MSG_DO_ATTACKMOVETO);
  258. // break;
  259. // }
  260. newMsg = TheMessageStream->appendMessage(GameMessage::MSG_DO_MOVETO);
  261. newMsg->appendLocationArgument(world);
  262. // Play the unit voice response
  263. pickAndPlayUnitVoiceResponse(drawableList, GameMessage::MSG_DO_MOVETO);
  264. } // end else
  265. }
  266. break;
  267. } // end left down
  268. // ------------------------------------------------------------------------
  269. default:
  270. return MSG_IGNORED;
  271. } // end switch( msg )
  272. TheInGameUI->clearAttackMoveToMode();
  273. return MSG_HANDLED;
  274. } // end LeftHUDInput
  275. //-------------------------------------------------------------------------------------------------
  276. /** Input procedure for the control bar */
  277. //-------------------------------------------------------------------------------------------------
  278. WindowMsgHandledType ControlBarInput( GameWindow *window, UnsignedInt msg,
  279. WindowMsgData mData1, WindowMsgData mData2 )
  280. {
  281. return MSG_IGNORED;
  282. } // end ControlBarInput
  283. void ToggleQuitMenu(void);
  284. //-------------------------------------------------------------------------------------------------
  285. /** System callback for the control bar parent */
  286. //-------------------------------------------------------------------------------------------------
  287. WindowMsgHandledType ControlBarSystem( GameWindow *window, UnsignedInt msg,
  288. WindowMsgData mData1, WindowMsgData mData2 )
  289. {
  290. static NameKeyType buttonCommunicator = NAMEKEY_INVALID;
  291. if(TheScriptEngine && TheScriptEngine->isGameEnding())
  292. return MSG_IGNORED;
  293. switch( msg )
  294. {
  295. // --------------------------------------------------------------------------------------------
  296. case GWM_CREATE:
  297. {
  298. // get ids for our children controls
  299. buttonCommunicator = TheNameKeyGenerator->nameToKey( AsciiString("ControlBar.wnd:PopupCommunicator") );
  300. break;
  301. } // end create
  302. //---------------------------------------------------------------------------------------------
  303. case GBM_MOUSE_ENTERING:
  304. case GBM_MOUSE_LEAVING:
  305. {
  306. GameWindow *control = (GameWindow *)mData1;
  307. TheControlBar->processContextSensitiveButtonTransition( control, (GadgetGameMessage)msg);
  308. break;
  309. }
  310. //---------------------------------------------------------------------------------------------
  311. case GBM_SELECTED:
  312. case GBM_SELECTED_RIGHT:
  313. {
  314. GameWindow *control = (GameWindow *)mData1;
  315. static NameKeyType beaconPlacementButtonID = NAMEKEY("ControlBar.wnd:ButtonPlaceBeacon");
  316. static NameKeyType beaconDeleteButtonID = NAMEKEY("ControlBar.wnd:ButtonDeleteBeacon");
  317. static NameKeyType beaconClearTextButtonID = NAMEKEY("ControlBar.wnd:ButtonClearBeaconText");
  318. static NameKeyType beaconGeneralButtonID = NAMEKEY("ControlBar.wnd:ButtonGeneral");
  319. // static NameKeyType buttonSmallID = NAMEKEY("ControlBar.wnd:ButtonSmall");
  320. // static NameKeyType buttonMediumID = NAMEKEY("ControlBar.wnd:ButtonMedium");
  321. static NameKeyType buttonLargeID = NAMEKEY("ControlBar.wnd:ButtonLarge");
  322. static NameKeyType buttonOptions = NAMEKEY("ControlBar.wnd:ButtonOptions");
  323. static NameKeyType buttonIdleWorker = NAMEKEY("ControlBar.wnd:ButtonIdleWorker");
  324. Int controlID = control->winGetWindowId();
  325. if( controlID == buttonCommunicator )
  326. {
  327. ToggleDiplomacy(FALSE);
  328. }
  329. else if( controlID == beaconPlacementButtonID && TheGameLogic->isInMultiplayerGame() &&
  330. ThePlayerList->getLocalPlayer()->isPlayerActive())
  331. {
  332. const CommandButton *commandButton = TheControlBar->findCommandButton( "Command_PlaceBeacon" );
  333. TheInGameUI->setGUICommand( commandButton );
  334. }
  335. else if( controlID == beaconDeleteButtonID && TheGameLogic->isInMultiplayerGame() )
  336. {
  337. TheMessageStream->appendMessage( GameMessage::MSG_REMOVE_BEACON );
  338. }
  339. else if( controlID == beaconClearTextButtonID && TheGameLogic->isInMultiplayerGame() )
  340. {
  341. static NameKeyType textID = NAMEKEY("ControlBar.wnd:EditBeaconText");
  342. GameWindow *win = TheWindowManager->winGetWindowFromId(NULL, textID);
  343. if (win)
  344. {
  345. GadgetTextEntrySetText( win, UnicodeString::TheEmptyString );
  346. }
  347. }
  348. else if( controlID == beaconGeneralButtonID)
  349. {
  350. HideQuitMenu( );
  351. TheControlBar->togglePurchaseScience();
  352. }
  353. //else if( controlID == buttonSmallID)
  354. // {
  355. // TheControlBar->switchControlBarStage( CONTROL_BAR_STAGE_LOW );
  356. // }
  357. // else if( controlID == buttonMediumID)
  358. // {
  359. // TheControlBar->switchControlBarStage( CONTROL_BAR_STAGE_SQUISHED );
  360. // }
  361. else if( controlID == buttonLargeID)
  362. {
  363. TheControlBar->toggleControlBarStage();
  364. }
  365. else if( controlID == buttonOptions)
  366. {
  367. ToggleQuitMenu();
  368. }
  369. else if( controlID == buttonIdleWorker)
  370. {
  371. HideQuitMenu( );
  372. TheInGameUI->selectNextIdleWorker();
  373. }
  374. else
  375. {
  376. //
  377. // all buttons from all the context sensitive user interface windows are part of the
  378. // control bar, send the button processing that way
  379. //
  380. TheControlBar->processContextSensitiveButtonClick( control, (GadgetGameMessage)msg );
  381. }
  382. break;
  383. } // end button selected
  384. //---------------------------------------------------------------------------------------------
  385. case GEM_EDIT_DONE:
  386. {
  387. GameWindow *control = (GameWindow *)mData1;
  388. Int controlID = control->winGetWindowId();
  389. static NameKeyType textID = NAMEKEY("ControlBar.wnd:EditBeaconText");
  390. if (controlID == textID)
  391. {
  392. // set beacon text
  393. if (TheInGameUI->getSelectCount() == 1)
  394. {
  395. GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_SET_BEACON_TEXT );
  396. UnicodeString newText = GadgetTextEntryGetText( control );
  397. TheLanguageFilter->filterLine(newText);
  398. const WideChar * c = newText.str();
  399. while ( c && *c )
  400. {
  401. msg->appendWideCharArgument( *c++ );
  402. }
  403. msg->appendWideCharArgument( L'\0' ); // trailing NULL
  404. }
  405. }
  406. break;
  407. } // end edit done
  408. //---------------------------------------------------------------------------------------------
  409. default:
  410. return MSG_IGNORED;
  411. } // end switch( msg )
  412. return MSG_HANDLED;
  413. } // end ControlBarSystem
  414. extern void showReplayControls( void );
  415. extern void hideReplayControls( void );
  416. extern void toggleReplayControls( void );
  417. //-------------------------------------------------------------------------------------------------
  418. /** Force the control bar to be shown */
  419. //-------------------------------------------------------------------------------------------------
  420. void ShowControlBar( Bool immediate )
  421. {
  422. showReplayControls();
  423. if(TheControlBar)
  424. TheControlBar->showSpecialPowerShortcut();
  425. if (TheWindowManager)
  426. {
  427. Int id = (Int)TheNameKeyGenerator->nameToKey(AsciiString("ControlBar.wnd:ControlBarParent"));
  428. GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id);
  429. if (window)
  430. {
  431. TheControlBar->switchControlBarStage(CONTROL_BAR_STAGE_DEFAULT);
  432. TheTacticalView->setHeight((Int)(TheDisplay->getHeight() * 0.80f));
  433. if (TheControlBar->m_animateWindowManager && !immediate)
  434. {
  435. TheControlBar->m_animateWindowManager->reset();
  436. //TheControlBar->m_animateWindowManager->registerGameWindow(window, WIN_ANIMATION_SLIDE_BOTTOM_TIMED, TRUE, 1000, 0);
  437. TheControlBar->m_animateWindowManager->registerGameWindow(window, WIN_ANIMATION_SLIDE_BOTTOM, TRUE, 500, 0);
  438. TheControlBar->animateSpecialPowerShortcut(TRUE);
  439. }
  440. window->winHide(FALSE);
  441. }
  442. }
  443. // We want to get everything recalced since this is a major state change.
  444. if(TheControlBar)
  445. TheControlBar->markUIDirty();
  446. }// void ShowControlBar(void)
  447. //-------------------------------------------------------------------------------------------------
  448. /** Force the control bar to be hidden */
  449. //-------------------------------------------------------------------------------------------------
  450. void HideControlBar( Bool immediate )
  451. {
  452. hideReplayControls();
  453. if(TheControlBar)
  454. TheControlBar->hideSpecialPowerShortcut();
  455. if (TheWindowManager)
  456. {
  457. Int id = (Int)TheNameKeyGenerator->nameToKey(AsciiString("ControlBar.wnd:ControlBarParent"));
  458. GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id);
  459. if (window)
  460. {
  461. #ifdef SLIDE_LETTERBOX
  462. TheTacticalView->setHeight((Int)(TheDisplay->getHeight() * 0.80f));
  463. #else
  464. TheTacticalView->setHeight(TheDisplay->getHeight());
  465. #endif
  466. }
  467. if (immediate)
  468. {
  469. window->winHide(TRUE);
  470. if(TheControlBar)
  471. TheControlBar->hideSpecialPowerShortcut();
  472. }
  473. else
  474. {
  475. TheControlBar->m_animateWindowManager->reverseAnimateWindow();
  476. TheControlBar->animateSpecialPowerShortcut(FALSE);
  477. }
  478. //Always get rid of the purchase science screen!
  479. if( TheControlBar )
  480. {
  481. TheControlBar->hidePurchaseScience();
  482. }
  483. }
  484. }//void HideControlBar( void )
  485. //-------------------------------------------------------------------------------------------------
  486. /** Toggle the control bar on or off */
  487. //-------------------------------------------------------------------------------------------------
  488. void ToggleControlBar( Bool immediate )
  489. {
  490. toggleReplayControls();
  491. if (TheWindowManager)
  492. {
  493. Int id = (Int)TheNameKeyGenerator->nameToKey(AsciiString("ControlBar.wnd:ControlBarParent"));
  494. GameWindow *window = TheWindowManager->winGetWindowFromId(NULL, id);
  495. if (window)
  496. {
  497. if (window->winIsHidden())
  498. {
  499. if(TheControlBar)
  500. TheControlBar->showSpecialPowerShortcut();
  501. //now hidden, we're making it visible again so shrink viewport under the window
  502. TheTacticalView->setHeight((Int)(TheDisplay->getHeight() * 0.80f));
  503. window->winHide(!window->winIsHidden());
  504. TheControlBar->switchControlBarStage(CONTROL_BAR_STAGE_DEFAULT);
  505. if (TheControlBar->m_animateWindowManager && !immediate)
  506. {
  507. TheControlBar->m_animateWindowManager->reset();
  508. //TheControlBar->m_animateWindowManager->registerGameWindow(window, WIN_ANIMATION_SLIDE_BOTTOM_TIMED, FALSE, 500, 0);
  509. TheControlBar->m_animateWindowManager->registerGameWindow(window, WIN_ANIMATION_SLIDE_BOTTOM, TRUE, 500, 0);
  510. TheControlBar->animateSpecialPowerShortcut(TRUE);
  511. }
  512. }
  513. else
  514. {
  515. if(TheControlBar)
  516. TheControlBar->hideSpecialPowerShortcut();
  517. TheTacticalView->setHeight(TheDisplay->getHeight());
  518. window->winHide(!window->winIsHidden());
  519. }
  520. }
  521. }
  522. }// end void ToggleControlBar( void )
  523. //-------------------------------------------------------------------------------------------------
  524. /** Resize the control bar */
  525. //-------------------------------------------------------------------------------------------------