1 #define TUBA_STARTNOTE(n) strcat((checkextension("DP_SND_SETPARAMS") ? "weapons/tuba_loopnote" : "weapons/tuba_note"), ftos(n), ".wav")
4 void Ent_TubaNote_Think()
6 self.cnt -= frametime * self.count * 3;
10 sound(self, CHAN_PROJECTILE, "misc/null.wav", 0, 0);
14 sound(self, CHAN_PROJECTILE, "", self.cnt, cvar("g_balance_tuba_attenuation"));
17 void Ent_TubaNote_UpdateSound()
19 self.enemy.cnt = bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1);
20 self.enemy.count = self.enemy.cnt;
21 sound(self.enemy, CHAN_PROJECTILE, TUBA_STARTNOTE(self.cnt), self.enemy.cnt, cvar("g_balance_tuba_attenuation"));
24 void Ent_TubaNote_StopSound()
26 self.enemy.nextthink = time;
30 void Ent_TubaNote(float bIsNew)
34 n = floor(f / 2) - 42;
35 if(n != self.cnt || bIsNew)
37 Ent_TubaNote_StopSound();
41 self.enemy.classname = "tuba_note";
46 self.enemy.origin_x = ReadCoord();
47 self.enemy.origin_y = ReadCoord();
48 self.enemy.origin_z = ReadCoord();
49 setorigin(self.enemy, self.enemy.origin);
51 self.think = Ent_TubaNote_StopSound;
52 self.entremove = Ent_TubaNote_StopSound;
53 self.enemy.think = Ent_TubaNote_Think;
54 self.enemy.nextthink = time + 10;
58 Ent_TubaNote_UpdateSound();
65 for(i = -18; i <= +27; ++i)
67 precache_sound(TUBA_STARTNOTE(i));
69 //precache_sound(""); // we want to change volume of existing sounds