CVoxelHash::InsertIntoTree
0x001dd450 · 982 bytes · __thiscall
_ZN10CVoxelHash14InsertIntoTreeEtRK6VectorS2_
Decompiled
undefined (4 params)
/* CVoxelHash::InsertIntoTree(unsigned short, Vector const&, Vector const&) */
void __thiscall
CVoxelHash::InsertIntoTree(CVoxelHash *this,ushort param_1,Vector *param_2,Vector *param_3)
{
CVoxelHash *pCVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
float fVar6;
float fVar7;
float fVar8;
float fVar9;
uint uVar10;
uint uVar11;
int iVar12;
int iVar13;
uint *puVar14;
int iVar15;
undefined4 *puVar16;
uint uVar17;
uint uVar18;
ushort *puVar19;
uint uVar20;
uint *puVar21;
undefined4 *puVar22;
byte bVar23;
int iVar24;
uint uVar25;
uint local_24;
uint local_20;
iVar12 = *(int *)(this + 0x1048);
puVar16 = (undefined4 *)((uint)param_1 * 0x34 + *(int *)(*(int *)(iVar12 + 0xbc) + 0x10));
iVar13 = *(int *)(iVar12 + 0x38);
*puVar16 = *(undefined4 *)param_2;
puVar16[1] = *(undefined4 *)(param_2 + 4);
puVar16[2] = *(undefined4 *)(param_2 + 8);
puVar16[3] = *(undefined4 *)param_3;
puVar16[4] = *(undefined4 *)(param_3 + 4);
puVar16[5] = *(undefined4 *)(param_3 + 8);
*(char *)((int)puVar16 + *(int *)(*(int *)(this + 0x1048) + 0x38) + 0x1f) =
(char)*(undefined4 *)(this + 0x104c);
fVar2 = *(float *)(param_2 + 4);
fVar3 = *(float *)this;
bVar23 = (char)*(undefined4 *)(this + 0x104c) * '\x02' + 8;
fVar4 = *(float *)(this + 4);
fVar5 = *(float *)(param_2 + 8);
fVar6 = *(float *)(this + 8);
fVar7 = *(float *)(param_3 + 4);
fVar8 = *(float *)(param_3 + 8);
fVar9 = *(float *)param_3;
uVar10 = (int)(*(float *)param_2 - fVar3) >> (bVar23 & 0x1f) & 0x7ff;
do {
if (((int)(fVar9 - fVar3) >> (bVar23 & 0x1f) & 0x7ffU) < uVar10) {
return;
}
local_24 = uVar10 & 0x7ff;
uVar17 = (uint)((ushort)((int)(fVar5 - fVar6) >> (bVar23 & 0x1f)) & 0x3ff);
uVar18 = (uint)((ushort)((int)(fVar8 - fVar6) >> (bVar23 & 0x1f)) & 0x3ff);
for (uVar11 = (int)(fVar2 - fVar4) >> (bVar23 & 0x1f) & 0x7ff;
uVar11 <= ((int)(fVar7 - fVar4) >> (bVar23 & 0x1f) & 0x7ffU); uVar11 = uVar11 + 1) {
local_24 = local_24 & 0xffc007ff | (uVar11 & 0x7ff) << 0xb;
if (uVar17 <= uVar18) {
local_20 = uVar17;
do {
uVar25 = local_24 & 0x3fffff | local_20 << 0x16;
puVar19 = (ushort *)
CUtlLinkedList<unsigned_short,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<unsigned_short,int>>>
::AllocInternal((CUtlLinkedList<unsigned_short,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<unsigned_short,int>>>
*)(this + 0x101c),true);
*puVar19 = param_1;
uVar20 = (((int)uVar25 >> 0x10 & 0xffU) +
(((local_24 & 0xff) + 0xaaaaaaaa) * 0x21 + ((local_24 & 0xff00) >> 8)) * 0x21) *
0x21 + ((local_20 << 0x16) >> 0x18);
pCVar1 = this + (((int)uVar20 >> 0x10 ^ uVar20) & 0x1ff) * 8 + 0xc;
puVar14 = *(uint **)pCVar1;
puVar21 = puVar14;
do {
if (puVar21 == (uint *)0x0) break;
if (uVar25 == *puVar21) {
if (puVar21 != (uint *)&DAT_ffffffff) {
uVar20 = puVar21[1];
CUtlLinkedList<unsigned_short,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<unsigned_short,int>>>
::Unlink((CUtlLinkedList<unsigned_short,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<unsigned_short,int>>>
*)(this + 0x101c),(int)puVar19);
*(uint *)(puVar19 + 4) = uVar20;
if (uVar20 == 0) {
iVar24 = *(int *)(this + 0x102c);
*(int *)(puVar19 + 2) = iVar24;
*(ushort **)(this + 0x102c) = puVar19;
if (iVar24 == 0) goto LAB_001dd7dd;
LAB_001dd7b6:
*(ushort **)(iVar24 + 8) = puVar19;
}
else {
iVar24 = *(int *)(uVar20 + 4);
*(int *)(puVar19 + 2) = iVar24;
*(ushort **)(uVar20 + 4) = puVar19;
if (iVar24 != 0) goto LAB_001dd7b6;
LAB_001dd7dd:
*(ushort **)(this + 0x1028) = puVar19;
}
*(int *)(this + 0x1034) = *(int *)(this + 0x1034) + 1;
puVar21[1] = (uint)puVar19;
goto LAB_001dd6fc;
}
break;
}
puVar21 = (uint *)puVar21[3];
} while (puVar14 != puVar21);
puVar21 = operator_new(0x10);
if (puVar14 == (uint *)0x0) {
puVar21[2] = (uint)puVar21;
puVar21[3] = (uint)puVar21;
}
else {
puVar21[3] = (uint)puVar14;
puVar21[2] = puVar14[2];
puVar14[2] = (uint)puVar21;
*(uint **)(puVar21[2] + 0xc) = puVar21;
}
*(int *)(pCVar1 + 4) = *(int *)(pCVar1 + 4) + 1;
*(uint **)pCVar1 = puVar21;
*puVar21 = uVar25;
puVar21[1] = (uint)puVar19;
*(int *)(this + 0x100c) = *(int *)(this + 0x100c) + 1;
LAB_001dd6fc:
puVar22 = (undefined4 *)
CUtlLinkedList<LeafListData_t,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<LeafListData_t,int>>>
::AllocInternal((CUtlLinkedList<LeafListData_t,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<LeafListData_t,int>>>
*)(iVar12 + 0xc),true);
*puVar22 = puVar21;
puVar22[1] = puVar19;
iVar24 = puVar16[iVar13 + 10];
if (iVar24 == 0) {
puVar16[iVar13 + 10] = puVar22;
}
else {
CUtlLinkedList<LeafListData_t,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<LeafListData_t,int>>>
::Unlink((CUtlLinkedList<LeafListData_t,int,true,int,CUtlFixedMemory<UtlLinkedListElem_t<LeafListData_t,int>>>
*)(iVar12 + 0xc),(int)puVar22);
puVar22[3] = iVar24;
iVar15 = *(int *)(iVar24 + 8);
puVar22[2] = iVar15;
*(undefined4 **)(iVar24 + 8) = puVar22;
if (iVar15 == 0) {
*(undefined4 **)(iVar12 + 0x18) = puVar22;
}
else {
*(undefined4 **)(iVar15 + 0xc) = puVar22;
}
*(int *)(iVar12 + 0x24) = *(int *)(iVar12 + 0x24) + 1;
puVar16[iVar13 + 10] = puVar22;
}
local_20 = local_20 + 1;
local_24 = uVar25;
} while (local_20 <= uVar18);
}
}
uVar10 = uVar10 + 1;
} 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.