L L4D2node

COverlayMgr::Surf_ClipFragment

0x001d3090 · 619 bytes · __thiscall

_ZN11COverlayMgr17Surf_ClipFragmentEP10moverlay_tR18moverlayfragment_tP11msurface2_tS3_

Decompiled

undefined (5 params)

/* COverlayMgr::Surf_ClipFragment(moverlay_t*, moverlayfragment_t&, msurface2_t*,
   moverlayfragment_t&) */

void __thiscall
COverlayMgr::Surf_ClipFragment
          (COverlayMgr *this,moverlay_t *param_1,moverlayfragment_t *param_2,msurface2_t *param_3,
          moverlayfragment_t *param_4)

{
  moverlayfragment_t *pmVar1;
  undefined4 *puVar2;
  int iVar3;
  int iVar4;
  undefined4 *puVar5;
  int iVar6;
  int local_40;
  moverlayfragment_t *local_38;
  moverlayfragment_t *local_34;
  int local_30 [8];
  
  local_30[0] = 0;
  local_30[1] = 0;
  local_30[2] = 0;
  local_30[3] = 0;
  local_30[4] = 0;
                    /* try { // try from 001d30e3 to 001d31fb has its CatchHandler @ 001d3300 */
  BuildClipPlanes(this,param_3,param_4,(Vector *)(param_1 + 0x84),(CUtlVector *)local_30);
  pmVar1 = (moverlayfragment_t *)CopyTempFragment(this,param_2);
  if (0 < local_30[3]) {
    iVar6 = 0;
    do {
      local_38 = (moverlayfragment_t *)0x0;
      local_34 = (moverlayfragment_t *)0x0;
      DoClipFragment(this,pmVar1,(cplane_t *)(local_30[0] + iVar6 * 0x14),&local_38,&local_34);
      DestroyTempFragment(this,pmVar1);
      pmVar1 = local_34;
      if (local_38 != (moverlayfragment_t *)0x0) {
        DestroyTempFragment(this,local_38);
      }
      iVar6 = iVar6 + 1;
    } while (iVar6 < local_30[3]);
  }
  local_30[3] = 0;
  CUtlMemory<cplane_t,int>::Purge((CUtlMemory<cplane_t,int> *)local_30);
  local_30[4] = local_30[0];
  *(undefined4 *)(param_2 + 0x1c) = 0;
  if ((pmVar1 != (moverlayfragment_t *)0x0) && (iVar6 = *(int *)(pmVar1 + 0x1c), iVar6 != 0)) {
    CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>>::GrowVector
              ((CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>> *)(param_2 + 0x10),iVar6);
    CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>>::ShiftElementsRight
              ((CUtlVector<overlayvert_t,CUtlMemory<overlayvert_t,int>> *)(param_2 + 0x10),0,iVar6);
    iVar4 = 0;
    iVar3 = 0;
    if (0 < iVar6) {
      do {
        puVar2 = (undefined4 *)(iVar4 + *(int *)(param_2 + 0x10));
        if (puVar2 != (undefined4 *)0x0) {
          *puVar2 = 0;
          puVar2[1] = 0;
          puVar2[2] = 0;
          puVar2[3] = 0;
          puVar2[4] = 0;
          puVar2[5] = 0;
          puVar2[6] = 0;
          puVar2[7] = 0;
          puVar2[8] = 0;
          puVar2[9] = 0;
          puVar2[0xb] = 0;
          puVar2[10] = 0;
          puVar2[0xc] = 0xffffffff;
        }
        iVar3 = iVar3 + 1;
        iVar4 = iVar4 + 0x34;
      } while (iVar3 != iVar6);
    }
    if (0 < *(int *)(pmVar1 + 0x1c)) {
      iVar6 = 0;
      local_40 = 0;
      do {
        local_40 = local_40 + 1;
        puVar2 = (undefined4 *)(*(int *)(pmVar1 + 0x10) + iVar6);
        puVar5 = (undefined4 *)(*(int *)(param_2 + 0x10) + iVar6);
        *puVar5 = *puVar2;
        puVar5[1] = puVar2[1];
        puVar5[2] = puVar2[2];
        iVar3 = *(int *)(param_2 + 0x10) + iVar6;
        iVar4 = *(int *)(pmVar1 + 0x10) + iVar6;
        iVar6 = iVar6 + 0x34;
        *(undefined4 *)(iVar3 + 0x18) = *(undefined4 *)(iVar4 + 0x18);
        *(undefined4 *)(iVar3 + 0x1c) = *(undefined4 *)(iVar4 + 0x1c);
        *(undefined4 *)(iVar3 + 0x20) = *(undefined4 *)(iVar4 + 0x20);
        *(undefined4 *)(iVar3 + 0x24) = *(undefined4 *)(iVar4 + 0x24);
      } while (local_40 < *(int *)(pmVar1 + 0x1c));
    }
  }
  DestroyTempFragment(this,pmVar1);
  local_30[3] = 0;
  CUtlMemory<cplane_t,int>::Purge((CUtlMemory<cplane_t,int> *)local_30);
  local_30[4] = local_30[0];
  CUtlMemory<cplane_t,int>::Purge((CUtlMemory<cplane_t,int> *)local_30);
  return;
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)