diff --git a/Source/UserInterface/GameShell.cpp b/Source/UserInterface/GameShell.cpp index b1f5d0a7..45002b64 100644 --- a/Source/UserInterface/GameShell.cpp +++ b/Source/UserInterface/GameShell.cpp @@ -138,7 +138,6 @@ windowClientSize_(1024, 768) GameActive = false; GameContinue = true; showKeysHelp_ = false; - interfaceShowFlag_ = true; autoSwitchAITimer = 0; @@ -893,7 +892,7 @@ void GameShell::Show() if(showWireFrame_) terRenderDevice->SetRenderState(RS_WIREFRAME,0); - if(interfaceShowFlag_) + if(_shellIconManager.interfaceShowFlag()) universe()->ShowInfo(); showWays(); @@ -1471,13 +1470,20 @@ bool GameShell::DebugKeyPressed(sKey& Key) case VK_SPACE: showWireFrame_ = !showWireFrame_; break; - case VK_F8: - _shellIconManager.Toggle(GameActive); - interfaceShowFlag_ ^= 1; - break; + case VK_F8 | KBD_SHIFT: + if (!_shellIconManager.isCutSceneMode()) { + _shellIconManager.Toggle(GameActive); + _shellIconManager.toggleInterfaceShowFlag(); + } + break; + case VK_F8: + if (!_shellIconManager.isCutSceneMode()) { + _shellIconManager.toggleInterfaceShowFlag(); + } + break; case VK_F7: - interfaceShowFlag_ ^= 1; - _shellIconManager.setCutSceneMode(!interfaceShowFlag_); + _shellIconManager.toggleInterfaceShowFlag(); + _shellIconManager.setCutSceneMode(!_shellIconManager.interfaceShowFlag()); break; case 'D': universe()->select.explodeUnit(); @@ -1610,7 +1616,7 @@ void GameShell::KeyPressed(sKey& Key) return; } - if (gameShell->currentSingleProfile.getLastGameType() == UserSingleProfile::MULTIPLAYER) { + if (_shellIconManager.IsInterface() && gameShell->currentSingleProfile.getLastGameType() == UserSingleProfile::MULTIPLAYER) { CChatInGameEditWindow* chatEdit = (CChatInGameEditWindow*) _shellIconManager.GetWnd(SQSH_INGAME_CHAT_EDIT_ID); CChatInfoWindow* chatInfo = (CChatInfoWindow*) _shellIconManager.GetWnd(SQSH_CHAT_INFO_ID); if (Key.fullkey == VK_INSERT) { @@ -1706,7 +1712,7 @@ void GameShell::ControlPressed(int key) int ctrl = g_controls_converter.control(key); if (ctrl == CTRL_ESCAPE) { //temp - if(_shellIconManager.IsInterface() && interfaceShowFlag_) + if(_shellIconManager.IsInterface() && _shellIconManager.interfaceShowFlag()) { //if(MainMenuEnable) EnterInMissionMenu(); @@ -2062,7 +2068,7 @@ void GameShell::MouseRightUnpressed(const Vect2f& pos) void GameShell::MouseWheel(int delta) { - if(!_bMenuMode && GameActive && !isScriptReelEnabled() && !(cameraMouseShift && mouseLeftPressed_)) { + if(!_bMenuMode && GameActive && _shellIconManager.IsInterface() && !isScriptReelEnabled() && !(cameraMouseShift && mouseLeftPressed_)) { CChatInfoWindow* chatInfo = (CChatInfoWindow*) _shellIconManager.GetWnd(SQSH_CHAT_INFO_ID); if (!chatInfo || !chatInfo->isVisible() || !chatInfo->HitTest(mousePosition().x+0.5f, mousePosition().y+0.5f)) { terCamera->mouseWheel(delta); diff --git a/Source/UserInterface/GameShell.h b/Source/UserInterface/GameShell.h index d6ec75f2..de532eb6 100644 --- a/Source/UserInterface/GameShell.h +++ b/Source/UserInterface/GameShell.h @@ -164,7 +164,6 @@ class GameShell void rememberPlayerCamera(terPlayer* player, const char* triggerName); - bool interfaceShowFlag() const { return interfaceShowFlag_; } bool showKeysHelp() const { return showKeysHelp_; } cFont* debugFont() const { return debugFont_; } @@ -313,7 +312,6 @@ class GameShell Vect2f mousePressControl_; bool alwaysRun_; - bool interfaceShowFlag_; bool showKeysHelp_; bool showWireFrame_; int activePlayerID_; diff --git a/Source/UserInterface/Menu/MultiplayerCommon.cpp b/Source/UserInterface/Menu/MultiplayerCommon.cpp index 9b4b3eff..632c38dd 100644 --- a/Source/UserInterface/Menu/MultiplayerCommon.cpp +++ b/Source/UserInterface/Menu/MultiplayerCommon.cpp @@ -367,7 +367,7 @@ void GameShell::addStringToChatWindow(bool clanOnly, const std::string& newStrin ////////// Latency info //////////// int updateLatencyInfoWindowQuant( float, float ) { - if (!_shellIconManager.getDesktop()) { + if (!_shellIconManager.IsInterface()) { return 0; } CNetLatencyInfoWindow* wnd = safe_cast(_shellIconManager.GetWnd(SQSH_NET_LATENCY_INFO_ID)); diff --git a/Source/UserInterface/PerimeterShellDisp.cpp b/Source/UserInterface/PerimeterShellDisp.cpp index 35573dab..c202316c 100644 --- a/Source/UserInterface/PerimeterShellDisp.cpp +++ b/Source/UserInterface/PerimeterShellDisp.cpp @@ -862,6 +862,7 @@ CShellIconManager::CShellIconManager() initialMenu = SQSH_MM_START_SCR; m_editMode = false; + interfaceShowFlag_ = true; speechSound = 0; resultMusicStarted = false; @@ -946,10 +947,10 @@ CShellIconManager::~CShellIconManager() void CShellIconManager::addChatString(const LocalizedText* newChatString) { CChatInfoWindow* wnd; - if (cutSceneModeOn) { - wnd = (CChatInfoWindow*)controls[SQSH_CHAT_INFO_ID]; + if (interfaceShowFlag()) { + wnd = (CChatInfoWindow*)GetWnd(SQSH_CHAT_INFO_ID); } else { - wnd = (CChatInfoWindow*)GetWnd(SQSH_CHAT_INFO_ID); + wnd = (CChatInfoWindow*)controls[SQSH_CHAT_INFO_ID]; } xassert(wnd); if (wnd) { @@ -961,10 +962,10 @@ void CShellIconManager::addChatString(const LocalizedText* newChatString) { void CShellIconManager::showHintChat(const LocalizedText* text, int showTime) { CChatInfoWindow* wnd; - if (cutSceneModeOn) { - wnd = (CChatInfoWindow*)controls[SQSH_CHAT_INFO_ID]; + if (interfaceShowFlag()) { + wnd = (CChatInfoWindow*)GetWnd(SQSH_CHAT_INFO_ID); } else { - wnd = (CChatInfoWindow*)GetWnd(SQSH_CHAT_INFO_ID); + wnd = (CChatInfoWindow*)controls[SQSH_CHAT_INFO_ID]; } if (wnd) { wnd->AddString(text); @@ -978,10 +979,10 @@ void CShellIconManager::showHint(const char* text, int showTime, ActionTask::Typ } CHintWindow* wnd; - if (cutSceneModeOn) { - wnd = (CHintWindow*)controls[SQSH_HINT_ID]; + if (interfaceShowFlag()) { + wnd = (CHintWindow*)GetWnd(SQSH_HINT_ID); } else { - wnd = (CHintWindow*)GetWnd(SQSH_HINT_ID); + wnd = (CHintWindow*)controls[SQSH_HINT_ID]; } xassert(wnd); if (wnd) { @@ -1080,10 +1081,10 @@ void CShellIconManager::fillTaskWnd() { } CTextWindow* wnd; - if (cutSceneModeOn) { - wnd = (CTextWindow*)controls[SQSH_MM_MISSION_TASK_TXT]; + if (interfaceShowFlag()) { + wnd = (CTextWindow*)GetWnd(SQSH_MM_MISSION_TASK_TXT); } else { - wnd = (CTextWindow*)GetWnd(SQSH_MM_MISSION_TASK_TXT); + wnd = (CTextWindow*)controls[SQSH_MM_MISSION_TASK_TXT]; } xassert(wnd); if (wnd) { @@ -1479,10 +1480,11 @@ CShellWindow* CShellIconManager::GetWnd(int id) // return 0; - if(getDesktop() && m_pDesktop->ID == id) - return m_pDesktop; - else - return controls[id]; + if (getDesktop() && m_pDesktop->ID == id) { + return m_pDesktop; + } else { + return controls[id]; + } // return FindWnd(m_pDesktop, id); } @@ -2408,9 +2410,9 @@ void CShellIconManager::draw() return; } - if(!mt_interface_quant) - return; - + if (!mt_interface_quant || !interfaceShowFlag()) { + return; + } if(getDesktop()) { @@ -2937,7 +2939,7 @@ void CShellIconManager::UpdateIcons() if(_bDebugDisplayAllIcons) return; - if(!getDesktop() || _bMenuMode) + if (!getDesktop() || _bMenuMode || !interfaceShowFlag()) return; // if(!universe()->activePlayer()) @@ -3857,10 +3859,12 @@ void CShellIconManager::ClearSquadIconTable() } bool CtrlAction::actionPerformed() { - CShellWindow* wnd = _shellIconManager.GetWnd(controlID); - if (wnd) { - return wnd->actionPerformed( action.code, action.param ); - } + if (_shellIconManager.IsInterface()) { + CShellWindow* wnd = _shellIconManager.GetWnd(controlID); + if (wnd) { + return wnd->actionPerformed(action.code, action.param); + } + } return false; } diff --git a/Source/UserInterface/PerimeterShellUI.h b/Source/UserInterface/PerimeterShellUI.h index 17130c52..46106cc0 100644 --- a/Source/UserInterface/PerimeterShellUI.h +++ b/Source/UserInterface/PerimeterShellUI.h @@ -1711,6 +1711,8 @@ class CShellIconManager CutSceneCommand cutSceneCommand; + bool interfaceShowFlag_; + public: std::string hold; std::string units; @@ -1772,6 +1774,8 @@ class CShellIconManager CShellWindow* GetModalWnd(); int IsFocusControl(); bool isInEditMode() const; + void toggleInterfaceShowFlag() { interfaceShowFlag_ = !interfaceShowFlag_; } + bool interfaceShowFlag() const { return interfaceShowFlag_; } int OnLButtonDown(float x, float y); int OnLButtonUp(float x, float y); @@ -1801,7 +1805,7 @@ class CShellIconManager m_dyn_queue.clear(); } inline int IsEffect() { return m_fEffectTime>=0; } - inline int IsInterface(){ return getDesktop() != 0;} + inline int IsInterface(){ return getDesktop() != nullptr;} void ShowControls(int bShow, const ShellControlID ids[], int numIds); diff --git a/Source/UserInterface/ShellLogDisp.cpp b/Source/UserInterface/ShellLogDisp.cpp index 38187f99..183fa343 100644 --- a/Source/UserInterface/ShellLogDisp.cpp +++ b/Source/UserInterface/ShellLogDisp.cpp @@ -120,7 +120,7 @@ void CShellLogicDispatcher::quant(bool game_active) if(game_active) { - if ((isAltPressed() || alwaysShowLifeBars) && !_bMenuMode && !gameShell->isScriptReelEnabled() && !gameShell->isCutSceneMode()) { + if ((isAltPressed() || alwaysShowLifeBars) && !_bMenuMode && !gameShell->isScriptReelEnabled() && _shellIconManager.interfaceShowFlag()) { for (int i = 0; i < universe()->Players.size(); i++) { universe()->Players[i]->mark(); } @@ -295,10 +295,8 @@ void CShellLogicDispatcher::draw() } #endif // PERIMETER_DEBUG - if(_shellIconManager.IsInterface()) - { - if(!_bMenuMode) - m_hScene->Draw(m_hCamera); + if (_shellIconManager.IsInterface() && !_bMenuMode && _shellIconManager.interfaceShowFlag()) { + m_hScene->Draw(m_hCamera); } } @@ -568,7 +566,8 @@ int CShellLogicDispatcher::OnLButtonDblClk(float x, float y) if (_pUnitHover()) { terPlayer* pPlayer = universe()->activePlayer(); terFrame* fr = dynamic_cast(_pUnitHover()); - if (fr && pPlayer && _pUnitHover->playerID() == pPlayer->playerID() && _shellIconManager.GetWnd(SQSH_SELPANEL_FRAME_INSTALL_ID)->isEnabled()) { + if (fr && pPlayer && _pUnitHover->playerID() == pPlayer->playerID() + && _shellIconManager.IsInterface() && _shellIconManager.GetWnd(SQSH_SELPANEL_FRAME_INSTALL_ID)->isEnabled()) { if (!fr->attached() && fr->basementReady()) { universe()->makeCommand(COMMAND_ID_FRAME_ATTACH,0); }