CModelLoader::RecomputeSurfaceFlags
0x0019c500 · 917 bytes · __thiscall
_ZN12CModelLoader21RecomputeSurfaceFlagsEP7model_t
Decompiled
undefined (2 params)
/* CModelLoader::RecomputeSurfaceFlags(model_t*) */
void __thiscall CModelLoader::RecomputeSurfaceFlags(CModelLoader *this,model_t *param_1)
{
undefined **ppuVar1;
uchar uVar2;
int iVar3;
int *piVar4;
int iVar5;
model_t *pmVar6;
char cVar7;
undefined2 uVar8;
int iVar9;
uint uVar10;
int iVar11;
int iVar12;
int iVar13;
undefined **ppuVar14;
uint *puVar15;
int iVar16;
int local_54;
int local_50;
int local_40;
uchar local_31;
undefined **local_30;
model_t *local_2c;
int local_28;
int local_24;
undefined **local_20;
local_54 = 0;
local_50 = 0;
if (0 < **(int **)(param_1 + 0x134)) {
do {
iVar9 = local_54 + *(int *)(this + 0x50);
iVar3 = *(int *)(iVar9 + 0x134);
*(undefined2 *)(iVar9 + 0x144) = 0;
*(undefined4 *)(iVar9 + 0x114) = 0x20;
*(undefined2 *)(iVar9 + 0x146) = 0;
iVar12 = *(int *)(iVar9 + 0x13c);
local_30 = (undefined **)0x0;
local_2c = (model_t *)0x0;
local_28 = 0;
local_24 = 0;
local_20 = (undefined **)0x0;
if (0 < iVar12) {
local_40 = 0;
do {
puVar15 = (uint *)((local_40 + *(int *)(iVar9 + 0x138)) * 0x20 + *(int *)(iVar3 + 0x78));
*puVar15 = *puVar15 & 0xffffaddf;
iVar16 = (uint)(*(ushort *)((int)puVar15 + 0x16) >> 1) * 0x50 + *(int *)(iVar3 + 0x5c);
piVar4 = *(int **)(iVar16 + 0x4c);
/* try { // try from 0019c5d6 to 0019c7d7 has its CatchHandler @ 0019c8aa */
cVar7 = (**(code **)(*piVar4 + 0x54))(piVar4);
if (cVar7 != '\0') {
*(uint *)(iVar9 + 0x114) = *(uint *)(iVar9 + 0x114) | 1;
}
cVar7 = (**(code **)(*piVar4 + 0x60))(piVar4,0);
if (cVar7 != '\0') {
*(uint *)(iVar9 + 0x114) = *(uint *)(iVar9 + 0x114) | 0x10;
}
cVar7 = (**(code **)(*piVar4 + 0x84))(piVar4);
if (cVar7 != '\0') {
*puVar15 = *puVar15 | 0x200;
}
if (((*(byte *)(iVar16 + 0x48) & 0x10) != 0) ||
(cVar7 = (**(code **)(*piVar4 + 0x44))(piVar4), cVar7 != '\0')) {
*(uint *)(iVar9 + 0x114) = *(uint *)(iVar9 + 0x114) | 2;
*puVar15 = *puVar15 | 0x20;
}
if (((*(byte *)(iVar16 + 0x49) & 0x20) == 0) &&
(cVar7 = (**(code **)(*piVar4 + 0x78))(piVar4,0x4000000), cVar7 == '\0')) {
cVar7 = (**(code **)(*piVar4 + 0x48))(piVar4);
uVar10 = *puVar15;
if ((cVar7 != '\0') || ((uVar10 & 1) != 0)) goto LAB_0019c63d;
}
else {
uVar10 = *puVar15;
LAB_0019c63d:
*puVar15 = uVar10 | 0x4000;
}
cVar7 = (**(code **)(*piVar4 + 0x48))(piVar4);
if (cVar7 != '\0') {
*puVar15 = *puVar15 | 0x1000;
}
iVar13 = 0;
iVar16 = *(int *)(iVar3 + 0x78);
iVar5 = *(int *)(iVar3 + 0x7c);
do {
uVar2 = *(uchar *)(((int)puVar15 - iVar16 & 0xffffffe0U) + iVar5 + 0x18 + iVar13);
if (uVar2 == 0xff) break;
local_31 = uVar2;
if (local_24 < 1) {
LAB_0019c698:
CUtlVector<unsigned_char,CUtlMemory<unsigned_char,int>>::InsertBefore
((CUtlVector<unsigned_char,CUtlMemory<unsigned_char,int>> *)&local_30,
local_24,&local_31);
}
else if (uVar2 != *(uchar *)local_30) {
iVar11 = 0;
do {
iVar11 = iVar11 + 1;
if (iVar11 == local_24) goto LAB_0019c698;
} while (uVar2 != *(uchar *)((int)local_30 + iVar11));
if (iVar11 == -1) goto LAB_0019c698;
}
iVar13 = iVar13 + 1;
} while (iVar13 != 4);
iVar16 = local_24;
local_40 = local_40 + 1;
} while (local_40 != iVar12);
if (local_24 != 0) {
*(undefined4 *)(iVar9 + 0x140) = 0;
uVar8 = (undefined2)DAT_003a8cc8;
ppuVar1 = (undefined **)((int)local_30 + local_24);
ppuVar14 = local_30;
if (0 < local_24) {
do {
CUtlVector<unsigned_char,CUtlMemory<unsigned_char,int>>::InsertBefore
((CUtlVector<unsigned_char,CUtlMemory<unsigned_char,int>> *)&DAT_003a8cbc,
DAT_003a8cc8,(uchar *)ppuVar14);
ppuVar14 = (undefined **)((int)ppuVar14 + 1);
} while (ppuVar14 != ppuVar1);
}
*(short *)(iVar9 + 0x146) = (short)iVar16;
*(undefined2 *)(iVar9 + 0x144) = uVar8;
}
}
local_24 = 0;
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_30);
local_20 = local_30;
CUtlMemory<unsigned_char,int>::Purge((CUtlMemory<unsigned_char,int> *)&local_30);
pmVar6 = host_state;
if (local_50 != 0) {
local_30 = &PTR_EnumerateLeaf_002b9270;
local_2c = param_1;
local_24 = *(int *)(iVar9 + 0x134);
local_20 = (undefined **)0x0;
local_28 = iVar9;
CCommonHostState::SetWorldModel((CCommonHostState *)&host_state,param_1);
(**(code **)(*(int *)g_pToolBSPTree + 8))
(g_pToolBSPTree,iVar9 + 0x118,iVar9 + 0x124,&local_30,iVar9);
if ((local_20 == (undefined **)0x0) && (iVar3 = *(int *)(local_28 + 0x13c), 0 < iVar3)) {
iVar12 = 0;
do {
iVar9 = *(int *)(local_28 + 0x138) + iVar12;
iVar12 = iVar12 + 1;
puVar15 = (uint *)(iVar9 * 0x20 + *(int *)(local_24 + 0x78));
*puVar15 = *puVar15 & 0xfff9ffff | 0x40000;
} while (iVar12 != iVar3);
}
CCommonHostState::SetWorldModel((CCommonHostState *)&host_state,pmVar6);
}
local_50 = local_50 + 1;
local_54 = local_54 + 0x14c;
} while (local_50 < **(int **)(param_1 + 0x134));
}
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.