L L4D2node

CWingedEdgeList::AddSurface

0x001cb6d0 · 386 bytes · __thiscall

_ZN15CWingedEdgeList10AddSurfaceERK8cplane_t

Decompiled

undefined (2 params)

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

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

{
  int iVar1;
  undefined4 *puVar2;
  int iVar3;
  void *pvVar4;
  int iVar5;
  int iVar6;
  
  iVar1 = *(int *)(this + 0x9c);
  iVar5 = *(int *)(this + 0x94);
  iVar6 = iVar1 + 1;
  if (iVar5 < iVar6) {
    iVar3 = *(int *)(this + 0x98);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar5 == 0) {
          if (iVar6 < 3) {
            iVar3 = 2;
            goto LAB_001cb797;
          }
          iVar5 = 2;
        }
        do {
          iVar3 = iVar5 * 2;
          if (iVar6 <= iVar3) break;
          iVar3 = iVar5 * 4;
          iVar5 = iVar3;
        } while (iVar3 < iVar6);
      }
      else {
        for (iVar3 = (iVar1 / iVar3 + 1) * iVar3; iVar3 < iVar6; iVar3 = (iVar3 + iVar6) / 2) {
        }
      }
LAB_001cb797:
      *(int *)(this + 0x94) = iVar3;
      if (*(void **)(this + 0x90) == (void *)0x0) {
        pvVar4 = malloc(iVar3 * 0x14);
        *(void **)(this + 0x90) = pvVar4;
      }
      else {
        pvVar4 = realloc(*(void **)(this + 0x90),iVar3 * 0x14);
        *(void **)(this + 0x90) = pvVar4;
        iVar6 = *(int *)(this + 0x9c) + 1;
      }
      goto LAB_001cb6f8;
    }
  }
  pvVar4 = *(void **)(this + 0x90);
LAB_001cb6f8:
  *(int *)(this + 0x9c) = iVar6;
  iVar6 = (iVar6 - iVar1) + -1;
  *(void **)(this + 0xa0) = pvVar4;
  if (0 < iVar6) {
    _V_memmove((void *)((int)pvVar4 + iVar1 * 0x14 + 0x14),(void *)((int)pvVar4 + iVar1 * 0x14),
               iVar6 * 0x14);
    pvVar4 = *(void **)(this + 0x90);
  }
  puVar2 = (undefined4 *)((int)pvVar4 + iVar1 * 0x14);
  *puVar2 = *(undefined4 *)param_1;
  puVar2[1] = *(undefined4 *)(param_1 + 4);
  puVar2[2] = *(undefined4 *)(param_1 + 8);
  puVar2[3] = *(undefined4 *)(param_1 + 0xc);
  *(cplane_t *)(puVar2 + 4) = param_1[0x10];
  *(cplane_t *)((int)puVar2 + 0x11) = param_1[0x11];
  *(undefined2 *)((int)puVar2 + 0x12) = *(undefined2 *)(param_1 + 0x12);
  return iVar1;
}

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)