From b9902e94ea3f65b017fd08c3ac25982f5dd1b262 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 10 Jan 2019 11:13:49 +0100 Subject: [PATCH] ambient_generic: Made it fully serverside to avoid headache. --- Source/Client/Entities.c | 12 +++------ Source/gs-entbase/server/ambient_generic.cpp | 26 +++----------------- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/Source/Client/Entities.c b/Source/Client/Entities.c index c5a7931f..9af687dd 100755 --- a/Source/Client/Entities.c +++ b/Source/Client/Entities.c @@ -41,11 +41,11 @@ void CSQC_ambient_generic( string sSample, float fVolume, float fAttenuation, fl fLoop = FALSE; } - if ( fLoop ) { + /*if ( fLoop ) { sound( self, CHAN_VOICE, sSample, fVolume, fAttenuation, 0, SOUNDFLAG_FORCELOOP ); - } else { + } else {*/ sound( self, CHAN_VOICE, sSample, fVolume, fAttenuation, 0, 0 ); - } + //} } /* @@ -98,11 +98,7 @@ void CSQC_Ent_Update( float flIsNew ) { CSQC_ambient_generic( readstring(), readfloat(), readbyte(), readbyte(), readbyte() ); } else if ( fEntType == ENT_SPRITE ) { - self.origin_x = readcoord(); - self.origin_y = readcoord(); - self.origin_z = readcoord(); - - Effect_AnimatedSprite( self.origin, readfloat(), readfloat(), readfloat(), readfloat(), readfloat() ); + Sprite_Animated(); } else if ( fEntType == ENT_SPRAY ) { Spraylogo_Parse(); } else if ( fEntType == ENT_DECAL ) { diff --git a/Source/gs-entbase/server/ambient_generic.cpp b/Source/gs-entbase/server/ambient_generic.cpp index d58a8a88..6228bc63 100644 --- a/Source/gs-entbase/server/ambient_generic.cpp +++ b/Source/gs-entbase/server/ambient_generic.cpp @@ -36,27 +36,8 @@ class ambient_generic:CBaseTrigger virtual void() Respawn; virtual void() UseNormal; virtual void() UseLoop; - virtual float(entity, float) Network; }; -float ambient_generic::Network(entity ePEnt, float fChanged) -{ - if (!m_iToggleSwitch) { - return FALSE; - } - - WriteByte(MSG_ENTITY, ENT_AMBIENTSOUND); - WriteCoord(MSG_ENTITY, origin[0]); - WriteCoord(MSG_ENTITY, origin[1]); - WriteCoord(MSG_ENTITY, origin[2]); - WriteString(MSG_ENTITY, m_strActivePath); - WriteFloat(MSG_ENTITY, m_flVolume); - WriteByte(MSG_ENTITY, m_flRadius); - WriteByte(MSG_ENTITY, m_iLoop); - WriteByte(MSG_ENTITY, 0); - return TRUE; -} - void ambient_generic::UseNormal(void) { sound(this, CHAN_VOICE, m_strActivePath, m_flVolume, m_flRadius, m_flPitch); @@ -69,7 +50,8 @@ void ambient_generic::UseLoop(void) m_strActivePath = m_strSoundPath; } m_iToggleSwitch = 1 - m_iToggleSwitch; - SendFlags = 1; + + UseNormal(); } void ambient_generic::Respawn(void) @@ -90,11 +72,9 @@ void ambient_generic::Respawn(void) } if (m_iLoop) { - pvsflags = PVSF_USEPHS; Trigger = UseLoop; - SendEntity = Network; - SendFlags = 1; } + UseNormal(); } void ambient_generic::ambient_generic (void)