]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
don't attenuate your own tuba soudn
authorRudolf Polzer <divverent@alientrap.org>
Sat, 30 Oct 2010 11:14:03 +0000 (13:14 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 30 Oct 2010 11:14:03 +0000 (13:14 +0200)
qcsrc/client/tuba.qc
qcsrc/server/w_tuba.qc

index 5265cb1bbf0f01a641c21f437341e3997b92c5af..cda2a415f39dd379abd48bf2a8d7c5f3038a10be 100644 (file)
@@ -1,5 +1,6 @@
 #define TUBA_STARTNOTE(n) strcat((checkextension("DP_SND_SETPARAMS") ? "weapons/tuba_loopnote" : "weapons/tuba_note"), ftos(n), ".wav")
 .float cnt; // note
+.float attenuate; // if set, attenuate it
 
 void Ent_TubaNote_Think()
 {
@@ -16,14 +17,14 @@ void Ent_TubaNote_Think()
                remove(self);
        }
        else
-               sound(self, CHAN_PROJECTILE, "", self.cnt, cvar("g_balance_tuba_attenuation"));
+               sound(self, CHAN_PROJECTILE, "", self.cnt, self.attenuate * cvar("g_balance_tuba_attenuation"));
 }
 
 void Ent_TubaNote_UpdateSound()
 {
        self.enemy.cnt = bound(0, VOL_BASE * cvar("g_balance_tuba_volume"), 1);
        self.enemy.count = self.enemy.cnt;
-       sound(self.enemy, CHAN_PROJECTILE, TUBA_STARTNOTE(self.cnt), self.enemy.cnt, cvar("g_balance_tuba_attenuation"));
+       sound(self.enemy, CHAN_PROJECTILE, TUBA_STARTNOTE(self.cnt), self.enemy.cnt, self.attenuate * cvar("g_balance_tuba_attenuation"));
 }
 
 void Ent_TubaNote_StopSound()
@@ -52,6 +53,7 @@ void Ent_TubaNote(float bIsNew)
                self.enemy.origin_y = ReadCoord();
                self.enemy.origin_z = ReadCoord();
                setorigin(self.enemy, self.enemy.origin);
+               self.enemy.attenuate = ReadByte();
        }
        self.think = Ent_TubaNote_StopSound;
        self.entremove = Ent_TubaNote_StopSound;
index c89735e55930fc81a8f8bc752890c5bd1fa1f73d..491030fcbcc486cfde1249c03d5d560e09b22bb4 100644 (file)
@@ -83,13 +83,14 @@ float W_Tuba_NoteSendEntity(entity to, float sf)
                WriteCoord(MSG_ENTITY, self.origin_x);
                WriteCoord(MSG_ENTITY, self.origin_y);
                WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteByte(MSG_ENTITY, self.owner != to);
        }
        return TRUE;
 }
 
 void W_Tuba_NoteThink()
 {
-       float needchange, dist_mult;
+       float dist_mult;
        float vol0, vol1;
        vector dir0, dir1;
        vector v;
@@ -102,7 +103,6 @@ void W_Tuba_NoteThink()
        }
        self.nextthink = time;
        dist_mult = cvar("g_balance_tuba_attenuation") / cvar("snd_soundradius");
-       needchange = 0;
        FOR_EACH_REALCLIENT(e)
        if(e != self.owner)
        {