Counter Strike : Global Offensive Source Code
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.

110 lines
2.9 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef MAPPLAYERHULLHANDLE_H
  7. #define MAPPLAYERHULLHANDLE_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "MapHelper.h"
  12. #include "ToolInterface.h"
  13. class CHelperInfo;
  14. class CRender2D;
  15. class CRender3D;
  16. class CMapPlayerHullHandle;
  17. #define MAX_KEYNAME_SIZE 32
  18. class CMapPlayerHullHandle : public CMapHelper
  19. {
  20. friend class CMapAxisHandle;
  21. friend class CMapSweptPlayerHull;
  22. public:
  23. DECLARE_MAPCLASS(CMapPlayerHullHandle,CMapHelper)
  24. //
  25. // Factory for building from a list of string parameters.
  26. //
  27. static CMapClass *Create(CHelperInfo *pInfo, CMapEntity *pParent);
  28. void Attach( CMapSweptPlayerHull *pOwner );
  29. inline int GetRadius(void);
  30. //
  31. // Construction/destruction:
  32. //
  33. CMapPlayerHullHandle(void);
  34. CMapPlayerHullHandle(const char *pszKey, bool bDrawLineToParent);
  35. ~CMapPlayerHullHandle(void);
  36. void CalcBounds(BOOL bFullUpdate = FALSE);
  37. virtual CMapClass *Copy(bool bUpdateDependencies);
  38. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  39. virtual void Render2D(CRender2D *pRender);
  40. virtual void Render3D(CRender3D *pRender);
  41. virtual int SerializeRMF(std::fstream &File, BOOL bRMF);
  42. virtual int SerializeMAP(std::fstream &File, BOOL bRMF);
  43. // Overridden because origin helpers don't take the color of their parent entity.
  44. virtual void SetRenderColor(unsigned char red, unsigned char green, unsigned char blue);
  45. virtual void SetRenderColor(color32 rgbColor);
  46. virtual bool HitTest2D(CMapView2D *pView, const Vector2D &point, HitInfo_t &HitData);
  47. virtual CMapClass *PrepareSelection(SelectMode_t eSelectMode);
  48. virtual bool IsVisualElement(void) { return false; } // Only visible if our parent is selected.
  49. virtual bool IsClutter(void) const { return true; }
  50. virtual bool CanBeCulledByCordon() const { return false; } // We don't hide unless our parent hides.
  51. virtual const char* GetDescription() { return("Player hull handle"); }
  52. virtual void OnAddToWorld(CMapWorld *pWorld);
  53. virtual void OnParentKeyChanged(const char *key, const char *value);
  54. virtual void OnUndoRedo(void);
  55. virtual void PostloadWorld(CMapWorld *pWorld);
  56. protected:
  57. // Called by the point handle tool while dragging.
  58. void UpdateOrigin(const Vector &vecOrigin);
  59. // Overridden to update our parent's keyvalue when we move.
  60. virtual void DoTransform(const VMatrix &matrix);
  61. private:
  62. void Initialize(void);
  63. void UpdateParentKey(void);
  64. CMapSweptPlayerHull *m_pOwner; // The swept player hull that we belong to.
  65. char m_szKeyName[MAX_KEYNAME_SIZE];
  66. bool m_bDrawLineToParent;
  67. };
  68. //-----------------------------------------------------------------------------
  69. // Purpose:
  70. //-----------------------------------------------------------------------------
  71. int CMapPlayerHullHandle::GetRadius(void)
  72. {
  73. return HANDLE_RADIUS;
  74. }
  75. #endif // MAPPLAYERHULLHANDLE_H