about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorfisted <van.fisted@googlemail.com>2011-01-18 06:50:24 +0100
committeroy <Tom_Adams@web.de>2011-01-20 00:15:18 +0100
commit372b62566b15bbcf79e3320d6daf751e04b7e501 (patch)
treed1123b210f1cd36014d6c1c9e3f742415e012434 /src
parent17012416369663cdd5bdeead537faede3b8b308d (diff)
downloadzcatch-372b62566b15bbcf79e3320d6daf751e04b7e501.tar.gz
zcatch-372b62566b15bbcf79e3320d6daf751e04b7e501.zip
fixed tower bug
Diffstat (limited to 'src')
-rw-r--r--src/game/gamecore.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/game/gamecore.cpp b/src/game/gamecore.cpp
index c3c29537..629b32e8 100644
--- a/src/game/gamecore.cpp
+++ b/src/game/gamecore.cpp
@@ -320,13 +320,15 @@ void CCharacterCore::Tick(bool UseInput)
 			if(d < PhysSize*1.25f && d > 1.0f)
 			{
 				float a = (PhysSize*1.45f - d);
-				
+				float v = 0.5f;
+
 				// make sure that we don't add excess force by checking the
-				// direction against the current velocity
-				vec2 VelDir = normalize(m_Vel);
-				float v = 1-(dot(VelDir, Dir)+1)/2;
-				m_Vel = m_Vel + Dir*a*(v*0.75f);
-				m_Vel = m_Vel * 0.85f;
+				// direction against the current velocity. if not zero.
+				if (length(m_Vel) > 0.0001)
+					v = 1-(dot(normalize(m_Vel), Dir)+1)/2;
+
+				m_Vel += Dir*a*(v*0.75f);
+				m_Vel *= 0.85f;
 			}
 			
 			// handle hook influence