Sound: Add Sound_PlayLocal() which is a 'sound shader' analogue to to
localsound()
This commit is contained in:
parent
749424aa84
commit
52dfde0cf1
|
@ -66,6 +66,7 @@ void Sound_Play(entity target, int chan, string shader);
|
||||||
void Sound_PlayAt(vector pos, string shader);
|
void Sound_PlayAt(vector pos, string shader);
|
||||||
|
|
||||||
#ifdef CLIENT
|
#ifdef CLIENT
|
||||||
|
void Sound_PlayLocal(string shader);
|
||||||
void Sound_Update(entity target, int channel, int sample, float volume);
|
void Sound_Update(entity target, int channel, int sample, float volume);
|
||||||
#else
|
#else
|
||||||
void Sound_Speak(entity target, string shader);
|
void Sound_Speak(entity target, string shader);
|
||||||
|
|
|
@ -512,11 +512,7 @@ Sound_PlayAt(vector pos, string shader)
|
||||||
sample = (int)hash_get(g_hashsounds, shader, -1);
|
sample = (int)hash_get(g_hashsounds, shader, -1);
|
||||||
|
|
||||||
if (sample < 0) {
|
if (sample < 0) {
|
||||||
#ifdef SERVER
|
crossprint(sprintf("^1Sound_PlayAt: shader %s is not precached\n", shader));
|
||||||
print(sprintf("^1Sound_PlayAt: shader %s is not precached (SERVER)\n", shader));
|
|
||||||
#else
|
|
||||||
print(sprintf("^1Sound_PlayAt: shader %s is not precached (CLIENT)\n", shader));
|
|
||||||
#endif
|
|
||||||
pointsound(pos, "misc/missing.wav", 1.0f, ATTN_NORM);
|
pointsound(pos, "misc/missing.wav", 1.0f, ATTN_NORM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -555,6 +551,35 @@ Sound_PlayAt(vector pos, string shader)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CLIENT
|
#ifdef CLIENT
|
||||||
|
void
|
||||||
|
Sound_PlayLocal(string shader)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
float radius;
|
||||||
|
float pitch;
|
||||||
|
int flag;
|
||||||
|
int sample;
|
||||||
|
|
||||||
|
if (shader == "")
|
||||||
|
return;
|
||||||
|
|
||||||
|
flag = 0;
|
||||||
|
sample = (int)hash_get(g_hashsounds, shader, -1);
|
||||||
|
|
||||||
|
if (sample < 0) {
|
||||||
|
crossprint(sprintf("^1Sound_PlayLocal: shader %s is not precached\n", shader));
|
||||||
|
localsound("misc/missing.wav");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* pick a sample */
|
||||||
|
r = floor(random(0, g_sounds[sample].sample_count));
|
||||||
|
tokenizebyseparator(g_sounds[sample].samples, "\n");
|
||||||
|
|
||||||
|
/* really? this doesn't do any more? */
|
||||||
|
localsound(argv(r));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Sound_Update(entity target, int channel, int sample, float volume)
|
Sound_Update(entity target, int channel, int sample, float volume)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue