Updated includes and spcomp to SourceMod 1.9

This commit is contained in:
BotoX
2016-08-23 15:34:00 +02:00
parent 0c0ce1adfc
commit 584ab0c27a
80 changed files with 2851 additions and 2474 deletions
+207 -177
View File
@@ -92,7 +92,7 @@ enum
SNDLEVEL_RUSTLE = 20, /**< Rustling leaves */
SNDLEVEL_WHISPER = 25, /**< Whispering */
SNDLEVEL_LIBRARY = 30, /**< In a library */
SNDLEVEL_FRIDGE = 45, /**< Refridgerator */
SNDLEVEL_FRIDGE = 45, /**< Refrigerator */
SNDLEVEL_HOME = 50, /**< Average home (3.9 attn) */
SNDLEVEL_CONVO = 60, /**< Normal conversation (2.0 attn) */
SNDLEVEL_DRYER = 60, /**< Clothes dryer */
@@ -125,9 +125,8 @@ enum
* Prefetches a sound.
*
* @param name Sound file name relative to the "sounds" folder.
* @noreturn
*/
native PrefetchSound(const String:name[]);
native void PrefetchSound(const char[] name);
/**
* This function is not known to work, and may crash. You should
@@ -137,7 +136,7 @@ native PrefetchSound(const String:name[]);
* @return Duration in seconds.
*/
#pragma deprecated Does not work, may crash.
native Float:GetSoundDuration(const String:name[]);
native float GetSoundDuration(const char[] name);
/**
* Emits an ambient sound.
@@ -150,16 +149,15 @@ native Float:GetSoundDuration(const String:name[]);
* @param vol Volume (from 0.0 to 1.0).
* @param pitch Pitch (from 0 to 255).
* @param delay Play delay.
* @noreturn
*/
native EmitAmbientSound(const String:name[],
const Float:pos[3],
entity = SOUND_FROM_WORLD,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:vol = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
Float:delay = 0.0);
native void EmitAmbientSound(const char[] name,
const float pos[3],
int entity = SOUND_FROM_WORLD,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float vol = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
float delay = 0.0);
/**
* Fades a client's volume level toward silence or a given percentage.
@@ -169,10 +167,9 @@ native EmitAmbientSound(const String:name[],
* @param outtime Fade out time, in seconds.
* @param holdtime Hold time, in seconds.
* @param intime Fade in time, in seconds.
* @noreturn
* @error Invalid client index or client not in game.
*/
native FadeClientVolume(client, Float:percent, Float:outtime, Float:holdtime, Float:intime);
native void FadeClientVolume(int client, float percent, float outtime, float holdtime, float intime);
/**
* Stops a sound.
@@ -180,9 +177,8 @@ native FadeClientVolume(client, Float:percent, Float:outtime, Float:holdtime, Fl
* @param entity Entity index.
* @param channel Channel number.
* @param name Sound file name relative to the "sounds" folder.
* @noreturn
*/
native StopSound(entity, channel, const String:name[]);
native void StopSound(int entity, int channel, const char[] name);
/**
* Emits a sound to a list of clients.
@@ -202,31 +198,71 @@ native StopSound(entity, channel, const String:name[]);
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @param ... Optional list of Float[3] arrays to specify additional origins.
* @noreturn
* @error Invalid client index.
*/
native EmitSound(const clients[],
numClients,
const String:sample[],
entity = SOUND_FROM_PLAYER,
channel = SNDCHAN_AUTO,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:volume = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0,
any:...);
native void EmitSound(const int[] clients,
int numClients,
const char[] sample,
int entity = SOUND_FROM_PLAYER,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0,
any ...);
/**
* Emits a sound or game sound to a list of clients using the latest version of the engine sound interface.
* This native is only available in engines that are greater than or equal to Portal 2.
*
* @param clients Array of client indexes.
* @param numClients Number of clients in the array.
* @param soundEntry Sound entry name.
* @param sample Sound file name relative to the "sounds" folder.
* @param entity Entity to emit from.
* @param channel Channel to emit with.
* @param level Sound level.
* @param seed Sound seed.
* @param flags Sound flags.
* @param volume Sound volume.
* @param pitch Sound pitch.
* @param speakerentity Unknown.
* @param origin Sound origin.
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @param ... Optional list of Float[3] arrays to specify additional origins.
* @error Invalid client index.
*/
native void EmitSoundEntry(const int[] clients,
int numClients,
const char[] soundEntry,
const char[] sample,
int entity = SOUND_FROM_PLAYER,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int seed = 0,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0,
any ...);
/**
* Emits a sentence to a list of clients.
*
* @param clients Array of client indexes.
* @param numClients Number of clients in the array.
* @param sentence Sentence index (from PrecacheSenteFile).
* @param sentence Sentence index (from PrecacheSentenceFile).
* @param entity Entity to emit from.
* @param channel Channel to emit with.
* @param level Sound level.
@@ -239,33 +275,32 @@ native EmitSound(const clients[],
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @param ... Optional list of Float[3] arrays to specify additional origins.
* @noreturn
* @error Invalid client index.
*/
native EmitSentence(const clients[],
numClients,
sentence,
entity,
channel = SNDCHAN_AUTO,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:volume = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0,
any:...);
native void EmitSentence(const int[] clients,
int numClients,
int sentence,
int entity,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0,
any ...);
/**
*Calculates gain of sound on given distance with given sound level in decibel
* Calculates gain of sound on given distance with given sound level in decibel
*
* @param soundlevel decibel of sound, like SNDLEVEL_NORMAL or integer value
* @param distance distance of sound to calculate, not meter or feet, but Source Engine`s normal Coordinate unit
* @return gain of sound. you can multiply this with original sound`s volume to calculate volume on given distance
*/
native Float:GetDistGainFromSoundLevel(soundlevel, Float:distance);
native float GetDistGainFromSoundLevel(int soundlevel, float distance);
/**
* Called when an ambient sound is about to be emitted to one or more clients.
@@ -294,69 +329,69 @@ typedef AmbientSHook = function Action (
float &delay
);
/**
* Called when a sound is going to be emitted to one or more clients.
* NOTICE: all params can be overwritten to modify the default behaviour.
*
* @param clients Array of client indexes.
* @param numClients Number of clients in the array (modify this value if you add/remove elements from the client array).
* @param sample Sound file name relative to the "sounds" folder.
* @param entity Entity emitting the sound.
* @param channel Channel emitting the sound.
* @param volume Sound volume.
* @param level Sound level.
* @param pitch Sound pitch.
* @param flags Sound flags.
* @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it,
* Plugin_Changed when any parameter has been modified.
*/
typedef NormalSHook = function Action (
int clients[64],
int &numClients,
char sample[PLATFORM_MAX_PATH],
int &entity,
int &channel,
float &volume,
int &level,
int &pitch,
int &flags
);
typeset NormalSHook
{
// Called when a sound is going to be emitted to one or more clients.
// NOTICE: all params can be overwritten to modify the default behavior.
//
// @param clients Array of client indexes.
// @param numClients Number of clients in the array (modify this value if you add/remove elements from the client array).
// @param sample Sound file name relative to the "sounds" folder.
// @param entity Entity emitting the sound.
// @param channel Channel emitting the sound.
// @param volume Sound volume.
// @param level Sound level.
// @param pitch Sound pitch.
// @param flags Sound flags.
// @param soundEntry Game sound entry name. (Used in engines newer than Portal 2)
// @param seed Sound seed. (Used in engines newer than Portal 2)
// @return Plugin_Continue to allow the sound to be played, Plugin_Stop to block it,
// Plugin_Changed when any parameter has been modified.
function Action (int clients[MAXPLAYERS], int &numClients, char sample[PLATFORM_MAX_PATH],
int &entity, int &channel, float &volume, int &level, int &pitch, int &flags,
char soundEntry[PLATFORM_MAX_PATH], int &seed);
// Deprecated. Use other prototype.
function Action (int clients[64], int &numClients, char sample[PLATFORM_MAX_PATH],
int &entity, int &channel, float &volume, int &level, int &pitch, int &flags,
char soundEntry[PLATFORM_MAX_PATH], int &seed);
// Deprecated. Use other prototype.
function Action (int clients[64], int &numClients, char sample[PLATFORM_MAX_PATH],
int &entity, int &channel, float &volume, int &level, int &pitch, int &flags);
};
/**
* Hooks all played ambient sounds.
*
* @param hook Function to use as a hook.
* @noreturn
* @error Invalid function hook.
*/
native AddAmbientSoundHook(AmbientSHook:hook);
native void AddAmbientSoundHook(AmbientSHook hook);
/**
* Hooks all played normal sounds.
*
* @param hook Function to use as a hook.
* @noreturn
* @error Invalid function hook.
*/
native AddNormalSoundHook(NormalSHook:hook);
native void AddNormalSoundHook(NormalSHook hook);
/**
* Unhooks all played ambient sounds.
*
* @param hook Function used for the hook.
* @noreturn
* @error Invalid function hook.
*/
native RemoveAmbientSoundHook(AmbientSHook:hook);
native void RemoveAmbientSoundHook(AmbientSHook hook);
/**
* Unhooks all played normal sounds.
*
* @param hook Function used for the hook.
* @noreturn
* @error Invalid function hook.
*/
native RemoveNormalSoundHook(NormalSHook:hook);
native void RemoveNormalSoundHook(NormalSHook hook);
/**
* Wrapper to emit sound to one client.
@@ -374,24 +409,23 @@ native RemoveNormalSoundHook(NormalSHook:hook);
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @noreturn
* @error Invalid client index.
*/
stock EmitSoundToClient(client,
const String:sample[],
entity = SOUND_FROM_PLAYER,
channel = SNDCHAN_AUTO,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:volume = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock void EmitSoundToClient(int client,
const char[] sample,
int entity = SOUND_FROM_PLAYER,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new clients[1];
int clients[1];
clients[0] = client;
/* Save some work for SDKTools and remove SOUND_FROM_PLAYER references */
entity = (entity == SOUND_FROM_PLAYER) ? client : entity;
@@ -415,26 +449,25 @@ stock EmitSoundToClient(client,
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @noreturn
* @error Invalid client index.
*/
stock EmitSoundToAll(const String:sample[],
entity = SOUND_FROM_PLAYER,
channel = SNDCHAN_AUTO,
level = SNDLEVEL_NORMAL,
flags = SND_NOFLAGS,
Float:volume = SNDVOL_NORMAL,
pitch = SNDPITCH_NORMAL,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock void EmitSoundToAll(const char[] sample,
int entity = SOUND_FROM_PLAYER,
int channel = SNDCHAN_AUTO,
int level = SNDLEVEL_NORMAL,
int flags = SND_NOFLAGS,
float volume = SNDVOL_NORMAL,
int pitch = SNDPITCH_NORMAL,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new clients[MaxClients];
new total = 0;
int[] clients = new int[MaxClients];
int total = 0;
for (new i=1; i<=MaxClients; i++)
for (int i=1; i<=MaxClients; i++)
{
if (IsClientInGame(i))
{
@@ -459,7 +492,7 @@ stock EmitSoundToAll(const String:sample[],
* @param attn Attenuation value.
* @return Integer sound level.
*/
stock ATTN_TO_SNDLEVEL(Float:attn)
stock int ATTN_TO_SNDLEVEL(float attn)
{
if (attn > 0.0)
{
@@ -488,14 +521,14 @@ stock ATTN_TO_SNDLEVEL(Float:attn)
* @return True if the sound was successfully retrieved, false if it
* was not found
*/
native bool:GetGameSoundParams(const String:gameSound[],
&channel,
&soundLevel,
&Float:volume,
&pitch,
String:sample[],
maxlength,
entity=SOUND_FROM_PLAYER);
native bool GetGameSoundParams(const char[] gameSound,
int &channel,
int &soundLevel,
float &volume,
int &pitch,
char[] sample,
int maxlength,
int entity=SOUND_FROM_PLAYER);
/**
* Emits a game sound to a list of clients.
@@ -519,22 +552,22 @@ native bool:GetGameSoundParams(const String:gameSound[],
* @return True if the sound was played successfully, false if it failed
* @error Invalid client index.
*/
stock bool:EmitGameSound(const clients[],
numClients,
const String:gameSound[],
entity = SOUND_FROM_PLAYER,
flags = SND_NOFLAGS,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock bool EmitGameSound(const int[] clients,
int numClients,
const char[] gameSound,
int entity = SOUND_FROM_PLAYER,
int flags = SND_NOFLAGS,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new channel;
new level;
new Float:volume;
new pitch;
new String:sample[PLATFORM_MAX_PATH];
int channel;
int level;
float volume;
int pitch;
char sample[PLATFORM_MAX_PATH];
if (GetGameSoundParams(gameSound, channel, level, volume, pitch, sample, sizeof(sample), entity))
{
@@ -561,19 +594,18 @@ stock bool:EmitGameSound(const clients[],
* @param entity Entity index to associate sound with.
* @param flags Sound flags.
* @param delay Play delay.
* @noreturn
*/
stock bool:EmitAmbientGameSound(const String:gameSound[],
const Float:pos[3],
entity = SOUND_FROM_WORLD,
flags = SND_NOFLAGS,
Float:delay = 0.0)
stock bool EmitAmbientGameSound(const char[] gameSound,
const float pos[3],
int entity = SOUND_FROM_WORLD,
int flags = SND_NOFLAGS,
float delay = 0.0)
{
new channel; // This is never actually used for Ambients, but it's a mandatory field to GetGameSoundParams
new level;
new Float:volume;
new pitch;
new String:sample[PLATFORM_MAX_PATH];
int channel; // This is never actually used for Ambients, but it's a mandatory field to GetGameSoundParams
int level;
float volume;
int pitch;
char sample[PLATFORM_MAX_PATH];
if (GetGameSoundParams(gameSound, channel, level, volume, pitch, sample, sizeof(sample), entity))
{
@@ -604,20 +636,19 @@ stock bool:EmitAmbientGameSound(const String:gameSound[],
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @noreturn
* @error Invalid client index.
*/
stock bool:EmitGameSoundToClient(client,
const String:gameSound[],
entity = SOUND_FROM_PLAYER,
flags = SND_NOFLAGS,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock bool EmitGameSoundToClient(int client,
const char[] gameSound,
int entity = SOUND_FROM_PLAYER,
int flags = SND_NOFLAGS,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new clients[1];
int clients[1];
clients[0] = client;
/* Save some work for SDKTools and remove SOUND_FROM_PLAYER references */
entity = (entity == SOUND_FROM_PLAYER) ? client : entity;
@@ -642,22 +673,21 @@ stock bool:EmitGameSoundToClient(client,
* @param dir Sound direction.
* @param updatePos Unknown (updates positions?)
* @param soundtime Alternate time to play sound for.
* @noreturn
* @error Invalid client index.
*/
stock bool:EmitGameSoundToAll(const String:gameSound[],
entity = SOUND_FROM_PLAYER,
flags = SND_NOFLAGS,
speakerentity = -1,
const Float:origin[3] = NULL_VECTOR,
const Float:dir[3] = NULL_VECTOR,
bool:updatePos = true,
Float:soundtime = 0.0)
stock bool EmitGameSoundToAll(const char[] gameSound,
int entity = SOUND_FROM_PLAYER,
int flags = SND_NOFLAGS,
int speakerentity = -1,
const float origin[3] = NULL_VECTOR,
const float dir[3] = NULL_VECTOR,
bool updatePos = true,
float soundtime = 0.0)
{
new clients[MaxClients];
new total = 0;
int[] clients = new int[MaxClients];
int total = 0;
for (new i=1; i<=MaxClients; i++)
for (int i=1; i<=MaxClients; i++)
{
if (IsClientInGame(i))
{
@@ -692,4 +722,4 @@ stock bool:EmitGameSoundToAll(const String:gameSound[],
* @return True if the game sound was found, false if sound did not exist
* or had no files
*/
native bool:PrecacheScriptSound(const String:soundname[]);
native bool PrecacheScriptSound(const char[] soundname);