COverlayMgr::CreateFragments
0x001d3c70 · 1327 bytes · __thiscall
_ZN11COverlayMgr15CreateFragmentsEv
Decompiled
undefined (1 param)
/* COverlayMgr::CreateFragments() */
void __thiscall COverlayMgr::CreateFragments(COverlayMgr *this)
{
moverlay_t *pmVar1;
ushort *puVar2;
int iVar3;
msurface2_t *pmVar4;
float *pfVar5;
undefined4 *puVar6;
uint uVar7;
int iVar8;
float *pfVar9;
float *pfVar10;
int iVar11;
undefined1 *puVar12;
int iVar13;
uint *puVar14;
int iVar15;
int iVar16;
float fVar17;
float fVar18;
float fVar19;
float fVar20;
int local_34;
int local_20;
iVar3 = *(int *)(this + 0x34);
if (0 < iVar3) {
local_20 = 0;
iVar15 = *(int *)(this + 0x28);
do {
while( true ) {
pmVar1 = (moverlay_t *)(iVar15 + local_20 * 0xa8);
iVar13 = *(int *)(pmVar1 + 0x18);
if (iVar13 == 0) break;
fVar20 = *(float *)(pmVar1 + 0x5c);
*(undefined4 *)(pmVar1 + 0x5c) = 0;
iVar15 = 0;
Overlay_BuildBasis((Vector *)(pmVar1 + 0x84),(Vector *)(pmVar1 + 0x6c),
(Vector *)(pmVar1 + 0x78),fVar20 == 1.0);
if (0 < iVar13) {
do {
while (pmVar4 = *(msurface2_t **)(*(int *)(pmVar1 + 0xc) + iVar15 * 4),
(*(uint *)pmVar4 & 0x800) == 0) {
Surf_CreateFragments(this,pmVar1,pmVar4);
iVar15 = iVar15 + 1;
if (iVar15 == iVar13) goto LAB_001d3d34;
}
Disp_CreateFragments(this,pmVar1,pmVar4);
iVar15 = iVar15 + 1;
} while (iVar15 != iVar13);
}
LAB_001d3d34:
local_20 = local_20 + 1;
iVar15 = *(int *)(this + 0x28);
if (local_20 == iVar3) goto LAB_001d3d4a;
}
local_20 = local_20 + 1;
} while (local_20 != iVar3);
LAB_001d3d4a:
local_20 = 0;
while( true ) {
iVar15 = local_20 * 0xa8 + iVar15;
uVar7 = (uint)*(ushort *)(iVar15 + 8);
fVar20 = 0.0;
if (uVar7 != 0xffff) {
do {
puVar2 = (ushort *)(*(int *)(this + 0x58) + uVar7 * 6);
iVar8 = (uint)*puVar2 * 0x2c + *(int *)(this + 0x3c);
iVar13 = *(int *)(iVar8 + 0x1c);
if (0 < iVar13) {
pfVar5 = *(float **)(iVar8 + 0x10);
pfVar9 = pfVar5;
do {
pfVar10 = pfVar9 + 0xd;
fVar17 = *pfVar9 - *(float *)(iVar15 + 0x60);
fVar19 = pfVar9[2] - *(float *)(iVar15 + 0x68);
fVar18 = pfVar9[1] - *(float *)(iVar15 + 100);
fVar17 = fVar17 * fVar17 + fVar19 * fVar19 + fVar18 * fVar18;
if (fVar20 <= fVar17) {
fVar20 = fVar17;
}
pfVar9 = pfVar10;
} while (pfVar10 != pfVar5 + iVar13 * 0xd);
}
uVar7 = (uint)puVar2[2];
} while (uVar7 != 0xffff);
fVar20 = SQRT(fVar20);
}
local_20 = local_20 + 1;
*(float *)(iVar15 + 0xa0) = fVar20;
if (local_20 == iVar3) break;
iVar15 = *(int *)(this + 0x28);
}
local_34 = 0;
local_20 = 0;
do {
iVar15 = local_34 + *(int *)(this + 0x28);
uVar7 = (uint)*(ushort *)(iVar15 + 8);
if (uVar7 != 0xffff) {
iVar13 = *(int *)(this + 0x58);
do {
iVar13 = (uint)*(ushort *)(iVar13 + uVar7 * 6) * 0x2c + *(int *)(this + 0x3c);
if ((*(uint *)(iVar13 + 0x24) & 0x7f800000) == 0x7f800000) {
iVar8 = *(short *)(iVar15 + 4) * 0x50 + *(int *)(DAT_003a172c + 0x5c);
if (iVar8 == 0) {
puVar12 = &DAT_002c79d4;
}
else {
puVar6 = *(undefined4 **)(iVar8 + 0x4c);
puVar12 = &DAT_002c79d4;
if (puVar6 != (undefined4 *)0x0) {
puVar12 = (undefined1 *)(**(code **)*puVar6)(puVar6);
}
}
DevMsg(1,"Bad overlay decal offset - %d with material \'%s\'\n",local_20,puVar12);
}
iVar16 = 0;
iVar8 = *(int *)(iVar13 + 0x1c);
if (0 < iVar8) {
do {
puVar14 = (uint *)(iVar16 * 0x34 + *(int *)(iVar13 + 0x10));
if ((((*puVar14 & 0x7f800000) == 0x7f800000) ||
((puVar14[1] & 0x7f800000) == 0x7f800000)) ||
((puVar14[2] & 0x7f800000) == 0x7f800000)) {
iVar11 = *(short *)(iVar15 + 4) * 0x50 + *(int *)(DAT_003a172c + 0x5c);
if (iVar11 == 0) {
puVar12 = &DAT_002c79d4;
}
else {
puVar6 = *(undefined4 **)(iVar11 + 0x4c);
puVar12 = &DAT_002c79d4;
if (puVar6 != (undefined4 *)0x0) {
puVar12 = (undefined1 *)(**(code **)*puVar6)(puVar6);
}
}
DevMsg(1,"Bad overlay vert - %d at (%f, %f, %f) with material \'%s\'\n",local_20,
(double)*(float *)(iVar15 + 0x60),(double)*(float *)(iVar15 + 100),
(double)*(float *)(iVar15 + 0x68),puVar12);
if ((puVar14[3] & 0x7f800000) != 0x7f800000) goto LAB_001d3f09;
LAB_001d4031:
iVar11 = *(short *)(iVar15 + 4) * 0x50 + *(int *)(DAT_003a172c + 0x5c);
if (iVar11 == 0) {
puVar12 = &DAT_002c79d4;
}
else {
puVar6 = *(undefined4 **)(iVar11 + 0x4c);
puVar12 = &DAT_002c79d4;
if (puVar6 != (undefined4 *)0x0) {
puVar12 = (undefined1 *)(**(code **)*puVar6)(puVar6);
}
}
DevMsg(1,"Bad overlay normal - %d at (%f, %f, %f) with material \'%s\'\n",local_20,
(double)*(float *)(iVar15 + 0x60),(double)*(float *)(iVar15 + 100),
(double)*(float *)(iVar15 + 0x68),puVar12);
if ((puVar14[6] & 0x7f800000) == 0x7f800000) goto LAB_001d40c0;
LAB_001d3f42:
if ((((puVar14[7] & 0x7f800000) == 0x7f800000) ||
((puVar14[8] & 0x7f800000) == 0x7f800000)) ||
((puVar14[9] & 0x7f800000) == 0x7f800000)) goto LAB_001d40c0;
}
else {
if ((puVar14[3] & 0x7f800000) == 0x7f800000) goto LAB_001d4031;
LAB_001d3f09:
if (((puVar14[4] & 0x7f800000) == 0x7f800000) ||
((puVar14[5] & 0x7f800000) == 0x7f800000)) goto LAB_001d4031;
if ((puVar14[6] & 0x7f800000) != 0x7f800000) goto LAB_001d3f42;
LAB_001d40c0:
iVar11 = *(short *)(iVar15 + 4) * 0x50 + *(int *)(DAT_003a172c + 0x5c);
if (iVar11 == 0) {
puVar12 = &DAT_002c79d4;
}
else {
puVar6 = *(undefined4 **)(iVar11 + 0x4c);
puVar12 = &DAT_002c79d4;
if (puVar6 != (undefined4 *)0x0) {
puVar12 = (undefined1 *)(**(code **)*puVar6)(puVar6);
}
}
DevMsg(1,"Bad overlay texture coords - %d at (%f, %f, %f) with material \'%s\'\n",
local_20,(double)*(float *)(iVar15 + 0x60),(double)*(float *)(iVar15 + 100),
(double)*(float *)(iVar15 + 0x68),puVar12);
}
iVar16 = iVar16 + 1;
} while (iVar16 != iVar8);
}
iVar13 = *(int *)(this + 0x58);
uVar7 = (uint)*(ushort *)(iVar13 + 4 + uVar7 * 6);
} while (uVar7 != 0xffff);
}
local_20 = local_20 + 1;
local_34 = local_34 + 0xa8;
} while (local_20 != iVar3);
}
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.