L L4D2node

CDirectorItemManager::RegisterWeaponSpawn

0x008a42f0 · 287 bytes · __thiscall

_ZN20CDirectorItemManager19RegisterWeaponSpawnEP24CWeaponSpawnConfigurable

Decompiled

undefined (2 params)

/* CDirectorItemManager::RegisterWeaponSpawn(CWeaponSpawnConfigurable*) */

void __thiscall
CDirectorItemManager::RegisterWeaponSpawn
          (CDirectorItemManager *this,CWeaponSpawnConfigurable *param_1)

{
  int iVar1;
  undefined4 uVar2;
  int iVar3;
  undefined4 *puVar4;
  void *pvVar5;
  int iVar6;
  int iVar7;
  
  if (param_1 == (CWeaponSpawnConfigurable *)0x0) {
    return;
  }
  if (((byte)param_1[0x14c] & 1) != 0) {
    return;
  }
  puVar4 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
  iVar1 = *(int *)(this + 0x43c);
  uVar2 = *puVar4;
  iVar6 = iVar1 + 1;
  iVar7 = *(int *)(this + 0x434);
  if (iVar7 < iVar6) {
    iVar3 = *(int *)(this + 0x438);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar7 == 0) {
          if (iVar6 < 9) {
            iVar7 = 8;
            goto LAB_008a43af;
          }
          iVar7 = 8;
        }
        do {
          iVar7 = iVar7 * 2;
        } while (iVar7 < iVar6);
      }
      else {
        for (iVar7 = (iVar1 / iVar3 + 1) * iVar3; iVar7 < iVar6; iVar7 = (iVar7 + iVar6) / 2) {
        }
      }
LAB_008a43af:
      *(int *)(this + 0x434) = iVar7;
      if (*(void **)(this + 0x430) == (void *)0x0) {
        pvVar5 = malloc(iVar7 << 2);
        *(void **)(this + 0x430) = pvVar5;
      }
      else {
        pvVar5 = realloc(*(void **)(this + 0x430),iVar7 << 2);
        *(void **)(this + 0x430) = pvVar5;
        iVar6 = *(int *)(this + 0x43c) + 1;
      }
      goto LAB_008a4332;
    }
  }
  pvVar5 = *(void **)(this + 0x430);
LAB_008a4332:
  *(int *)(this + 0x43c) = iVar6;
  iVar7 = iVar1 * 4;
  iVar6 = (iVar6 - iVar1) + -1;
  *(void **)(this + 0x440) = pvVar5;
  if (0 < iVar6) {
    _V_memmove((void *)((int)pvVar5 + iVar7 + 4),(void *)((int)pvVar5 + iVar7),iVar6 * 4);
    pvVar5 = *(void **)(this + 0x430);
  }
  if ((undefined4 *)(iVar7 + (int)pvVar5) != (undefined4 *)0x0) {
    *(undefined4 *)(iVar7 + (int)pvVar5) = uVar2;
  }
  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)