CollisionBSPData_LoadSubmodels
0x00122330 · 524 bytes · __cdecl
_Z30CollisionBSPData_LoadSubmodelsP17CCollisionBSPData
Decompiled
undefined (1 param)
/* CollisionBSPData_LoadSubmodels(CCollisionBSPData*) */
void CollisionBSPData_LoadSubmodels(CCollisionBSPData *param_1)
{
undefined4 *puVar1;
int iVar2;
uint uVar3;
undefined4 uVar4;
uint uVar5;
int iVar6;
int iVar7;
int in_GS_OFFSET;
uint local_150;
CMapLoadHelper local_140 [288];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
CMapLoadHelper::CMapLoadHelper(local_140,0xe);
/* try { // try from 0012236f to 00122538 has its CatchHandler @ 00122543 */
iVar2 = CMapLoadHelper::LumpBase(local_140);
uVar3 = CMapLoadHelper::LumpSize(local_140);
if (uVar3 != (uVar3 / 0x30) * 0x30) {
Sys_Error("CMod_LoadSubmodels: funny lump size");
}
uVar3 = CMapLoadHelper::LumpSize(local_140);
uVar3 = uVar3 / 0x30;
if (uVar3 == 0) {
Sys_Error("Map with no models");
}
else if (0x400 < uVar3) {
Sys_Error("Map has too many models");
}
uVar4 = Hunk_AllocName(uVar3 * 0x38,"map_cmodels",true);
local_150 = 0;
*(undefined4 *)(param_1 + 0xb8) = uVar4;
*(uint *)(param_1 + 0xbc) = uVar3;
*(uint *)(param_1 + 0xb4) = uVar3;
uVar5 = uVar3;
if (uVar3 != 0) {
while( true ) {
if ((int)uVar5 <= (int)local_150) {
Error("Cannot load corrupted map.\n");
}
iVar7 = 0;
iVar6 = local_150 * 0x38 + *(int *)(param_1 + 0xb8);
do {
*(float *)(iVar6 + iVar7 * 4) = *(float *)(iVar2 + iVar7 * 4) - 1.0;
*(float *)(iVar6 + 0xc + iVar7 * 4) = *(float *)(iVar2 + 0xc + iVar7 * 4) + 1.0;
*(undefined4 *)(iVar6 + 0x18 + iVar7 * 4) = *(undefined4 *)(iVar2 + 0x18 + iVar7 * 4);
iVar7 = iVar7 + 1;
} while (iVar7 != 3);
puVar1 = (undefined4 *)(iVar2 + 0x24);
iVar2 = iVar2 + 0x30;
local_150 = local_150 + 1;
*(undefined4 *)(iVar6 + 0x24) = *puVar1;
if (uVar3 == local_150) break;
uVar5 = *(uint *)(param_1 + 0xbc);
}
}
CMapLoadHelper::~CMapLoadHelper(local_140);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__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.