L L4D2node

CClaw::OnPrimaryAttack

0x00535280 · 458 bytes · __thiscall

_ZN5CClaw15OnPrimaryAttackEv

Decompiled

undefined (1 param)

/* CClaw::OnPrimaryAttack() */

void __thiscall CClaw::OnPrimaryAttack(CClaw *this)

{
  code *pcVar1;
  CTerrorPlayer *this_00;
  int *piVar2;
  undefined4 uVar3;
  undefined4 *puVar4;
  byte *pbVar5;
  int iVar6;
  byte *pbVar7;
  byte *pbVar8;
  bool bVar9;
  bool bVar10;
  byte bVar11;
  longdouble lVar12;
  Vector local_34 [8];
  float local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  bVar11 = 0;
  this_00 = (CTerrorPlayer *)CTerrorWeapon::GetPlayerOwner((CTerrorWeapon *)this);
  if (this_00 != (CTerrorPlayer *)0x0) {
    lVar12 = (longdouble)CTerrorPlayer::GetRunTopSpeed(this_00);
    if (10.0 <= (float)lVar12) {
      piVar2 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"weapon_fire",0,0);
      if (piVar2 != (int *)0x0) {
        pcVar1 = *(code **)(*piVar2 + 0x30);
        uVar3 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
        (*pcVar1)(piVar2,"userid",uVar3);
        pbVar5 = *(byte **)(this + 0x7c);
        bVar9 = false;
        if (pbVar5 == (byte *)0x0) {
          pbVar5 = &DAT_00d539c2;
        }
        else {
          iVar6 = 7;
          bVar10 = false;
          pbVar7 = pbVar5;
          pbVar8 = (byte *)"weapon_";
          do {
            if (iVar6 == 0) break;
            iVar6 = iVar6 + -1;
            bVar9 = *pbVar7 < *pbVar8;
            bVar10 = *pbVar7 == *pbVar8;
            pbVar7 = pbVar7 + (uint)bVar11 * -2 + 1;
            pbVar8 = pbVar8 + (uint)bVar11 * -2 + 1;
          } while (bVar10);
          if ((!bVar9 && !bVar10) == bVar9) {
            pbVar5 = pbVar5 + 7;
          }
        }
        (**(code **)(*piVar2 + 0x3c))(piVar2,"weapon",pbVar5);
        pcVar1 = *(code **)(*piVar2 + 0x30);
        uVar3 = (**(code **)(*(int *)this + 0x638))(this);
        (*pcVar1)(piVar2,"weaponid",uVar3);
        (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar2,0);
      }
      uVar3 = *(undefined4 *)(ClawRange._28_4_ + 0x2c);
      piVar2 = (int *)CBaseCombatWeapon::GetOwner((CBaseCombatWeapon *)this);
      puVar4 = (undefined4 *)(**(code **)(*piVar2 + 0x238))(piVar2);
      local_28 = *puVar4;
      local_24 = puVar4[1];
      local_20 = puVar4[2];
      AngleVectors((QAngle *)&local_28,local_34);
      if (local_2c < -0.95) {
        uVar3 = *(undefined4 *)(ClawRangeDown._28_4_ + 0x2c);
      }
      (**(code **)(*(int *)this + 0x6d4))
                (this,*(undefined4 *)(ClawSwingInterval._28_4_ + 0x2c),
                 *(undefined4 *)(ClawSwingDuration._28_4_ + 0x2c),uVar3);
      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)