summaryrefslogtreecommitdiff
path: root/engine/changeframelist.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /engine/changeframelist.cpp
downloadarchived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz
archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip
Diffstat (limited to 'engine/changeframelist.cpp')
-rw-r--r--engine/changeframelist.cpp108
1 files changed, 108 insertions, 0 deletions
diff --git a/engine/changeframelist.cpp b/engine/changeframelist.cpp
new file mode 100644
index 0000000..2469508
--- /dev/null
+++ b/engine/changeframelist.cpp
@@ -0,0 +1,108 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#include "basetypes.h"
+#include "changeframelist.h"
+#include "dt.h"
+#include "utlvector.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+
+class CChangeFrameList : public IChangeFrameList
+{
+public:
+
+ void Init( int nProperties, int iCurTick )
+ {
+ m_ChangeTicks.SetSize( nProperties );
+ for ( int i=0; i < nProperties; i++ )
+ m_ChangeTicks[i] = iCurTick;
+ }
+
+
+// IChangeFrameList implementation.
+public:
+
+ virtual void Release()
+ {
+ delete this;
+ }
+
+ virtual IChangeFrameList* Copy()
+ {
+ CChangeFrameList *pRet = new CChangeFrameList;
+
+ int numProps = m_ChangeTicks.Count();
+
+ pRet->m_ChangeTicks.SetSize( numProps );
+
+ for ( int i=0; i < numProps; i++ )
+ {
+ pRet->m_ChangeTicks[ i ] = m_ChangeTicks[ i ];
+ }
+
+ return pRet;
+
+ }
+
+ virtual int GetNumProps()
+ {
+ return m_ChangeTicks.Count();
+ }
+
+ virtual void SetChangeTick( const int *pPropIndices, int nPropIndices, const int iTick )
+ {
+ for ( int i=0; i < nPropIndices; i++ )
+ {
+ m_ChangeTicks[ pPropIndices[i] ] = iTick;
+ }
+ }
+
+ virtual int GetPropsChangedAfterTick( int iTick, int *iOutProps, int nMaxOutProps )
+ {
+ int nOutProps = 0;
+
+ int c = m_ChangeTicks.Count();
+
+ Assert( c <= nMaxOutProps );
+
+ for ( int i=0; i < c; i++ )
+ {
+ if ( m_ChangeTicks[i] > iTick )
+ {
+ iOutProps[nOutProps] = i;
+ ++nOutProps;
+ }
+ }
+
+ return nOutProps;
+ }
+
+// IChangeFrameList implementation.
+protected:
+
+ virtual ~CChangeFrameList()
+ {
+ }
+
+private:
+ // Change frames for each property.
+ CUtlVector<int> m_ChangeTicks;
+};
+
+
+IChangeFrameList* AllocChangeFrameList( int nProperties, int iCurTick )
+{
+ CChangeFrameList *pRet = new CChangeFrameList;
+ pRet->Init( nProperties, iCurTick);
+ return pRet;
+}
+
+
+