InfectedAlert::OnSound
0x00a195c0 · 997 bytes · __cdecl
_ZN13InfectedAlert7OnSoundEP8InfectedP11CBaseEntityRK6VectorP9KeyValues
Decompiled
undefined (4 params)
/* InfectedAlert::OnSound(Infected*, CBaseEntity*, Vector const&, KeyValues*) */
Infected *
InfectedAlert::OnSound(Infected *param_1,CBaseEntity *param_2,Vector *param_3,KeyValues *param_4)
{
uint uVar1;
char cVar2;
KeyValues *this;
char *pcVar3;
int iVar4;
InfectedAttack *this_00;
CBaseEntity *this_01;
undefined4 uVar5;
undefined *puVar6;
longdouble lVar7;
float fVar8;
float *in_stack_00000014;
KeyValues *in_stack_00000018;
if ((((in_stack_00000018 == (KeyValues *)0x0) || (((byte)param_3[0x1c74] & 8) != 0)) ||
(this = (KeyValues *)KeyValues::FindKey(in_stack_00000018,"Reaction",false),
this == (KeyValues *)0x0)) ||
((((pcVar3 = (char *)KeyValues::GetString(this,(char *)0x0,""), pcVar3 != "SeekAndDestroy" &&
(iVar4 = _V_stricmp("SeekAndDestroy",pcVar3), iVar4 != 0)) ||
(cVar2 = (**(code **)(*(int *)(param_3 + 0x1a3c) + 0x114))
(param_3 + 0x1a3c,param_4,
*(undefined4 *)(ZombieForceAttackFromSoundRange._28_4_ + 0x2c)),
cVar2 == '\0')) &&
((pcVar3 = (char *)KeyValues::GetString(this,(char *)0x0,""), pcVar3 != "ChaseFromAnywhere" &&
(iVar4 = _V_stricmp("ChaseFromAnywhere",pcVar3), iVar4 != 0)))))) {
if (*(float *)(param_2 + 0x58) <= 0.0) {
lVar7 = (longdouble)CountdownTimer::Now();
if ((((*(float *)(param_2 + 0x7c) <= (float)lVar7) &&
(lVar7 = (longdouble)CountdownTimer::Now(), *(float *)(param_2 + 0x70) <= (float)lVar7))
&& (param_4 != (KeyValues *)0x0)) &&
(cVar2 = (**(code **)(*(int *)param_4 + 300))(param_4), cVar2 != '\0')) {
iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)param_4);
cVar2 = IsASurvivorTeam(iVar4);
if ((cVar2 != '\0') &&
(fVar8 = *(float *)(param_2 + 0x34) - *in_stack_00000014,
2500.0 < (*(float *)(param_2 + 0x38) - in_stack_00000014[1]) *
(*(float *)(param_2 + 0x38) - in_stack_00000014[1]) + fVar8 * fVar8 +
(*(float *)(param_2 + 0x3c) - in_stack_00000014[2]) *
(*(float *)(param_2 + 0x3c) - in_stack_00000014[2]))) {
*(float *)(param_2 + 0x34) = *in_stack_00000014;
*(float *)(param_2 + 0x38) = in_stack_00000014[1];
*(float *)(param_2 + 0x3c) = in_stack_00000014[2];
lVar7 = (longdouble)RandomFloat(0x3e99999a,0x40000000);
fVar8 = (float)lVar7;
lVar7 = (longdouble)CountdownTimer::Now();
if ((float)lVar7 + fVar8 != *(float *)(param_2 + 0x7c)) {
(**(code **)(*(int *)(param_2 + 0x74) + 4))(param_2 + 0x74,param_2 + 0x7c);
*(float *)(param_2 + 0x7c) = (float)lVar7 + fVar8;
}
if (fVar8 != *(float *)(param_2 + 0x78)) {
(**(code **)(*(int *)(param_2 + 0x74) + 4))(param_2 + 0x74,param_2 + 0x78);
*(float *)(param_2 + 0x78) = fVar8;
}
}
}
}
}
else {
uVar1 = *(uint *)(param_4 + 0x180);
if (((uVar1 == 0xffffffff) ||
(puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 == (undefined *)0xfffffffc)) ||
((*(uint *)(puVar6 + 8) != uVar1 >> 0xc ||
(*(CBaseEntity **)(puVar6 + 4) == (CBaseEntity *)0x0)))) {
LAB_00a196ae:
this_00 = ::operator_new(0x48);
/* try { // try from 00a196c6 to 00a196ca has its CatchHandler @ 00a199b9 */
InfectedAttack::InfectedAttack(this_00,(CBaseEntity *)param_4);
*(undefined4 *)param_1 = 1;
*(InfectedAttack **)(param_1 + 4) = this_00;
*(char **)(param_1 + 8) = "Heard a sound that forced me to attack its source";
*(undefined4 *)(param_1 + 0xc) = 2;
return param_1;
}
iVar4 = CBaseEntity::GetGender(*(CBaseEntity **)(puVar6 + 4));
if (iVar4 != 0x10) {
this_01 = (CBaseEntity *)0x0;
uVar1 = *(uint *)(param_4 + 0x180);
if (((uVar1 != 0xffffffff) &&
(puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) {
this_01 = *(CBaseEntity **)(puVar6 + 4);
}
iVar4 = CBaseEntity::GetGender(this_01);
if (iVar4 != 0x11) goto LAB_00a196ae;
}
iVar4 = CBaseEntity::GetGender((CBaseEntity *)param_3);
if ((iVar4 != 0x10) && (iVar4 = CBaseEntity::GetGender((CBaseEntity *)param_3), iVar4 != 0x11))
{
uVar5 = 0;
uVar1 = *(uint *)(param_4 + 0x180);
if ((uVar1 != 0xffffffff) &&
((puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc &&
(*(uint *)(puVar6 + 8) == uVar1 >> 0xc)))) {
uVar5 = *(undefined4 *)(puVar6 + 4);
}
cVar2 = (**(code **)(*(int *)param_3 + 0x42c))(param_3,uVar5,0);
if (cVar2 != '\0') goto LAB_00a196ae;
}
}
*(undefined4 *)param_1 = 4;
*(undefined4 *)(param_1 + 4) = 0;
*(undefined4 *)(param_1 + 8) = 0;
*(undefined4 *)(param_1 + 0xc) = 1;
return param_1;
}
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.