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 = autocvar_g_balance_tuba_fadetime;
10 self.cnt -= frametime * self.count / f;
13 self.nextthink = time;
16 sound(self, CH_SHOTS_SINGLE, "misc/null.wav", 0, 0);
20 sound(self, CH_SHOTS_SINGLE, "", self.cnt, self.attenuate * autocvar_g_balance_tuba_attenuation);
23 void Ent_TubaNote_UpdateSound()
25 self.enemy.cnt = bound(0, VOL_BASE * autocvar_g_balance_tuba_volume, 1);
26 self.enemy.count = self.enemy.cnt;
28 sound7(self.enemy, CH_SHOTS_SINGLE, TUBA_STARTNOTE(0), self.enemy.cnt, self.enemy.attenuate * autocvar_g_balance_tuba_attenuation, 100 * pow(2.0, self.cnt / 12.0), 0);
30 sound(self.enemy, CH_SHOTS_SINGLE, TUBA_STARTNOTE(self.cnt), self.enemy.cnt, self.enemy.attenuate * autocvar_g_balance_tuba_attenuation);
34 void Ent_TubaNote_StopSound()
36 self.enemy.nextthink = time;
40 void Ent_TubaNote(float bIsNew)
44 n = floor(f / 2) - 42;
45 if(n != self.cnt || bIsNew)
47 Ent_TubaNote_StopSound();
51 self.enemy.classname = "tuba_note";
56 self.enemy.origin_x = ReadCoord();
57 self.enemy.origin_y = ReadCoord();
58 self.enemy.origin_z = ReadCoord();
59 setorigin(self.enemy, self.enemy.origin);
60 self.enemy.attenuate = ReadByte();
62 self.think = Ent_TubaNote_StopSound;
63 self.entremove = Ent_TubaNote_StopSound;
64 self.enemy.think = Ent_TubaNote_Think;
65 self.enemy.nextthink = time + 10;
69 Ent_TubaNote_UpdateSound();
77 precache_sound(TUBA_STARTNOTE(0));
79 for(i = -18; i <= +27; ++i)
81 precache_sound(TUBA_STARTNOTE(i));
84 //precache_sound(""); // we want to change volume of existing sounds