about summary refs log tree commit diff
path: root/src/game/client/components/camera.cpp
diff options
context:
space:
mode:
authoroy <Tom_Adams@web.de>2010-09-19 16:00:46 +0200
committeroy <Tom_Adams@web.de>2010-09-19 16:00:46 +0200
commit80b570c7952ef6cc4f54b4cbb1b873a5b770a5d7 (patch)
tree2f47635f2fcb668bc3ffaca39144fa31081599af /src/game/client/components/camera.cpp
parent0905b7755d4d5da79144979ffae554476d44495f (diff)
downloadzcatch-80b570c7952ef6cc4f54b4cbb1b873a5b770a5d7.tar.gz
zcatch-80b570c7952ef6cc4f54b4cbb1b873a5b770a5d7.zip
fixed view offset when changing from spectator to player. Closes #152
Diffstat (limited to 'src/game/client/components/camera.cpp')
-rw-r--r--src/game/client/components/camera.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/game/client/components/camera.cpp b/src/game/client/components/camera.cpp
index 96baf459..185f02c5 100644
--- a/src/game/client/components/camera.cpp
+++ b/src/game/client/components/camera.cpp
@@ -10,6 +10,7 @@
 
 CCamera::CCamera()
 {
+	m_WasSpectator = false;
 }
 
 void CCamera::OnRender()
@@ -19,10 +20,17 @@ void CCamera::OnRender()
 
 	// update camera center		
 	if(m_pClient->m_Snap.m_Spectate)
+	{
 		m_Center = m_pClient->m_pControls->m_MousePos;
+		m_WasSpectator = true;
+	}
 	else
 	{
-
+		if(m_WasSpectator)
+		{
+			m_pClient->m_pControls->ClampMousePos();
+			m_WasSpectator = false;
+		}
 		float l = length(m_pClient->m_pControls->m_MousePos);
 		float DeadZone = g_Config.m_ClMouseDeadzone;
 		float FollowFactor = g_Config.m_ClMouseFollowfactor/100.0f;