L L4D2node

HandleFoundryEntitySpawnRecords

0x006810a0 · 736 bytes · unknown

_Z31HandleFoundryEntitySpawnRecordsv

Decompiled

undefined (0 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* HandleFoundryEntitySpawnRecords() */

void HandleFoundryEntitySpawnRecords(void)

{
  undefined4 *puVar1;
  CUtlMemory<char,int> *this;
  char cVar2;
  char *pcVar3;
  int iVar4;
  int iVar5;
  CBaseEntity *this_00;
  int in_GS_OFFSET;
  undefined4 local_864;
  undefined4 local_860;
  undefined4 local_85c;
  undefined4 local_858;
  undefined4 local_854;
  undefined4 local_850;
  undefined4 local_84c;
  undefined4 local_848;
  CMapEntitySpawner local_844 [36];
  char local_820 [2048];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (_DAT_00fdb5f8 != 0) {
    local_858 = 0;
    local_854 = 0;
    local_850 = 0;
    local_84c = 0;
    local_848 = 0;
                    /* try { // try from 0068111b to 0068111f has its CatchHandler @ 0068138c */
    CMapEntitySpawner::CMapEntitySpawner(local_844);
    local_844[0] = (CMapEntitySpawner)0x1;
    if (DAT_00fdb5ec != -1) {
      iVar4 = DAT_00fdb5ec;
      do {
        puVar1 = *(undefined4 **)(g_FoundryEntitySpawnRecords + iVar4 * 0xc);
        if (0 < (int)puVar1[5]) {
          *(undefined4 *)(gEntList + puVar1[5] * 0x10 + 8) = puVar1[7];
          (**(code **)(*engine + 0x1dc))(engine,puVar1[5]);
        }
        local_864 = *puVar1;
        local_860 = 0xffffffff;
        local_85c = local_864;
        cVar2 = CEntityMapData::ExtractValue((CEntityMapData *)&local_864,"classname",local_820);
        if (cVar2 != '\0') {
          iVar5 = puVar1[5];
          if (iVar5 == 0) {
            iVar5 = -1;
          }
          this_00 = (CBaseEntity *)CreateEntityByName(local_820,iVar5,true);
          if (this_00 == (CBaseEntity *)0x0) {
            Warning("HandleFoundryEntitySpawnRecords - CreateEntityByName( %s, %d ) failed\n",
                    local_820,puVar1[5]);
          }
          else {
                    /* try { // try from 0068114b to 006812c4 has its CatchHandler @ 006813c2 */
            pcVar3 = (char *)CEntityMapData::CurrentBufferPosition((CEntityMapData *)&local_864);
            CBaseEntity::ParseMapData(this_00,(CEntityMapData *)&local_864);
            if (puVar1[8] != -1) {
              *(undefined4 *)(this_00 + 0x110) = puVar1[8];
            }
            *(undefined4 *)(this_00 + 0x88) = puVar1[6];
            iVar5 = CEntityMapData::CurrentBufferPosition((CEntityMapData *)&local_864);
            CMapEntitySpawner::AddEntity(local_844,this_00,pcVar3,(iVar5 - (int)pcVar3) + 2);
          }
        }
        iVar4 = *(int *)(g_FoundryEntitySpawnRecords + 8 + iVar4 * 0xc);
      } while (iVar4 != -1);
    }
    CMapEntitySpawner::HandleTemplates(local_844);
    CMapEntitySpawner::SpawnAndActivate(local_844,true);
    PrecachePointTemplates();
    CGlobalEntityList::CleanupDeleteList();
    iVar4 = DAT_00fdb5ec;
    while (iVar4 != -1) {
      while( true ) {
        puVar1 = (undefined4 *)(g_FoundryEntitySpawnRecords + iVar4 * 0xc);
        this = (CUtlMemory<char,int> *)*puVar1;
        iVar4 = puVar1[2];
        if (this == (CUtlMemory<char,int> *)0x0) break;
        *(undefined4 *)(this + 0xc) = 0;
        CUtlMemory<char,int>::Purge(this);
        *(undefined4 *)(this + 0x10) = *(undefined4 *)this;
        CUtlMemory<char,int>::Purge(this);
        operator_delete(this);
        if (iVar4 == -1) goto LAB_0068130d;
      }
    }
LAB_0068130d:
    CUtlLinkedList<CFoundryEntitySpawnRecord*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CFoundryEntitySpawnRecord*,int>,int>>
    ::RemoveAll((CUtlLinkedList<CFoundryEntitySpawnRecord*,int,false,int,CUtlMemory<UtlLinkedListElem_t<CFoundryEntitySpawnRecord*,int>,int>>
                 *)&g_FoundryEntitySpawnRecords);
    CUtlMemory<UtlLinkedListElem_t<CFoundryEntitySpawnRecord*,int>,int>::Purge
              ((CUtlMemory<UtlLinkedListElem_t<CFoundryEntitySpawnRecord*,int>,int> *)
               &g_FoundryEntitySpawnRecords);
    _DAT_00fdb5f4 = 0xffffffff;
    _DAT_00fdb5fc = 0;
    _DAT_00fdb600 = 0xffffffff;
    _DAT_00fdb604 = g_FoundryEntitySpawnRecords;
    CMapEntitySpawner::~CMapEntitySpawner(local_844);
    local_84c = 0;
    CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_858);
    local_848 = local_858;
    CUtlMemory<CBaseEntity*,int>::Purge((CUtlMemory<CBaseEntity*,int> *)&local_858);
  }
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)