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.

91 lines
2.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef MAP_SHARED_H
  7. #define MAP_SHARED_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "ChunkFile.h"
  12. #include "bsplib.h"
  13. #include "cmdlib.h"
  14. struct LoadEntity_t
  15. {
  16. entity_t *pEntity;
  17. int nID;
  18. int nBaseFlags;
  19. int nBaseContents;
  20. };
  21. class CMapError
  22. {
  23. public:
  24. void BrushState( int brushID )
  25. {
  26. m_brushID = brushID;
  27. }
  28. void BrushSide( int side )
  29. {
  30. m_sideIndex = side;
  31. }
  32. void TextureState( const char *pTextureName )
  33. {
  34. Q_strncpy( m_textureName, pTextureName, sizeof( m_textureName ) );
  35. }
  36. void ClearState( void )
  37. {
  38. BrushState( 0 );
  39. BrushSide( 0 );
  40. TextureState( "Not a Parse error!" );
  41. }
  42. //-----------------------------------------------------------------------------
  43. // Purpose: Hook the map parse errors and report brush/ent/texture state
  44. // Input : *pErrorString -
  45. //-----------------------------------------------------------------------------
  46. void ReportError( const char *pErrorString )
  47. {
  48. Error( "Brush %i: %s\nSide %i\nTexture: %s\n", m_brushID, pErrorString, m_sideIndex, m_textureName );
  49. }
  50. //-----------------------------------------------------------------------------
  51. // Purpose: Hook the map parse errors and report brush/ent/texture state without exiting.
  52. // Input : pWarningString -
  53. //-----------------------------------------------------------------------------
  54. void ReportWarning( const char *pWarningString )
  55. {
  56. printf( "Brush %i, Side %i: %s\n", m_brushID, m_sideIndex, pWarningString );
  57. }
  58. private:
  59. int m_brushID;
  60. int m_sideIndex;
  61. char m_textureName[80];
  62. };
  63. extern CMapError g_MapError;
  64. extern int g_nMapFileVersion;
  65. // Shared mapload code.
  66. ChunkFileResult_t LoadEntityKeyCallback( const char *szKey, const char *szValue, LoadEntity_t *pLoadEntity );
  67. // Used by VRAD incremental lighting - only load ents from the file and
  68. // fill in the global entities/num_entities array.
  69. bool LoadEntsFromMapFile( char const *pFilename );
  70. #endif // MAP_SHARED_H