COverlayMgr::Disp_PreClipFragment
0x001d3680 · 1225 bytes · __thiscall
_ZN11COverlayMgr20Disp_PreClipFragmentEP10moverlay_tR10CUtlVectorIP18moverlayfragment_t10CUtlMemoryIS4_iEEP11msurface2_t
Decompiled
undefined (4 params)
/* COverlayMgr::Disp_PreClipFragment(moverlay_t*, CUtlVector<moverlayfragment_t*,
CUtlMemory<moverlayfragment_t*, int> >&, msurface2_t*) */
char __thiscall
COverlayMgr::Disp_PreClipFragment
(COverlayMgr *this,moverlay_t *param_1,CUtlVector *param_2,msurface2_t *param_3)
{
undefined4 *puVar1;
int iVar2;
undefined1 *puVar3;
int iVar4;
undefined4 *puVar5;
int iVar6;
int iVar7;
int in_GS_OFFSET;
char local_1a1;
moverlayfragment_t *local_188;
uint local_184;
uint local_180;
moverlayfragment_t local_17c [16];
int local_16c [6];
moverlayfragment_t local_154 [16];
int local_144 [6];
CFmtStrN<256> local_12c [5];
undefined1 local_127 [263];
int local_20;
local_16c[0] = 0;
local_16c[1] = 0;
local_16c[2] = 0;
local_16c[3] = 0;
local_16c[4] = 0;
iVar2 = *(int *)(param_3 + 8);
local_20 = *(int *)(in_GS_OFFSET + 0x14);
CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>>::GrowVector
((CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>> *)local_16c,4);
/* try { // try from 001d3719 to 001d371d has its CatchHandler @ 001d3b82 */
CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>>::ShiftElementsRight
((CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>> *)local_16c,0,4);
iVar4 = 0;
do {
puVar5 = (undefined4 *)(local_16c[0] + iVar4);
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;
}
iVar4 = iVar4 + 0x34;
} while (iVar4 != 0xd0);
iVar4 = 0;
do {
puVar5 = (undefined4 *)
(*(int *)(DAT_003a172c + 0x20) +
(uint)*(ushort *)(*(int *)(DAT_003a172c + 0x88) + iVar4 + iVar2 * 2) * 0xc);
iVar7 = iVar4 * 0x1a;
iVar4 = iVar4 + 2;
puVar1 = (undefined4 *)(local_16c[0] + iVar7);
*puVar1 = *puVar5;
puVar1[1] = puVar5[1];
puVar1[2] = puVar5[2];
} while (iVar4 != 8);
local_144[0] = 0;
local_144[1] = 0;
local_144[2] = 0;
local_144[3] = 0;
local_144[4] = 0;
/* try { // try from 001d3855 to 001d3b46 has its CatchHandler @ 001d3b5c */
local_1a1 = Surf_PreClipFragment(this,param_1,local_154,param_3,local_17c);
if ((local_1a1 == '\0') ||
(Surf_ClipFragment(this,param_1,local_154,param_3,local_17c), iVar2 = local_144[3],
local_144[3] == 0)) {
LAB_001d389c:
local_1a1 = '\0';
}
else {
local_188 = (moverlayfragment_t *)CopyTempFragment(this,local_154);
CUtlVector<moverlayfragment_t*,CUtlMemory<moverlayfragment_t*,int>>::InsertBefore
((CUtlVector<moverlayfragment_t*,CUtlMemory<moverlayfragment_t*,int>> *)param_2,
*(int *)(param_2 + 0xc),&local_188);
iVar4 = *(int *)(*(int *)(param_3 + 0x18) + 0x170);
if (0 < iVar2) {
iVar7 = 0;
do {
iVar6 = iVar7 * 0x34;
PointInQuadToBarycentric
((Vector *)(local_16c[0] + iVar4 * 0x34),
(Vector *)(local_16c[0] + ((iVar4 + 3) % 4) * 0x34),
(Vector *)(local_16c[0] + ((iVar4 + 2) % 4) * 0x34),
(Vector *)(local_16c[0] + ((iVar4 + 1) % 4) * 0x34),
(Vector *)(local_144[0] + iVar6),(Vector2D *)&local_184);
if (((local_184 & 0x7f800000) == 0x7f800000) || ((local_180 & 0x7f800000) == 0x7f800000)) {
iVar2 = *(short *)(param_1 + 4) * 0x50 + *(int *)(DAT_003a172c + 0x5c);
if ((iVar2 == 0) || (puVar5 = *(undefined4 **)(iVar2 + 0x4c), puVar5 == (undefined4 *)0x0)
) {
puVar3 = &DAT_002c79d4;
}
else {
puVar3 = (undefined1 *)(**(code **)*puVar5)(puVar5);
}
CFmtStrN<256>::CFmtStrN
(local_12c,"(%f, %f, %f)",(double)*(float *)(param_1 + 0x60),
(double)*(float *)(param_1 + 100),(double)*(float *)(param_1 + 0x68));
DevWarning(1,"Bad overlay geometry at %s with material \'%s\'\n",local_127,puVar3);
goto LAB_001d389c;
}
iVar7 = iVar7 + 1;
*(uint *)(*(int *)(local_188 + 0x10) + iVar6) = local_184;
*(uint *)(*(int *)(local_188 + 0x10) + 4 + iVar6) = local_180;
*(undefined4 *)(*(int *)(local_188 + 0x10) + 8 + iVar6) = 0;
} while (iVar7 != iVar2);
}
}
local_144[3] = 0;
CUtlMemory<overlayvert_t,int>::Purge((CUtlMemory<overlayvert_t,int> *)local_144);
local_144[4] = local_144[0];
CUtlMemory<overlayvert_t,int>::Purge((CUtlMemory<overlayvert_t,int> *)local_144);
local_16c[3] = 0;
CUtlMemory<overlayvert_t,int>::Purge((CUtlMemory<overlayvert_t,int> *)local_16c);
local_16c[4] = local_16c[0];
CUtlMemory<overlayvert_t,int>::Purge((CUtlMemory<overlayvert_t,int> *)local_16c);
if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
/* WARNING: Subroutine does not return */
__stack_chk_fail();
}
return local_1a1;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
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.
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.