diff --git a/Source/Client/Entities.c b/Source/Client/Entities.c index 68c7283e..5b3ef946 100644 --- a/Source/Client/Entities.c +++ b/Source/Client/Entities.c @@ -26,7 +26,22 @@ Called whenever an entity is sent manually via .SendFlags and so on ================= */ void CSQC_Ent_Update( float fIsNew ) { + float fEntType = readbyte(); + + if ( fEntType == 1 ) { + self.origin_x = readcoord(); + self.origin_y = readcoord(); + self.origin_z = readcoord(); + + setorigin( self, self.origin ); + string sSample = readstring(); // WriteString( MSG_ENTITY, self.message ); + float fVolume = readfloat(); // WriteFloat( MSG_ENTITY, self.health ); + float fAttennuation = readbyte(); // WriteByte( MSG_ENTITY, self.style ); + CSQC_ambient_generic( sSample, fVolume, fAttennuation ); + //print( sprintf( "[DEV] Ambientsound (%s), ATTN %d \n", sSample, fAttennuation ) ); + } + } /* @@ -37,6 +52,7 @@ Self explanatory ================= */ void CSQC_Ent_Remove( void ) { - + soundupdate( self, CHAN_VOICE, "", -1, ATTN_IDLE, 0, 0, 0 ); + remove( self ); } diff --git a/Source/Client/progs.src b/Source/Client/progs.src index 51749493..61e79273 100644 --- a/Source/Client/progs.src +++ b/Source/Client/progs.src @@ -35,8 +35,10 @@ Defs.h ../Shared/WeaponXM1014.c ../Shared/WeaponBase.c ../Shared/Weapons.c - ../Shared/Effects.c + +../Server/AmbientSound.c + View.c VGUI_Objects.c VGUI_MOTD.c diff --git a/Source/Server/AmbientSound.c b/Source/Server/AmbientSound.c index bbfec847..97f45ab7 100644 --- a/Source/Server/AmbientSound.c +++ b/Source/Server/AmbientSound.c @@ -40,14 +40,30 @@ Not Toggled (32) - Older FGDs show this as Not Looped. Must be left unchecked for looping sound files. Note that actual looping depends purely on cue points defined in the .wav file (see notes). */ +#ifdef SSQC void ambient_generic( void ) { + static float ambient_generic_send( entity ePEnt, float fChanged ) { + WriteByte( MSG_ENTITY, 1 ); // Identifier + WriteCoord( MSG_ENTITY, self.origin_x ); + WriteCoord( MSG_ENTITY, self.origin_y ); + WriteCoord( MSG_ENTITY, self.origin_z ); + WriteString( MSG_ENTITY, self.message ); + WriteFloat( MSG_ENTITY, self.health ); + WriteByte( MSG_ENTITY, self.style ); + return TRUE; + } static void ambient_generic_use( void ) { sound( self, CHAN_VOICE, self.message, self.health, self.style ); } + static void ambient_generic_useloop( void ) { + //self.message = "common/null.wav"; + self.SendFlags = 128; + } precache_sound( self.message ); + setorigin( self, self.origin ); self.health = self.health / 10; - + if ( self.spawnflags & 1 ) { self.style = ATTN_NONE; } else if ( self.spawnflags & 2 ) { @@ -60,11 +76,18 @@ void ambient_generic( void ) { self.style = ATTN_STATIC; } - if ( self.spawnflags & 32 ) { - sound( self, CHAN_VOICE, self.message, self.health, self.style ); + if( self.spawnflags & 32 ) { + self.vUse = ambient_generic_use; } else { - ambientsound( self.origin, self.message, self.health, self.style ); + self.pvsflags = PVSF_NOREMOVE | PVSF_IGNOREPVS; + self.vUse = ambient_generic_useloop; + self.SendEntity = ambient_generic_send; } - self.vUse = ambient_generic_use; + } +#else +void CSQC_ambient_generic( string sSample, float fVolume, float fAttenuation ) { + sound( self, CHAN_VOICE, sSample, fVolume, fAttenuation ); +} +#endif diff --git a/Source/Server/FuncButton.c b/Source/Server/FuncButton.c index bda93a51..28a6a74e 100644 --- a/Source/Server/FuncButton.c +++ b/Source/Server/FuncButton.c @@ -266,14 +266,8 @@ void func_button( void ) { if ( !self.speed ) { self.speed = 100; } - if ( !self.wait ) { - self.wait = 2; - } - if ( !self.dmg ) { - self.dmg = 2; - } - if ( !( self.spawnflags & SF_BTT_TOUCH_ONLY ) ) { + if ( self.spawnflags & SF_BTT_TOUCH_ONLY ) { self.touch = FuncButton_Touch; }