L L4D2node

COcclusionSystem::ClipPolygonToAxisAlignedPlane

0x001cccd0 · 570 bytes · __thiscall

_ZNK16COcclusionSystem29ClipPolygonToAxisAlignedPlaneEPP6VectoriRKNS_18AxisAlignedPlane_tES2_

Decompiled

undefined (5 params)

/* COcclusionSystem::ClipPolygonToAxisAlignedPlane(Vector**, int,
   COcclusionSystem::AxisAlignedPlane_t const&, Vector**) const */

int __thiscall
COcclusionSystem::ClipPolygonToAxisAlignedPlane
          (COcclusionSystem *this,Vector **param_1,int param_2,AxisAlignedPlane_t *param_3,
          Vector **param_4)

{
  Vector *pVVar1;
  bool bVar2;
  bool bVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  longdouble lVar7;
  float fVar8;
  float fVar9;
  Vector *local_28;
  int local_24;
  
  iVar5 = *(int *)param_3;
  fVar8 = *(float *)(param_3 + 4);
  fVar9 = *(float *)(param_3 + 8);
  if (param_2 < 1) {
    local_24 = 0;
  }
  else {
    local_24 = 0;
    iVar6 = 0;
    local_28 = param_1[param_2 + -1];
    bVar3 = fVar9 <= *(float *)(param_1[param_2 + -1] + iVar5 * 4) * fVar8;
    while( true ) {
      iVar4 = s_nTempVertCount;
      pVVar1 = param_1[iVar6];
      bVar2 = fVar9 <= fVar8 * *(float *)(pVVar1 + iVar5 * 4);
      if (bVar2) {
        if (!bVar3) {
          iVar5 = s_nTempVertCount * 0xc;
          s_nTempVertCount = s_nTempVertCount + 1;
          param_4[local_24] = (Vector *)(s_TempVertMemory + iVar5);
          lVar7 = (longdouble)
                  IntersectRayWithAAPlane
                            (local_28,pVVar1,*(int *)param_3,*(float *)(param_3 + 4),
                             *(float *)(param_3 + 8));
          fVar8 = (float)lVar7;
          local_24 = local_24 + 1;
          *(float *)(s_TempVertMemory + iVar4 * 0xc) =
               (*(float *)pVVar1 - *(float *)local_28) * fVar8 + *(float *)local_28;
          *(float *)(s_TempVertMemory + iVar5 + 4) =
               (*(float *)(pVVar1 + 4) - *(float *)(local_28 + 4)) * fVar8 +
               *(float *)(local_28 + 4);
          *(float *)(s_TempVertMemory + iVar5 + 8) =
               (*(float *)(pVVar1 + 8) - *(float *)(local_28 + 8)) * fVar8 +
               *(float *)(local_28 + 8);
        }
        param_4[local_24] = pVVar1;
        local_24 = local_24 + 1;
      }
      else if (bVar3) {
        iVar5 = s_nTempVertCount * 0xc;
        s_nTempVertCount = s_nTempVertCount + 1;
        param_4[local_24] = (Vector *)(s_TempVertMemory + iVar5);
        lVar7 = (longdouble)
                IntersectRayWithAAPlane
                          (local_28,pVVar1,*(int *)param_3,*(float *)(param_3 + 4),
                           *(float *)(param_3 + 8));
        fVar8 = (float)lVar7;
        local_24 = local_24 + 1;
        *(float *)(s_TempVertMemory + iVar4 * 0xc) =
             (*(float *)pVVar1 - *(float *)local_28) * fVar8 + *(float *)local_28;
        *(float *)(s_TempVertMemory + iVar5 + 4) =
             (*(float *)(pVVar1 + 4) - *(float *)(local_28 + 4)) * fVar8 + *(float *)(local_28 + 4);
        *(float *)(s_TempVertMemory + iVar5 + 8) =
             (*(float *)(pVVar1 + 8) - *(float *)(local_28 + 8)) * fVar8 + *(float *)(local_28 + 8);
      }
      if (iVar6 + 1 == param_2) break;
      iVar6 = iVar6 + 1;
      iVar5 = *(int *)param_3;
      fVar8 = *(float *)(param_3 + 4);
      fVar9 = *(float *)(param_3 + 8);
      local_28 = pVVar1;
      bVar3 = bVar2;
    }
  }
  return local_24;
}

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)