|
faluco@1735
|
1 |
/** |
|
faluco@1735
|
2 |
* vim: set ts=4 : |
|
faluco@1735
|
3 |
* ============================================================================= |
|
faluco@1735
|
4 |
* SourceMod SDKTools Extension |
|
ds@1947
|
5 |
* Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. |
|
faluco@1735
|
6 |
* ============================================================================= |
|
faluco@1735
|
7 |
* |
|
faluco@1735
|
8 |
* This program is free software; you can redistribute it and/or modify it under |
|
faluco@1735
|
9 |
* the terms of the GNU General Public License, version 3.0, as published by the |
|
faluco@1735
|
10 |
* Free Software Foundation. |
|
faluco@1735
|
11 |
* |
|
faluco@1735
|
12 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
faluco@1735
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
faluco@1735
|
14 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
faluco@1735
|
15 |
* details. |
|
faluco@1735
|
16 |
* |
|
faluco@1735
|
17 |
* You should have received a copy of the GNU General Public License along with |
|
faluco@1735
|
18 |
* this program. If not, see <http://www.gnu.org/licenses/>. |
|
faluco@1735
|
19 |
* |
|
faluco@1735
|
20 |
* As a special exception, AlliedModders LLC gives you permission to link the |
|
faluco@1735
|
21 |
* code of this program (as well as its derivative works) to "Half-Life 2," the |
|
faluco@1735
|
22 |
* "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software |
|
faluco@1735
|
23 |
* by the Valve Corporation. You must obey the GNU General Public License in |
|
faluco@1735
|
24 |
* all respects for all other code used. Additionally, AlliedModders LLC grants |
|
faluco@1735
|
25 |
* this exception to all derivative works. AlliedModders LLC defines further |
|
faluco@1735
|
26 |
* exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), |
|
faluco@1735
|
27 |
* or <http://www.sourcemod.net/license.php>. |
|
faluco@1735
|
28 |
* |
|
faluco@1735
|
29 |
* Version: $Id$ |
|
faluco@1735
|
30 |
*/ |
|
faluco@1735
|
31 |
|
|
faluco@1735
|
32 |
#ifndef _INCLUDE_SOURCEMOD_VSOUND_H_ |
|
faluco@1735
|
33 |
#define _INCLUDE_SOURCEMOD_VSOUND_H_ |
|
faluco@1735
|
34 |
|
|
faluco@1735
|
35 |
#include <sh_list.h> |
|
faluco@1735
|
36 |
#include "extension.h" |
|
faluco@1735
|
37 |
#include "CellRecipientFilter.h" |
|
faluco@1735
|
38 |
|
|
faluco@1735
|
39 |
#define NORMAL_SOUND_HOOK 0 |
|
faluco@1735
|
40 |
#define AMBIENT_SOUND_HOOK 1 |
|
faluco@1735
|
41 |
|
|
faluco@1735
|
42 |
typedef SourceHook::List<IPluginFunction *>::iterator SoundHookIter; |
|
faluco@1735
|
43 |
|
|
faluco@1735
|
44 |
class SoundHooks : public IPluginsListener |
|
faluco@1735
|
45 |
{ |
|
faluco@1735
|
46 |
public: //IPluginsListener |
|
faluco@1735
|
47 |
void OnPluginUnloaded(IPlugin *plugin); |
|
faluco@1735
|
48 |
public: |
|
faluco@1735
|
49 |
void Initialize(); |
|
faluco@1735
|
50 |
void Shutdown(); |
|
faluco@1735
|
51 |
void AddHook(int type, IPluginFunction *pFunc); |
|
faluco@1735
|
52 |
bool RemoveHook(int type, IPluginFunction *pFunc); |
|
skamonkey@3942
|
53 |
|
|
skamonkey@3942
|
54 |
#if SOURCE_ENGINE == SE_DOTA |
|
skamonkey@3942
|
55 |
void OnEmitAmbientSound(CEntityIndex index, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay); |
|
skamonkey@3942
|
56 |
#else |
|
skamonkey@3942
|
57 |
void OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay); |
|
skamonkey@3942
|
58 |
#endif |
|
skamonkey@3942
|
59 |
|
|
skamonkey@3515
|
60 |
#if SOURCE_ENGINE >= SE_PORTAL2 |
|
skamonkey@3515
|
61 |
int OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *, unsigned int, const char *pSample, float flVolume, |
|
skamonkey@3515
|
62 |
soundlevel_t iSoundlevel, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, |
|
skamonkey@3515
|
63 |
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, |
|
skamonkey@3515
|
64 |
float soundtime, int speakerentity); |
|
skamonkey@3515
|
65 |
int OnEmitSound2(IRecipientFilter &filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash, const char *pSample, |
|
skamonkey@3515
|
66 |
float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, |
|
skamonkey@3515
|
67 |
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, |
|
skamonkey@3515
|
68 |
float soundtime, int speakerentity); |
|
skamonkey@3515
|
69 |
#else |
|
skamonkey@3613
|
70 |
#if SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS |
|
skamonkey@3564
|
71 |
|
|
skamonkey@3564
|
72 |
void OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume, |
|
skamonkey@3564
|
73 |
soundlevel_t iSoundlevel, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin, |
|
skamonkey@3564
|
74 |
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, |
|
skamonkey@3564
|
75 |
float soundtime, int speakerentity); |
|
skamonkey@3564
|
76 |
void OnEmitSound2(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume, |
|
skamonkey@3564
|
77 |
float flAttenuation, int iFlags, int iPitch, int iSpecialDSP, const Vector *pOrigin, |
|
skamonkey@3564
|
78 |
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, |
|
skamonkey@3564
|
79 |
float soundtime, int speakerentity); |
|
skamonkey@3564
|
80 |
#else |
|
faluco@1735
|
81 |
void OnEmitSound(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume, |
|
faluco@1735
|
82 |
soundlevel_t iSoundlevel, int iFlags, int iPitch, const Vector *pOrigin, |
|
faluco@1735
|
83 |
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, |
|
faluco@1735
|
84 |
float soundtime, int speakerentity); |
|
faluco@1735
|
85 |
void OnEmitSound2(IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, float flVolume, |
|
faluco@1735
|
86 |
float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, |
|
faluco@1735
|
87 |
const Vector *pDirection, CUtlVector<Vector> *pUtlVecOrigins, bool bUpdatePositions, |
|
faluco@1735
|
88 |
float soundtime, int speakerentity); |
|
skamonkey@3613
|
89 |
#endif // SOURCE_ENGINE == SE_ORANGEBOXVALVE || SOURCE_ENGINE == SE_CSS |
|
skamonkey@3564
|
90 |
#endif // SOURCE_ENGINE >= SE_PORTAL2 |
|
faluco@1735
|
91 |
private: |
|
faluco@1735
|
92 |
size_t _FillInPlayers(int *pl_array, IRecipientFilter *pFilter); |
|
faluco@1735
|
93 |
void _IncRefCounter(int type); |
|
faluco@1735
|
94 |
void _DecRefCounter(int type); |
|
faluco@1735
|
95 |
private: |
|
faluco@1735
|
96 |
SourceHook::List<IPluginFunction *> m_AmbientFuncs; |
|
faluco@1735
|
97 |
SourceHook::List<IPluginFunction *> m_NormalFuncs; |
|
faluco@1735
|
98 |
size_t m_NormalCount; |
|
faluco@1735
|
99 |
size_t m_AmbientCount; |
|
faluco@1735
|
100 |
}; |
|
faluco@1735
|
101 |
|
|
faluco@1735
|
102 |
extern SoundHooks s_SoundHooks; |
|
faluco@1735
|
103 |
|
|
faluco@1737
|
104 |
#endif //_INCLUDE_SOURCEMOD_VSOUND_H_ |