L L4D2node

hammer_update_safe_entities

0x00b5f9c0 · 601 bytes · __cdecl

_ZL27hammer_update_safe_entitiesRK8CCommand

Decompiled

undefined (1 param)

/* hammer_update_safe_entities(CCommand const&) */

void hammer_update_safe_entities(CCommand *param_1)

{
  int *piVar1;
  code *pcVar2;
  char cVar3;
  undefined1 uVar4;
  CBaseEntity *pCVar5;
  uint uVar6;
  undefined *puVar7;
  int iVar8;
  CBaseEntity *pCVar9;
  char *pcVar10;
  pointer_____offset_0x8___ *ppuVar11;
  int local_70;
  char local_6c [22];
  short local_56;
  CUtlSymbolTable local_54 [18];
  short local_42;
  
  cVar3 = UTIL_IsCommandIssuedByServerAdmin();
  if (cVar3 != '\0') {
    pCVar9 = (CBaseEntity *)0x0;
    Msg("\n====================================================\nPerforming Safe Entity Update\n");
    CUtlSymbolTable::CUtlSymbolTable(local_54,0x10,0x20,true);
    while( true ) {
      pcVar10 = "hammer_updateignorelist";
                    /* try { // try from 00b5fa23 to 00b5fc0b has its CatchHandler @ 00b5fc15 */
      pCVar9 = (CBaseEntity *)
               CGlobalEntityList::FindEntityByClassname
                         ((CGlobalEntityList *)gEntList,pCVar9,"hammer_updateignorelist");
      if (pCVar9 == (CBaseEntity *)0x0) break;
      iVar8 = 0;
      do {
        if (*(int *)(pCVar9 + iVar8 * 4 + 0x440) != 0) {
          CUtlSymbolTable::AddString(local_6c);
        }
        iVar8 = iVar8 + 1;
      } while (iVar8 != 0x10);
    }
    ppuVar11 = (pointer_____offset_0x8___ *)pcVar10;
    if (local_42 != 0) {
      Msg("Ignoring %d specified targetnames.\n",local_42);
      ppuVar11 = (pointer_____offset_0x8___ *)pcVar10;
    }
    pCVar9 = (CBaseEntity *)0x0;
    pCVar5 = (CBaseEntity *)
             CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0);
    if (pCVar5 == (CBaseEntity *)0x0) {
      local_70 = 0;
    }
    else {
      local_70 = 0;
      do {
        uVar6 = (**(code **)(*(int *)pCVar5 + 0xa4))(pCVar5,pCVar9,ppuVar11);
        if (((((uVar6 & 0x40000000) != 0) &&
             ((((uVar6 = *(uint *)(pCVar5 + 0x188), uVar6 == 0xffffffff ||
                (puVar7 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)
                ) || (*(uint *)(puVar7 + 8) != uVar6 >> 0xc)) || (*(int *)(puVar7 + 4) == 0)))) &&
            ((((uVar6 = *(uint *)(pCVar5 + 0x18c), uVar6 == 0xffffffff ||
               (puVar7 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc))
              || (*(uint *)(puVar7 + 8) != uVar6 >> 0xc)) || (*(int *)(puVar7 + 4) == 0)))) &&
           (piVar1 = *(int **)(pCVar5 + 0x238), piVar1 != (int *)0x0)) {
          pcVar2 = *(code **)(*piVar1 + 0x30);
          uVar4 = Ragdoll_IsPropRagdoll(pCVar5);
          cVar3 = (*pcVar2)(piVar1,uVar4);
          if ((cVar3 == '\0') && (cVar3 = (**(code **)(*piVar1 + 0x2c))(piVar1), cVar3 != '\0')) {
            ppuVar11 = &CPhysBox::typeinfo;
            iVar8 = __dynamic_cast(pCVar5,&CBaseEntity::typeinfo,&CPhysBox::typeinfo,0);
            if (iVar8 == 0) {
              ppuVar11 = *(pointer_____offset_0x8___ **)(pCVar5 + 0x154);
              if (ppuVar11 == (pointer_____offset_0x8___ *)0x0) {
                ppuVar11 = (pointer_____offset_0x8___ *)&DAT_00d539c2;
              }
              CUtlSymbolTable::Find((char *)&local_56);
              if (local_56 == -1) {
                NWCEdit::UpdateEntityPosition(pCVar5);
                local_70 = local_70 + 1;
              }
            }
          }
        }
        pCVar9 = pCVar5;
        pCVar5 = (CBaseEntity *)CGlobalEntityList::NextEnt((CGlobalEntityList *)gEntList,pCVar5);
      } while (pCVar5 != (CBaseEntity *)0x0);
    }
    Msg("Updated %d entities.\n",local_70);
    CUtlSymbolTable::~CUtlSymbolTable(local_54);
    return;
  }
  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)