SoundDef: add helper function int Sound_GetID(string)

This commit is contained in:
Marco Cawthorne 2023-09-27 00:12:28 -07:00
parent 49408b1342
commit d7ddfc1c87
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
2 changed files with 10 additions and 0 deletions

View File

@ -93,6 +93,8 @@ void Sound_PlayAt(vector worldPos, string sndDef);
void Sound_PlayLocal(string shader);
/** Client-side only: Update the sound parameters on a given entity. */
void Sound_Update(entity targetEntity, int sndChannel, int sndSample, float desiredVolume);
int Sound_GetID(string sndDef);
#else
/** Server-side only: Play a sentences.txt entry on a given entity. */
void Sound_Speak(entity targetEntity, string sentencesEntry);

View File

@ -790,6 +790,14 @@ Sound_PlayLocal(string shader)
localsound(argv(r));
}
int
Sound_GetID(string defName)
{
if (defName == "")
return -1;
return (int)hash_get(g_hashsounds, defName, -1);
}
void
Sound_Update(entity target, int channel, int sample, float volume)
{