about summary refs log tree commit diff
path: root/src/game/client/components/sounds.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/client/components/sounds.cpp')
-rw-r--r--src/game/client/components/sounds.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/game/client/components/sounds.cpp b/src/game/client/components/sounds.cpp
index 4e9ef5b5..c4ade00e 100644
--- a/src/game/client/components/sounds.cpp
+++ b/src/game/client/components/sounds.cpp
@@ -65,8 +65,17 @@ void CSounds::OnInit()
 
 void CSounds::OnReset()
 {
-	Sound()->StopAll();
-	ClearQueue();
+	if(Client()->State() >= IClient::STATE_ONLINE)
+	{
+		Sound()->StopAll();
+		ClearQueue();
+	}
+}
+
+void CSounds::OnStateChange(int NewState, int OldState)
+{
+	if(NewState == IClient::STATE_ONLINE || NewState == IClient::STATE_DEMOPLAYBACK)
+		OnReset();
 }
 
 void CSounds::OnRender()