L L4D2node

CreateEntityTransitionList

0x004abbe0 · 1161 bytes · __cdecl

_Z26CreateEntityTransitionListP16CSaveRestoreDatai

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CreateEntityTransitionList(CSaveRestoreData*, int) */

int CreateEntityTransitionList(CSaveRestoreData *param_1,int param_2)

{
  uint uVar1;
  int *piVar2;
  undefined *puVar3;
  undefined1 *puVar4;
  undefined *puVar5;
  int iVar6;
  entitytable_t *peVar7;
  int iVar8;
  CBaseEntity *pCVar9;
  CUtlMemory<int,int> *local_6c;
  int local_64;
  int local_5c;
  int local_58;
  undefined4 local_54;
  undefined4 local_50;
  int local_4c;
  int local_48;
  undefined **local_44;
  undefined4 local_40 [3];
  undefined4 local_34;
  undefined4 local_30;
  
  CreateEntitiesInTransitionList(param_1,param_2);
  local_58 = 0;
  local_54 = 0;
  local_50 = 0;
  local_4c = 0;
  local_48 = 0;
  local_5c = 0;
  if (*(int *)(param_1 + 0x574) < 1) {
    local_5c = -1;
    local_64 = 0;
  }
  else {
    local_64 = 0;
    do {
      pCVar9 = (CBaseEntity *)0x0;
      peVar7 = (entitytable_t *)(local_5c * 0x38 + *(int *)(param_1 + 0x578));
      uVar1 = *(uint *)(peVar7 + 0x10);
      if (((uVar1 != 0xffffffff) &&
          (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar5 + 8) == uVar1 >> 0xc)) {
        pCVar9 = *(CBaseEntity **)(puVar5 + 4);
      }
      iVar6 = *(int *)(peVar7 + 0x14);
      if ((-1 < iVar6) && (iVar6 < *(int *)(param_1 + 0xc))) {
        *(int *)(param_1 + 8) = iVar6;
        *(int *)(param_1 + 4) = iVar6 + *(int *)param_1;
      }
      *(undefined4 *)(param_1 + 0x568) = 0;
      *(undefined4 *)(param_1 + 0x56c) = 0;
      *(undefined4 *)(param_1 + 0x570) = 0;
      if ((pCVar9 != (CBaseEntity *)0x0) && ((param_2 & *(uint *)(peVar7 + 0x1c)) != 0)) {
        if ((*(uint *)(peVar7 + 0x1c) & 0x10000000) == 0) {
          if (*(int *)(pCVar9 + 0x30) == 0) {
            iVar6 = -1;
          }
          else {
            iVar6 = *(int *)(pCVar9 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
          }
          puVar4 = &DAT_00d539c2;
          if (*(undefined1 **)(peVar7 + 0x20) != (undefined1 *)0x0) {
            puVar4 = *(undefined1 **)(peVar7 + 0x20);
          }
          DevMsg(2,"Transferring %s (%d)\n",puVar4,iVar6);
          CRestore::CRestore((CRestore *)&local_44,param_1);
                    /* try { // try from 004abe30 to 004abe55 has its CatchHandler @ 004ac0ba */
          iVar6 = CEntitySaveRestoreBlockHandler::RestoreEntity
                            ((CBaseEntity *)g_EntitySaveRestoreBlockHandler,(IRestore *)pCVar9,
                             (entitytable_t *)&local_44);
          if (iVar6 < 0) {
                    /* try { // try from 004abed3 to 004abed7 has its CatchHandler @ 004ac0ba */
            UTIL_RemoveImmediate(pCVar9);
          }
          else {
            CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
                      ((CUtlVector<int,CUtlMemory<int,int>> *)&local_58,local_4c,&local_5c);
          }
          local_44 = &PTR_GetReadPos_00c1d008;
          local_34 = 0;
          CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)local_40);
          local_30 = local_40[0];
          CUtlMemory<int,int>::Purge((CUtlMemory<int,int> *)local_40);
        }
        else {
          puVar4 = &DAT_00d539c2;
          if (*(undefined1 **)(peVar7 + 0x20) != (undefined1 *)0x0) {
            puVar4 = *(undefined1 **)(peVar7 + 0x20);
          }
                    /* try { // try from 004abc70 to 004abe0a has its CatchHandler @ 004ac0d0 */
          DevMsg(2,"Merging changes for global: %s\n",puVar4);
          iVar6 = CEntitySaveRestoreBlockHandler::RestoreGlobalEntity
                            ((CEntitySaveRestoreBlockHandler *)g_EntitySaveRestoreBlockHandler,
                             pCVar9,param_1,peVar7);
          puVar5 = g_pEntityList;
          if (iVar6 < 1) {
            uVar1 = *(uint *)(peVar7 + 0x10);
            pCVar9 = (CBaseEntity *)0x0;
            if (((uVar1 != 0xffffffff) &&
                (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)
                ) && (*(uint *)(puVar5 + 8) == uVar1 >> 0xc)) {
              pCVar9 = *(CBaseEntity **)(puVar5 + 4);
            }
                    /* try { // try from 004abec3 to 004abec7 has its CatchHandler @ 004ac0d0 */
            UTIL_RemoveImmediate(pCVar9);
          }
          else {
            uVar1 = *(uint *)(peVar7 + 0x10);
            local_64 = local_64 + 1;
            if (((uVar1 == 0xffffffff) ||
                (puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 == (undefined *)0xfffffffc)
                ) || (*(uint *)(puVar3 + 8) != uVar1 >> 0xc)) {
              iVar6 = _DAT_00000030;
              if (_DAT_00000030 == 0) goto LAB_004abf08;
LAB_004abcde:
              iVar6 = iVar6 - *(int *)(gpGlobals + 0x58) >> 4;
            }
            else {
              iVar6 = *(int *)(*(int *)(puVar3 + 4) + 0x30);
              if (iVar6 != 0) goto LAB_004abcde;
LAB_004abf08:
              iVar6 = 0;
            }
            pCVar9 = (CBaseEntity *)0x0;
            *(int *)(peVar7 + 0xc) = iVar6;
            if (((uVar1 != 0xffffffff) &&
                (puVar5 = puVar5 + (uVar1 & 0xfff) * 0x10, puVar5 != (undefined *)0xfffffffc)) &&
               (*(uint *)(puVar5 + 8) == uVar1 >> 0xc)) {
              pCVar9 = *(CBaseEntity **)(puVar5 + 4);
            }
            AddRestoredEntity(pCVar9);
          }
        }
        CGlobalEntityList::CleanupDeleteList();
      }
      local_5c = local_5c + 1;
      iVar6 = local_4c;
    } while (local_5c < *(int *)(param_1 + 0x574));
    while (local_5c = iVar6 + -1, -1 < local_5c) {
      while( true ) {
        piVar2 = mdlcache;
        iVar8 = *(int *)(local_58 + local_5c * 4) * 0x38 + *(int *)(param_1 + 0x578);
        uVar1 = *(uint *)(iVar8 + 0x10);
        iVar6 = local_5c;
        if ((((uVar1 == 0xffffffff) ||
             (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar5 == (undefined *)0xfffffffc))
            || (*(uint *)(puVar5 + 8) != uVar1 >> 0xc)) ||
           (pCVar9 = *(CBaseEntity **)(puVar5 + 4), pCVar9 == (CBaseEntity *)0x0)) break;
                    /* try { // try from 004abf9c to 004abf9e has its CatchHandler @ 004ac0d0 */
        (**(code **)(*mdlcache + 0x68))(mdlcache);
                    /* try { // try from 004abfb0 to 004abff8 has its CatchHandler @ 004ac09d */
        if ((*(int *)(iVar8 + 0x1c) < 0) || (iVar6 = UTIL_EntityInSolid(pCVar9), iVar6 == 0)) {
          *(undefined4 *)(iVar8 + 0x1c) = 0x40000000;
          if (*(int *)(pCVar9 + 0x30) == 0) {
            iVar6 = 0;
          }
          else {
            iVar6 = *(int *)(pCVar9 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
          }
          *(int *)(iVar8 + 0xc) = iVar6;
                    /* try { // try from 004ac066 to 004ac06a has its CatchHandler @ 004ac09d */
          AddRestoredEntity(pCVar9);
          local_64 = local_64 + 1;
        }
        else {
          puVar4 = *(undefined1 **)(iVar8 + 0x20);
          if (puVar4 == (undefined1 *)0x0) {
            puVar4 = &DAT_00d539c2;
          }
          DevMsg(2,"Suppressing %s\n",puVar4);
          UTIL_RemoveImmediate(pCVar9);
          CGlobalEntityList::CleanupDeleteList();
        }
        (**(code **)(*piVar2 + 0x6c))(piVar2);
        local_5c = local_5c + -1;
        if (local_5c < 0) goto LAB_004ac012;
      }
    }
  }
LAB_004ac012:
  local_6c = (CUtlMemory<int,int> *)&local_58;
  local_4c = 0;
  CUtlMemory<int,int>::Purge(local_6c);
  local_48 = local_58;
  CUtlMemory<int,int>::Purge(local_6c);
  return local_64;
}

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)