|
| 1 | +/** |
| 2 | +* ============================================================================= |
| 3 | +* Source Python |
| 4 | +* Copyright (C) 2014 Source Python Development Team. All rights reserved. |
| 5 | +* ============================================================================= |
| 6 | +* |
| 7 | +* This program is free software; you can redistribute it and/or modify it under |
| 8 | +* the terms of the GNU General Public License, version 3.0, as published by the |
| 9 | +* Free Software Foundation. |
| 10 | +* |
| 11 | +* This program is distributed in the hope that it will be useful, but WITHOUT |
| 12 | +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 13 | +* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 14 | +* details. |
| 15 | +* |
| 16 | +* You should have received a copy of the GNU General Public License along with |
| 17 | +* this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | +* |
| 19 | +* As a special exception, the Source Python Team gives you permission |
| 20 | +* to link the code of this program (as well as its derivative works) to |
| 21 | +* "Half-Life 2," the "Source Engine," and any Game MODs that run on software |
| 22 | +* by the Valve Corporation. You must obey the GNU General Public License in |
| 23 | +* all respects for all other code used. Additionally, the Source.Python |
| 24 | +* Development Team grants this exception to all derivative works. |
| 25 | +*/ |
| 26 | + |
| 27 | +#ifndef _ENGINES_GMOD_H |
| 28 | +#define _ENGINES_GMOD_H |
| 29 | + |
| 30 | +//----------------------------------------------------------------------------- |
| 31 | +// Includes. |
| 32 | +//----------------------------------------------------------------------------- |
| 33 | +#include "engine/IEngineSound.h" |
| 34 | + |
| 35 | + |
| 36 | +//----------------------------------------------------------------------------- |
| 37 | +// IVEngineServer extension class. |
| 38 | +//----------------------------------------------------------------------------- |
| 39 | +class GameIVEngineServerExt |
| 40 | +{ |
| 41 | +public: |
| 42 | + static bool IsMapValid(IVEngineServer* pServer, const char* map_name) |
| 43 | + { |
| 44 | + return pServer->IsMapValid(map_name); |
| 45 | + } |
| 46 | +}; |
| 47 | + |
| 48 | + |
| 49 | +//----------------------------------------------------------------------------- |
| 50 | +// IEngineSound extension class. |
| 51 | +//----------------------------------------------------------------------------- |
| 52 | +class IEngineSoundExt |
| 53 | +{ |
| 54 | +public: |
| 55 | + static void EmitSound(IEngineSound* pEngineSound, IRecipientFilter& filter, int iEntIndex, int iChannel, const char *pSample, |
| 56 | + float flVolume, float flAttenuation, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection, |
| 57 | + tuple origins, bool bUpdatePositions, float soundtime, int speakerentity) |
| 58 | + { |
| 59 | + CUtlVector<Vector> *pUtlVecOrigins = NULL; |
| 60 | + CUtlVector<Vector> vecOrigins; |
| 61 | + if (len(origins) > 0) |
| 62 | + { |
| 63 | + pUtlVecOrigins = &vecOrigins; |
| 64 | + for(int i=0; i < len(origins); i++) |
| 65 | + { |
| 66 | + vecOrigins.AddToTail(extract<Vector>(origins[i])); |
| 67 | + } |
| 68 | + } |
| 69 | + |
| 70 | + pEngineSound->EmitSound(filter, iEntIndex, iChannel, pSample, flVolume, flAttenuation, iFlags, iPitch, pOrigin, pDirection, |
| 71 | + pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity); |
| 72 | + } |
| 73 | + |
| 74 | + static void StopSound(IEngineSound* pEngineSound, int iEntIndex, int iChannel, const char *pSample) |
| 75 | + { |
| 76 | + pEngineSound->StopSound(iEntIndex, iChannel, pSample); |
| 77 | + } |
| 78 | +}; |
| 79 | + |
| 80 | + |
| 81 | +//--------------------------------------------------------------------------------- |
| 82 | +// IEngineTrace |
| 83 | +//--------------------------------------------------------------------------------- |
| 84 | +inline int GetPointContents(const Vector &vecAbsPosition, IHandleEntity** ppEntity) |
| 85 | +{ |
| 86 | + return enginetrace->GetPointContents(vecAbsPosition, ppEntity); |
| 87 | +} |
| 88 | + |
| 89 | + |
| 90 | +#endif // _ENGINES_GMOD_H |
0 commit comments