CollisionBSPData_LoadLeafs_Version_1
0x00121470 · 593 bytes · __cdecl
_Z36CollisionBSPData_LoadLeafs_Version_1P17CCollisionBSPDataR14CMapLoadHelper
Decompiled
undefined (2 params)
/* CollisionBSPData_LoadLeafs_Version_1(CCollisionBSPData*, CMapLoadHelper&) */
void CollisionBSPData_LoadLeafs_Version_1(CCollisionBSPData *param_1,CMapLoadHelper *param_2)
{
short sVar1;
uint uVar2;
uint *puVar3;
uint uVar4;
undefined4 uVar5;
int iVar6;
uint *puVar7;
undefined4 *puVar8;
uint uVar9;
uint local_28;
puVar3 = (uint *)CMapLoadHelper::LumpBase(param_2);
uVar4 = CMapLoadHelper::LumpSize(param_2);
if ((uVar4 & 0x1f) != 0) {
Sys_Error("CollisionBSPData_LoadLeafs: funny lump size");
}
uVar4 = CMapLoadHelper::LumpSize(param_2);
uVar4 = uVar4 >> 5;
if (uVar4 == 0) {
Sys_Error("Map with no leafs");
uVar5 = Hunk_AllocName(0x10,"map_leafs",true);
*(undefined4 *)(param_1 + 0x9c) = 1;
*(undefined4 *)(param_1 + 0x98) = uVar5;
*(undefined4 *)(param_1 + 0x94) = 0;
*(undefined4 *)(param_1 + 0x23c) = 0;
*(undefined4 *)(param_1 + 0x264) = 0;
}
else {
if (0x10000 < uVar4) {
Sys_Error("Map has too many planes");
}
iVar6 = uVar4 + 1;
uVar5 = Hunk_AllocName(iVar6 * 0x10,"map_leafs",true);
*(int *)(param_1 + 0x9c) = iVar6;
*(undefined4 *)(param_1 + 0x98) = uVar5;
*(undefined4 *)(param_1 + 0x23c) = 0;
local_28 = 0;
*(uint *)(param_1 + 0x94) = uVar4;
uVar9 = 0;
do {
if (iVar6 <= (int)uVar9) {
Error("Cannot load corrupted map.\n");
}
puVar7 = (uint *)(uVar9 * 0x10 + *(int *)(param_1 + 0x98));
*puVar7 = *puVar3;
sVar1 = (short)puVar3[1];
*(short *)(puVar7 + 1) = sVar1;
*(ushort *)((int)puVar7 + 6) =
*(ushort *)((int)puVar7 + 6) & 0xfe00 | *(ushort *)((int)puVar3 + 6) & 0x1ff;
*(byte *)((int)puVar7 + 7) =
*(byte *)((int)puVar7 + 7) & 1 | *(byte *)((int)puVar3 + 7) & 0xfe;
*(short *)(puVar7 + 2) = (short)puVar3[6];
*(undefined2 *)((int)puVar7 + 10) = *(undefined2 *)((int)puVar3 + 0x1a);
*(undefined2 *)((int)puVar7 + 0xe) = 0;
if (*(int *)(param_1 + 0x23c) <= (int)sVar1) {
*(int *)(param_1 + 0x23c) = sVar1 + 1;
}
uVar2 = *puVar3;
uVar9 = uVar9 + 1;
puVar3 = puVar3 + 8;
local_28 = local_28 | uVar2;
iVar6 = *(int *)(param_1 + 0x9c);
} while (uVar4 != uVar9);
*(uint *)(param_1 + 0x264) = local_28;
if (iVar6 < 1) {
Error("Cannot load corrupted map.\n");
}
}
if (**(int **)(param_1 + 0x98) != 1) {
Sys_Error("Map leaf 0 is not CONTENTS_SOLID");
}
*(undefined4 *)(param_1 + 0xa4) = 0;
iVar6 = *(int *)(param_1 + 0x94);
*(int *)(param_1 + 0xa0) = iVar6;
if ((iVar6 < 0) || (*(int *)(param_1 + 0x9c) <= iVar6)) {
Error("Cannot load corrupted map.\n");
}
puVar8 = (undefined4 *)(iVar6 * 0x10 + *(int *)(param_1 + 0x98));
*puVar8 = 0;
puVar8[1] = 0;
puVar8[2] = 0;
puVar8[3] = 0;
*(int *)(param_1 + 0x94) = *(int *)(param_1 + 0x94) + 1;
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.