CHLTVServer::EntityPVSCheck
0x00171920 · 687 bytes · __thiscall
_ZN11CHLTVServer14EntityPVSCheckEP12CClientFrame
Decompiled
undefined (2 params)
/* CHLTVServer::EntityPVSCheck(CClientFrame*) */
void __thiscall CHLTVServer::EntityPVSCheck(CHLTVServer *this,CClientFrame *param_1)
{
CClientFrame *pCVar1;
CFrameSnapshot *pCVar2;
uint uVar3;
byte bVar4;
int iVar5;
int iVar6;
int iVar7;
undefined4 *puVar8;
uint uVar9;
uint uVar10;
uint *puVar11;
int in_GS_OFFSET;
undefined4 local_2050;
undefined4 local_202c;
undefined4 local_2028;
undefined4 local_2024;
byte local_2020 [8192];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
iVar5 = DAT_0039453c + 7;
if (DAT_0039453c + 7 < 0) {
iVar5 = DAT_0039453c + 0xe;
}
local_2050 = 0x171970;
SV_ResetPVS(local_2020,iVar5 >> 3);
pCVar2 = *(CFrameSnapshot **)(param_1 + 0x118);
local_2050 = 0x17198a;
iVar6 = (**(code **)(**(int **)(this + 0x51b8) + 0x18))();
if ((iVar6 < 1) || (pCVar2 == (CFrameSnapshot *)0x0)) {
local_2050 = 0x1719b4;
(**(code **)(**(int **)(this + 0x51b8) + 0x1c))();
*(undefined4 *)(this + 0x6394) = local_202c;
*(undefined4 *)(this + 0x6398) = local_2028;
*(undefined4 *)(this + 0x639c) = local_2024;
puVar11 = &local_2050;
}
else {
local_2050 = 0x171aea;
puVar8 = (undefined4 *)FindHLTVDataInSnapshot(pCVar2,iVar6);
puVar11 = (uint *)&stack0xffffdfb4;
if (puVar8 != (undefined4 *)0x0) {
*(undefined4 *)(this + 0x6394) = *puVar8;
*(undefined4 *)(this + 0x6398) = puVar8[1];
*(undefined4 *)(this + 0x639c) = puVar8[2];
puVar11 = (uint *)&stack0xffffdfb4;
}
}
*puVar11 = (uint)(this + 0x6394);
puVar11[-1] = 0x1719f8;
SV_AddOriginToPVS((Vector *)*puVar11);
uVar10 = 0;
do {
iVar7 = (int)uVar10 >> 5;
pCVar1 = param_1 + iVar7 * 4 + 0xc;
uVar10 = *(uint *)pCVar1 & (&GetStartBitMask(int)::g_StartMask)[uVar10 & 0x1f];
iVar6 = iVar7;
if (uVar10 == 0) {
iVar6 = iVar7 + 1;
uVar10 = *(uint *)(pCVar1 + 4);
if (0x3f < iVar6) break;
while (uVar10 == 0) {
uVar10 = *(uint *)(pCVar1 + iVar6 * 4 + iVar7 * -4 + 4);
iVar6 = iVar6 + 1;
if (iVar6 == 0x40) goto LAB_00171ac0;
}
}
iVar6 = iVar6 * 0x20;
if ((uVar10 & 0xff) == 0) {
uVar9 = uVar10 >> 8 & 0xff;
if (uVar9 == 0) {
uVar9 = uVar10 >> 0x10 & 0xff;
if (uVar9 == 0) {
if (uVar10 >> 0x18 == 0) break;
uVar10 = iVar6 + 0x18 +
*(int *)(FirstBitInWord(unsigned_int,int)::firstBitLUT + (uVar10 >> 0x18) * 4);
}
else {
uVar10 = iVar6 + 0x10 +
*(int *)(FirstBitInWord(unsigned_int,int)::firstBitLUT + uVar9 * 4);
}
}
else {
uVar10 = iVar6 + 8 + *(int *)(FirstBitInWord(unsigned_int,int)::firstBitLUT + uVar9 * 4);
}
}
else {
uVar10 = iVar6 + *(int *)(FirstBitInWord(unsigned_int,int)::firstBitLUT + (uVar10 & 0xff) * 4)
;
}
if ((int)uVar10 < 0) break;
uVar9 = 1 << ((byte)uVar10 & 0x1f);
if ((*(uint *)(*(int *)(param_1 + 0x110) + (uVar10 >> 5) * 4) & uVar9) == 0) {
puVar11[1] = uVar10;
*puVar11 = (uint)pCVar2;
puVar11[-1] = 0x171b38;
iVar6 = FindHLTVDataInSnapshot((CFrameSnapshot *)*puVar11,puVar11[1]);
if (iVar6 != 0) {
uVar3 = *(uint *)(iVar6 + 0xc);
if ((int)uVar3 < 0) {
*puVar11 = uVar3 & 0x7fffffff;
puVar11[2] = iVar5 >> 3;
puVar11[1] = (uint)local_2020;
puVar11[-1] = 0x171bd1;
bVar4 = CM_HeadnodeVisible(*puVar11,(uchar *)puVar11[1],puVar11[2]);
}
else {
bVar4 = local_2020[uVar3 >> 3] >> (uVar3 & 7) & 1;
}
if (bVar4 != 0) goto LAB_00171aa7;
*(uint *)(param_1 + ((int)uVar10 >> 5) * 4 + 0xc) =
*(uint *)(param_1 + ((int)uVar10 >> 5) * 4 + 0xc) & ~uVar9;
}
}
else {
LAB_00171aa7:
*(uint *)(param_1 + 4) = uVar10;
}
uVar10 = uVar10 + 1;
} while ((int)uVar10 < 0x800);
LAB_00171ac0:
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
puVar11[-1] = (uint)&UNK_00171be5;
__stack_chk_fail();
}
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.