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.

109 lines
2.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef MAPPOINTHANDLE_H
  8. #define MAPPOINTHANDLE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "MapHelper.h"
  13. #include "ToolInterface.h"
  14. class CHelperInfo;
  15. class CRender2D;
  16. class CRender3D;
  17. class CMapPointHandle;
  18. #define MAX_KEYNAME_SIZE 32
  19. class CMapPointHandle : public CMapHelper
  20. {
  21. friend class CToolPointHandle;
  22. friend class CMapAxisHandle;
  23. friend class CMapSweptPlayerHull;
  24. public:
  25. DECLARE_MAPCLASS(CMapPointHandle,CMapHelper)
  26. //
  27. // Factory for building from a list of string parameters.
  28. //
  29. static CMapClass *Create(CHelperInfo *pInfo, CMapEntity *pParent);
  30. inline int GetRadius(void);
  31. //
  32. // Construction/destruction:
  33. //
  34. CMapPointHandle(void);
  35. CMapPointHandle(const char *pszKey, bool bDrawLineToParent);
  36. ~CMapPointHandle(void);
  37. void CalcBounds(BOOL bFullUpdate = FALSE);
  38. virtual CMapClass *Copy(bool bUpdateDependencies);
  39. virtual CMapClass *CopyFrom(CMapClass *pFrom, bool bUpdateDependencies);
  40. virtual void Render2D(CRender2D *pRender);
  41. virtual void Render3D(CRender3D *pRender);
  42. virtual int SerializeRMF(std::fstream &File, BOOL bRMF);
  43. virtual int SerializeMAP(std::fstream &File, BOOL bRMF);
  44. // Overridden because origin helpers don't take the color of their parent entity.
  45. virtual void SetRenderColor(unsigned char red, unsigned char green, unsigned char blue);
  46. virtual void SetRenderColor(color32 rgbColor);
  47. virtual bool HitTest2D(CMapView2D *pView, const Vector2D &point, HitInfo_t &HitData);
  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("Point helper"); }
  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. virtual CBaseTool *GetToolObject(int nHitData, bool bAttachObject);
  57. protected:
  58. // Called by the point handle tool while dragging.
  59. void UpdateOrigin(const Vector &vecOrigin);
  60. // Overridden to update our parent's keyvalue when we move.
  61. virtual void DoTransform(const VMatrix &matrix);
  62. private:
  63. void Initialize(void);
  64. void UpdateParentKey(void);
  65. char m_szKeyName[MAX_KEYNAME_SIZE];
  66. bool m_bDrawLineToParent;
  67. };
  68. //-----------------------------------------------------------------------------
  69. // Purpose:
  70. //-----------------------------------------------------------------------------
  71. int CMapPointHandle::GetRadius(void)
  72. {
  73. return HANDLE_RADIUS;
  74. }
  75. #endif // MAPPOINTHANDLE_H