From: Rudolf Polzer Date: Tue, 1 Jan 2013 18:50:41 +0000 (+0100) Subject: jetpack: move sound to client X-Git-Tag: xonotic-v0.7.0~143 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=cd1334b476f8810b3f84bafa13d79c83263324b0;p=xonotic%2Fxonotic-data.pk3dir.git jetpack: move sound to client --- diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index c389540fd..066f32ef6 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -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; diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index eb35425f5..cb06932e4 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -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; diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 9c87d13ad..ccc5dc354 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -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 diff --git a/qcsrc/client/projectile.qc b/qcsrc/client/projectile.qc index bdf633468..10f47b446 100644 --- a/qcsrc/client/projectile.qc +++ b/qcsrc/client/projectile.qc @@ -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); diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index f3ece2af4..433261d45 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 900217c95..3caa12a9f 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 9317e2340..b57377b10 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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");