]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/tuba.qc
Rename defs to qh
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / tuba.qc
index 38ce1090a12aea33334f64478bb69dd33bc27172..33378a041ea4e9d5594a7736286590b3000b130a 100644 (file)
@@ -1,15 +1,27 @@
-#define TUBA_MIN -18
-#define TUBA_MAX  27
-#define TUBA_INSTRUMENTS 3
+#if defined(CSQC)
+       #include "../dpdefs/csprogsdefs.qh"
+       #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)
 {
@@ -30,7 +42,7 @@ 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)
@@ -117,7 +129,8 @@ void Ent_TubaNote_StopSound()
 
 void Ent_TubaNote(float bIsNew)
 {
-       float f, n, i, att, upd;
+    int f, n, i;
+       float att, upd;
        f = ReadByte();
 
        upd = 0;
@@ -144,7 +157,7 @@ void Ent_TubaNote(float bIsNew)
                                self.enemy.enemy = spawn();
                                self.enemy.enemy.classname = "tuba_note_2";
                        }
-                       bIsNew = TRUE;
+                       bIsNew = true;
                }
 
                self.enemy.attenuate = att;
@@ -178,7 +191,8 @@ void Ent_TubaNote(float bIsNew)
 
 void Tuba_Precache()
 {
-       float i, n;
+       float i;
+    int n;
        Tuba_PitchStep = autocvar_g_balance_tuba_pitchstep;
        if(Tuba_PitchStep)
        {
@@ -190,7 +204,7 @@ void Tuba_Precache()
        }
        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));