1 #define TUBA_STARTNOTE(n) strcat((checkextension("DP_SND_SETPARAMS") ? "weapons/tuba_loopnote" : "weapons/tuba_note"), ftos(n), ".wav")
3 .float attenuate; // if set, attenuate it
5 void Ent_TubaNote_Think()
8 f = cvar("g_balance_tuba_fadetime");
10 self.cnt -= frametime * self.count / f;
13 self.nextthink = time;
16 sound(self, CHAN_PROJECTILE, "misc/null.wav", 0, 0);
20 sound(self, CHAN_PROJECTILE, "", self.cnt, self.attenuate * cvar("g_balance_tuba_attenuation"));
23 void Ent_TubaNote_UpdateSound()
25 self.enemy.cnt = bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1);
26 self.enemy.count = self.enemy.cnt;
27 sound(self.enemy, CHAN_PROJECTILE, TUBA_STARTNOTE(self.cnt), self.enemy.cnt, self.enemy.attenuate * cvar("g_balance_tuba_attenuation"));
30 void Ent_TubaNote_StopSound()
32 self.enemy.nextthink = time;
36 void Ent_TubaNote(float bIsNew)
40 n = floor(f / 2) - 42;
41 if(n != self.cnt || bIsNew)
43 Ent_TubaNote_StopSound();
47 self.enemy.classname = "tuba_note";
52 self.enemy.origin_x = ReadCoord();
53 self.enemy.origin_y = ReadCoord();
54 self.enemy.origin_z = ReadCoord();
55 setorigin(self.enemy, self.enemy.origin);
56 self.enemy.attenuate = ReadByte();
58 self.think = Ent_TubaNote_StopSound;
59 self.entremove = Ent_TubaNote_StopSound;
60 self.enemy.think = Ent_TubaNote_Think;
61 self.enemy.nextthink = time + 10;
65 Ent_TubaNote_UpdateSound();
72 for(i = -18; i <= +27; ++i)
74 precache_sound(TUBA_STARTNOTE(i));
76 //precache_sound(""); // we want to change volume of existing sounds