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.

153 lines
2.8 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef STOCKSOLIDS_H
  8. #define STOCKSOLIDS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #pragma warning(push, 1)
  13. #pragma warning(disable:4701 4702 4530)
  14. #include <fstream>
  15. #pragma warning(pop)
  16. #include "mathlib/vector.h"
  17. #include "MapFace.h"
  18. class BoundBox;
  19. class CMapSolid;
  20. class Vector;
  21. class StockSolid
  22. {
  23. public:
  24. void Serialize(std::fstream& file, BOOL bIsStoring);
  25. int GetFieldCount() const;
  26. void SetFieldData(int iIndex, int iData);
  27. int GetFieldData(int iIndex, int *piData = NULL) const;
  28. void GetFieldRange(int iIndex, int *piRangeLower, int *piRangeUpper);
  29. void SetOrigin(const Vector &o);
  30. void SetCenterOffset(const Vector &ofs);
  31. virtual void SetFromBox(BoundBox * pBox) {}
  32. virtual void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eAlignment) = 0;
  33. ~StockSolid();
  34. protected:
  35. StockSolid(int nFields);
  36. typedef enum
  37. {
  38. DFTYPE_INTEGER,
  39. DFTYPE_BOOLEAN
  40. } STSDF_TYPE;
  41. void AddDataField(STSDF_TYPE type, const char *pszName, int iRangeLower = -1,
  42. int iRangeUpper = -1);
  43. Vector origin;
  44. Vector cofs;
  45. private:
  46. void AllocateDataFields(int nFields);
  47. enum
  48. {
  49. DFFLAG_RANGED = 0x01
  50. };
  51. typedef struct
  52. {
  53. unsigned flags;
  54. STSDF_TYPE type;
  55. char szName[128];
  56. // range:
  57. int iRangeLower;
  58. int iRangeUpper;
  59. // value:
  60. int iValue;
  61. } STSDATAFIELD;
  62. STSDATAFIELD *pFields;
  63. int nFields;
  64. int iMaxFields;
  65. };
  66. class StockBlock : public StockSolid
  67. {
  68. public:
  69. StockBlock();
  70. void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
  71. void SetFromBox(BoundBox *pBox);
  72. enum { fieldWidth, fieldDepth, fieldHeight };
  73. };
  74. class StockWedge : public StockSolid
  75. {
  76. public:
  77. StockWedge();
  78. void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
  79. void SetFromBox(BoundBox *pBox);
  80. enum { fieldWidth, fieldDepth, fieldHeight };
  81. };
  82. class StockCylinder : public StockSolid
  83. {
  84. public:
  85. StockCylinder();
  86. void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
  87. void SetFromBox(BoundBox *pBox);
  88. enum { fieldWidth, fieldDepth, fieldHeight, fieldSideCount };
  89. };
  90. class StockSpike : public StockSolid
  91. {
  92. public:
  93. StockSpike();
  94. void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
  95. void SetFromBox(BoundBox *pBox);
  96. enum { fieldWidth, fieldDepth, fieldHeight, fieldSideCount };
  97. };
  98. class StockSphere : public StockSolid
  99. {
  100. public:
  101. StockSphere();
  102. void CreateMapSolid(CMapSolid *pSolid, TextureAlignment_t eTextureAlignment);
  103. void SetFromBox(BoundBox *pBox);
  104. enum { fieldWidth, fieldDepth, fieldHeight, fieldSideCount };
  105. };
  106. #endif // STOCKSOLIDS_H