Fixed ambience.
This commit is contained in:
parent
a36e0dab5a
commit
476eface23
@ -109,6 +109,7 @@ public Action:EventRoundEnd(Handle:event, const String:name[], bool:dontBroadcas
|
|||||||
// Forward event to modules.
|
// Forward event to modules.
|
||||||
RoundEndOnRoundEnd(reason);
|
RoundEndOnRoundEnd(reason);
|
||||||
InfectOnRoundEnd();
|
InfectOnRoundEnd();
|
||||||
|
SEffectsOnRoundEnd();
|
||||||
RespawnOnRoundEnd();
|
RespawnOnRoundEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,18 @@ AmbientSoundsOnRoundStart()
|
|||||||
AmbientSoundsRestart();
|
AmbientSoundsRestart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The round is ending.
|
||||||
|
*/
|
||||||
|
AmbientSoundsOnRoundEnd()
|
||||||
|
{
|
||||||
|
// x = client index
|
||||||
|
for (new x = 1; x <= MaxClients; x++)
|
||||||
|
{
|
||||||
|
bAmbientSoundsIsPlaying[x] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client is spawning into the game.
|
* Client is spawning into the game.
|
||||||
*
|
*
|
||||||
@ -145,6 +157,9 @@ AmbientSoundsOnClientSpawn(client)
|
|||||||
|
|
||||||
// Emit ambient sound.
|
// Emit ambient sound.
|
||||||
SEffectsEmitAmbientSound(sound, ambientvolume, client);
|
SEffectsEmitAmbientSound(sound, ambientvolume, client);
|
||||||
|
|
||||||
|
// Flag client that sound is playing.
|
||||||
|
bAmbientSoundsIsPlaying[client] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,18 +179,6 @@ AmbientSoundsRestart()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// x = client index
|
|
||||||
for (new x = 1; x <= MaxClients; x++)
|
|
||||||
{
|
|
||||||
// If client isn't in-game, then stop.
|
|
||||||
if (!IsClientInGame(x))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
bAmbientSoundsIsPlaying[x] = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get ambient sound length.
|
// Get ambient sound length.
|
||||||
new Float:ambientlength = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH]);
|
new Float:ambientlength = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_LENGTH]);
|
||||||
|
|
||||||
@ -203,6 +206,9 @@ public Action:AmbientSoundsTimer(Handle:timer)
|
|||||||
// Get ambient sound volume.
|
// Get ambient sound volume.
|
||||||
new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]);
|
new Float:ambientvolume = GetConVarFloat(g_hCvarsList[CVAR_AMBIENTSOUNDS_VOLUME]);
|
||||||
|
|
||||||
|
// Stop sound before playing again.
|
||||||
|
SEffectsStopAmbientSound(sound);
|
||||||
|
|
||||||
// Emit ambient sound.
|
// Emit ambient sound.
|
||||||
SEffectsEmitAmbientSound(sound, ambientvolume);
|
SEffectsEmitAmbientSound(sound, ambientvolume);
|
||||||
|
|
||||||
|
@ -61,6 +61,15 @@ SEffectsOnRoundStart()
|
|||||||
AmbientSoundsOnRoundStart();
|
AmbientSoundsOnRoundStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The round is ending.
|
||||||
|
*/
|
||||||
|
SEffectsOnRoundEnd()
|
||||||
|
{
|
||||||
|
// Forward event to sub-modules.
|
||||||
|
AmbientSoundsOnRoundEnd();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client is spawning into the game.
|
* Client is spawning into the game.
|
||||||
*
|
*
|
||||||
@ -118,9 +127,6 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client
|
|||||||
// Precache sound before playing.
|
// Precache sound before playing.
|
||||||
PrecacheSound(sound);
|
PrecacheSound(sound);
|
||||||
|
|
||||||
// Stop sound before playing again.
|
|
||||||
SEffectsStopAmbientSound(sound);
|
|
||||||
|
|
||||||
if (ZRIsClientValid(client))
|
if (ZRIsClientValid(client))
|
||||||
{
|
{
|
||||||
// Emit ambient sound.
|
// Emit ambient sound.
|
||||||
@ -140,10 +146,7 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit ambient sound.
|
// Emit ambient sound.
|
||||||
EmitSoundToClient(x, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, ambientvolume);
|
EmitSoundToClient(x, sound, SOUND_FROM_PLAYER, SNDCHAN_AUTO, _, _, ambientvolume);
|
||||||
|
|
||||||
// Flag client that sound is playing.
|
|
||||||
bAmbientSoundsIsPlaying[x] = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user