L L4D2node

CSheetSimulator::AddGravityForce

0x004af5f0 · 231 bytes · __thiscall

_ZN15CSheetSimulator15AddGravityForceEi

Decompiled

undefined (2 params)

/* CSheetSimulator::AddGravityForce(int) */

void __thiscall CSheetSimulator::AddGravityForce(CSheetSimulator *this,int param_1)

{
  int iVar1;
  int iVar2;
  void *pvVar3;
  int iVar4;
  int iVar5;
  
  iVar1 = *(int *)(this + 0x3c);
  iVar5 = *(int *)(this + 0x34);
  iVar4 = iVar1 + 1;
  if (iVar5 < iVar4) {
    iVar2 = *(int *)(this + 0x38);
    if (-1 < iVar2) {
      if (iVar2 == 0) {
        if (iVar5 == 0) {
          if (iVar4 < 9) {
            iVar2 = 8;
            goto LAB_004af67f;
          }
          iVar5 = 8;
        }
        do {
          iVar2 = iVar5 * 2;
          if (iVar4 <= iVar2) break;
          iVar2 = iVar5 * 4;
          iVar5 = iVar2;
        } while (iVar2 < iVar4);
      }
      else {
        for (iVar2 = (iVar1 / iVar2 + 1) * iVar2; iVar2 < iVar4; iVar2 = (iVar2 + iVar4) / 2) {
        }
      }
LAB_004af67f:
      *(int *)(this + 0x34) = iVar2;
      if (*(void **)(this + 0x30) == (void *)0x0) {
        pvVar3 = malloc(iVar2 << 2);
        *(void **)(this + 0x30) = pvVar3;
      }
      else {
        pvVar3 = realloc(*(void **)(this + 0x30),iVar2 << 2);
        *(void **)(this + 0x30) = pvVar3;
        iVar4 = *(int *)(this + 0x3c) + 1;
      }
      goto LAB_004af60c;
    }
  }
  pvVar3 = *(void **)(this + 0x30);
LAB_004af60c:
  *(int *)(this + 0x3c) = iVar4;
  iVar5 = iVar1 * 4;
  iVar4 = (iVar4 - iVar1) + -1;
  *(void **)(this + 0x40) = pvVar3;
  if (0 < iVar4) {
    _V_memmove((void *)((int)pvVar3 + iVar5 + 4),(void *)((int)pvVar3 + iVar5),iVar4 * 4);
    pvVar3 = *(void **)(this + 0x30);
  }
  if ((int *)(iVar5 + (int)pvVar3) != (int *)0x0) {
    *(int *)(iVar5 + (int)pvVar3) = param_1;
  }
  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)