adding the zvolume and ambient features over here
This commit is contained in:
parent
99b0a6aa12
commit
206bbfdd91
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,7 +1,5 @@
|
|||||||
src/zr/hgversion.h.inc
|
src/zr/hgversion.h.inc
|
||||||
|
|
||||||
cstrike/
|
|
||||||
|
|
||||||
build/
|
build/
|
||||||
release/
|
release/
|
||||||
docs/changes/
|
docs/changes/
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -351,6 +351,7 @@ public OnClientCookiesCached(client)
|
|||||||
ClassOnCookiesCached(client);
|
ClassOnCookiesCached(client);
|
||||||
WeaponsOnCookiesCached(client);
|
WeaponsOnCookiesCached(client);
|
||||||
ZHPOnCookiesCached(client);
|
ZHPOnCookiesCached(client);
|
||||||
|
ZVolumeOnCookiesCached(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -45,6 +45,7 @@ CommandsInit()
|
|||||||
ZTele_OnCommandsCreate();
|
ZTele_OnCommandsCreate();
|
||||||
ZHPOnCommandsCreate();
|
ZHPOnCommandsCreate();
|
||||||
VolOnCommandsCreate();
|
VolOnCommandsCreate();
|
||||||
|
ZVolumeOnCommandsCreate();
|
||||||
ZombieSoundsOnCommandsCreate();
|
ZombieSoundsOnCommandsCreate();
|
||||||
ImmunityOnCommandsCreate();
|
ImmunityOnCommandsCreate();
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ CookiesInit()
|
|||||||
ClassOnCookiesCreate();
|
ClassOnCookiesCreate();
|
||||||
WeaponsOnCookiesCreate();
|
WeaponsOnCookiesCreate();
|
||||||
ZHPOnCookiesCreate();
|
ZHPOnCookiesCreate();
|
||||||
|
ZVolumeOnCookiesCreate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -152,6 +152,7 @@ enum CvarsList
|
|||||||
Handle:CVAR_SEFFECTS_DEATH,
|
Handle:CVAR_SEFFECTS_DEATH,
|
||||||
Handle:CVAR_SEFFECTS_COMMAND_LIMIT,
|
Handle:CVAR_SEFFECTS_COMMAND_LIMIT,
|
||||||
Handle:CVAR_SEFFECTS_COMMAND_TIMESPAN,
|
Handle:CVAR_SEFFECTS_COMMAND_TIMESPAN,
|
||||||
|
Handle:CVAR_SEFFECTS_VOLUME,
|
||||||
Handle:CVAR_AMBIENTSOUNDS,
|
Handle:CVAR_AMBIENTSOUNDS,
|
||||||
Handle:CVAR_AMBIENTSOUNDS_FILE,
|
Handle:CVAR_AMBIENTSOUNDS_FILE,
|
||||||
Handle:CVAR_AMBIENTSOUNDS_LENGTH,
|
Handle:CVAR_AMBIENTSOUNDS_LENGTH,
|
||||||
@ -450,6 +451,7 @@ CvarsCreate()
|
|||||||
g_hCvarsList[CVAR_SEFFECTS_DEATH] = CreateConVar("zr_seffects_death", "1", "Emit a death sound when a zombie dies.");
|
g_hCvarsList[CVAR_SEFFECTS_DEATH] = CreateConVar("zr_seffects_death", "1", "Emit a death sound when a zombie dies.");
|
||||||
g_hCvarsList[CVAR_SEFFECTS_COMMAND_LIMIT] = CreateConVar("zr_seffects_command_limit", "4", "Number of sound commands allowed within the time span, or total limit if time span is disabled. ['0' = Disable sound command limit]");
|
g_hCvarsList[CVAR_SEFFECTS_COMMAND_LIMIT] = CreateConVar("zr_seffects_command_limit", "4", "Number of sound commands allowed within the time span, or total limit if time span is disabled. ['0' = Disable sound command limit]");
|
||||||
g_hCvarsList[CVAR_SEFFECTS_COMMAND_TIMESPAN] = CreateConVar("zr_seffects_command_timespan", "10", "Time span for sound command limiter (in seconds). ['0' = Disable time span check | positive number = Time span]");
|
g_hCvarsList[CVAR_SEFFECTS_COMMAND_TIMESPAN] = CreateConVar("zr_seffects_command_timespan", "10", "Time span for sound command limiter (in seconds). ['0' = Disable time span check | positive number = Time span]");
|
||||||
|
g_hCvarsList[CVAR_SEFFECTS_VOLUME] = CreateConVar("zr_seffects_volume", "0.8", "Default volume of the zombie voice sounds, used as each client's starting !zsound value. [1.0 = Max volume | 0.0001 = Not audible]");
|
||||||
|
|
||||||
// Ambient Sounds
|
// Ambient Sounds
|
||||||
g_hCvarsList[CVAR_AMBIENTSOUNDS] = CreateConVar("zr_ambientsounds", "1", "Play an ambient sound to all players during gameplay.");
|
g_hCvarsList[CVAR_AMBIENTSOUNDS] = CreateConVar("zr_ambientsounds", "1", "Play an ambient sound to all players during gameplay.");
|
||||||
|
|||||||
@ -38,6 +38,7 @@
|
|||||||
#include "zr/soundeffects/voice"
|
#include "zr/soundeffects/voice"
|
||||||
#include "zr/soundeffects/ambientsounds"
|
#include "zr/soundeffects/ambientsounds"
|
||||||
#include "zr/soundeffects/zombiesounds"
|
#include "zr/soundeffects/zombiesounds"
|
||||||
|
#include "zr/soundeffects/volumecontrol"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load sound effects data.
|
* Load sound effects data.
|
||||||
@ -172,8 +173,17 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client
|
|||||||
|
|
||||||
if (ZRIsClientValid(client))
|
if (ZRIsClientValid(client))
|
||||||
{
|
{
|
||||||
|
// Scale by this client's personal ambient volume setting.
|
||||||
|
new Float:finalvolume = ambientvolume * ZVolume_GetAmbientVolume(client);
|
||||||
|
|
||||||
|
// If client has muted ambient sounds, then stop.
|
||||||
|
if (finalvolume <= 0.0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Emit ambient sound.
|
// Emit ambient sound.
|
||||||
EmitSoundToClient(client, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, ambientvolume);
|
EmitSoundToClient(client, sound, SOUND_FROM_PLAYER, SOUND_AMBIENT_CHANNEL, _, _, finalvolume);
|
||||||
|
|
||||||
// Flag client that sound is playing.
|
// Flag client that sound is playing.
|
||||||
bAmbientSoundsIsPlaying[client] = true;
|
bAmbientSoundsIsPlaying[client] = true;
|
||||||
@ -188,8 +198,17 @@ SEffectsEmitAmbientSound(const String:sound[], Float:ambientvolume = 1.0, client
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Scale by this client's personal ambient volume setting.
|
||||||
|
new Float:finalvolume = ambientvolume * ZVolume_GetAmbientVolume(x);
|
||||||
|
|
||||||
|
// If client has muted ambient sounds, then skip them.
|
||||||
|
if (finalvolume <= 0.0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Emit ambient sound.
|
// Emit ambient sound.
|
||||||
EmitSoundToClient(x, sound, SOUND_FROM_PLAYER, SNDCHAN_AUTO, _, _, ambientvolume);
|
EmitSoundToClient(x, sound, SOUND_FROM_PLAYER, SNDCHAN_AUTO, _, _, finalvolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -233,6 +252,25 @@ SEffectsEmitSoundFromClient(client, const String:sound[], level = SNDLEVEL_NORMA
|
|||||||
// Precache sound before playing.
|
// Precache sound before playing.
|
||||||
PrecacheSound(sound);
|
PrecacheSound(sound);
|
||||||
|
|
||||||
// Emit sound from client.
|
// x = receiving client index.
|
||||||
EmitSoundToAll(sound, client, _, level);
|
for (new x = 1; x <= MaxClients; x++)
|
||||||
|
{
|
||||||
|
// If client isn't in-game, then skip.
|
||||||
|
if (!IsClientInGame(x))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get this client's personal zombie-voice volume.
|
||||||
|
new Float:zvolume = ZVolume_GetZSoundVolume(x);
|
||||||
|
|
||||||
|
// If client has muted zombie voice sounds, then skip them.
|
||||||
|
if (zvolume <= 0.0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Emit sound from client, at this receiving client's personal volume.
|
||||||
|
EmitSoundToClient(x, sound, client, _, level, _, zvolume);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user