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.

69 lines
2.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: A Scene Image file aggregates all the compiled binary VCD files into
  4. // a single file.
  5. //
  6. //=====================================================================================//
  7. #ifndef SCENE_IMAGE_FILE_H
  8. #define SCENE_IMAGE_FILE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "commonmacros.h"
  13. #include "tier1/checksum_crc.h"
  14. #define SCENE_IMAGE_ID MAKEID( 'V','S','I','F' )
  15. #define SCENE_IMAGE_VERSION 3
  16. // scene summary: cached calcs for commmon startup queries, variable sized
  17. // note: if you want to add a member to this struct, one way to do it and
  18. // save memory is to make lastspeech_msecs be a uint16 rather than a uint32
  19. // and store it as a fixed point seconds (say, 8.8) rather than straight
  20. // msecs; that gives you an additional 16 bits to squeeze into this struct
  21. // without actually increasing memory usage. Override the inline float
  22. // GetDurToSpeechEnd() function if you do this; all game code uses that rather
  23. // than reading the lastspeech_msecs member directly.
  24. struct SceneImageSummary_t
  25. {
  26. unsigned int msecs;
  27. unsigned int lastspeech_msecs; ///< milliseconds from beginning of vcd to end of last speak event.
  28. int numSounds;
  29. int soundStrings[1]; // has numSounds
  30. // return time in seconds from beginning of scene to end of last Speak event
  31. inline float GetDurToSpeechEnd( void ) const { return lastspeech_msecs * 0.001f; }
  32. };
  33. // stored sorted by crc filename for binary search
  34. struct SceneImageEntry_t
  35. {
  36. CRC32_t crcFilename; // expected to be normalized as scenes\???.vcd
  37. int nDataOffset; // offset to dword aligned data from start
  38. int nDataLength;
  39. int nSceneSummaryOffset; // offset to summary
  40. };
  41. struct SceneImageHeader_t
  42. {
  43. int nId;
  44. int nVersion;
  45. int nNumScenes; // number of scene files
  46. int nNumStrings; // number of unique strings in table
  47. int nSceneEntryOffset;
  48. inline const char *String( short iString )
  49. {
  50. if ( iString < 0 || iString >= nNumStrings )
  51. {
  52. Assert( 0 );
  53. return NULL;
  54. }
  55. // access string table (after header) to access pool
  56. unsigned int *pTable = (unsigned int *)((byte *)this + sizeof( SceneImageHeader_t ));
  57. return (char *)this + pTable[iString];
  58. }
  59. };
  60. #endif // SCENE_IMAGE_FILE_H