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.

290 lines
8.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Defines game-specific data
  4. //
  5. // $Revision: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef GAMEBSPFILE_H
  9. #define GAMEBSPFILE_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. #include "mathlib/vector.h"
  14. #include "basetypes.h"
  15. //-----------------------------------------------------------------------------
  16. // This enumerations defines all the four-CC codes for the client lump names
  17. //-----------------------------------------------------------------------------
  18. enum
  19. {
  20. GAMELUMP_DETAIL_PROPS = 'dprp',
  21. GAMELUMP_DETAIL_PROP_LIGHTING = 'dplt',
  22. GAMELUMP_STATIC_PROPS = 'sprp',
  23. GAMELUMP_DETAIL_PROP_LIGHTING_HDR = 'dplh',
  24. };
  25. // Versions...
  26. enum
  27. {
  28. GAMELUMP_DETAIL_PROPS_VERSION = 4,
  29. GAMELUMP_DETAIL_PROP_LIGHTING_VERSION = 0,
  30. GAMELUMP_STATIC_PROPS_VERSION = 10,
  31. GAMELUMP_STATIC_PROP_LIGHTING_VERSION = 0,
  32. GAMELUMP_DETAIL_PROP_LIGHTING_HDR_VERSION = 0,
  33. };
  34. //-----------------------------------------------------------------------------
  35. // This is the data associated with the GAMELUMP_DETAIL_PROPS lump
  36. //-----------------------------------------------------------------------------
  37. #define DETAIL_NAME_LENGTH 128
  38. enum DetailPropOrientation_t
  39. {
  40. DETAIL_PROP_ORIENT_NORMAL = 0,
  41. DETAIL_PROP_ORIENT_SCREEN_ALIGNED,
  42. DETAIL_PROP_ORIENT_SCREEN_ALIGNED_VERTICAL,
  43. };
  44. // NOTE: If DetailPropType_t enum changes, change CDetailModel::QuadsToDraw
  45. // in detailobjectsystem.cpp
  46. enum DetailPropType_t
  47. {
  48. DETAIL_PROP_TYPE_MODEL = 0,
  49. DETAIL_PROP_TYPE_SPRITE,
  50. DETAIL_PROP_TYPE_SHAPE_CROSS,
  51. DETAIL_PROP_TYPE_SHAPE_TRI,
  52. };
  53. //-----------------------------------------------------------------------------
  54. // Model index when using studiomdls for detail props
  55. //-----------------------------------------------------------------------------
  56. struct DetailObjectDictLump_t
  57. {
  58. DECLARE_BYTESWAP_DATADESC();
  59. char m_Name[DETAIL_NAME_LENGTH]; // model name
  60. };
  61. //-----------------------------------------------------------------------------
  62. // Information about the sprite to render
  63. //-----------------------------------------------------------------------------
  64. struct DetailSpriteDictLump_t
  65. {
  66. DECLARE_BYTESWAP_DATADESC();
  67. // NOTE: All detail prop sprites must lie in the material detail/detailsprites
  68. Vector2D m_UL; // Coordinate of upper left
  69. Vector2D m_LR; // Coordinate of lower right
  70. Vector2D m_TexUL; // Texcoords of upper left
  71. Vector2D m_TexLR; // Texcoords of lower left
  72. };
  73. struct DetailObjectLump_t
  74. {
  75. DECLARE_BYTESWAP_DATADESC();
  76. Vector m_Origin;
  77. QAngle m_Angles;
  78. unsigned short m_DetailModel; // either index into DetailObjectDictLump_t or DetailPropSpriteLump_t
  79. unsigned short m_Leaf;
  80. ColorRGBExp32 m_Lighting;
  81. unsigned int m_LightStyles;
  82. unsigned char m_LightStyleCount;
  83. unsigned char m_SwayAmount; // how much do the details sway
  84. unsigned char m_ShapeAngle; // angle param for shaped sprites
  85. unsigned char m_ShapeSize; // size param for shaped sprites
  86. unsigned char m_Orientation; // See DetailPropOrientation_t
  87. unsigned char m_Padding2[3]; // FIXME: Remove when we rev the detail lump again..
  88. unsigned char m_Type; // See DetailPropType_t
  89. unsigned char m_Padding3[3]; // FIXME: Remove when we rev the detail lump again..
  90. float m_flScale; // For sprites only currently
  91. };
  92. //-----------------------------------------------------------------------------
  93. // This is the data associated with the GAMELUMP_DETAIL_PROP_LIGHTING lump
  94. //-----------------------------------------------------------------------------
  95. struct DetailPropLightstylesLump_t
  96. {
  97. DECLARE_BYTESWAP_DATADESC();
  98. ColorRGBExp32 m_Lighting;
  99. unsigned char m_Style;
  100. };
  101. //-----------------------------------------------------------------------------
  102. // This is the data associated with the GAMELUMP_STATIC_PROPS lump
  103. //-----------------------------------------------------------------------------
  104. enum
  105. {
  106. STATIC_PROP_NAME_LENGTH = 128,
  107. // Flags field
  108. // These are automatically computed
  109. STATIC_PROP_FLAG_FADES = 0x1,
  110. STATIC_PROP_USE_LIGHTING_ORIGIN = 0x2,
  111. STATIC_PROP_NO_DRAW = 0x4, // computed at run time based on dx level
  112. // These are set in WC
  113. STATIC_PROP_IGNORE_NORMALS = 0x8,
  114. STATIC_PROP_NO_SHADOW = 0x10,
  115. STATIC_PROP_SCREEN_SPACE_FADE = 0x20,
  116. STATIC_PROP_NO_PER_VERTEX_LIGHTING = 0x40, // in vrad, compute lighting at
  117. // lighting origin, not for each vertex
  118. STATIC_PROP_NO_SELF_SHADOWING = 0x80, // disable self shadowing in vrad
  119. STATIC_PROP_NO_PER_TEXEL_LIGHTING = 0x100, // whether we should do per-texel lightmaps in vrad.
  120. STATIC_PROP_WC_MASK = 0x1d8, // all flags settable in hammer (?)
  121. };
  122. struct StaticPropDictLump_t
  123. {
  124. DECLARE_BYTESWAP_DATADESC();
  125. char m_Name[STATIC_PROP_NAME_LENGTH]; // model name
  126. };
  127. struct StaticPropLumpV4_t
  128. {
  129. DECLARE_BYTESWAP_DATADESC();
  130. Vector m_Origin;
  131. QAngle m_Angles;
  132. unsigned short m_PropType;
  133. unsigned short m_FirstLeaf;
  134. unsigned short m_LeafCount;
  135. unsigned char m_Solid;
  136. unsigned char m_Flags;
  137. int m_Skin;
  138. float m_FadeMinDist;
  139. float m_FadeMaxDist;
  140. Vector m_LightingOrigin;
  141. // int m_Lighting; // index into the GAMELUMP_STATIC_PROP_LIGHTING lump
  142. };
  143. struct StaticPropLumpV5_t
  144. {
  145. DECLARE_BYTESWAP_DATADESC();
  146. Vector m_Origin;
  147. QAngle m_Angles;
  148. unsigned short m_PropType;
  149. unsigned short m_FirstLeaf;
  150. unsigned short m_LeafCount;
  151. unsigned char m_Solid;
  152. unsigned char m_Flags;
  153. int m_Skin;
  154. float m_FadeMinDist;
  155. float m_FadeMaxDist;
  156. Vector m_LightingOrigin;
  157. float m_flForcedFadeScale;
  158. // int m_Lighting; // index into the GAMELUMP_STATIC_PROP_LIGHTING lump
  159. };
  160. struct StaticPropLumpV6_t
  161. {
  162. DECLARE_BYTESWAP_DATADESC();
  163. Vector m_Origin;
  164. QAngle m_Angles;
  165. unsigned short m_PropType;
  166. unsigned short m_FirstLeaf;
  167. unsigned short m_LeafCount;
  168. unsigned char m_Solid;
  169. unsigned char m_Flags;
  170. int m_Skin;
  171. float m_FadeMinDist;
  172. float m_FadeMaxDist;
  173. Vector m_LightingOrigin;
  174. float m_flForcedFadeScale;
  175. unsigned short m_nMinDXLevel;
  176. unsigned short m_nMaxDXLevel;
  177. // int m_Lighting; // index into the GAMELUMP_STATIC_PROP_LIGHTING lump
  178. };
  179. struct StaticPropLump_t
  180. {
  181. DECLARE_BYTESWAP_DATADESC();
  182. Vector m_Origin;
  183. QAngle m_Angles;
  184. unsigned short m_PropType;
  185. unsigned short m_FirstLeaf;
  186. unsigned short m_LeafCount;
  187. unsigned char m_Solid;
  188. int m_Skin;
  189. float m_FadeMinDist;
  190. float m_FadeMaxDist;
  191. Vector m_LightingOrigin;
  192. float m_flForcedFadeScale;
  193. unsigned short m_nMinDXLevel;
  194. unsigned short m_nMaxDXLevel;
  195. // int m_Lighting; // index into the GAMELUMP_STATIC_PROP_LIGHTING lump
  196. unsigned int m_Flags;
  197. unsigned short m_nLightmapResolutionX;
  198. unsigned short m_nLightmapResolutionY;
  199. StaticPropLump_t& operator=(const StaticPropLumpV4_t& _rhs)
  200. {
  201. m_Origin = _rhs.m_Origin;
  202. m_Angles = _rhs.m_Angles;
  203. m_PropType = _rhs.m_PropType;
  204. m_FirstLeaf = _rhs.m_FirstLeaf;
  205. m_LeafCount = _rhs.m_LeafCount;
  206. m_Solid = _rhs.m_Solid;
  207. m_Flags = _rhs.m_Flags;
  208. m_Skin = _rhs.m_Skin;
  209. m_FadeMinDist = _rhs.m_FadeMinDist;
  210. m_FadeMaxDist = _rhs.m_FadeMaxDist;
  211. m_LightingOrigin = _rhs.m_LightingOrigin;
  212. // These get potentially set twice--once here and once in the caller.
  213. // Value judgement: This makes the code easier to work with, so unless it's a perf issue...
  214. m_flForcedFadeScale = 1.0f;
  215. m_nMinDXLevel = 0;
  216. m_nMaxDXLevel = 0;
  217. m_nLightmapResolutionX = 0;
  218. m_nLightmapResolutionY = 0;
  219. // Older versions don't want this.
  220. m_Flags |= STATIC_PROP_NO_PER_TEXEL_LIGHTING;
  221. return *this;
  222. }
  223. StaticPropLump_t& operator=(const StaticPropLumpV5_t& _rhs)
  224. {
  225. (*this) = reinterpret_cast<const StaticPropLumpV4_t&>(_rhs);
  226. m_flForcedFadeScale = _rhs.m_flForcedFadeScale;
  227. return *this;
  228. }
  229. StaticPropLump_t& operator=(const StaticPropLumpV6_t& _rhs)
  230. {
  231. (*this) = reinterpret_cast<const StaticPropLumpV5_t&>(_rhs);
  232. m_nMinDXLevel = _rhs.m_nMinDXLevel;
  233. m_nMaxDXLevel = _rhs.m_nMaxDXLevel;
  234. return *this;
  235. }
  236. };
  237. struct StaticPropLeafLump_t
  238. {
  239. DECLARE_BYTESWAP_DATADESC();
  240. unsigned short m_Leaf;
  241. };
  242. //-----------------------------------------------------------------------------
  243. // This is the data associated with the GAMELUMP_STATIC_PROP_LIGHTING lump
  244. //-----------------------------------------------------------------------------
  245. struct StaticPropLightstylesLump_t
  246. {
  247. ColorRGBExp32 m_Lighting;
  248. };
  249. #endif // GAMEBSPFILE_H