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.

111 lines
3.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Implements a helper that manages a single keyvalue of type "side"
  4. // or "sidelist" for the entity that is its parent.
  5. //
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef MAPSIDELIST_H
  9. #define MAPSIDELIST_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "MapFace.h"
  14. #include "MapHelper.h"
  15. class CHelperInfo;
  16. class CMapEntity;
  17. class CMapSolid;
  18. class CMapSideList : public CMapHelper
  19. {
  20. public:
  21. //
  22. // Factory function.
  23. //
  24. static CMapClass *CreateMapSideList(CHelperInfo *pHelperInfo, CMapEntity *pParent);
  25. //
  26. // Construction/destruction:
  27. //
  28. CMapSideList(void);
  29. CMapSideList(char const *pszKeyName);
  30. virtual ~CMapSideList(void);
  31. DECLARE_MAPCLASS(CMapSideList,CMapHelper)
  32. public:
  33. virtual size_t GetSize(void);
  34. //
  35. // Replication.
  36. //
  37. virtual CMapClass *Copy(bool bUpdateDependencies);
  38. virtual CMapClass *CopyFrom(CMapClass *pOther, bool bUpdateDependencies);
  39. //
  40. // Should NOT have children.
  41. //
  42. virtual void AddChild(CMapClass *pChild) { Assert(false); }
  43. virtual void UpdateChild(CMapClass *pChild) { Assert(false); }
  44. //
  45. // Notifications.
  46. //
  47. virtual void OnClone(CMapClass *pClone, CMapWorld *pWorld, const CMapObjectList &OriginalList, CMapObjectList &NewList);
  48. virtual void OnNotifyDependent(CMapClass *pObject, Notify_Dependent_t eNotifyType);
  49. virtual void OnParentKeyChanged(const char* key, const char* value);
  50. virtual void OnPaste(CMapClass *pCopy, CMapWorld *pSourceWorld, CMapWorld *pDestWorld, const CMapObjectList &OriginalList, CMapObjectList &NewList);
  51. virtual void OnRemoveFromWorld(CMapWorld *pWorld, bool bNotifyChildren);
  52. //
  53. // Spatial functions.
  54. //
  55. virtual void CalcBounds(BOOL bFullUpdate = FALSE);
  56. virtual const char* GetDescription(void) { return "Side list helper"; }
  57. //
  58. // Serialization.
  59. //
  60. virtual bool ShouldSerialize(void) { return(false); }
  61. //
  62. // Can be rendered:
  63. //
  64. virtual void Render2D(CRender2D *pRender);
  65. virtual void Render3D(CRender3D *pRender);
  66. //
  67. // Getting face data.
  68. //
  69. int GetFaceCount( void ) { return m_Faces.Count(); }
  70. CMapFace *GetFace( int index ) { return m_Faces.Element( index ); }
  71. const char *GetKeyName( void ) { return m_szKeyName; }
  72. protected:
  73. virtual void UpdateDependencies(CMapWorld *pWorld, CMapClass *pObject);
  74. void RebuildFaceList();
  75. void BuildFaceListForValue(char const *pszValue, CMapWorld *pWorld);
  76. CMapFace *FindFaceIDInList(int nFaceID, const CMapObjectList &List);
  77. void ReplaceFacesInCopy(CMapSideList *pCopy, const CMapObjectList &OriginalList, CMapObjectList &NewList);
  78. bool ReplaceSolidFaces(CMapSolid *pOrigSolid, CMapSolid *pNewSolid);
  79. void RemoveFacesNotInList(const CMapObjectList &List);
  80. void UpdateParentKey(void);
  81. char m_szKeyName[80]; // The name of the key in our parent entity that we represent.
  82. CMapFaceList m_Faces; // The list of solid faces that this object manages.
  83. CUtlVector<int> m_LostFaceIDs; // The list of face IDs that were in m_Faces, but were lost during this session through the deletion of their solid.
  84. };
  85. #endif // MAPSIDELIST_H