L L4D2node

CDirectorChallengeMode::RecordScriptSpawnedEntity

0x0089a7e0 · 332 bytes · __thiscall

_ZN22CDirectorChallengeMode25RecordScriptSpawnedEntityEP11CBaseEntity

Decompiled

undefined (2 params)

/* CDirectorChallengeMode::RecordScriptSpawnedEntity(CBaseEntity*) */

void __thiscall
CDirectorChallengeMode::RecordScriptSpawnedEntity(CDirectorChallengeMode *this,CBaseEntity *param_1)

{
  int iVar1;
  undefined4 *puVar2;
  int iVar3;
  void *pvVar4;
  int iVar5;
  undefined4 uVar6;
  int iVar7;
  
  uVar6 = 0xffffffff;
  if (param_1 != (CBaseEntity *)0x0) {
    puVar2 = (undefined4 *)(**(code **)(*(int *)param_1 + 0xc))(param_1);
    uVar6 = *puVar2;
  }
  iVar1 = *(int *)(this + 0x154);
  iVar5 = *(int *)(this + 0x14c);
  iVar7 = iVar1 + 1;
  if (iVar5 < iVar7) {
    iVar3 = *(int *)(this + 0x150);
    if (-1 < iVar3) {
      if (iVar3 == 0) {
        if (iVar5 == 0) {
          if (iVar7 < 9) {
            iVar3 = 8;
            goto LAB_0089a87f;
          }
          iVar5 = 8;
        }
        do {
          iVar3 = iVar5 * 2;
          if (iVar7 <= iVar3) break;
          iVar3 = iVar5 * 4;
          iVar5 = iVar3;
        } while (iVar3 < iVar7);
      }
      else {
        for (iVar3 = (iVar1 / iVar3 + 1) * iVar3; iVar3 < iVar7; iVar3 = (iVar3 + iVar7) / 2) {
        }
      }
LAB_0089a87f:
      *(int *)(this + 0x14c) = iVar3;
      if (*(void **)(this + 0x148) == (void *)0x0) {
        pvVar4 = malloc(iVar3 << 2);
        *(void **)(this + 0x148) = pvVar4;
      }
      else {
        pvVar4 = realloc(*(void **)(this + 0x148),iVar3 << 2);
        *(void **)(this + 0x148) = pvVar4;
        iVar7 = *(int *)(this + 0x154) + 1;
      }
      goto LAB_0089a81b;
    }
  }
  pvVar4 = *(void **)(this + 0x148);
LAB_0089a81b:
  *(int *)(this + 0x154) = iVar7;
  iVar7 = (iVar7 - iVar1) + -1;
  *(void **)(this + 0x158) = pvVar4;
  if (0 < iVar7) {
    _V_memmove((void *)((int)pvVar4 + iVar1 * 4 + 4),(void *)((int)pvVar4 + iVar1 * 4),iVar7 * 4);
    pvVar4 = *(void **)(this + 0x148);
  }
  puVar2 = (undefined4 *)(iVar1 * 4 + (int)pvVar4);
  if (puVar2 != (undefined4 *)0x0) {
    *puVar2 = uVar6;
  }
  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)