aboutsummaryrefslogtreecommitdiff
path: root/mp/src/game/client/simple_keys.cpp
diff options
context:
space:
mode:
authorJørgen P. Tjernø <[email protected]>2013-12-02 19:31:46 -0800
committerJørgen P. Tjernø <[email protected]>2013-12-02 19:46:31 -0800
commitf56bb35301836e56582a575a75864392a0177875 (patch)
treede61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/client/simple_keys.cpp
parentMark some more files as text. (diff)
downloadsource-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz
source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/client/simple_keys.cpp')
-rw-r--r--mp/src/game/client/simple_keys.cpp192
1 files changed, 96 insertions, 96 deletions
diff --git a/mp/src/game/client/simple_keys.cpp b/mp/src/game/client/simple_keys.cpp
index e8a84088..1a5af280 100644
--- a/mp/src/game/client/simple_keys.cpp
+++ b/mp/src/game/client/simple_keys.cpp
@@ -1,96 +1,96 @@
-//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-//=============================================================================//
-
-#include "cbase.h"
-#include "simple_keys.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-//-----------------------------------------------------------------------------
-// Simple key interpolations
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Input : &out -
-// t -
-// &start -
-// &end -
-//-----------------------------------------------------------------------------
-void CSimpleKeyInterp::Interp( Vector &out, float t, const CSimpleKeyInterp &start, const CSimpleKeyInterp &end )
-{
- float delta = end.GetTime() - start.GetTime();
- t = clamp( t-start.GetTime(), 0.f, delta );
-
- float unitT = (delta > 0) ? (t / delta) : 1;
-
- switch( end.m_interp )
- {
- case KEY_SPLINE:
- unitT = SimpleSpline( unitT );
- break;
- case KEY_ACCELERATE:
- unitT *= unitT;
- break;
- case KEY_DECELERATE:
- unitT = sqrt(unitT);
- break;
- default:
- case KEY_LINEAR:
- //unitT = unitT;
- break;
- }
- out = (1-unitT) * ((Vector)start) + unitT * ((Vector)end);
-}
-
-//-----------------------------------------------------------------------------
-// Simple key list
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Input : &key -
-// Output : int
-//-----------------------------------------------------------------------------
-int CSimpleKeyList::Insert( const CSimpleKeyInterp &key )
-{
- for ( int i = 0; i < m_list.Count(); i++ )
- {
- if ( key.GetTime() < m_list[i].GetTime() )
- return m_list.InsertBefore( i, key );
- }
-
- return m_list.AddToTail( key );
-}
-
-//-----------------------------------------------------------------------------
-// Purpose:
-// Input : &out -
-// t -
-// Output : Returns true on success, false on failure.
-//-----------------------------------------------------------------------------
-bool CSimpleKeyList::Interp( Vector &out, float t )
-{
- int startIndex = -1;
-
- out.Init();
- for ( int i = 0; i < m_list.Count(); i++ )
- {
- if ( t < m_list[i].GetTime() )
- {
- // before start
- if ( startIndex < 0 )
- return false;
- CSimpleKeyInterp::Interp( out, t, m_list[startIndex], m_list[i] );
- return true;
- }
- startIndex = i;
- }
-
- // past end
- return false;
-}
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#include "cbase.h"
+#include "simple_keys.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+//-----------------------------------------------------------------------------
+// Simple key interpolations
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// Purpose:
+// Input : &out -
+// t -
+// &start -
+// &end -
+//-----------------------------------------------------------------------------
+void CSimpleKeyInterp::Interp( Vector &out, float t, const CSimpleKeyInterp &start, const CSimpleKeyInterp &end )
+{
+ float delta = end.GetTime() - start.GetTime();
+ t = clamp( t-start.GetTime(), 0.f, delta );
+
+ float unitT = (delta > 0) ? (t / delta) : 1;
+
+ switch( end.m_interp )
+ {
+ case KEY_SPLINE:
+ unitT = SimpleSpline( unitT );
+ break;
+ case KEY_ACCELERATE:
+ unitT *= unitT;
+ break;
+ case KEY_DECELERATE:
+ unitT = sqrt(unitT);
+ break;
+ default:
+ case KEY_LINEAR:
+ //unitT = unitT;
+ break;
+ }
+ out = (1-unitT) * ((Vector)start) + unitT * ((Vector)end);
+}
+
+//-----------------------------------------------------------------------------
+// Simple key list
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// Purpose:
+// Input : &key -
+// Output : int
+//-----------------------------------------------------------------------------
+int CSimpleKeyList::Insert( const CSimpleKeyInterp &key )
+{
+ for ( int i = 0; i < m_list.Count(); i++ )
+ {
+ if ( key.GetTime() < m_list[i].GetTime() )
+ return m_list.InsertBefore( i, key );
+ }
+
+ return m_list.AddToTail( key );
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+// Input : &out -
+// t -
+// Output : Returns true on success, false on failure.
+//-----------------------------------------------------------------------------
+bool CSimpleKeyList::Interp( Vector &out, float t )
+{
+ int startIndex = -1;
+
+ out.Init();
+ for ( int i = 0; i < m_list.Count(); i++ )
+ {
+ if ( t < m_list[i].GetTime() )
+ {
+ // before start
+ if ( startIndex < 0 )
+ return false;
+ CSimpleKeyInterp::Interp( out, t, m_list[startIndex], m_list[i] );
+ return true;
+ }
+ startIndex = i;
+ }
+
+ // past end
+ return false;
+}