ambient_generic: Made it fully serverside to avoid headache.

This commit is contained in:
Marco Cawthorne 2019-01-10 11:13:49 +01:00
parent 3c42426b43
commit b9902e94ea
2 changed files with 7 additions and 31 deletions

View file

@ -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 ) {

View file

@ -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)