summaryrefslogtreecommitdiff
path: root/game/client/viewangleanim.h
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 /game/client/viewangleanim.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/viewangleanim.h')
-rw-r--r--game/client/viewangleanim.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/game/client/viewangleanim.h b/game/client/viewangleanim.h
new file mode 100644
index 0000000..c5d08bc
--- /dev/null
+++ b/game/client/viewangleanim.h
@@ -0,0 +1,75 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+//=============================================================================//
+
+#include "utlvector.h"
+
+#define VIEWANIM_RELATIVE (1<<0) // angles in keyframe are relative, add anim to current angles
+#define VIEWANIM_IGNORE_X (1<<1) // ignore the x component of this animation
+#define VIEWANIM_IGNORE_Y (1<<2) // ditto for y
+#define VIEWANIM_IGNORE_Z (1<<3) // ditto for z
+
+#define QAngleToVector(a,v) { v[0] = a[0]; v[1] = a[1]; v[2] = a[2]; }
+
+class CViewAngleKeyFrame
+{
+public:
+ CViewAngleKeyFrame( QAngle vecAngles, float flTime, int iFlags )
+ {
+ m_vecAngles = vecAngles;
+ m_flTime = flTime;
+ m_iFlags = iFlags;
+ }
+
+ // the target angles for this keyframe in the view angle animation
+ QAngle m_vecAngles;
+
+ // time position of this keyframe
+ float m_flTime;
+
+ int m_iFlags;
+};
+
+
+typedef void (*ViewAnimCompleteCallback)( void );
+
+class CViewAngleAnimation : public C_BaseEntity
+{
+public:
+ CViewAngleAnimation();
+ ~CViewAngleAnimation();
+
+ virtual void Spawn();
+
+ void DeleteKeyFrames();
+
+
+ void LoadViewAnimFile( const char *pKeyFrameFileName );
+ void SaveAsAnimFile( const char *pKeyFrameFileName );
+
+ void AddKeyFrame( CViewAngleKeyFrame *pKeyFrame );
+ bool IsFinished( void );
+ void RunAnimation( QAngle angles );
+ void ClientThink();
+
+ void SetAnimCompleteCallback( ViewAnimCompleteCallback pFunc )
+ {
+ m_pAnimCompleteCallback = pFunc;
+ }
+
+private:
+ void SetAngles( QAngle vecCalculatedAngles );
+
+ float m_flAnimStartTime; // time this animation started
+ bool m_bFinished;
+
+ CUtlVector<CViewAngleKeyFrame *> m_KeyFrames;
+
+ QAngle m_vecBaseAngles;
+
+ int m_iFlags;
+
+ ViewAnimCompleteCallback m_pAnimCompleteCallback;
+}; \ No newline at end of file