CDispLeafBuilder::BuildLeafListForDisplacement
0x00125b60 · 610 bytes · __thiscall
_ZN16CDispLeafBuilder28BuildLeafListForDisplacementEi
Decompiled
undefined (2 params)
/* CDispLeafBuilder::BuildLeafListForDisplacement(int) */
void __thiscall CDispLeafBuilder::BuildLeafListForDisplacement(CDispLeafBuilder *this,int param_1)
{
undefined4 *puVar1;
ushort *puVar2;
float fVar3;
cplane_t cVar4;
cplane_t *pcVar5;
uint uVar6;
short *psVar7;
int iVar8;
int iVar9;
int iVar10;
ushort local_104c;
int local_1040;
float local_1034 [4];
undefined4 local_1024;
undefined4 local_1020;
int local_101c [1027];
iVar8 = param_1 * 0xf4 + g_pDispCollTrees;
if ((iVar8 == 0) || (*(int *)(iVar8 + 0x28) == 0)) {
return;
}
*(undefined4 *)(*(int *)(this + 0x18) + param_1 * 4) = *(undefined4 *)(this + 0x10);
*(undefined2 *)(*(int *)(this + 0x2c) + param_1 * 2) = 0;
iVar10 = *(int *)this;
if (*(int *)(iVar10 + 0xbc) < 1) {
Error("Cannot load corrupted map.\n");
}
local_1040 = 0;
iVar9 = 1;
local_1034[0] = *(float *)(iVar8 + 4);
local_1034[1] = (float)*(undefined4 *)(iVar8 + 8);
iVar10 = *(int *)(*(int *)(iVar10 + 0xb8) + 0x24);
local_1034[2] = (float)*(undefined4 *)(iVar8 + 0xc);
local_1034[3] = (float)*(undefined4 *)(iVar8 + 0x14);
local_101c[0] = iVar10;
local_1024 = *(undefined4 *)(iVar8 + 0x18);
local_1020 = *(undefined4 *)(iVar8 + 0x1c);
do {
local_1040 = (local_1040 + 1) % 0x400;
if (iVar10 < 0) {
local_104c = ~(ushort)iVar10;
iVar8 = *(int *)(this + 0x10);
CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>>::GrowVector
((CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>> *)(this + 4),1);
CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>>::ShiftElementsRight
((CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>> *)(this + 4),iVar8,1);
puVar2 = (ushort *)(*(int *)(this + 4) + iVar8 * 2);
if (puVar2 != (ushort *)0x0) {
*puVar2 = local_104c;
}
psVar7 = (short *)(param_1 * 2 + *(int *)(this + 0x2c));
*psVar7 = *psVar7 + 1;
}
else {
puVar1 = (undefined4 *)(**(int **)this + iVar10 * 0xc);
pcVar5 = (cplane_t *)*puVar1;
cVar4 = pcVar5[0x10];
if ((byte)cVar4 < 3) {
fVar3 = *(float *)(pcVar5 + 0xc);
if (fVar3 < local_1034[(byte)cVar4] || fVar3 == local_1034[(byte)cVar4]) {
uVar6 = 0;
LAB_00125c43:
local_101c[iVar9] = puVar1[1];
iVar9 = (iVar9 + 1) % 0x400;
goto LAB_00125c62;
}
uVar6 = 2;
if (fVar3 < local_1034[(byte)cVar4 + 3]) goto LAB_00125c43;
}
else {
uVar6 = BoxOnPlaneSide(local_1034,local_1034 + 3,pcVar5);
if ((uVar6 & 1) != 0) {
uVar6 = uVar6 & 2;
goto LAB_00125c43;
}
uVar6 = uVar6 & 2;
LAB_00125c62:
if (uVar6 == 0) goto LAB_00125c66;
}
local_101c[iVar9] = puVar1[2];
iVar9 = (iVar9 + 1) % 0x400;
}
LAB_00125c66:
if (iVar9 == local_1040) {
return;
}
iVar10 = local_101c[local_1040];
} while( true );
}
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.