]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
jetpack: move sound to client
authorRudolf Polzer <divverent@xonotic.org>
Tue, 1 Jan 2013 18:50:41 +0000 (19:50 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 1 Jan 2013 18:50:41 +0000 (19:50 +0100)
qcsrc/client/Main.qc
qcsrc/client/autocvars.qh
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/projectile.qc
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/miscfunctions.qc

index c389540fd920ce2699307862c23c8452467ee397..066f32ef6e44f394d2dc2775baf4ae9c648d0482 100644 (file)
@@ -179,6 +179,7 @@ void CSQC_Init(void)
        turrets_precache();
     Announcer_Precache();
        Tuba_Precache();
+       CSQCPlayer_Precache();
        
        if(autocvar_cl_reticle)
        {
@@ -792,6 +793,18 @@ void Ent_Remove()
        if(self.entremove)
                self.entremove();
 
+       if(self.skeletonindex)
+       {
+               skel_delete(self.skeletonindex);
+               self.skeletonindex = 0;
+       }
+
+       if(self.snd_looping > 0)
+       {
+               sound(self, self.snd_looping, "misc/null.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
+               self.snd_looping = 0;
+       }
+
        self.enttype = 0;
        self.classname = "";
        self.draw = menu_sub_null;
index eb35425f51e0e99dc5eb91d0ebb38a8dc9428e51..cb06932e45e00eefaa25e29dd3abf2e25df753c4 100644 (file)
@@ -407,3 +407,4 @@ string autocvar__cl_playermodel;
 float autocvar_cl_precacheplayermodels;
 float autocvar_cl_deathglow;
 float autocvar_developer_csqcentities;
+float autocvar_g_jetpack_attenuation;
index 9c87d13addf9949c671a4319da1e5c91f2f69b45..ccc5dc35475dcda19612e5d228bad1c508059d94 100644 (file)
@@ -443,6 +443,7 @@ void CSQCModel_Effects_PostUpdate(void)
        if(self.csqcmodel_teleported)
                Projectile_ResetTrail(self.origin);
 }
+.float snd_looping;
 void CSQCModel_Effects_Apply(void)
 {
        float eff = self.csqcmodel_effects;
@@ -514,6 +515,28 @@ void CSQCModel_Effects_Apply(void)
        if(self.csqcmodel_effects & CSQCMODEL_EF_RESPAWNGHOST)
                self.renderflags |= RF_ADDITIVE;
                // also special in CSQCPlayer_GlowMod_Apply
+
+       if(self.csqcmodel_modelflags & MF_ROCKET)
+       {
+               if(!self.snd_looping)
+               {
+                       sound(self, CH_TRIGGER_SINGLE, "misc/jetpack_fly.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
+                       self.snd_looping = CH_TRIGGER_SINGLE;
+               }
+       }
+       else
+       {
+               if(self.snd_looping)
+               {
+                       sound(self, self.snd_looping, "misc/null.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
+                       self.snd_looping = 0;
+               }
+       }
+}
+
+void CSQCPlayer_Precache()
+{
+       precache_sound("misc/jetpack_fly.wav");
 }
 
 // FEATURE: auto glowmod
index bdf633468df3bb34fb0c0da2225bc5155e0eeb0f..10f47b446634a6a53a2f21d827bd6ca704490941 100644 (file)
@@ -160,14 +160,11 @@ void loopsound(entity e, float ch, string samp, float vol, float attn)
                return;
 
        sound(e, ch, samp, vol, attn);
-       e.snd_looping = 1;
+       e.snd_looping = ch;
 }
 
 void Ent_RemoveProjectile()
 {
-       if(self.snd_looping)
-               sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTN_NORM);
-
        if(self.count & 0x80)
        {
                tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.05, MOVE_NORMAL, self);
index f3ece2af44ee6c4da987738df7d92222b8dab5de..433261d45a94b464e25e1e5d4b2b3d6a53aefecd 100644 (file)
@@ -868,7 +868,6 @@ string autocvar_g_hitplots_individuals;
 float autocvar_g_jetpack_acceleration_side;
 float autocvar_g_jetpack_acceleration_up;
 float autocvar_g_jetpack_antigravity;
-float autocvar_g_jetpack_attenuation;
 float autocvar_g_jetpack_fuel;
 float autocvar_g_jetpack_maxspeed_side;
 float autocvar_g_jetpack_maxspeed_up;
index 900217c952a8e05aba3e77e7ada6a52d37aa9846..3caa12a9f1fa6ad6cf1dca7f0f3334fd1f5ae414 100644 (file)
@@ -1782,15 +1782,9 @@ void player_powerups (void)
        olditems = self.items;
 
        if((self.items & IT_USING_JETPACK) && !self.deadflag)
-       {
-               SoundEntity_StartSound(self, CH_TRIGGER_SINGLE, "misc/jetpack_fly.wav", VOL_BASE, autocvar_g_jetpack_attenuation);
                self.modelflags |= MF_ROCKET;
-       }
        else
-       {
-               SoundEntity_StopSound(self, CH_TRIGGER_SINGLE);
                self.modelflags &~= MF_ROCKET;
-       }
 
        self.effects &~= (EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
 
index 9317e234067ea69734a4e5bbeb36fb5d6564328a..b57377b1052410d5f0e5fba3f95687da3eb8e584 100644 (file)
@@ -1599,9 +1599,6 @@ void precache()
     precache_sound ("player/lava.wav");
     precache_sound ("player/slime.wav");
 
-    if (g_jetpack)
-        precache_sound ("misc/jetpack_fly.wav");
-
     precache_model ("models/sprites/0.spr32");
     precache_model ("models/sprites/1.spr32");
     precache_model ("models/sprites/2.spr32");