soundsetmap.c 734 B

1234567891011121314151617181920212223242526272829303132
  1. class SoundSetMap
  2. {
  3. ref static map<int, string> m_SoundSetMapIDByID = new map<int, string>;
  4. ref static map<string, int> m_SoundSetMapIDByName = new map<string, int>;
  5. static void Init()
  6. {
  7. string path = "CfgSoundSets";
  8. int soundCount = GetGame().ConfigGetChildrenCount(path);
  9. for (int i = 1; i < soundCount; i++)
  10. {
  11. string soundClassName;
  12. GetGame().ConfigGetChildName(path, i, soundClassName);
  13. m_SoundSetMapIDByID.Insert(i,soundClassName);
  14. m_SoundSetMapIDByName.Insert(soundClassName,i);
  15. //PrintString(soundClassName);
  16. }
  17. }
  18. static string GetSoundSetName(int id)
  19. {
  20. return m_SoundSetMapIDByID.Get(id);
  21. }
  22. static int GetSoundSetID(string name)
  23. {
  24. return m_SoundSetMapIDByName.Get(name);
  25. }
  26. }