-#define TUBA_MIN -18
-#define TUBA_MAX 27
-#define TUBA_INSTRUMENTS 2
+#if defined(CSQC)
+ #include "../dpdefs/csprogsdefs.qc"
+ #include "../common/constants.qh"
+ #include "../warpzonelib/mathlib.qh"
+ #include "../common/util.qh"
+ #include "autocvars.qh"
+ #include "main.qh"
+ #include "../csqcmodellib/cl_model.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+#endif
+
+const float TUBA_MIN = -18;
+const float TUBA_MAX = 27;
+const float TUBA_INSTRUMENTS = 3;
#define TUBA_STARTNOTE(i,n) strcat("weapons/tuba", (i ? ftos(i) : ""), "_loopnote", ftos(n), ".wav")
-.float note; // note
+.int note; // note
.float attenuate; // if set, attenuate it
.float cnt; // current volume
.float count; // initial volume
.float tuba_instrument;
-float Tuba_PitchStep;
+int Tuba_PitchStep;
void tubasound(entity e, float restart)
{
f2 = 0;
p2 = 1;
- m = mod(e.note, Tuba_PitchStep);
+ m = e.note % Tuba_PitchStep;
if(m)
{
if(e.note - m < TUBA_MIN)
snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note);
}
- sound7(e, CH_TUBA, snd1, e.cnt * f1, e.attenuate * autocvar_g_balance_tuba_attenuation, 100 * p1, 0);
+ sound7(e, CH_TUBA_SINGLE, snd1, e.cnt * f1, e.attenuate * autocvar_g_balance_tuba_attenuation, 100 * p1, 0);
if(f2)
- sound7(e.enemy, CH_TUBA, snd2, e.cnt * f2, e.attenuate * autocvar_g_balance_tuba_attenuation, 100 * p2, 0);
+ sound7(e.enemy, CH_TUBA_SINGLE, snd2, e.cnt * f2, e.attenuate * autocvar_g_balance_tuba_attenuation, 100 * p2, 0);
}
else
{
if(restart)
snd1 = TUBA_STARTNOTE(e.tuba_instrument, e.note);
- sound(e, CH_TUBA, snd1, e.cnt, e.attenuate * autocvar_g_balance_tuba_attenuation);
+ sound(e, CH_TUBA_SINGLE, snd1, e.cnt, e.attenuate * autocvar_g_balance_tuba_attenuation);
}
}
self.nextthink = time;
if(self.cnt <= 0)
{
- sound(self, CH_TUBA, "misc/null.wav", 0, 0);
+ sound(self, CH_TUBA_SINGLE, "misc/null.wav", 0, 0);
if(self.enemy)
{
- sound(self.enemy, CH_TUBA, "misc/null.wav", 0, 0);
+ sound(self.enemy, CH_TUBA_SINGLE, "misc/null.wav", 0, 0);
remove(self.enemy);
}
remove(self);
void Ent_TubaNote(float bIsNew)
{
- float f, n, i, att, upd;
+ int f, n, i;
+ float att, upd;
f = ReadByte();
upd = 0;
self.enemy.enemy = spawn();
self.enemy.enemy.classname = "tuba_note_2";
}
- bIsNew = TRUE;
+ bIsNew = true;
}
self.enemy.attenuate = att;
void Tuba_Precache()
{
- float i, n;
+ float i;
+ int n;
Tuba_PitchStep = autocvar_g_balance_tuba_pitchstep;
if(Tuba_PitchStep)
{
}
for(n = TUBA_MIN; n <= TUBA_MAX; ++n)
{
- if(!Tuba_PitchStep || (mod(n, Tuba_PitchStep) == 0))
+ if(!Tuba_PitchStep || ((n % Tuba_PitchStep) == 0))
{
for(i = 0; i < TUBA_INSTRUMENTS; ++i)
precache_sound(TUBA_STARTNOTE(i, n));