fixed amb728, precache slap sounds
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401268
This commit is contained in:
parent
b79f1f6df3
commit
5b564e15da
@ -42,6 +42,8 @@
|
|||||||
* @brief Implements SDK Tools extension code.
|
* @brief Implements SDK Tools extension code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, false, bool, const char *, const char *, const char *, const char *, bool, bool);
|
||||||
|
|
||||||
SDKTools g_SdkTools; /**< Global singleton for extension's main interface */
|
SDKTools g_SdkTools; /**< Global singleton for extension's main interface */
|
||||||
IServerGameEnts *gameents = NULL;
|
IServerGameEnts *gameents = NULL;
|
||||||
IEngineTrace *enginetrace = NULL;
|
IEngineTrace *enginetrace = NULL;
|
||||||
@ -89,6 +91,8 @@ bool SDKTools::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
|
|
||||||
ConCommandBaseMgr::OneTimeInit(this);
|
ConCommandBaseMgr::OneTimeInit(this);
|
||||||
|
|
||||||
|
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SDKTools::LevelInit, true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +127,8 @@ void SDKTools::SDK_OnUnload()
|
|||||||
|
|
||||||
gameconfs->CloseGameConfigFile(g_pGameConf);
|
gameconfs->CloseGameConfigFile(g_pGameConf);
|
||||||
playerhelpers->RemoveClientListener(&g_SdkTools);
|
playerhelpers->RemoveClientListener(&g_SdkTools);
|
||||||
|
|
||||||
|
SH_REMOVE_HOOK_MEMFUNC(IServerGameDLL, LevelInit, gamedll, this, &SDKTools::LevelInit, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDKTools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late)
|
bool SDKTools::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late)
|
||||||
@ -185,3 +191,29 @@ bool SDKTools::RegisterConCommandBase(ConCommandBase *pVar)
|
|||||||
{
|
{
|
||||||
return g_SMAPI->RegisterConCmdBase(g_PLAPI, pVar);
|
return g_SMAPI->RegisterConCmdBase(g_PLAPI, pVar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SDKTools::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background)
|
||||||
|
{
|
||||||
|
const char *name;
|
||||||
|
char key[32];
|
||||||
|
int count, n = 1;
|
||||||
|
|
||||||
|
if (!(name=g_pGameConf->GetKeyValue("SlapSoundCount")))
|
||||||
|
{
|
||||||
|
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
count = atoi(name);
|
||||||
|
|
||||||
|
while (n <= count)
|
||||||
|
{
|
||||||
|
snprintf(key, sizeof(key), "SlapSound%d", n);
|
||||||
|
if ((name=g_pGameConf->GetKeyValue(key)))
|
||||||
|
{
|
||||||
|
engsound->PrecacheSound(name, true);
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
RETURN_META_VALUE(MRES_IGNORED, true);
|
||||||
|
}
|
||||||
|
@ -80,6 +80,8 @@ public: //IClientListner
|
|||||||
void OnClientDisconnecting(int client);
|
void OnClientDisconnecting(int client);
|
||||||
public: // IVoiceServer
|
public: // IVoiceServer
|
||||||
bool OnSetClientListening(int iReceiver, int iSender, bool bListen);
|
bool OnSetClientListening(int iReceiver, int iSender, bool bListen);
|
||||||
|
public:
|
||||||
|
bool LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SDKTools g_SdkTools;
|
extern SDKTools g_SdkTools;
|
||||||
|
@ -428,6 +428,11 @@ static cell_t smn_AddTempEntHook(IPluginContext *pContext, const cell_t *params)
|
|||||||
char *name;
|
char *name;
|
||||||
IPluginFunction *pFunc;
|
IPluginFunction *pFunc;
|
||||||
|
|
||||||
|
if (!g_TEManager.IsAvailable())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("TempEntity System unsupported or not available, file a bug report");
|
||||||
|
}
|
||||||
|
|
||||||
pContext->LocalToString(params[1], &name);
|
pContext->LocalToString(params[1], &name);
|
||||||
pFunc = pContext->GetFunctionById(params[2]);
|
pFunc = pContext->GetFunctionById(params[2]);
|
||||||
if (!pFunc)
|
if (!pFunc)
|
||||||
@ -448,6 +453,11 @@ static cell_t smn_RemoveTempEntHook(IPluginContext *pContext, const cell_t *para
|
|||||||
char *name;
|
char *name;
|
||||||
IPluginFunction *pFunc;
|
IPluginFunction *pFunc;
|
||||||
|
|
||||||
|
if (!g_TEManager.IsAvailable())
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("TempEntity System unsupported or not available, file a bug report");
|
||||||
|
}
|
||||||
|
|
||||||
pContext->LocalToString(params[1], &name);
|
pContext->LocalToString(params[1], &name);
|
||||||
pFunc = pContext->GetFunctionById(params[2]);
|
pFunc = pContext->GetFunctionById(params[2]);
|
||||||
if (!pFunc)
|
if (!pFunc)
|
||||||
|
Loading…
Reference in New Issue
Block a user