L L4D2node

Infected::TryToCull

0x00a129d0 · 758 bytes · __thiscall

_ZN8Infected9TryToCullEv

Decompiled

undefined (1 param)

/* Infected::TryToCull() */

undefined4 __thiscall Infected::TryToCull(Infected *this)

{
  char cVar1;
  int iVar2;
  int *piVar3;
  TerrorNavArea *pTVar4;
  undefined4 uVar5;
  longdouble lVar6;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  undefined1 local_1c;
  int local_18;
  float local_14;
  undefined4 local_10;
  
  if ((*(int *)(ZombieNoCull._28_4_ + 0x30) != 0) || (((byte)this[0x14c] & 1) != 0)) {
    return 0;
  }
  iVar2 = (**(code **)(*(int *)this + 0x52c))(this);
  if ((iVar2 != 0) &&
     ((cVar1 = CDirector::IsBackgroundMap(), cVar1 == '\0' && (((byte)this[0x1c74] & 0x80) == 0))))
  {
    piVar3 = (int *)(**(code **)(*(int *)this + 0x594))(this);
    cVar1 = (**(code **)(*piVar3 + 0x114))(piVar3,2);
    if (cVar1 == '\0') {
      if (((byte)this[0x1c74] & 1) != 0) {
        return 0;
      }
      cVar1 = CDirector::AreWanderersAllowed(TheDirector);
      if ((cVar1 == '\0') &&
         (cVar1 = CDirectorTacticalServices::IsVisibleToTeam
                            (*(CDirectorTacticalServices **)(TheDirector + 0x628),
                             (CBaseEntity *)this,2,0,0.0,(TerrorNavArea *)0x0), cVar1 == '\0')) {
        UTIL_Remove((CBaseEntity *)this);
        return 1;
      }
      lVar6 = (longdouble)(**(code **)(*(int *)this + 0x4a0))(this);
      if ((float)lVar6 < 2.0) {
        return 0;
      }
    }
    else {
      lVar6 = (longdouble)(**(code **)(*(int *)this + 0x4a0))(this);
      if ((float)lVar6 < 30.0) {
        return 0;
      }
    }
    if (*(char *)(iVar2 + 0x7d) == '\0') {
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      local_2c = *(undefined4 *)(this + 0x2e0);
      local_1c = 1;
      local_20 = 2;
      local_28 = *(undefined4 *)(this + 0x2e4);
      local_18 = 0;
      local_24 = *(undefined4 *)(this + 0x2e8);
      local_14 = 1e+09;
      local_10 = 0;
      ForEachPlayer<ClosestPlayerScan>((ClosestPlayerScan *)&local_2c);
      if ((local_18 != 0) &&
         ((lVar6 = (longdouble)
                   CDirector::GetScriptValue
                             (TheDirector,"ZombieDiscardRange",
                              *(float *)(DirectorPrivate_DirectorZombieDiscardRange._28_4_ + 0x2c)),
          (float)lVar6 * (float)lVar6 <= local_14 ||
          (((*(float *)(this + 0x1cb0) <= 0.0 ||
            (lVar6 = (longdouble)IntervalTimer::Now(),
            3.0 <= (float)lVar6 - *(float *)(this + 0x1cb0))) &&
           ((*(float *)(this + 0x1cb8) <= 0.0 ||
            (lVar6 = (longdouble)IntervalTimer::Now(),
            1.0 <= (float)lVar6 - *(float *)(this + 0x1cb8))))))))) {
        pTVar4 = (TerrorNavArea *)(**(code **)(*(int *)this + 0x52c))(this);
        cVar1 = CDirectorTacticalServices::IsVisibleToTeam
                          (*(CDirectorTacticalServices **)(TheDirector + 0x628),(CBaseEntity *)this,
                           2,0,0.0,pTVar4);
        if (cVar1 == '\0') {
          *(int *)(iVar2 + 0x128) = *(int *)(iVar2 + 0x128) + 1;
          uVar5 = 0;
          if (-1 < *(int *)(iVar2 + 0x128)) {
            uVar5 = *(undefined4 *)(iVar2 + 0x128);
          }
          *(undefined4 *)(iVar2 + 0x128) = uVar5;
          UTIL_Remove((CBaseEntity *)this);
          return 1;
        }
      }
    }
  }
  return 0;
}

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)