L L4D2node

Test_InitRandomEntitySpawner

0x00af4500 · 613 bytes · __cdecl

_Z28Test_InitRandomEntitySpawnerRK8CCommand

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* Test_InitRandomEntitySpawner(CCommand const&) */

void Test_InitRandomEntitySpawner(CCommand *param_1)

{
  undefined4 *puVar1;
  bool bVar2;
  long lVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  
  DAT_0102ca24 = 0;
  CUtlMemory<CStressEntityReg*,int>::Purge((CUtlMemory<CStressEntityReg*,int> *)&g_StressEntityRegs)
  ;
  _DAT_0102ca28 = g_StressEntityRegs;
  iVar4 = DAT_0102ca24;
  for (puVar1 = CStressEntityReg::s_pHead; DAT_0102ca24 = iVar4, puVar1 != (undefined4 *)0x0;
      puVar1 = (undefined4 *)*puVar1) {
    iVar5 = iVar4 + 1;
    if ((DAT_0102ca1c < iVar5) && (-1 < DAT_0102ca20)) {
      if (DAT_0102ca20 == 0) {
        iVar6 = DAT_0102ca1c;
        if (DAT_0102ca1c == 0) {
          if (iVar5 < 9) {
            DAT_0102ca1c = 8;
            goto LAB_00af45cf;
          }
          iVar6 = 8;
        }
        do {
          DAT_0102ca1c = iVar6 * 2;
          if (iVar5 <= DAT_0102ca1c) break;
          DAT_0102ca1c = iVar6 * 4;
          iVar6 = DAT_0102ca1c;
        } while (DAT_0102ca1c < iVar5);
      }
      else {
        for (DAT_0102ca1c = (iVar4 / DAT_0102ca20 + 1) * DAT_0102ca20; DAT_0102ca1c < iVar5;
            DAT_0102ca1c = (DAT_0102ca1c + iVar5) / 2) {
        }
      }
LAB_00af45cf:
      if (g_StressEntityRegs == (void *)0x0) {
        g_StressEntityRegs = malloc(DAT_0102ca1c << 2);
      }
      else {
        g_StressEntityRegs = realloc(g_StressEntityRegs,DAT_0102ca1c << 2);
        iVar5 = DAT_0102ca24 + 1;
      }
    }
    iVar6 = iVar4 * 4;
    iVar4 = (iVar5 - iVar4) + -1;
    DAT_0102ca24 = iVar5;
    _DAT_0102ca28 = g_StressEntityRegs;
    if (0 < iVar4) {
      _V_memmove((void *)((int)g_StressEntityRegs + iVar6 + 4),
                 (void *)((int)g_StressEntityRegs + iVar6),iVar4 * 4);
    }
    if ((undefined4 *)(iVar6 + (int)g_StressEntityRegs) != (undefined4 *)0x0) {
      *(undefined4 *)(iVar6 + (int)g_StressEntityRegs) = puVar1;
    }
    iVar4 = DAT_0102ca24;
  }
  if (*(int *)param_1 < 2) {
    bVar2 = true;
    lVar3 = 100;
    DAT_0102ca10 = 0;
    CUtlMemory<CHandle<CBaseEntity>,int>::Purge
              ((CUtlMemory<CHandle<CBaseEntity>,int> *)&g_StressEntities);
  }
  else {
    lVar3 = strtol(*(char **)(param_1 + 0x40c),(char **)0x0,10);
    DAT_0102ca10 = 0;
    CUtlMemory<CHandle<CBaseEntity>,int>::Purge
              ((CUtlMemory<CHandle<CBaseEntity>,int> *)&g_StressEntities);
    DAT_0102ca10 = 0;
    _DAT_0102ca14 = g_StressEntities;
    if (lVar3 == 0) goto LAB_00af465e;
    bVar2 = 0 < lVar3;
  }
  DAT_0102ca10 = 0;
  _DAT_0102ca14 = g_StressEntities;
  CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>>::GrowVector
            ((CUtlVector<CHandle<CBaseEntity>,CUtlMemory<CHandle<CBaseEntity>,int>> *)
             &g_StressEntities,lVar3);
  if (DAT_0102ca10 - lVar3 < 1) {
    if (!bVar2) goto LAB_00af465e;
  }
  else {
    if (!bVar2) goto LAB_00af465e;
    _V_memmove((void *)((int)g_StressEntities + lVar3 * 4),g_StressEntities,
               (DAT_0102ca10 - lVar3) * 4);
  }
  iVar4 = 0;
  do {
    puVar1 = (undefined4 *)((int)g_StressEntities + iVar4 * 4);
    if (puVar1 != (undefined4 *)0x0) {
      *puVar1 = 0xffffffff;
    }
    iVar4 = iVar4 + 1;
  } while (iVar4 < lVar3);
LAB_00af465e:
  Msg("Test_InitRandomEntitySpawner: created %d slots.\n",lVar3);
  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)