diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/engine/client.h | 2 | ||||
| -rw-r--r-- | src/engine/client/client.cpp | 2 | ||||
| -rw-r--r-- | src/engine/client/client.h | 3 | ||||
| -rw-r--r-- | src/game/client/components/menus.cpp | 15 | ||||
| -rw-r--r-- | src/game/client/components/menus.h | 1 |
5 files changed, 22 insertions, 1 deletions
diff --git a/src/engine/client.h b/src/engine/client.h index a0ebb3e7..2da2bd8b 100644 --- a/src/engine/client.h +++ b/src/engine/client.h @@ -130,6 +130,8 @@ public: virtual const char *ErrorString() = 0; virtual const char *LatestVersion() = 0; virtual bool ConnectionProblems() = 0; + + virtual bool SoundInitFailed() = 0; }; class IGameClient : public IInterface diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 9b8c4151..3652b272 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -1803,7 +1803,7 @@ void CClient::Run() m_pEditor->Init(); // init sound, allowed to fail - Sound()->Init(); + m_SoundInitFailed = Sound()->Init() != 0; // load data if(!LoadData()) diff --git a/src/engine/client/client.h b/src/engine/client/client.h index f25e7cf7..8ba70662 100644 --- a/src/engine/client/client.h +++ b/src/engine/client/client.h @@ -142,6 +142,7 @@ class CClient : public IClient, public CDemoPlayer::IListner int m_SnapCrcErrors; bool m_AutoScreenshotRecycle; bool m_EditorActive; + bool m_SoundInitFailed; int m_AckGameTick; int m_CurrentRecvTick; @@ -235,6 +236,8 @@ public: virtual bool ConnectionProblems(); + virtual bool SoundInitFailed() { return m_SoundInitFailed; } + void DirectInput(int *pInput, int Size); void SendInput(); diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index d70e0b88..cac86588 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -753,6 +753,14 @@ int CMenus::Render() // some margin around the screen Screen.Margin(10.0f, &Screen); + static bool s_SoundCheck = false; + if(!s_SoundCheck && m_Popup == POPUP_NONE) + { + if(Client()->SoundInitFailed()) + m_Popup = POPUP_SOUNDERROR; + s_SoundCheck = true; + } + if(m_Popup == POPUP_NONE) { // do tab bar @@ -840,6 +848,13 @@ int CMenus::Render() pExtraText = Localize("Are you sure that you want to delete the demo?"); ExtraAlign = -1; } + else if(m_Popup == POPUP_SOUNDERROR) + { + pTitle = Localize("Sound error"); + pExtraText = Localize("The audio device couldn't be initialised."); + pButtonText = Localize("Ok"); + ExtraAlign = -1; + } else if(m_Popup == POPUP_PASSWORD) { pTitle = Localize("Password incorrect"); diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 5e93a90a..40f6f1bd 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -97,6 +97,7 @@ class CMenus : public CComponent POPUP_PURE, POPUP_LANGUAGE, POPUP_DELETE_DEMO, + POPUP_SOUNDERROR, POPUP_PASSWORD, POPUP_QUIT, }; |