void SoundHooks::OnEmitAmbientSound(CEntityIndex index, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay) { int entindex = index.Get(); #else void SoundHooks::OnEmitAmbientSound(int entindex, const Vector &pos, const char *samp, float vol, soundlevel_t soundlevel, int fFlags, int pitch, float delay) { #endif SoundHookIter iter; IPluginFunction *pFunc; cell_t vec[3] = {sp_ftoc(pos.x), sp_ftoc(pos.y), sp_ftoc(pos.z)}; cell_t res = static_cast<ResultType>(Pl_Continue); char buffer[PLATFORM_MAX_PATH]; strcpy(buffer, samp); for (iter=m_AmbientFuncs.begin(); iter!=m_AmbientFuncs.end(); iter++) { pFunc = (*iter); pFunc->PushStringEx(buffer, sizeof(buffer), SM_PARAM_STRING_COPY, SM_PARAM_COPYBACK); pFunc->PushCellByRef(&entindex); pFunc->PushFloatByRef(&vol); pFunc->PushCellByRef(reinterpret_cast<cell_t *>(&soundlevel)); pFunc->PushCellByRef(&pitch); pFunc->PushArray(vec, 3, SM_PARAM_COPYBACK); pFunc->PushCellByRef(&fFlags); pFunc->PushFloatByRef(&delay); g_InSoundHook = true; pFunc->Execute(&res); g_InSoundHook = false; switch (res) { case Pl_Handled: case Pl_Stop: { RETURN_META(MRES_SUPERCEDE); } case Pl_Changed: { Vector vec2; vec2.x = sp_ctof(vec[0]); vec2.y = sp_ctof(vec[1]); vec2.z = sp_ctof(vec[2]); #if SOURCE_ENGINE == SE_DOTA RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound, (CEntityIndex(entindex), vec2, buffer, vol, soundlevel, fFlags, pitch, delay)); #else RETURN_META_NEWPARAMS(MRES_IGNORED, &IVEngineServer::EmitAmbientSound, (entindex, vec2, buffer, vol, soundlevel, fFlags, pitch, delay)); #endif } } } }
void ClientCommand(CEntityIndex index, const CCommand &_cmd) { int client = index.Get(); GlobCommand cmd(&_cmd); #elif SOURCE_ENGINE >= SE_ORANGEBOX void ClientCommand(edict_t *client, const CCommand &_cmd) { GlobCommand cmd(&_cmd); #else void ClientCommand(edict_t *client) { GlobCommand cmd; #endif if (strcmp(cmd.GetArg(0), "meta") == 0) { Command_ClientMeta(client, &cmd); RETURN_META(MRES_SUPERCEDE); } RETURN_META(MRES_IGNORED); }