L L4D2node

CThrow::ActivateAbility

0x004e1620 · 1065 bytes · __thiscall

_ZN6CThrow15ActivateAbilityEv

Decompiled

undefined (1 param)

/* CThrow::ActivateAbility() */

void __thiscall CThrow::ActivateAbility(CThrow *this)

{
  uint uVar1;
  CBaseEntity *this_00;
  code *pcVar2;
  char cVar3;
  int iVar4;
  int *piVar5;
  undefined4 uVar6;
  undefined1 *puVar7;
  undefined *puVar8;
  longdouble lVar9;
  
  uVar1 = *(uint *)(this + 0x44c);
  if ((((uVar1 == 0xffffffff) ||
       (puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar8 + 8) != uVar1 >> 0xc)) ||
     (this_00 = *(CBaseEntity **)(puVar8 + 4), this_00 == (CBaseEntity *)0x0)) {
    return;
  }
  cVar3 = (**(code **)(*(int *)this + 0x32c))(this);
  if ((cVar3 == '\0') || (iVar4 = CBaseEntity::GetGroundEntity(this_00), iVar4 == 0)) {
    CBaseEntity::EmitSound(this_00,"HulkZombie.Throw.Fail",0.0,(float *)0x0);
    return;
  }
  cVar3 = (**(code **)(*(int *)this_00 + 0x840))(this_00);
  if (cVar3 != '\0') {
    lVar9 = (longdouble)CountdownTimer::Now();
    if ((float)lVar9 + 0.7 != *(float *)(this + 0x474)) {
      (**(code **)(*(int *)(this + 0x46c) + 4))(this + 0x46c,this + 0x474);
      *(float *)(this + 0x474) = (float)lVar9 + 0.7;
    }
    if (*(float *)(this + 0x470) != 0.7) {
      (**(code **)(*(int *)(this + 0x46c) + 4))(this + 0x46c,this + 0x470);
      *(undefined4 *)(this + 0x470) = 0x3f333333;
    }
    lVar9 = (longdouble)CountdownTimer::Now();
    if ((float)lVar9 + 1.0 != *(float *)(this + 0x484)) {
      (**(code **)(*(int *)(this + 0x47c) + 4))(this + 0x47c,this + 0x484);
      *(float *)(this + 0x484) = (float)lVar9 + 1.0;
    }
    if (*(float *)(this + 0x480) != 1.0) {
      (**(code **)(*(int *)(this + 0x47c) + 4))(this + 0x47c,this + 0x480);
      *(undefined4 *)(this + 0x480) = 0x3f800000;
    }
    lVar9 = (longdouble)CountdownTimer::Now();
    if ((float)lVar9 + 1.0 != *(float *)(this + 0x490)) {
      (**(code **)(*(int *)(this + 0x488) + 4))(this + 0x488,this + 0x490);
      *(float *)(this + 0x490) = (float)lVar9 + 1.0;
    }
    if (*(float *)(this + 0x48c) != 1.0) {
      (**(code **)(*(int *)(this + 0x488) + 4))(this + 0x488,this + 0x48c);
      *(undefined4 *)(this + 0x48c) = 0x3f800000;
    }
    uVar1 = *(uint *)(this + 0x494);
    if (((uVar1 != 0xffffffff) &&
        (puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
       ((*(uint *)(puVar8 + 8) == uVar1 >> 0xc &&
        (*(CBaseEntity **)(puVar8 + 4) != (CBaseEntity *)0x0)))) {
      UTIL_Remove(*(CBaseEntity **)(puVar8 + 4));
      *(undefined4 *)(this + 0x494) = 0xffffffff;
    }
    pcVar2 = *(code **)(*(int *)this_00 + 0x7fc);
    iVar4 = RandomInt(1,100);
    (*pcVar2)(this_00,0x5d,iVar4 <= *(int *)(TankRockOverHeadPercent._28_4_ + 0x30));
    uVar6 = ZombieHulkThrowInterval._28_4_;
    this[0x478] = (CThrow)0x1;
    CBaseAbility::StartActivationTimer((CBaseAbility *)this,*(float *)(uVar6 + 0x2c) + 1.0,0.0);
    CBaseEntity::EmitSound(this_00,"HulkZombie.Throw.Pickup",0.0,(float *)0x0);
    piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"ability_use",0,0);
    if (piVar5 != (int *)0x0) {
      pcVar2 = *(code **)(*piVar5 + 0x30);
      uVar6 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
      (*pcVar2)(piVar5,"userid",uVar6);
      puVar7 = &DAT_00d539c2;
      if (*(undefined1 **)(this + 0x7c) != (undefined1 *)0x0) {
        puVar7 = *(undefined1 **)(this + 0x7c);
      }
      (**(code **)(*piVar5 + 0x3c))(piVar5,"ability",puVar7);
      (**(code **)(*piVar5 + 0x30))(piVar5,"context",0);
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar5,0);
    }
    CBaseAbility::ActivateAbility((CBaseAbility *)this);
    return;
  }
  CBaseEntity::EmitSound(this_00,"HulkZombie.Throw.Fail",0.0,(float *)0x0);
  if (*(float *)(ZombieHulkThrowFailInterval._28_4_ + 0x2c) <= 0.0) {
    return;
  }
  CBaseAbility::StartActivationTimer
            ((CBaseAbility *)this,*(float *)(ZombieHulkThrowFailInterval._28_4_ + 0x2c),0.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)