1 #define TUBA_STARTNOTE(n) strcat((checkextension("DP_SND_SETPARAMS") ? "weapons/tuba_loopnote" : "weapons/tuba_note"), ftos(n), ".wav")
4 void Ent_TubaNote_Think()
7 f = cvar("g_balance_tuba_fadetime");
9 self.cnt -= frametime * self.count / f;
12 self.nextthink = time;
15 sound(self, CHAN_PROJECTILE, "misc/null.wav", 0, 0);
19 sound(self, CHAN_PROJECTILE, "", self.cnt, cvar("g_balance_tuba_attenuation"));
22 void Ent_TubaNote_UpdateSound()
24 self.enemy.cnt = bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1);
25 self.enemy.count = self.enemy.cnt;
26 sound(self.enemy, CHAN_PROJECTILE, TUBA_STARTNOTE(self.cnt), self.enemy.cnt, cvar("g_balance_tuba_attenuation"));
29 void Ent_TubaNote_StopSound()
31 self.enemy.nextthink = time;
35 void Ent_TubaNote(float bIsNew)
39 n = floor(f / 2) - 42;
40 if(n != self.cnt || bIsNew)
42 Ent_TubaNote_StopSound();
46 self.enemy.classname = "tuba_note";
51 self.enemy.origin_x = ReadCoord();
52 self.enemy.origin_y = ReadCoord();
53 self.enemy.origin_z = ReadCoord();
54 setorigin(self.enemy, self.enemy.origin);
56 self.think = Ent_TubaNote_StopSound;
57 self.entremove = Ent_TubaNote_StopSound;
58 self.enemy.think = Ent_TubaNote_Think;
59 self.enemy.nextthink = time + 10;
63 Ent_TubaNote_UpdateSound();
70 for(i = -18; i <= +27; ++i)
72 precache_sound(TUBA_STARTNOTE(i));
74 //precache_sound(""); // we want to change volume of existing sounds