L L4D2node

CDirectorScavengeMode::SpawnNextScavengeCluster

0x008b40f0 · 396 bytes · __thiscall

_ZN21CDirectorScavengeMode24SpawnNextScavengeClusterEv

Decompiled

undefined (1 param)

/* CDirectorScavengeMode::SpawnNextScavengeCluster() */

undefined4 __thiscall CDirectorScavengeMode::SpawnNextScavengeCluster(CDirectorScavengeMode *this)

{
  uint uVar1;
  int iVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  undefined *puVar6;
  CUtlMemory<CHandle<CBaseEntity>,int> *this_00;
  
  iVar2 = *(int *)(this + 0x60);
  iVar5 = *(int *)(this + 0x38);
  if ((-1 < iVar2) && (iVar2 < iVar5)) {
    iVar4 = iVar2 * 0x14;
    this_00 = (CUtlMemory<CHandle<CBaseEntity>,int> *)(iVar4 + *(int *)(this + 0x2c));
    *(undefined4 *)(this_00 + 0xc) = 0;
    CUtlMemory<CHandle<CBaseEntity>,int>::Purge(this_00);
    *(undefined4 *)(this_00 + 0x10) = *(undefined4 *)this_00;
    CUtlMemory<CHandle<CBaseEntity>,int>::Purge(this_00);
    iVar5 = *(int *)(this + 0x38);
    iVar2 = (iVar5 - iVar2) + -1;
    if (0 < iVar2) {
      _V_memmove((void *)(*(int *)(this + 0x2c) + iVar4),
                 (void *)(*(int *)(this + 0x2c) + 0x14 + iVar4),iVar2 * 0x14);
      iVar5 = *(int *)(this + 0x38);
    }
    iVar5 = iVar5 + -1;
    *(int *)(this + 0x38) = iVar5;
  }
  if (iVar5 != 0) {
    iVar2 = RandomInt(0,(iVar5 + -1) / 2);
    iVar5 = TheDirector;
    *(int *)(this + 0x60) = iVar2;
    if (*(char *)(iVar5 + 0x4e5) == '\0') {
      CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
                ((CUtlVector<int,CUtlMemory<int,int>> *)(this + 0x40),*(int *)(this + 0x4c),
                 (int *)(this + 0x60));
      iVar2 = *(int *)(this + 0x60);
    }
    else {
      iVar5 = *(int *)(this + 100);
      if (iVar5 < *(int *)(this + 0x4c)) {
        iVar2 = *(int *)(*(int *)(this + 0x40) + iVar5 * 4);
        *(int *)(this + 100) = iVar5 + 1;
        *(int *)(this + 0x60) = iVar2;
      }
    }
    iVar5 = *(int *)(this + 0x2c);
    iVar4 = 0;
    piVar3 = (int *)(iVar5 + iVar2 * 0x14);
    if (0 < piVar3[3]) {
      do {
        uVar1 = *(uint *)(*piVar3 + iVar4 * 4);
        if ((((uVar1 != 0xffffffff) &&
             (puVar6 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar6 != (undefined *)0xfffffffc))
            && (*(uint *)(puVar6 + 8) == uVar1 >> 0xc)) &&
           (*(inputdata_t **)(puVar6 + 4) != (inputdata_t *)0x0)) {
          CWeaponScavengeItemSpawn::InputSpawnScavengeItem(*(inputdata_t **)(puVar6 + 4));
          iVar5 = *(int *)(this + 0x2c);
        }
        iVar4 = iVar4 + 1;
        piVar3 = (int *)(iVar5 + *(int *)(this + 0x60) * 0x14);
      } while (iVar4 < piVar3[3]);
    }
    return 1;
  }
  return 0;
}

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)