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.

78 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef DOWNLOADLISTGENERATOR_H
  7. #define DOWNLOADLISTGENERATOR_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "filesystem.h"
  12. #include "utlvector.h"
  13. #include "utlsymbol.h"
  14. #include "networkstringtable.h"
  15. #define DOWNLOADABLE_FILE_TABLENAME "downloadables"
  16. #define MAX_DOWNLOADABLE_FILES 8192
  17. enum ConsistencyType
  18. {
  19. CONSISTENCY_NONE,
  20. CONSISTENCY_EXACT,
  21. CONSISTENCY_SIMPLE_MATERIAL, // uses ExactFileUserData
  22. CONSISTENCY_BOUNDS,
  23. };
  24. struct ExactFileUserData
  25. {
  26. unsigned char consistencyType;
  27. unsigned long crc;
  28. };
  29. struct ModelBoundsUserData
  30. {
  31. unsigned char consistencyType;
  32. Vector mins;
  33. Vector maxs;
  34. };
  35. //-----------------------------------------------------------------------------
  36. // Purpose: Handles collating lists of resources on level load
  37. // Used to generate reslists for in-game downloads
  38. //-----------------------------------------------------------------------------
  39. class CDownloadListGenerator
  40. {
  41. public:
  42. CDownloadListGenerator();
  43. void SetStringTable( INetworkStringTable *pStringTable );
  44. // call to mark level load/end
  45. void OnLevelLoadStart(const char *levelName);
  46. void OnLevelLoadEnd();
  47. // call to mark resources as being precached
  48. void OnResourcePrecached(const char *relativePathFileName);
  49. void OnModelPrecached(const char *relativePathFileName);
  50. void OnSoundPrecached(const char *relativePathFileName);
  51. void ForceModelBounds( const char *relativePathFileName, const Vector &mins, const Vector &maxs );
  52. void ForceSimpleMaterial( const char *relativePathFileName );
  53. private:
  54. void OnResourcePrecachedFullPath(char *fullPathFileName, const char *relativeFileName );
  55. char m_gameDir[256];
  56. char m_mapName[64];
  57. FileHandle_t m_hReslistFile;
  58. CUtlSymbolTable m_AlreadyWrittenFileNames;
  59. INetworkStringTable *m_pStringTable;
  60. };
  61. // singleton accessor
  62. CDownloadListGenerator &DownloadListGenerator();
  63. #endif // DOWNLOADLISTGENERATOR_H