CEnvMicrophone::CanHearSound
0x006882b0 · 701 bytes · __thiscall
_ZN14CEnvMicrophone12CanHearSoundEi12soundlevel_tRfPK6Vector
Decompiled
undefined (5 params)
/* CEnvMicrophone::CanHearSound(int, soundlevel_t, float&, Vector const*) */
bool __thiscall
CEnvMicrophone::CanHearSound
(CEnvMicrophone *this,uint param_1,int param_3,float *param_4,float *param_5)
{
byte *pbVar1;
int *piVar2;
uint uVar3;
char cVar4;
CBaseEntity *pCVar5;
float *pfVar6;
undefined *puVar7;
byte *pbVar8;
CBaseEntity *this_00;
longdouble lVar9;
float fVar10;
float fVar11;
float fVar12;
if (this[0x440] == (CEnvMicrophone)0x0) {
if ((((byte)this[0x148] & 0x40) != 0) && (param_3 == 0)) {
return false;
}
if (param_1 == 0) {
LAB_00688350:
pCVar5 = (CBaseEntity *)0x0;
}
else {
pbVar1 = *(byte **)(gpGlobals + 0x58);
if (0x7ff < param_1) {
if (pbVar1 != (byte *)0x0) {
LAB_00688344:
pbVar8 = pbVar1;
if ((*pbVar1 & 2) == 0) goto LAB_006882f9;
}
goto LAB_00688350;
}
if (pbVar1 == (byte *)0x0) goto LAB_00688350;
pbVar8 = pbVar1 + param_1 * 0x10;
if ((pbVar1[param_1 * 0x10] & 2) != 0) goto LAB_00688344;
LAB_006882f9:
piVar2 = *(int **)(pbVar8 + 0xc);
if (piVar2 == (int *)0x0) goto LAB_00688350;
pCVar5 = (CBaseEntity *)(**(code **)(*piVar2 + 0x18))(piVar2);
}
uVar3 = *(uint *)(this + 0x46c);
if ((((uVar3 == 0xffffffff) ||
(puVar7 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
(*(uint *)(puVar7 + 8) != uVar3 >> 0xc)) ||
(*(CBaseFilter **)(puVar7 + 4) == (CBaseFilter *)0x0)) {
if (param_5 != (float *)0x0) {
LAB_00688393:
uVar3 = *(uint *)(this + 0x444);
pCVar5 = (CBaseEntity *)0x0;
if (((uVar3 != 0xffffffff) &&
(puVar7 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar7 + 8) == uVar3 >> 0xc)) {
pCVar5 = *(CBaseEntity **)(puVar7 + 4);
}
if (((byte)pCVar5[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar5);
}
fVar12 = *param_5 - *(float *)(pCVar5 + 0x2e0);
fVar11 = param_5[1] - *(float *)(pCVar5 + 0x2e4);
fVar10 = param_5[2] - *(float *)(pCVar5 + 0x2e8);
goto LAB_006883f6;
}
if (pCVar5 != (CBaseEntity *)0x0) goto LAB_006884f3;
fVar10 = 0.0;
}
else {
if ((pCVar5 == (CBaseEntity *)0x0) ||
(cVar4 = CBaseFilter::PassesFilter
(*(CBaseFilter **)(puVar7 + 4),(CBaseEntity *)this,pCVar5),
cVar4 == '\0')) goto LAB_00688310;
if (param_5 != (float *)0x0) goto LAB_00688393;
LAB_006884f3:
uVar3 = *(uint *)(this + 0x444);
this_00 = (CBaseEntity *)0x0;
if (((uVar3 != 0xffffffff) &&
(puVar7 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar7 + 8) == uVar3 >> 0xc)) {
this_00 = *(CBaseEntity **)(puVar7 + 4);
}
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
pfVar6 = (float *)(**(code **)(*(int *)pCVar5 + 0x288))(pCVar5);
fVar11 = *pfVar6 - *(float *)(this_00 + 0x2e0);
fVar10 = pfVar6[1] - *(float *)(this_00 + 0x2e4);
fVar12 = pfVar6[2] - *(float *)(this_00 + 0x2e8);
LAB_006883f6:
fVar10 = SQRT(fVar10 * fVar10 + fVar12 * fVar12 + fVar11 * fVar11);
}
if ((*(float *)(this + 0x454) == 0.0) || (fVar10 <= *(float *)(this + 0x454))) {
lVar9 = (longdouble)(**(code **)(*enginesound + 0x34))(enginesound,param_3,fVar10);
fVar10 = *param_4;
*param_4 = (float)lVar9 * fVar10;
return 0.0 < (float)lVar9 * fVar10;
}
}
else {
LAB_00688310:
*param_4 = 0.0;
}
return false;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.