Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef MAPKEYFRAME_H
  8. #define MAPKEYFRAME_H
  9. #pragma once
  10. #include "MapHelper.h"
  11. #include "hammer_mathlib.h"
  12. #include "keyframe/keyframe.h"
  13. class CMapAnimator;
  14. class CHelperInfo;
  15. class CMapKeyFrame : public CMapHelper
  16. {
  17. public:
  18. DECLARE_MAPCLASS(CMapKeyFrame,CMapHelper);
  19. //
  20. // Factories.
  21. //
  22. static CMapClass *CreateMapKeyFrame(CHelperInfo *pHelperInfo, CMapEntity *pParent);
  23. //
  24. // Construction/destruction.
  25. //
  26. CMapKeyFrame(void);
  27. ~CMapKeyFrame(void);
  28. void CalcBounds(BOOL bFullUpdate = FALSE);
  29. virtual size_t GetSize( void ) { return sizeof(*this); }
  30. void Render3D(CRender3D *pRender);
  31. virtual CMapClass *Copy(bool bUpdateDependencies);
  32. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  33. virtual void SetOrigin( Vector& pfOrigin );
  34. virtual void GetQuatAngles( Quaternion &outQuat );
  35. virtual void OnClone( CMapClass *pClone, CMapWorld *pWorld, const CMapObjectList &OriginalList, CMapObjectList &NewList );
  36. virtual void OnNotifyDependent(CMapClass *pObject, Notify_Dependent_t eNotifyType);
  37. virtual void OnParentKeyChanged( const char* key, const char* value );
  38. virtual void OnRemoveFromWorld( CMapWorld *pWorld, bool bNotifyChildren );
  39. virtual void UpdateDependencies(CMapWorld *pWorld, CMapClass *pObject);
  40. bool IsAnyKeyInSequenceSelected( void );
  41. CMapKeyFrame *NextKeyFrame( void );
  42. void SetAnimator(CMapAnimator *pAnimator);
  43. virtual CMapAnimator *GetAnimator(void) { return m_pAnimator; }
  44. CMapEntity *GetParentEntity( void );
  45. float GetRemainingTime( CMapObjectList *pVisited = NULL );
  46. float MoveTime( void ) { return m_flMoveTime; }
  47. IPositionInterpolator* SetupPositionInterpolator( int iInterpolator );
  48. protected:
  49. void SetNextKeyFrame( CMapKeyFrame *pNext );
  50. void RecalculateTimeFromSpeed( void );
  51. void CheckForKeyFrameNextKeyLoops( void );
  52. void BuildPathSegment( CMapKeyFrame *pPrev );
  53. IPositionInterpolator *m_pPositionInterpolator;
  54. int m_iPositionInterpolator;
  55. int m_iChangeFrame;
  56. Quaternion m_qAngles;
  57. QAngle m_Angles;
  58. float m_flMoveTime; // time it takes to travel to next key frame
  59. float m_flSpeed; // average speed travelling to next time; if this is non-zero, m_flMoveTime is calculated from it
  60. CMapAnimator *m_pAnimator; // The animator that is at the head of our path.
  61. CMapKeyFrame *m_pNextKeyFrame; // The next keyframe in our path.
  62. enum
  63. {
  64. MAX_LINE_POINTS = 10,
  65. };
  66. Vector m_LinePoints[MAX_LINE_POINTS];
  67. bool m_bRebuildPath;
  68. friend CMapAnimator;
  69. };
  70. #endif // MAPKEYFRAME_H