L L4D2node

CAmbientGeneric::Activate

0x005dd110 · 590 bytes · __thiscall

_ZN15CAmbientGeneric8ActivateEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CAmbientGeneric::Activate() */

void __thiscall CAmbientGeneric::Activate(CAmbientGeneric *this)

{
  char cVar1;
  undefined *puVar2;
  int *piVar3;
  uint *puVar4;
  undefined4 *puVar5;
  int iVar6;
  undefined4 uVar7;
  uint uVar8;
  uint local_20;
  
  CBaseEntity::Activate((CBaseEntity *)this);
  local_20 = *(uint *)(this + 0x4bc);
  if ((((local_20 != 0xffffffff) &&
       (puVar2 = g_pEntityList + (local_20 & 0xfff) * 0x10, puVar2 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar2 + 8) == local_20 >> 0xc)) && (*(int *)(puVar2 + 4) != 0)) goto LAB_005dd23b;
  if (*(char **)(this + 0x4b8) == (char *)0x0) {
    puVar2 = g_pEntityList;
    if (local_20 != 0xffffffff) {
LAB_005dd334:
      piVar3 = (int *)(puVar2 + (local_20 & 0xfff) * 0x10 + 4);
      if (piVar3 != (int *)0x0) {
LAB_005dd1e4:
        if ((piVar3[1] == local_20 >> 0xc) && (*piVar3 != 0)) {
          if (((byte)this[0x148] & 1) == 0) {
            *(uint *)(this + 0x14c) = *(uint *)(this + 0x14c) | 0x80;
            CBaseEntity::DispatchUpdateTransmitState((CBaseEntity *)this);
          }
          goto LAB_005dd23b;
        }
      }
    }
  }
  else {
    piVar3 = (int *)CGlobalEntityList::FindEntityByName
                              ((CGlobalEntityList *)gEntList,(CBaseEntity *)0x0,
                               *(char **)(this + 0x4b8),(CBaseEntity *)0x0,(CBaseEntity *)0x0,
                               (CBaseEntity *)0x0,(IEntityFindFilter *)0x0);
    if (piVar3 == (int *)0x0) {
      *(undefined4 *)(this + 0x4bc) = 0xffffffff;
    }
    else {
      puVar4 = (uint *)(**(code **)(*piVar3 + 0xc))(piVar3);
      puVar2 = g_pEntityList;
      local_20 = *puVar4;
      *(uint *)(this + 0x4bc) = local_20;
      if (local_20 != 0xffffffff) {
        uVar8 = local_20 & 0xfff;
        piVar3 = (int *)(puVar2 + uVar8 * 0x10 + 4);
        if (piVar3 != (int *)0x0) {
          if ((*(uint *)(puVar2 + uVar8 * 0x10 + 8) == local_20 >> 0xc) &&
             (*(int *)(puVar2 + uVar8 * 0x10 + 4) != 0)) {
            iVar6 = *(int *)(*(int *)(puVar2 + uVar8 * 0x10 + 4) + 0x30);
            if (iVar6 == 0) {
              iVar6 = 0;
            }
            else {
              iVar6 = iVar6 - *(int *)(gpGlobals + 0x58) >> 4;
            }
            *(int *)(this + 0x4c0) = iVar6;
            goto LAB_005dd334;
          }
          goto LAB_005dd1e4;
        }
      }
    }
  }
  if (this == (CAmbientGeneric *)0x0) {
    _DAT_000004bc = 0xffffffff;
  }
  else {
    puVar5 = (undefined4 *)(**(code **)(*(int *)this + 0xc))(this);
    *(undefined4 *)(this + 0x4bc) = *puVar5;
  }
  if (*(int *)(this + 0x30) == 0) {
    iVar6 = 0;
  }
  else {
    iVar6 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
  }
  *(int *)(this + 0x4c0) = iVar6;
LAB_005dd23b:
  if (this[0x4b0] != (CAmbientGeneric)0x0) {
    if ((*(int *)(gpGlobals + 0x48) - 1U < 2) ||
       (cVar1 = (**(code **)(*g_pGameRules + 0x90))(g_pGameRules), cVar1 != '\0')) {
      uVar7 = 3;
    }
    else {
      uVar7 = 0xb;
    }
    if (0 < *(int *)(this + 0x498)) {
      (**(code **)(*(int *)this + 0x328))(this,uVar7);
    }
    CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.1,(char *)0x0);
  }
  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)