COverlayMgr::Surf_CreateFragments
0x001d3330 · 801 bytes · __thiscall
_ZN11COverlayMgr20Surf_CreateFragmentsEP10moverlay_tP11msurface2_t
Decompiled
undefined (3 params)
/* COverlayMgr::Surf_CreateFragments(moverlay_t*, msurface2_t*) */
void __thiscall
COverlayMgr::Surf_CreateFragments(COverlayMgr *this,moverlay_t *param_1,msurface2_t *param_2)
{
float *pfVar1;
msurface2_t mVar2;
int iVar3;
char cVar4;
undefined4 *puVar5;
int iVar6;
int iVar7;
int iVar8;
float fVar9;
float fVar10;
float fVar11;
float fVar12;
float fVar13;
float fVar14;
float fVar15;
moverlayfragment_t local_6c [16];
undefined4 local_5c;
undefined4 local_58;
undefined4 local_54;
undefined4 local_50;
undefined4 local_4c;
moverlayfragment_t local_44 [16];
float *local_34;
undefined4 local_30;
undefined4 local_2c;
undefined4 local_28;
float *local_24;
local_5c = 0;
local_58 = 0;
local_54 = 0;
local_4c = 0;
local_34 = (float *)0x0;
iVar3 = *(int *)(param_2 + 8);
local_30 = 0;
local_2c = 0;
mVar2 = param_2[3];
local_24 = (float *)0x0;
if (0x2ffffff < *(uint *)param_2) {
iVar7 = 0;
iVar8 = iVar3 * 2;
while( true ) {
iVar8 = iVar8 + 2;
local_50 = 0;
local_28 = 0;
CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>>::GrowVector
((CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>> *)&local_34,3);
/* try { // try from 001d33da to 001d35fb has its CatchHandler @ 001d3658 */
CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>>::ShiftElementsRight
((CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>> *)&local_34,0,3);
iVar6 = 0;
do {
puVar5 = (undefined4 *)((int)local_34 + iVar6);
if (puVar5 != (undefined4 *)0x0) {
*puVar5 = 0;
puVar5[1] = 0;
puVar5[2] = 0;
puVar5[3] = 0;
puVar5[4] = 0;
puVar5[5] = 0;
puVar5[6] = 0;
puVar5[7] = 0;
puVar5[8] = 0;
puVar5[9] = 0;
puVar5[0xb] = 0;
puVar5[10] = 0;
puVar5[0xc] = 0xffffffff;
}
iVar6 = iVar6 + 0x34;
} while (iVar6 != 0x9c);
pfVar1 = (float *)(*(int *)(DAT_003a172c + 0x20) +
(uint)*(ushort *)(*(int *)(DAT_003a172c + 0x88) + iVar3 * 2) * 0xc);
*local_34 = *pfVar1;
local_34[1] = pfVar1[1];
iVar6 = DAT_003a172c;
local_34[2] = pfVar1[2];
pfVar1 = (float *)(*(int *)(iVar6 + 0x20) +
(uint)*(ushort *)(*(int *)(iVar6 + 0x88) + iVar8) * 0xc);
fVar10 = *pfVar1;
local_34[0xd] = fVar10;
fVar9 = pfVar1[1];
local_34[0xe] = fVar9;
fVar9 = fVar9 - local_34[1];
fVar11 = pfVar1[2];
fVar10 = fVar10 - *local_34;
local_34[0xf] = fVar11;
pfVar1 = (float *)(*(int *)(iVar6 + 0x20) +
(uint)*(ushort *)(*(int *)(iVar6 + 0x88) + 2 + iVar8) * 0xc);
fVar15 = *pfVar1;
local_34[0x1a] = fVar15;
fVar15 = fVar15 - *local_34;
fVar14 = pfVar1[1];
local_34[0x1b] = fVar14;
fVar14 = fVar14 - local_34[1];
fVar13 = pfVar1[2];
local_34[0x1c] = fVar13;
fVar13 = fVar13 - local_34[2];
fVar11 = fVar11 - local_34[2];
fVar12 = fVar11 * fVar15 - fVar13 * fVar10;
fVar15 = fVar14 * fVar10 - fVar15 * fVar9;
fVar10 = fVar13 * fVar9 - fVar14 * fVar11;
if (1.0 < SQRT(fVar12 * fVar12 + fVar15 * fVar15 + fVar10 * fVar10) * 0.5) {
cVar4 = Surf_PreClipFragment(this,param_1,local_6c,param_2,local_44);
if (cVar4 != '\0') {
Surf_ClipFragment(this,param_1,local_6c,param_2,local_44);
}
}
if (iVar7 + 1 == (byte)mVar2 - 2) break;
iVar7 = iVar7 + 1;
}
}
local_50 = 0;
local_28 = 0;
CUtlMemory<overlayvert_t,int>::Purge((CUtlMemory<overlayvert_t,int> *)&local_34);
local_24 = local_34;
CUtlMemory<overlayvert_t,int>::Purge((CUtlMemory<overlayvert_t,int> *)&local_34);
local_50 = 0;
CUtlMemory<overlayvert_t,int>::Purge((CUtlMemory<overlayvert_t,int> *)&local_5c);
local_4c = local_5c;
CUtlMemory<overlayvert_t,int>::Purge((CUtlMemory<overlayvert_t,int> *)&local_5c);
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.