L L4D2node

CSpitAbility::ActivateAbility

0x004dc920 · 649 bytes · __thiscall

_ZN12CSpitAbility15ActivateAbilityEv

Decompiled

undefined (1 param)

/* CSpitAbility::ActivateAbility() */

void __thiscall CSpitAbility::ActivateAbility(CSpitAbility *this)

{
  float fVar1;
  uint uVar2;
  CBaseCombatCharacter *this_00;
  CBaseEdict *this_01;
  code *pcVar3;
  char cVar4;
  QAngle *pQVar5;
  int iVar6;
  int *piVar7;
  undefined4 uVar8;
  undefined1 *puVar9;
  undefined *puVar10;
  longdouble lVar11;
  Vector local_28 [24];
  
  uVar2 = *(uint *)(this + 0x44c);
  if ((((uVar2 != 0xffffffff) &&
       (puVar10 = g_pEntityList + (uVar2 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar10 + 8) == uVar2 >> 0xc)) &&
     (this_00 = *(CBaseCombatCharacter **)(puVar10 + 4), this_00 != (CBaseCombatCharacter *)0x0)) {
    cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
    if (cVar4 != '\0') {
      pQVar5 = (QAngle *)(**(code **)(*(int *)this_00 + 0x238))(this_00);
      AngleVectors(pQVar5,local_28,(Vector *)0x0,(Vector *)0x0);
      if (this[0x45d] != (CSpitAbility)0x1) {
        if (this[0x6c] == (CSpitAbility)0x0) {
          this_01 = *(CBaseEdict **)(this + 0x30);
          if (this_01 != (CBaseEdict *)0x0) {
            *(uint *)this_01 = *(uint *)this_01 | 0x101;
            iVar6 = CBaseEdict::GetChangeAccessor(this_01);
            *(undefined2 *)(iVar6 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CSpitAbility)((byte)this[0x70] | 1);
        }
        this[0x45d] = (CSpitAbility)0x1;
      }
      piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"ability_use",0,0);
      if (piVar7 != (int *)0x0) {
        pcVar3 = *(code **)(*piVar7 + 0x30);
        uVar8 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
        (*pcVar3)(piVar7,"userid",uVar8);
        puVar9 = &DAT_00d539c2;
        if (*(undefined1 **)(this + 0x7c) != (undefined1 *)0x0) {
          puVar9 = *(undefined1 **)(this + 0x7c);
        }
        (**(code **)(*piVar7 + 0x3c))(piVar7,"ability",puVar9);
        (**(code **)(*piVar7 + 0x30))(piVar7,"context",0);
        (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
      }
      piVar7 = (int *)CBaseCombatCharacter::GetActiveWeapon(this_00);
      if (piVar7 != (int *)0x0) {
        (**(code **)(*piVar7 + 0x3f0))(piVar7,0x1f6);
      }
      CBaseAbility::StartActivationTimer((CBaseAbility *)this,3600.0,0.0);
      fVar1 = *(float *)(z_spit_latency._28_4_ + 0x2c);
      lVar11 = (longdouble)CountdownTimer::Now();
      if ((float)lVar11 + fVar1 != *(float *)(this + 0x468)) {
        (**(code **)(*(int *)(this + 0x460) + 4))(this + 0x460,this + 0x468);
        *(float *)(this + 0x468) = (float)lVar11 + fVar1;
      }
      if (fVar1 != *(float *)(this + 0x464)) {
        (**(code **)(*(int *)(this + 0x460) + 4))(this + 0x460,this + 0x464);
        *(float *)(this + 0x464) = fVar1;
      }
      CBaseAbility::ActivateAbility((CBaseAbility *)this);
      (**(code **)(*(int *)this_00 + 0x7fc))(this_00,0x46,0);
      CTerrorPlayer::Vocalize((CTerrorPlayer *)this_00,"SpitterZombie.Spit",0.0,0.0);
      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)