CollisionBSPData_LoadPlanes
0x00121900 · 447 bytes · __cdecl
_Z27CollisionBSPData_LoadPlanesP17CCollisionBSPData
Decompiled
undefined (1 param)
/* CollisionBSPData_LoadPlanes(CCollisionBSPData*) */
void CollisionBSPData_LoadPlanes(CCollisionBSPData *param_1)
{
float fVar1;
int iVar2;
uint uVar3;
undefined4 uVar4;
int iVar5;
int iVar6;
uint uVar7;
int iVar8;
uint uVar9;
int in_GS_OFFSET;
CMapLoadHelper local_140 [288];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
CMapLoadHelper::CMapLoadHelper(local_140,1);
/* try { // try from 00121939 to 00121ac0 has its CatchHandler @ 00121acb */
iVar2 = CMapLoadHelper::LumpBase(local_140);
uVar3 = CMapLoadHelper::LumpSize(local_140);
if (uVar3 != (uVar3 / 0x14) * 0x14) {
Sys_Error("CollisionBSPData_LoadPlanes: funny lump size");
}
uVar3 = CMapLoadHelper::LumpSize(local_140);
uVar3 = uVar3 / 0x14;
if (uVar3 == 0) {
Sys_Error("Map with no planes");
}
else if (0x10000 < uVar3) {
Sys_Error("Map has too many planes");
}
uVar4 = Hunk_AllocName(uVar3 * 0x14,"map_planes",true);
*(undefined4 *)(param_1 + 0x80) = uVar4;
*(uint *)(param_1 + 0x84) = uVar3;
*(uint *)(param_1 + 0x7c) = uVar3;
if (uVar3 != 0) {
uVar9 = 0;
uVar7 = uVar3;
iVar8 = iVar2;
while( true ) {
if ((int)uVar7 <= (int)uVar9) {
Error("Cannot load corrupted map.\n");
}
uVar7 = 0;
iVar6 = 0;
iVar5 = (iVar8 - iVar2) + *(int *)(param_1 + 0x80);
do {
fVar1 = *(float *)(iVar8 + iVar6 * 4);
*(float *)(iVar5 + iVar6 * 4) = fVar1;
if (fVar1 < 0.0) {
uVar7 = uVar7 | 1 << ((byte)iVar6 & 0x1f);
}
iVar6 = iVar6 + 1;
} while (iVar6 != 3);
*(undefined4 *)(iVar5 + 0xc) = *(undefined4 *)(iVar8 + 0xc);
uVar9 = uVar9 + 1;
uVar4 = *(undefined4 *)(iVar8 + 0x10);
*(char *)(iVar5 + 0x11) = (char)uVar7;
*(char *)(iVar5 + 0x10) = (char)uVar4;
if (uVar3 == uVar9) break;
uVar7 = *(uint *)(param_1 + 0x84);
iVar8 = iVar8 + 0x14;
}
}
CMapLoadHelper::~CMapLoadHelper(local_140);
if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
return;
}
/* WARNING: Subroutine does not return */
__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.