L L4D2node

CLunge::ActivateAbility

0x004da2e0 · 1828 bytes · __thiscall

_ZN6CLunge15ActivateAbilityEv

Decompiled

undefined (1 param)

/* CLunge::ActivateAbility() */

void __thiscall CLunge::ActivateAbility(CLunge *this)

{
  CBaseEntity CVar1;
  uint uVar2;
  CBaseEdict *pCVar3;
  code *pcVar4;
  code *pcVar5;
  undefined1 *puVar6;
  uint *puVar7;
  float fVar8;
  char cVar9;
  int iVar10;
  int *piVar11;
  undefined4 uVar12;
  undefined1 *puVar13;
  undefined *puVar14;
  undefined4 *puVar15;
  CBaseEntity *this_00;
  longdouble lVar16;
  float fVar17;
  float fVar18;
  float fVar19;
  CLunge *in_stack_ffffff24;
  CBaseEntity *pCVar20;
  float local_ac;
  float local_a8;
  float local_a4;
  float local_a0;
  float local_9c;
  float local_98;
  Vector local_94 [12];
  float local_88;
  float local_84;
  float local_80;
  float local_7c;
  float local_78;
  float local_74;
  float local_70;
  float local_6c;
  float local_68;
  float local_5c;
  float local_44;
  
  puVar15 = (undefined4 *)&stack0xffffff24;
  if (((this[0x47d] == (CLunge)0x0) && (cVar9 = CanLungeAgain(in_stack_ffffff24), cVar9 != '\0')) ||
     (cVar9 = (**(code **)(*(int *)this + 0x32c))(), cVar9 != '\0')) {
    uVar2 = *(uint *)(this + 0x44c);
    this_00 = (CBaseEntity *)0x0;
    if (((uVar2 != 0xffffffff) &&
        (puVar14 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar14 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar14 + 8) == uVar2 >> 0xc)) {
      this_00 = *(CBaseEntity **)(puVar14 + 4);
    }
    cVar9 = (**(code **)(*(int *)this_00 + 0x6f8))();
    if (cVar9 == '\0') {
      pCVar20 = this_00 + 0x32d4;
      lVar16 = (longdouble)CountdownTimer::Now();
      if ((*(float *)(this_00 + 0x32dc) <= (float)lVar16) &&
         (((this[0x47d] == (CLunge)0x0 && (cVar9 = CanLungeAgain((CLunge *)pCVar20), cVar9 != '\0'))
          || ((iVar10 = CBaseEntity::GetGroundEntity(this_00), iVar10 != 0 ||
              (this_00[0x186] == (CBaseEntity)0x9)))))) {
        pCVar20 = this_00;
        CBasePlayer::EyeVectors
                  ((CBasePlayer *)this_00,(Vector *)&local_ac,(Vector *)0x0,(Vector *)0x0);
        local_a0 = local_ac;
        local_9c = local_a8;
        local_98 = local_a4;
        if ((this[0x47d] == (CLunge)0x0) &&
           (cVar9 = CanLungeAgain((CLunge *)pCVar20), local_a4 = local_98, local_a8 = local_9c,
           local_ac = local_a0, cVar9 != '\0')) {
          fVar17 = *(float *)(this_00 + 0x2324) * local_9c + *(float *)(this_00 + 0x2320) * local_a0
                   + *(float *)(this_00 + 9000) * local_98;
          if (*(int *)(ZombieLungeReflect._28_4_ + 0x30) == 0) {
            if (fVar17 < 0.2) {
              return;
            }
          }
          else if (fVar17 < 0.0) {
            CBaseEntity::PhysicsClipVelocity
                      ((CBaseEntity *)this,(Vector *)&local_a0,(Vector *)(this_00 + 0x2320),
                       (Vector *)&local_70,2.0);
            local_a4 = local_68;
            local_a8 = local_6c;
            local_ac = local_70;
          }
        }
        local_98 = *(float *)(ZombieLungePower._28_4_ + 0x2c);
        local_a0 = local_ac * local_98;
        local_9c = local_a8 * local_98;
        local_98 = local_a4 * local_98;
        CTerrorPlayer::OnLungeStart((CTerrorPlayer *)this_00);
        if (this[0x47c] != (CLunge)0x1) {
          if (this[0x6c] == (CLunge)0x0) {
            pCVar3 = *(CBaseEdict **)(this + 0x30);
            if (pCVar3 != (CBaseEdict *)0x0) {
              *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
              iVar10 = CBaseEdict::GetChangeAccessor(pCVar3);
              *(undefined2 *)(iVar10 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CLunge)((byte)this[0x70] | 1);
          }
          this[0x47c] = (CLunge)0x1;
        }
        fVar17 = *(float *)(gpGlobals + 0xc);
        if (fVar17 != *(float *)(this + 0x46c)) {
          if (this[0x6c] == (CLunge)0x0) {
            pCVar3 = *(CBaseEdict **)(this + 0x30);
            if (pCVar3 != (CBaseEdict *)0x0) {
              *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
              iVar10 = CBaseEdict::GetChangeAccessor(pCVar3);
              *(undefined2 *)(iVar10 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CLunge)((byte)this[0x70] | 1);
          }
          *(float *)(this + 0x46c) = fVar17;
        }
        if (*(float *)(this + 0x468) != -1.0) {
          (**(code **)(*(int *)(this + 0x460) + 4))();
          *(undefined4 *)(this + 0x468) = 0xbf800000;
        }
        iVar10 = CBaseEntity::GetGroundEntity(this_00);
        if (iVar10 != 0) {
          lVar16 = (longdouble)VectorNormalize((Vector *)&local_a0);
          fVar8 = local_98;
          fVar17 = (float)lVar16;
          puVar15 = (undefined4 *)&stack0xffffff24;
          if ((local_98 < 0.0) && (puVar15 = (undefined4 *)&stack0xffffff24, -0.7 < local_98)) {
            fVar18 = local_a0 * 5000.0;
            fVar19 = local_9c * 5000.0;
            (**(code **)(*(int *)this_00 + 0x234))();
            local_7c = fVar18 + local_88;
            local_78 = fVar19 + local_84;
            local_74 = fVar8 * 5000.0 + local_80;
            (**(code **)(*(int *)this_00 + 0x234))();
            UTIL_TraceLine(local_94,(Vector *)&local_7c,0x202420b,(IHandleEntity *)this_00,0,
                           (CGameTrace *)&local_70);
            puVar15 = (undefined4 *)&stack0xffffff1c;
            if ((0.0 < local_44) && (puVar15 = (undefined4 *)&stack0xffffff1c, local_44 < 1.0)) {
              if (((byte)this_00[0x14d] & 8) != 0) {
                CBaseEntity::CalcAbsolutePosition(this_00);
              }
              local_98 = (float)((uint)local_98 &
                                -(uint)(local_5c < *(float *)(this_00 + 0x2e8) - 20.0));
              puVar15 = (undefined4 *)&stack0xffffff1c;
            }
          }
          local_a0 = local_a0 * fVar17;
          local_9c = local_9c * fVar17;
          local_98 = fVar17 * local_98;
          if (this_00[0x3e78] != (CBaseEntity)0x0) {
            *puVar15 = this_00;
            puVar15[-1] = 0x4da85b;
            piVar11 = (int *)CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)*puVar15)
            ;
            if (piVar11 != (int *)0x0) {
              iVar10 = *piVar11;
              puVar15[1] = 0x1f8;
              *puVar15 = piVar11;
              pcVar4 = *(code **)(iVar10 + 0x3f0);
              puVar15[-1] = 0x4da876;
              (*pcVar4)();
            }
          }
        }
        puVar15[2] = 0;
        uVar12 = *(undefined4 *)(ZombieLungeInterval._28_4_ + 0x2c);
        *puVar15 = this;
        puVar15[1] = uVar12;
        puVar15[-1] = 0x4da545;
        CBaseAbility::StartActivationTimer
                  ((CBaseAbility *)*puVar15,(float)puVar15[1],(float)puVar15[2]);
        fVar18 = local_98;
        fVar8 = local_9c;
        fVar17 = local_a0;
        if (((local_a0 != *(float *)(this + 0x470)) || (local_9c != *(float *)(this + 0x474))) ||
           (local_98 != *(float *)(this + 0x478))) {
          if (this[0x6c] == (CLunge)0x0) {
            puVar7 = *(uint **)(this + 0x30);
            if (puVar7 != (uint *)0x0) {
              *puVar7 = *puVar7 | 0x101;
              *puVar15 = puVar7;
              puVar15[-1] = 0x4da6d8;
              iVar10 = CBaseEdict::GetChangeAccessor((CBaseEdict *)*puVar15);
              *(undefined2 *)(iVar10 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CLunge)((byte)this[0x70] | 1);
          }
          *(float *)(this + 0x470) = fVar17;
          *(float *)(this + 0x474) = fVar8;
          *(float *)(this + 0x478) = fVar18;
        }
        piVar11 = gameeventmanager;
        this[0x48c] = (CLunge)0x0;
        this[0x48d] = (CLunge)0x0;
        this[0x47d] = (CLunge)0x0;
        iVar10 = *piVar11;
        puVar15[3] = 0;
        puVar15[2] = 0;
        puVar15[1] = "ability_use";
        *puVar15 = piVar11;
        pcVar4 = *(code **)(iVar10 + 0x1c);
        puVar15[-1] = 0x4da5be;
        piVar11 = (int *)(*pcVar4)();
        if (piVar11 != (int *)0x0) {
          pcVar4 = *(code **)(*piVar11 + 0x30);
          uVar12 = *(undefined4 *)(this_00 + 0x30);
          iVar10 = *engine;
          *puVar15 = engine;
          puVar15[1] = uVar12;
          pcVar5 = *(code **)(iVar10 + 0x40);
          puVar15[-1] = 0x4da5e7;
          uVar12 = (*pcVar5)();
          *puVar15 = piVar11;
          puVar15[2] = uVar12;
          puVar15[1] = "userid";
          puVar15[-1] = 0x4da5fe;
          (*pcVar4)();
          puVar6 = *(undefined1 **)(this + 0x7c);
          pcVar4 = *(code **)(*piVar11 + 0x3c);
          puVar15[1] = "ability";
          puVar13 = &DAT_00d539c2;
          if (puVar6 != (undefined1 *)0x0) {
            puVar13 = puVar6;
          }
          *puVar15 = piVar11;
          puVar15[2] = puVar13;
          puVar15[-1] = 0x4da621;
          (*pcVar4)();
          CVar1 = this_00[0x3e78];
          iVar10 = *piVar11;
          puVar15[1] = "context";
          *puVar15 = piVar11;
          puVar15[2] = (uint)(byte)CVar1;
          pcVar4 = *(code **)(iVar10 + 0x30);
          puVar15[-1] = 0x4da63c;
          (*pcVar4)();
          iVar10 = *gameeventmanager;
          puVar15[2] = 0;
          puVar15[1] = piVar11;
          *puVar15 = gameeventmanager;
          pcVar4 = *(code **)(iVar10 + 0x20);
          puVar15[-1] = 0x4da655;
          (*pcVar4)();
        }
        *puVar15 = this;
        puVar15[-1] = 0x4da65d;
        CBaseAbility::ActivateAbility((CBaseAbility *)*puVar15);
      }
    }
  }
  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)