CVisibilityMonitor::AddEntity
0x00665850 · 494 bytes · __thiscall
_ZN18CVisibilityMonitor9AddEntityEP11CBaseEntityfPFbS1_P11CBasePlayerES5_
Decompiled
undefined (5 params)
/* CVisibilityMonitor::AddEntity(CBaseEntity*, float, bool (*)(CBaseEntity*, CBasePlayer*), bool
(*)(CBaseEntity*, CBasePlayer*)) */
void __thiscall
CVisibilityMonitor::AddEntity
(CVisibilityMonitor *this,CBaseEntity *param_1,float param_2,
_func_bool_CBaseEntity_ptr_CBasePlayer_ptr *param_3,
_func_bool_CBaseEntity_ptr_CBasePlayer_ptr *param_4)
{
int iVar1;
char cVar2;
undefined4 *puVar3;
int iVar4;
void *pvVar5;
int iVar6;
int iVar7;
undefined4 local_24;
cVar2 = IsTrackingEntity(this,param_1);
if (cVar2 != '\0') {
return;
}
local_24 = 0xffffffff;
if (param_1 != (CBaseEntity *)0x0) {
puVar3 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
local_24 = *puVar3;
}
iVar1 = *(int *)(this + 0x18);
iVar6 = *(int *)(this + 0x10);
iVar7 = iVar1 + 1;
if (iVar6 < iVar7) {
iVar4 = *(int *)(this + 0x14);
if (iVar4 < 0) goto LAB_006658b6;
if (iVar4 == 0) {
if (iVar6 == 0) {
if (iVar7 < 3) {
iVar4 = 2;
goto LAB_00665947;
}
iVar6 = 2;
}
do {
iVar4 = iVar6 * 2;
if (iVar7 <= iVar4) break;
iVar4 = iVar6 * 4;
iVar6 = iVar4;
} while (iVar4 < iVar7);
}
else {
for (iVar4 = (iVar1 / iVar4 + 1) * iVar4; iVar4 < iVar7; iVar4 = (iVar4 + iVar7) / 2) {
}
}
LAB_00665947:
*(int *)(this + 0x10) = iVar4;
if (*(void **)(this + 0xc) != (void *)0x0) {
pvVar5 = realloc(*(void **)(this + 0xc),iVar4 * 0x14);
iVar7 = *(int *)(this + 0x18);
*(void **)(this + 0xc) = pvVar5;
*(void **)(this + 0x1c) = pvVar5;
*(int *)(this + 0x18) = iVar7 + 1;
iVar7 = (iVar7 + 1) - iVar1;
goto joined_r0x0066598d;
}
pvVar5 = malloc(iVar4 * 0x14);
*(void **)(this + 0xc) = pvVar5;
}
else {
LAB_006658b6:
pvVar5 = *(void **)(this + 0xc);
}
*(int *)(this + 0x18) = iVar7;
iVar7 = iVar7 - iVar1;
*(void **)(this + 0x1c) = pvVar5;
joined_r0x0066598d:
if (0 < iVar7 + -1) {
_V_memmove((void *)((int)pvVar5 + iVar1 * 0x14 + 0x14),(void *)((int)pvVar5 + iVar1 * 0x14),
(iVar7 + -1) * 0x14);
pvVar5 = *(void **)(this + 0xc);
}
puVar3 = (undefined4 *)((int)pvVar5 + iVar1 * 0x14);
if (puVar3 != (undefined4 *)0x0) {
puVar3[1] = param_2 * param_2;
puVar3[2] = 0;
*puVar3 = local_24;
puVar3[4] = param_4;
puVar3[3] = param_3;
}
if (*(int *)(debug_visibility_monitor._28_4_ + 0x30) == 0) {
return;
}
CBaseEntity::GetDebugName(param_1);
Msg();
return;
}
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.