CollisionBSPData_LoadTextures
0x00120c60 · 1194 bytes · __cdecl
_Z29CollisionBSPData_LoadTexturesP17CCollisionBSPData
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CollisionBSPData_LoadTextures(CCollisionBSPData*) */
void CollisionBSPData_LoadTextures(CCollisionBSPData *param_1)
{
int iVar1;
int iVar2;
code *pcVar3;
char cVar4;
undefined2 uVar5;
void *__src;
int iVar6;
uint uVar7;
int iVar8;
uint uVar9;
undefined4 uVar10;
int iVar11;
size_t __n;
undefined4 *puVar12;
int *piVar13;
uint uVar14;
int in_GS_OFFSET;
bool bVar15;
int local_390;
char local_381;
CMapLoadHelper local_380 [288];
CMapLoadHelper local_260 [288];
CMapLoadHelper local_140 [288];
int local_20;
local_20 = *(int *)(in_GS_OFFSET + 0x14);
CMapLoadHelper::CMapLoadHelper(local_380,2);
/* try { // try from 00120ca1 to 00120ca5 has its CatchHandler @ 00121152 */
CMapLoadHelper::CMapLoadHelper(local_260,0x2b);
/* try { // try from 00120caf to 00120cf4 has its CatchHandler @ 0012111a */
__src = (void *)CMapLoadHelper::LumpBase(local_260);
iVar6 = CMapLoadHelper::LumpSize(local_260);
if ((0 < iVar6) && (*(char *)((int)__src + iVar6 + -1) != '\0')) {
/* try { // try from 001210ea to 001210fe has its CatchHandler @ 0012111a */
uVar10 = CMapLoadHelper::GetLoadName(local_380);
Sys_Error("Unable to load corrupt BSP %s",uVar10);
}
CMapLoadHelper::CMapLoadHelper(local_140,0x2c);
/* try { // try from 00120cfe to 00121079 has its CatchHandler @ 00121140 */
uVar7 = CMapLoadHelper::LumpSize(local_140);
if ((uVar7 & 3) != 0) {
Sys_Error("CMod_LoadTextures: funny lump size");
}
iVar8 = CMapLoadHelper::LumpBase(local_140);
uVar7 = CMapLoadHelper::LumpSize(local_260);
local_390 = CMapLoadHelper::LumpBase(local_380);
uVar9 = CMapLoadHelper::LumpSize(local_380);
if ((uVar9 & 0x1f) != 0) {
Sys_Error("CMod_LoadTextures: funny lump size");
}
uVar9 = CMapLoadHelper::LumpSize(local_380);
uVar9 = uVar9 >> 5;
if (uVar9 == 0) {
/* try { // try from 0012110b to 0012110f has its CatchHandler @ 00121140 */
Sys_Error("Map with no textures");
}
else if (0x800 < uVar9) {
Sys_Error("Map has too many textures");
}
uVar10 = Hunk_AllocName((uVar9 + 1) * 8,"map_surfaces",true);
*(undefined4 *)(param_1 + 0x24c) = uVar10;
*(uint *)(param_1 + 0x250) = uVar9 + 1;
*(uint *)(param_1 + 0x244) = uVar9;
iVar11 = CMapLoadHelper::LumpSize(local_260);
uVar10 = Hunk_AllocName(iVar11,"map_texturenames",false);
*(undefined4 *)(param_1 + 0x248) = uVar10;
__n = CMapLoadHelper::LumpSize(local_260);
memcpy(*(void **)(param_1 + 0x248),__src,__n);
infectedClimbSurfaceIndex = 0xffffffff;
if (uVar9 != 0) {
uVar14 = 0;
do {
iVar11 = *(int *)(local_390 + 0xc);
if ((iVar11 < 0) || ((int)(uVar7 >> 2) <= iVar11)) {
uVar10 = CMapLoadHelper::GetLoadName(local_380);
Sys_Error("Unable to load corrupted map %s.",uVar10);
iVar11 = *(int *)(local_390 + 0xc);
}
iVar11 = *(int *)(iVar8 + iVar11 * 4);
if ((iVar6 <= iVar11) || (iVar11 < 0)) {
uVar10 = CMapLoadHelper::GetLoadName(local_380);
Sys_Error("Unable to load corrupted map %s",uVar10);
}
if (*(int *)(param_1 + 0x250) <= (int)uVar14) {
Error("Cannot load corrupted map.\n");
}
iVar1 = uVar14 * 8;
iVar2 = *(int *)(param_1 + 0x248);
puVar12 = (undefined4 *)(iVar1 + *(int *)(param_1 + 0x24c));
bVar15 = infectedClimbSurfaceIndex == 0xffffffff;
*puVar12 = (char *)(iVar11 + iVar2);
*(undefined2 *)(puVar12 + 1) = 0;
*(undefined2 *)((int)puVar12 + 6) = 0;
if (bVar15) {
iVar11 = _V_strcmp((char *)(iVar11 + iVar2),"TOOLS/CLIMB_VERSUS");
if (iVar11 == 0) {
infectedClimbSurfaceIndex = uVar14;
}
}
pcVar3 = *(code **)(*materials + 0x11c);
if (*(int *)(param_1 + 0x250) <= (int)uVar14) {
Error("Cannot load corrupted map.\n");
}
piVar13 = (int *)(*pcVar3)(materials,*(undefined4 *)(*(int *)(param_1 + 0x24c) + iVar1),
"World textures",1,0);
if (piVar13 != (int *)0x0) {
cVar4 = (**(code **)(*piVar13 + 0xa8))(piVar13);
if (cVar4 == '\0') {
piVar13 = (int *)(**(code **)(*piVar13 + 0x2c))(piVar13,"$surfaceprop",&local_381,0);
if (local_381 != '\0') {
uVar10 = (**(code **)(*piVar13 + 0x18))(piVar13);
if (*(int *)(param_1 + 0x250) <= (int)uVar14) {
Error("Cannot load corrupted map.\n");
}
iVar11 = *(int *)(param_1 + 0x24c);
uVar5 = (**(code **)(*physprops + 0x10))(physprops,uVar10);
*(undefined2 *)(iVar1 + iVar11 + 4) = uVar5;
}
}
}
local_390 = local_390 + 0x20;
uVar14 = uVar14 + 1;
} while (uVar9 != uVar14);
}
if (*(int *)(param_1 + 0x250) <= (int)uVar9) {
Error("Cannot load corrupted map.\n");
}
puVar12 = (undefined4 *)(*(int *)(param_1 + 0x24c) + uVar9 * 8);
_noclimbSurfaceIndex = uVar9;
*puVar12 = noclimb;
puVar12[1] = DAT_00340c9c;
CMapLoadHelper::~CMapLoadHelper(local_140);
CMapLoadHelper::~CMapLoadHelper(local_260);
CMapLoadHelper::~CMapLoadHelper(local_380);
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.