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.

93 lines
2.6 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef MAPSPRITE_H
  8. #define MAPSPRITE_H
  9. #pragma once
  10. #include "MapHelper.h"
  11. #include "Sprite.h"
  12. class CRender3D;
  13. class CSpriteModel;
  14. //-----------------------------------------------------------------------------
  15. // Purpose:
  16. //-----------------------------------------------------------------------------
  17. class CMapSprite : public CMapHelper
  18. {
  19. public:
  20. //
  21. // Factories.
  22. //
  23. static CMapClass *CreateMapSprite(CHelperInfo *pHelperInfo, CMapEntity *pParent);
  24. static CMapSprite *CreateMapSprite(const char *pszSpritePath);
  25. //
  26. // Construction/destruction:
  27. //
  28. CMapSprite(void);
  29. ~CMapSprite(void);
  30. DECLARE_MAPCLASS(CMapSprite, CMapHelper)
  31. void CalcBounds(BOOL bFullUpdate = FALSE);
  32. virtual CMapClass *Copy(bool bUpdateDependencies);
  33. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  34. void Initialize(void);
  35. void Render2D(CRender2D *pRender);
  36. void Render3D(CRender3D *pRender);
  37. // Called by entity code to render sprites
  38. void RenderLogicalAt(CRender2D *pRender, const Vector2D &vecMins, const Vector2D &vecMaxs );
  39. void GetAngles(QAngle &Angles);
  40. int SerializeRMF(std::fstream &File, BOOL bRMF);
  41. int SerializeMAP(std::fstream &File, BOOL bRMF);
  42. static void SetRenderDistance(float fRenderDistance);
  43. static void EnableAnimation(BOOL bEnable);
  44. bool ShouldRenderLast(void);
  45. bool IsVisualElement(void) { return(true); }
  46. const char* GetDescription() { return("Sprite"); }
  47. void OnParentKeyChanged(const char* szKey, const char* szValue);
  48. protected:
  49. //
  50. // Implements CMapAtom transformation functions.
  51. //
  52. void DoTransform(const VMatrix &matrix);
  53. int GetNextSpriteFrame( CRender3D* pRender );
  54. void SetRenderMode( int mode );
  55. void SpriteColor(unsigned char *pColor, int eRenderMode, colorVec RenderColor, int alpha);
  56. QAngle m_Angles;
  57. CSpriteModel *m_pSpriteInfo; // Pointer to a sprite model in the cache.
  58. int m_nCurrentFrame; // Current sprite frame for rendering.
  59. float m_fSecondsPerFrame; // How many seconds to render each frame before advancing.
  60. float m_fElapsedTimeThisFrame; // How many seconds we have rendered this sprite frame so far.
  61. float m_fScale; // Sprite scale along sprite axes.
  62. int m_eRenderMode; // Our render mode (transparency, etc.).
  63. colorVec m_RenderColor; // Our render color.
  64. bool m_bIsIcon; // If true, this sprite is an iconic representation of an entity.
  65. };
  66. #endif // MAPSPRITE_H