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.

94 lines
2.9 KiB

  1. //====== Copyright � 1996-2004, Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #include "movieobjects/dmesound.h"
  7. #include "datamodel/dmelementfactoryhelper.h"
  8. #include "movieobjects_interfaces.h"
  9. #include "tier2/tier2.h"
  10. #include "filesystem.h"
  11. #include "datamodel/dmattributevar.h"
  12. // memdbgon must be the last include file in a .cpp file!!!
  13. #include "tier0/memdbgon.h"
  14. //-----------------------------------------------------------------------------
  15. // Expose this class to the scene database
  16. //-----------------------------------------------------------------------------
  17. IMPLEMENT_ELEMENT_FACTORY( DmeSound, CDmeSound );
  18. //-----------------------------------------------------------------------------
  19. // Constructor, destructor
  20. //-----------------------------------------------------------------------------
  21. void CDmeSound::OnConstruction()
  22. {
  23. m_SoundName.Init( this, "soundname" );
  24. m_GameSoundName.Init( this, "gameSoundName" );
  25. }
  26. void CDmeSound::OnDestruction()
  27. {
  28. }
  29. //-----------------------------------------------------------------------------
  30. // For sounds that are relative paths (instead of GameSound names), get full path
  31. //-----------------------------------------------------------------------------
  32. bool CDmeSound::ComputeSoundFullPath( char *pBuf, int nBufLen )
  33. {
  34. if ( !m_SoundName[0] )
  35. {
  36. pBuf[0] = 0;
  37. return false;
  38. }
  39. // Compute the full path of the sound
  40. char pRelativePath[MAX_PATH];
  41. Q_snprintf( pRelativePath, sizeof(pRelativePath), "sound\\%s", m_SoundName.Get() );
  42. return g_pFullFileSystem->RelativePathToFullPath( pRelativePath, "GAME", pBuf, nBufLen ) != NULL;
  43. }
  44. //-----------------------------------------------------------------------------
  45. // Expose this class to the scene database
  46. //-----------------------------------------------------------------------------
  47. IMPLEMENT_ELEMENT_FACTORY( DmeGameSound, CDmeGameSound );
  48. //-----------------------------------------------------------------------------
  49. // Constructor, destructor
  50. //-----------------------------------------------------------------------------
  51. void CDmeGameSound::OnConstruction()
  52. {
  53. m_Volume .Init( this, "volume" );
  54. m_Level .Init( this, "level" );
  55. m_Pitch .Init( this, "pitch" );
  56. m_IsStatic .Init( this, "static" );
  57. m_Channel .Init( this, "channel" );
  58. m_Flags .Init( this, "flags" );
  59. // m_Source .Init( this, "source" );
  60. // m_FollowSource.Init( this, "followsource" );
  61. m_Origin .Init( this, "origin" );
  62. m_Direction .Init( this, "direction" );
  63. }
  64. void CDmeGameSound::OnDestruction()
  65. {
  66. }
  67. CDmElement *CDmeGameSound::FindOrAddPhonemeExtractionSettings()
  68. {
  69. if ( HasAttribute( "PhonemeExtractionSettings" ) )
  70. return GetValueElement< CDmElement >( "PhonemeExtractionSettings" );
  71. CDmElement *settings = CreateElement< CDmElement >( "PhonemeExtractionSettings", GetFileId() );
  72. if ( !settings )
  73. return NULL;
  74. SetValue( "PhonemeExtractionSettings", settings );
  75. return settings;
  76. }