env_spark: Use sound shaders instead of hard-coding sfx paths.
This commit is contained in:
parent
4d3cace6da
commit
90b716bd5d
2 changed files with 12 additions and 15 deletions
10
platform/data.pk3dir/sound/env_spark.sndshd
Normal file
10
platform/data.pk3dir/sound/env_spark.sndshd
Normal file
|
@ -0,0 +1,10 @@
|
|||
env_spark.sfx
|
||||
{
|
||||
attenuation idle
|
||||
sample buttons/spark1.wav
|
||||
sample buttons/spark2.wav
|
||||
sample buttons/spark3.wav
|
||||
sample buttons/spark4.wav
|
||||
sample buttons/spark5.wav
|
||||
sample buttons/spark6.wav
|
||||
}
|
|
@ -35,15 +35,6 @@ enumflags
|
|||
EVSPARK_STARTON
|
||||
};
|
||||
|
||||
string spark_snd[] = {
|
||||
"buttons/spark1.wav",
|
||||
"buttons/spark2.wav",
|
||||
"buttons/spark3.wav",
|
||||
"buttons/spark4.wav",
|
||||
"buttons/spark5.wav",
|
||||
"buttons/spark6.wav"
|
||||
};
|
||||
|
||||
class env_spark:CBaseTrigger
|
||||
{
|
||||
float m_flMaxDelay;
|
||||
|
@ -59,8 +50,7 @@ class env_spark:CBaseTrigger
|
|||
void
|
||||
env_spark::CreateSpark(void)
|
||||
{
|
||||
int r = floor((random() * spark_snd.length));
|
||||
sound(this, CHAN_AUTO, spark_snd[r], 1.0f, ATTN_IDLE);
|
||||
Sound_Play(this, CHAN_AUTO, "env_spark.sfx");
|
||||
FX_Spark(self.origin, self.angles);
|
||||
}
|
||||
|
||||
|
@ -123,9 +113,6 @@ env_spark::SpawnKey(string strKey, string strValue)
|
|||
void
|
||||
env_spark::env_spark(void)
|
||||
{
|
||||
for (int i = 0; i < spark_snd.length; i++) {
|
||||
precache_sound(spark_snd[i]);
|
||||
}
|
||||
|
||||
Sound_Precache("env_spark.sfx");
|
||||
CBaseTrigger::CBaseTrigger();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue