CEdgeList::CullSmallOccluders
0x001cd200 · 521 bytes · __thiscall
_ZN9CEdgeList18CullSmallOccludersEv
Decompiled
undefined (1 param)
/* CEdgeList::CullSmallOccluders() */
void __thiscall CEdgeList::CullSmallOccluders(CEdgeList *this)
{
ushort *puVar1;
float *pfVar2;
ushort uVar3;
size_t __nmemb;
int iVar4;
int iVar5;
int iVar6;
size_t sVar7;
void *pvVar8;
int iVar9;
int iVar10;
int in_GS_OFFSET;
longdouble lVar11;
float fVar12;
undefined4 uStackY_50;
int local_30 [4];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
__nmemb = *(size_t *)(this + 0xb0);
s_pSortSurfaces = *(undefined4 *)(this + 0xa4);
uStackY_50 = 0x1cd24a;
qsort(*(void **)(this + 0xb8),__nmemb,4,SurfCompare);
iVar4 = *(int *)(r_occludermincount._28_4_ + 0x30);
fVar12 = *(float *)(r_occluderminarea._28_4_ + 0x2c) * 0.02;
if (fVar12 == 0.0) {
uStackY_50 = 0x1cd3ec;
lVar11 = (longdouble)(**(code **)(g_OcclusionSystem + 0x10))();
fVar12 = (float)lVar11 * 0.02;
}
iVar6 = -((__nmemb + 0xf & 0xfffffff0) + 0x10);
*(size_t *)((int)local_30 + iVar6 + -0x14) = __nmemb;
local_30[0] = (int)local_30 + iVar6;
*(undefined4 *)((int)local_30 + iVar6 + -0x18) = 0;
*(int *)((int)local_30 + iVar6 + -0x1c) = local_30[0];
*(undefined4 *)((int)&uStackY_50 + iVar6) = 0x1cd2aa;
memset(*(void **)((int)local_30 + iVar6 + -0x1c),*(int *)((int)local_30 + iVar6 + -0x18),
*(size_t *)((int)local_30 + iVar6 + -0x14));
if (0 < (int)__nmemb) {
iVar9 = *(int *)(this + 0xa4);
iVar10 = *(int *)(this + 0xb8);
sVar7 = 0;
do {
iVar5 = *(int *)(iVar10 + sVar7 * 4);
pfVar2 = (float *)(iVar9 + 0x24 + iVar5 * 0x28);
if ((*pfVar2 <= fVar12 && fVar12 != *pfVar2) && (iVar4 <= (int)sVar7)) break;
sVar7 = sVar7 + 1;
*(undefined1 *)(local_30[0] + iVar5) = 1;
} while (sVar7 != __nmemb);
}
iVar4 = *(int *)(this + 0x20);
*(undefined4 *)(this + 0x3c) = 0;
if ((*(int *)(this + 0x34) < iVar4) && (-1 < *(int *)(this + 0x38))) {
*(int *)(this + 0x34) = iVar4;
if (*(int *)(this + 0x30) == 0) {
*(int *)((int)local_30 + iVar6 + -0x1c) = iVar4 * 2;
*(undefined4 *)((int)&uStackY_50 + iVar6) = 0x1cd40d;
pvVar8 = malloc(*(size_t *)((int)local_30 + iVar6 + -0x1c));
*(void **)(this + 0x30) = pvVar8;
}
else {
*(int *)((int)local_30 + iVar6 + -0x1c) = *(int *)(this + 0x30);
*(int *)((int)local_30 + iVar6 + -0x18) = iVar4 * 2;
*(undefined4 *)((int)&uStackY_50 + iVar6) = 0x1cd326;
pvVar8 = realloc(*(void **)((int)local_30 + iVar6 + -0x1c),
*(size_t *)((int)local_30 + iVar6 + -0x18));
*(void **)(this + 0x30) = pvVar8;
}
}
else {
pvVar8 = *(void **)(this + 0x30);
}
*(void **)(this + 0x40) = pvVar8;
iVar10 = 0;
iVar9 = local_30[0];
if (0 < iVar4) {
do {
while (uVar3 = *(ushort *)(*(int *)(this + 0x14) + iVar10),
*(char *)(iVar9 + *(int *)((uint)uVar3 * 0x30 + *(int *)this + 0x24)) == '\0') {
LAB_001cd350:
iVar10 = iVar10 + 2;
if (iVar10 == iVar4 * 2) goto LAB_001cd3c1;
}
iVar5 = *(int *)(this + 0x3c);
*(undefined4 *)((int)local_30 + iVar6 + -0x18) = 1;
local_30[0] = iVar9;
*(CEdgeList **)((int)local_30 + iVar6 + -0x1c) = this + 0x30;
*(undefined4 *)((int)&uStackY_50 + iVar6) = 0x1cd38f;
CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>>::GrowVector
(*(CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>> **)
((int)local_30 + iVar6 + -0x1c),*(int *)((int)local_30 + iVar6 + -0x18));
*(undefined4 *)((int)local_30 + iVar6 + -0x14) = 1;
*(int *)((int)local_30 + iVar6 + -0x18) = iVar5;
*(CEdgeList **)((int)local_30 + iVar6 + -0x1c) = this + 0x30;
*(undefined4 *)((int)&uStackY_50 + iVar6) = 0x1cd3a6;
CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>>::ShiftElementsRight
(*(CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>> **)
((int)local_30 + iVar6 + -0x1c),*(int *)((int)local_30 + iVar6 + -0x18),
*(int *)((int)local_30 + iVar6 + -0x14));
puVar1 = (ushort *)(*(int *)(this + 0x30) + iVar5 * 2);
iVar9 = local_30[0];
if (puVar1 == (ushort *)0x0) goto LAB_001cd350;
iVar10 = iVar10 + 2;
*puVar1 = uVar3;
} while (iVar10 != iVar4 * 2);
}
LAB_001cd3c1:
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
*(undefined **)((int)&uStackY_50 + iVar6) = &UNK_001cd41a;
__stack_chk_fail();
}
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.