L L4D2node

SpawnHierarchicalList

0x006f0c90 · 835 bytes · __cdecl

_Z21SpawnHierarchicalListiP19HierarchicalSpawn_tb

Decompiled

undefined (3 params)

/* SpawnHierarchicalList(int, HierarchicalSpawn_t*, bool) */

void SpawnHierarchicalList(int param_1,HierarchicalSpawn_t *param_2,bool param_3)

{
  int iVar1;
  char *pcVar2;
  CBaseEntity *pCVar3;
  CStringRegistry *pCVar4;
  undefined4 uVar5;
  HierarchicalSpawn_t *pHVar6;
  CBaseEntity *this;
  int local_24;
  char *local_20 [4];
  
  local_24 = 0;
  pHVar6 = param_2;
  if (0 < param_1) {
    do {
      this = *(CBaseEntity **)pHVar6;
      if ((this == (CBaseEntity *)0x0) || (iVar1 = CBaseEntity::IsDormant(this), iVar1 != 0)) {
        *(undefined4 *)(pHVar6 + 4) = 1;
      }
      else {
        iVar1 = 0;
        if (*(int *)(this + 0x84) == 0) {
          iVar1 = 1;
        }
        else {
          do {
            ExtractParentName(local_20,*(undefined4 *)(this + 0x84));
            pcVar2 = local_20[0];
            if (local_20[0] == (char *)0x0) {
              pcVar2 = "";
            }
            pCVar3 = (CBaseEntity *)
                     CGlobalEntityList::FindEntityByName
                               ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,pcVar2,
                                (CBaseEntity *)0x0,(CBaseEntity *)0x0,(CBaseEntity *)0x0,
                                (IEntityFindFilter *)0x0);
            if (pCVar3 == (CBaseEntity *)0x0) break;
            if (this == pCVar3) {
              uVar5 = CBaseEntity::GetDebugName(this);
              Warning("LEVEL DESIGN ERROR: Entity %s is parented to itself!\n",uVar5);
              break;
            }
            iVar1 = iVar1 + 1;
            this = pCVar3;
          } while (*(int *)(pCVar3 + 0x84) != 0);
          iVar1 = iVar1 + 1;
        }
        *(int *)(pHVar6 + 4) = iVar1;
      }
      local_24 = local_24 + 1;
      pHVar6 = pHVar6 + 0x10;
    } while (local_24 != param_1);
  }
  pCVar4 = operator_new(4);
                    /* try { // try from 006f0d92 to 006f0d96 has its CatchHandler @ 006f0fdf */
  CStringRegistry::CStringRegistry(pCVar4);
  g_pClassnameSpawnPriority = pCVar4;
  CStringRegistry::AddString(pCVar4,"func_wall",10);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"scripted_sequence",9);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"phys_hinge",8);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"phys_ballsocket",8);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"phys_slideconstraint",8);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"phys_constraint",8);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"phys_pulleyconstraint",8);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"phys_lengthconstraint",8);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"phys_ragdollconstraint",8);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"info_mass_center",8);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"trigger_vphysics_motion",8);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"prop_physics",7);
  CStringRegistry::AddString(g_pClassnameSpawnPriority,"prop_ragdoll",7);
  qsort(param_2,param_1,0x10,CompareSpawnOrder);
  pCVar4 = g_pClassnameSpawnPriority;
  if (g_pClassnameSpawnPriority != (CStringRegistry *)0x0) {
    CStringRegistry::~CStringRegistry(g_pClassnameSpawnPriority);
    operator_delete(pCVar4);
  }
  g_pClassnameSpawnPriority = (CStringRegistry *)0x0;
  iVar1 = (**(code **)(*engine + 0xc))(engine);
  if (iVar1 != 0) {
    RememberInitialEntityPositions(param_1,param_2);
  }
  SetupParentsForSpawnList(param_1,param_2);
  SpawnAllEntities(param_1,param_2,param_3);
  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)