L L4D2node

CTerrorMeleeWeapon::StartMeleeSwing

0x0056b160 · 1252 bytes · __thiscall

_ZN18CTerrorMeleeWeapon15StartMeleeSwingEP13CTerrorPlayerb

Decompiled

undefined (3 params)

/* CTerrorMeleeWeapon::StartMeleeSwing(CTerrorPlayer*, bool) */

void __thiscall
CTerrorMeleeWeapon::StartMeleeSwing(CTerrorMeleeWeapon *this,CTerrorPlayer *param_1,bool param_2)

{
  code *pcVar1;
  CBaseEdict *pCVar2;
  CMeleeWeaponInfo *pCVar3;
  undefined4 uVar4;
  int iVar5;
  int iVar6;
  CStudioHdr *pCVar7;
  CStudioHdr *pCVar8;
  longdouble lVar9;
  float fVar10;
  float fVar11;
  
  pCVar3 = (CMeleeWeaponInfo *)
           CMeleeWeaponInfoStore::GetMeleeWeaponInfo
                     ((CMeleeWeaponInfoStore *)g_MeleeWeaponInfoStore,*(int *)(this + 0x17e0));
  if (pCVar3 == (CMeleeWeaponInfo *)0x0) {
    return;
  }
  pcVar1 = *(code **)(*(int *)this + 0x3f0);
  if (param_2) {
    uVar4 = GetPrimaryAttackActivity(this,pCVar3);
    (*pcVar1)(this,uVar4);
    (**(code **)(*(int *)param_1 + 0x7fc))(param_1,0x28,0);
    iVar5 = *(int *)(this + 0x494);
    fVar10 = *(float *)(gpGlobals + 0xc);
    pCVar7 = *(CStudioHdr **)(this + 0x13e0);
    if (pCVar7 == (CStudioHdr *)0x0) {
      iVar6 = CBaseEntity::GetModel((CBaseEntity *)this);
      if (iVar6 == 0) {
        pCVar7 = *(CStudioHdr **)(this + 0x13e0);
      }
      else {
        CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
        pCVar7 = *(CStudioHdr **)(this + 0x13e0);
      }
      pCVar8 = (CStudioHdr *)0x0;
      if (pCVar7 != (CStudioHdr *)0x0) goto LAB_0056b40f;
    }
    else {
LAB_0056b40f:
      pCVar8 = (CStudioHdr *)0x0;
      if (*(int *)pCVar7 != 0) {
        pCVar8 = pCVar7;
      }
    }
    lVar9 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar8,iVar5);
    fVar10 = (float)lVar9 + fVar10;
    if (fVar10 != *(float *)(this + 0x13fc)) {
      if (this[0x6c] == (CTerrorMeleeWeapon)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x13fc) = fVar10;
    }
    fVar10 = *(float *)(gpGlobals + 0xc) + 0.7;
    if (fVar10 != *(float *)(this + 0x1400)) {
      if (this[0x6c] == (CTerrorMeleeWeapon)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x1400) = fVar10;
    }
    goto LAB_0056b246;
  }
  uVar4 = GetSecondaryAttackActivity(this,pCVar3);
  (*pcVar1)(this,uVar4);
  (**(code **)(*(int *)param_1 + 0x7fc))(param_1,0x29,0);
  iVar5 = *(int *)(this + 0x494);
  fVar10 = *(float *)(gpGlobals + 0xc);
  pCVar7 = *(CStudioHdr **)(this + 0x13e0);
  if (pCVar7 == (CStudioHdr *)0x0) {
    iVar6 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar6 == 0) {
      pCVar7 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      pCVar7 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar8 = (CStudioHdr *)0x0;
    if (pCVar7 != (CStudioHdr *)0x0) goto LAB_0056b1fd;
  }
  else {
LAB_0056b1fd:
    pCVar8 = (CStudioHdr *)0x0;
    if (*(int *)pCVar7 != 0) {
      pCVar8 = pCVar7;
    }
  }
  lVar9 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar8,iVar5);
  fVar10 = (float)lVar9 + fVar10;
  fVar11 = *(float *)(this + 0x1400);
  if (fVar10 != *(float *)(this + 0x1400)) {
    if (this[0x6c] == (CTerrorMeleeWeapon)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x1400) = fVar10;
    fVar11 = fVar10;
  }
  if (fVar11 != *(float *)(this + 0x13fc)) {
    if (this[0x6c] == (CTerrorMeleeWeapon)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x13fc) = fVar11;
  }
LAB_0056b246:
  (**(code **)(*(int *)this + 0x404))(this,*(undefined4 *)(pCVar3 + 0xc4c));
  (**(code **)(*(int *)this + 0x4b8))(this,8,0);
  CTerrorWeapon::SuppressHelpingHands((CTerrorWeapon *)this,0.0);
  fVar10 = *(float *)(*(int *)(this + 0x1824) + 0x1c);
  lVar9 = (longdouble)CountdownTimer::Now();
  if ((float)lVar9 + fVar10 != *(float *)(this + 0x1814)) {
    (**(code **)(*(int *)(this + 0x180c) + 4))(this + 0x180c,this + 0x1814);
    *(float *)(this + 0x1814) = (float)lVar9 + fVar10;
  }
  if (fVar10 != *(float *)(this + 0x1810)) {
    (**(code **)(*(int *)(this + 0x180c) + 4))(this + 0x180c,this + 0x1810);
    *(float *)(this + 0x1810) = fVar10;
  }
  if (this[0x1808] != (CTerrorMeleeWeapon)0x1) {
    if (this[0x6c] == (CTerrorMeleeWeapon)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CTerrorMeleeWeapon)((byte)this[0x70] | 1);
    }
    this[0x1808] = (CTerrorMeleeWeapon)0x1;
  }
  uVar4 = vec3_origin;
  *(undefined4 *)(this + 0x17f4) = 0;
  *(undefined4 *)(this + 0x1828) = 0;
  *(undefined4 *)(this + 0x1818) = uVar4;
  *(undefined4 *)(this + 0x181c) = DAT_01053d4c;
  *(undefined4 *)(this + 0x1820) = DAT_01053d50;
  DoMeleeSwing(this);
  iVar5 = CTerrorWeapon::GetTerrorWeaponData((CTerrorWeapon *)this);
  (**(code **)(*(int *)param_1 + 0x850))(param_1,*(undefined4 *)(iVar5 + 0x9f8));
  CTerrorPlayer::InhibitCalm(param_1,2.0);
                    /* WARNING: Could not recover jumptable at 0x0056b3b7. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (**(code **)(*(int *)param_1 + 0x844))();
  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)