about summary refs log tree commit diff
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2011-01-17 13:28:15 +0100
committeroy <Tom_Adams@web.de>2011-01-17 13:28:15 +0100
commitbf6fcc20f4a9cccab0470d5848a2401bd0bfe93e (patch)
treea945e41ad55c5a0d5877e60e3eefa90e563e907a
parent40f6740742c7d967038abdd5a582d8b50712d1b2 (diff)
downloadzcatch-bf6fcc20f4a9cccab0470d5848a2401bd0bfe93e.tar.gz
zcatch-bf6fcc20f4a9cccab0470d5848a2401bd0bfe93e.zip
added an error popup on startup when the sound couldn't be initialised. Closes #425
-rw-r--r--data/languages/bosnian.txt6
-rw-r--r--data/languages/czech.txt6
-rw-r--r--data/languages/dutch.txt6
-rw-r--r--data/languages/finnish.txt6
-rw-r--r--data/languages/french.txt6
-rw-r--r--data/languages/german.txt6
-rw-r--r--data/languages/italian.txt6
-rw-r--r--data/languages/polish.txt6
-rw-r--r--data/languages/portuguese.txt6
-rw-r--r--data/languages/romanian.txt6
-rw-r--r--data/languages/russian.txt6
-rw-r--r--data/languages/serbian.txt6
-rw-r--r--data/languages/swedish.txt6
-rw-r--r--data/languages/ukrainian.txt6
-rw-r--r--src/engine/client.h2
-rw-r--r--src/engine/client/client.cpp2
-rw-r--r--src/engine/client/client.h3
-rw-r--r--src/game/client/components/menus.cpp15
-rw-r--r--src/game/client/components/menus.h1
19 files changed, 106 insertions, 1 deletions
diff --git a/data/languages/bosnian.txt b/data/languages/bosnian.txt
index 8f183bb1..c8806356 100644
--- a/data/languages/bosnian.txt
+++ b/data/languages/bosnian.txt
@@ -867,6 +867,9 @@ Select layer. Right click for properties.
 Shift
 == 
 
+Sound error
+== 
+
 Square
 == 
 
@@ -882,6 +885,9 @@ Switch between images and layers managment.
 Switch curve type
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/czech.txt b/data/languages/czech.txt
index 0383f26e..9b39066a 100644
--- a/data/languages/czech.txt
+++ b/data/languages/czech.txt
@@ -858,6 +858,9 @@ Shift
 Show chat
 == 
 
+Sound error
+== 
+
 Square
 == 
 
@@ -876,6 +879,9 @@ Switch between images and layers managment.
 Switch curve type
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/dutch.txt b/data/languages/dutch.txt
index fc5d2a8d..cf55a647 100644
--- a/data/languages/dutch.txt
+++ b/data/languages/dutch.txt
@@ -963,6 +963,12 @@ no limit
 Name plates size
 == 
 
+Sound error
+== 
+
+The audio device couldn't be initialised.
+== 
+
 Unable to delete the demo
 == 
 
diff --git a/data/languages/finnish.txt b/data/languages/finnish.txt
index 6c240eef..f97a10e5 100644
--- a/data/languages/finnish.txt
+++ b/data/languages/finnish.txt
@@ -864,6 +864,9 @@ Select layer. Right click for properties.
 Shift
 == 
 
+Sound error
+== 
+
 Square
 == 
 
@@ -879,6 +882,9 @@ Switch between images and layers managment.
 Switch curve type
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/french.txt b/data/languages/french.txt
index febb632d..e19aa1e2 100644
--- a/data/languages/french.txt
+++ b/data/languages/french.txt
@@ -897,6 +897,9 @@ Rotation of the envelope
 Shift
 == 
 
+Sound error
+== 
+
 Squares the current quad
 == 
 
@@ -909,6 +912,9 @@ Switch between images and layers managment.
 Switch curve type
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/german.txt b/data/languages/german.txt
index ca1c5007..da62f00e 100644
--- a/data/languages/german.txt
+++ b/data/languages/german.txt
@@ -963,6 +963,12 @@ no limit
 Name plates size
 == 
 
+Sound error
+== 
+
+The audio device couldn't be initialised.
+== 
+
 Unable to delete the demo
 == 
 
diff --git a/data/languages/italian.txt b/data/languages/italian.txt
index e93ac0be..495033aa 100644
--- a/data/languages/italian.txt
+++ b/data/languages/italian.txt
@@ -855,6 +855,9 @@ Shift
 Show chat
 == 
 
+Sound error
+== 
+
 Square
 == 
 
@@ -873,6 +876,9 @@ Switch between images and layers managment.
 Switch curve type
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/polish.txt b/data/languages/polish.txt
index 2fee6abc..9c693e2d 100644
--- a/data/languages/polish.txt
+++ b/data/languages/polish.txt
@@ -930,9 +930,15 @@ Rotation of the envelope
 Shift
 == 
 
+Sound error
+== 
+
 Stop record
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/portuguese.txt b/data/languages/portuguese.txt
index eb1770f0..db7beab2 100644
--- a/data/languages/portuguese.txt
+++ b/data/languages/portuguese.txt
@@ -864,6 +864,9 @@ Select layer. Right click for properties.
 Shift
 == 
 
+Sound error
+== 
+
 Square
 == 
 
@@ -879,6 +882,9 @@ Switch between images and layers managment.
 Switch curve type
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/romanian.txt b/data/languages/romanian.txt
index 9e33ca35..49886482 100644
--- a/data/languages/romanian.txt
+++ b/data/languages/romanian.txt
@@ -963,6 +963,12 @@ no limit
 
 ##### needs translation #####
 
+Sound error
+== 
+
+The audio device couldn't be initialised.
+== 
+
 Unable to delete the demo
 == 
 
diff --git a/data/languages/russian.txt b/data/languages/russian.txt
index 8ae65a8c..d708923d 100644
--- a/data/languages/russian.txt
+++ b/data/languages/russian.txt
@@ -930,9 +930,15 @@ Rotation of the envelope
 Shift
 == 
 
+Sound error
+== 
+
 Stop record
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/serbian.txt b/data/languages/serbian.txt
index e3d106de..54445eba 100644
--- a/data/languages/serbian.txt
+++ b/data/languages/serbian.txt
@@ -864,6 +864,9 @@ Select layer. Right click for properties.
 Shift
 == 
 
+Sound error
+== 
+
 Square
 == 
 
@@ -879,6 +882,9 @@ Switch between images and layers managment.
 Switch curve type
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/swedish.txt b/data/languages/swedish.txt
index b779995f..4ee8e04d 100644
--- a/data/languages/swedish.txt
+++ b/data/languages/swedish.txt
@@ -855,6 +855,9 @@ Shift
 Show chat
 == 
 
+Sound error
+== 
+
 Square
 == 
 
@@ -873,6 +876,9 @@ Switch between images and layers managment.
 Switch curve type
 == 
 
+The audio device couldn't be initialised.
+== 
+
 Tiles
 == 
 
diff --git a/data/languages/ukrainian.txt b/data/languages/ukrainian.txt
index 477bed26..c526600c 100644
--- a/data/languages/ukrainian.txt
+++ b/data/languages/ukrainian.txt
@@ -945,6 +945,12 @@ Rotation of the envelope
 Shift
 == 
 
+Sound error
+== 
+
+The audio device couldn't be initialised.
+== 
+
 Unable to delete the demo
 == 
 
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, 
 	};