L L4D2node

CPistol::PrimaryAttack

0x005554c0 · 258 bytes · __thiscall

_ZN7CPistol13PrimaryAttackEv

Decompiled

undefined (1 param)

/* CPistol::PrimaryAttack() */

void __thiscall CPistol::PrimaryAttack(CPistol *this)

{
  CBaseEdict *this_00;
  char cVar1;
  int iVar2;
  int iVar3;
  CStudioHdr *pCVar4;
  CStudioHdr *pCVar5;
  longdouble lVar6;
  float fVar7;
  
  CTerrorGun::PrimaryAttack((CTerrorGun *)this);
  cVar1 = (**(code **)(*(int *)this + 0x674))(this);
  if (cVar1 == '\0') {
    return;
  }
  if (*(int *)(this + 0x1420) != 1) {
    return;
  }
  pCVar5 = *(CStudioHdr **)(this + 0x13e0);
  iVar2 = *(int *)(this + 0x494);
  fVar7 = *(float *)(gpGlobals + 0xc);
  if (pCVar5 == (CStudioHdr *)0x0) {
    iVar3 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar3 == 0) {
      pCVar5 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      pCVar5 = *(CStudioHdr **)(this + 0x13e0);
    }
    if (pCVar5 == (CStudioHdr *)0x0) {
      pCVar4 = (CStudioHdr *)0x0;
      goto LAB_00555523;
    }
  }
  pCVar4 = (CStudioHdr *)0x0;
  if (*(int *)pCVar5 != 0) {
    pCVar4 = pCVar5;
  }
LAB_00555523:
  lVar6 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar4,iVar2);
  fVar7 = fVar7 + -0.35 + (float)lVar6;
  if (fVar7 == *(float *)(this + 0x142c)) {
    return;
  }
  if (this[0x6c] == (CPistol)0x0) {
    this_00 = *(CBaseEdict **)(this + 0x30);
    if (this_00 != (CBaseEdict *)0x0) {
      *(uint *)this_00 = *(uint *)this_00 | 0x101;
      iVar2 = CBaseEdict::GetChangeAccessor(this_00);
      *(undefined2 *)(iVar2 + 2) = 0;
    }
  }
  else {
    this[0x70] = (CPistol)((byte)this[0x70] | 1);
  }
  *(float *)(this + 0x142c) = fVar7;
  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)