L L4D2node

CTerrorPlayer::UpdateZombieClassState

0x009a23b0 · 1563 bytes · __thiscall

_ZN13CTerrorPlayer22UpdateZombieClassStateEv

Decompiled

undefined (1 param)

/* CTerrorPlayer::UpdateZombieClassState() */

void __thiscall CTerrorPlayer::UpdateZombieClassState(CTerrorPlayer *this)

{
  code *pcVar1;
  char cVar2;
  int iVar3;
  int *piVar4;
  undefined4 uVar5;
  CBaseEntity *pCVar6;
  longdouble lVar7;
  float local_28;
  float local_24;
  float local_20;
  
  iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
  if (iVar3 == 3) {
    if (0.0 < *(float *)(this + 0x3f8c)) {
      lVar7 = (longdouble)CountdownTimer::Now();
      if (*(float *)(this + 0x3f8c) <= (float)lVar7) {
        if (*(float *)(this + 0x3f8c) != -1.0) {
          (**(code **)(*(int *)(this + 0x3f84) + 4))(this + 0x3f84,this + 0x3f8c);
          *(undefined4 *)(this + 0x3f8c) = 0xbf800000;
        }
        iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
        if ((((iVar3 == 3) && (iVar3 = (**(code **)(*(int *)this + 0x544))(this), iVar3 == 8)) &&
            (cVar2 = (**(code **)(*(int *)this + 300))(this), cVar2 != '\0')) &&
           (piVar4 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                      (gameeventmanager,"spawned_as_tank",0,0), piVar4 != (int *)0x0
           )) {
          pcVar1 = *(code **)(*piVar4 + 0x30);
          uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
          (*pcVar1)(piVar4,"userid",uVar5);
          (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar4,0);
        }
      }
    }
    lVar7 = (longdouble)CountdownTimer::Now();
    if (((*(float *)(this + 0x2e94) <= (float)lVar7) &&
        (cVar2 = (**(code **)(*(int *)this + 300))(this), cVar2 != '\0')) &&
       (cVar2 = (**(code **)(*(int *)this + 0x558))(this), cVar2 == '\0')) {
      lVar7 = (longdouble)CountdownTimer::Now();
      if ((float)lVar7 + 0.25 != *(float *)(this + 0x2e94)) {
        (**(code **)(*(int *)(this + 0x2e8c) + 4))(this + 0x2e8c,this + 0x2e94);
        *(float *)(this + 0x2e94) = (float)lVar7 + 0.25;
      }
      if (*(float *)(this + 0x2e90) != 0.25) {
        (**(code **)(*(int *)(this + 0x2e8c) + 4))(this + 0x2e8c,this + 0x2e90);
        *(undefined4 *)(this + 0x2e90) = 0x3e800000;
      }
      iVar3 = *(int *)(this + 0x2e88);
      if (iVar3 == 1) {
        if (*(int *)(ZombieStateDebug._28_4_ + 0x30) != 0) {
          pcVar1 = *(code **)(*engine + 0xbc);
          uVar5 = (**(code **)(*(int *)this + 0xb8))(this);
          if (*(int *)(this + 0x30) == 0) {
            iVar3 = 0;
          }
          else {
            iVar3 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
          }
          (*pcVar1)(engine,iVar3 + 0xc,"Player %s, state Alert.",uVar5);
        }
        iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
        if (((iVar3 == 3) && (iVar3 = (**(code **)(*(int *)this + 0x544))(this), iVar3 == 2)) &&
           (pCVar6 = (CBaseEntity *)
                     CDirectorTacticalServices::GetClosestSurvivor
                               (*(CDirectorTacticalServices **)(TheDirector + 0x628),
                                (CBaseCombatCharacter *)this,true,true),
           pCVar6 != (CBaseEntity *)0x0)) {
          if (((byte)this[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
          }
          if (((byte)pCVar6[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(pCVar6);
          }
          local_28 = *(float *)(pCVar6 + 0x2e0) - *(float *)(this + 0x2e0);
          local_24 = *(float *)(pCVar6 + 0x2e4) - *(float *)(this + 0x2e4);
          local_20 = *(float *)(pCVar6 + 0x2e8) - *(float *)(this + 0x2e8);
          VectorNormalize((Vector *)&local_28);
          if (local_20 < -0.7071) {
            return;
          }
        }
        if ((0.0 < *(float *)(this + 0x3120)) &&
           (lVar7 = (longdouble)IntervalTimer::Now(),
           (float)lVar7 - *(float *)(this + 0x3120) <= 5.0)) {
          return;
        }
      }
      else {
        if (iVar3 != 2) {
          if (iVar3 != 0) {
            return;
          }
          if (*(int *)(ZombieStateDebug._28_4_ + 0x30) != 0) {
            pcVar1 = *(code **)(*engine + 0xbc);
            uVar5 = (**(code **)(*(int *)this + 0xb8))(this);
            if (*(int *)(this + 0x30) == 0) {
              iVar3 = 0;
            }
            else {
              iVar3 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
            }
            (*pcVar1)(engine,iVar3 + 0xc,"Player %s, state normal.",uVar5);
          }
          iVar3 = CBaseEntity::GetTeamNumber((CBaseEntity *)this);
          if (((iVar3 == 3) && (iVar3 = (**(code **)(*(int *)this + 0x544))(this), iVar3 == 2)) &&
             (pCVar6 = (CBaseEntity *)
                       CDirectorTacticalServices::GetClosestSurvivor
                                 (*(CDirectorTacticalServices **)(TheDirector + 0x628),
                                  (CBaseCombatCharacter *)this,true,true),
             pCVar6 != (CBaseEntity *)0x0)) {
            if (((byte)this[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
            }
            if (((byte)pCVar6[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition(pCVar6);
            }
            local_28 = *(float *)(pCVar6 + 0x2e0) - *(float *)(this + 0x2e0);
            local_24 = *(float *)(pCVar6 + 0x2e4) - *(float *)(this + 0x2e4);
            local_20 = *(float *)(pCVar6 + 0x2e8) - *(float *)(this + 0x2e8);
            VectorNormalize((Vector *)&local_28);
            if (local_20 < -0.7071) {
              SetClassState(this,1);
            }
          }
          if (*(float *)(this + 0x3120) <= 0.0) {
            return;
          }
          lVar7 = (longdouble)IntervalTimer::Now();
          if (1.0 <= (float)lVar7 - *(float *)(this + 0x3120)) {
            return;
          }
          SetClassState(this,1);
          return;
        }
        if (*(int *)(ZombieStateDebug._28_4_ + 0x30) != 0) {
          pcVar1 = *(code **)(*engine + 0xbc);
          uVar5 = (**(code **)(*(int *)this + 0xb8))(this);
          if (*(int *)(this + 0x30) == 0) {
            iVar3 = 0;
          }
          else {
            iVar3 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
          }
          (*pcVar1)(engine,iVar3 + 0xc,"Player %s, state ENGAGED.",uVar5);
        }
        if ((0.0 < *(float *)(this + 0x3120)) &&
           (lVar7 = (longdouble)IntervalTimer::Now(),
           (float)lVar7 - *(float *)(this + 0x3120) <= 25.0)) {
          return;
        }
      }
      SetClassState(this,0);
    }
  }
  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)