L L4D2node

CEdgeList::AddSurface

0x001cd870 · 457 bytes · __thiscall

_ZN9CEdgeList10AddSurfaceERK8cplane_t

Decompiled

undefined (2 params)

/* CEdgeList::AddSurface(cplane_t const&) */

int __thiscall CEdgeList::AddSurface(CEdgeList *this,cplane_t *param_1)

{
  int *piVar1;
  undefined2 uVar2;
  int iVar3;
  undefined4 *puVar4;
  int iVar5;
  void *pvVar6;
  int iVar7;
  int iVar8;
  
  iVar3 = *(int *)(this + 0xb0);
  iVar8 = *(int *)(this + 0xa8);
  iVar7 = iVar3 + 1;
  if (iVar8 < iVar7) {
    iVar5 = *(int *)(this + 0xac);
    if (-1 < iVar5) {
      if (iVar5 == 0) {
        if (iVar8 == 0) {
          if (iVar7 < 2) {
            iVar5 = 1;
            goto LAB_001cd9bf;
          }
          iVar8 = 1;
        }
        do {
          iVar5 = iVar8 * 2;
          if (iVar7 <= iVar5) break;
          iVar5 = iVar8 * 4;
          iVar8 = iVar5;
        } while (iVar5 < iVar7);
      }
      else {
        for (iVar5 = (iVar3 / iVar5 + 1) * iVar5; iVar5 < iVar7; iVar5 = (iVar5 + iVar7) / 2) {
        }
      }
LAB_001cd9bf:
      *(int *)(this + 0xa8) = iVar5;
      if (*(void **)(this + 0xa4) == (void *)0x0) {
        pvVar6 = malloc(iVar5 * 0x28);
        *(void **)(this + 0xa4) = pvVar6;
      }
      else {
        pvVar6 = realloc(*(void **)(this + 0xa4),iVar5 * 0x28);
        *(void **)(this + 0xa4) = pvVar6;
        iVar7 = *(int *)(this + 0xb0) + 1;
      }
      goto LAB_001cd89c;
    }
  }
  pvVar6 = *(void **)(this + 0xa4);
LAB_001cd89c:
  *(int *)(this + 0xb0) = iVar7;
  iVar7 = (iVar7 - iVar3) + -1;
  iVar8 = iVar3 * 0x28;
  *(void **)(this + 0xb4) = pvVar6;
  if (0 < iVar7) {
    _V_memmove((void *)((int)pvVar6 + iVar8 + 0x28),(void *)((int)pvVar6 + iVar8),iVar7 * 0x28);
    pvVar6 = *(void **)(this + 0xa4);
  }
  puVar4 = (undefined4 *)((int)pvVar6 + iVar8);
  puVar4[5] = 0;
  *puVar4 = *(undefined4 *)param_1;
  puVar4[1] = *(undefined4 *)(param_1 + 4);
  puVar4[2] = *(undefined4 *)(param_1 + 8);
  puVar4[3] = *(undefined4 *)(param_1 + 0xc);
  *(cplane_t *)(puVar4 + 4) = param_1[0x10];
  *(cplane_t *)((int)puVar4 + 0x11) = param_1[0x11];
  uVar2 = *(undefined2 *)(param_1 + 0x12);
  puVar4[7] = 0;
  puVar4[6] = 0;
  puVar4[8] = iVar3;
  *(undefined2 *)((int)puVar4 + 0x12) = uVar2;
  iVar7 = *(int *)(this + 0xc4);
  CUtlVector<int,CUtlMemory<int,int>>::GrowVector
            ((CUtlVector<int,CUtlMemory<int,int>> *)(this + 0xb8),1);
  CUtlVector<int,CUtlMemory<int,int>>::ShiftElementsRight
            ((CUtlVector<int,CUtlMemory<int,int>> *)(this + 0xb8),iVar7,1);
  piVar1 = (int *)(*(int *)(this + 0xb8) + iVar7 * 4);
  if (piVar1 != (int *)0x0) {
    *piVar1 = iVar3;
  }
  return iVar3;
}

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)