L L4D2node

CTerrorMeleeWeapon::DoMeleeSwing

0x0056abd0 · 992 bytes · __thiscall

_ZN18CTerrorMeleeWeapon12DoMeleeSwingEv

Decompiled

undefined (1 param)

/* CTerrorMeleeWeapon::DoMeleeSwing() */

void __thiscall CTerrorMeleeWeapon::DoMeleeSwing(CTerrorMeleeWeapon *this)

{
  float *pfVar1;
  bool bVar2;
  int *piVar3;
  char cVar4;
  CBasePlayer *this_00;
  int iVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  longdouble lVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  Vector local_4c [12];
  float local_40;
  float local_3c;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  this_00 = (CBasePlayer *)CTerrorWeapon::GetPlayerOwner((CTerrorWeapon *)this);
  if (this_00 == (CBasePlayer *)0x0) {
    return;
  }
  if (*(int *)(this + 0x1824) == 0) {
    return;
  }
  lVar9 = (longdouble)CountdownTimer::Now();
  fVar10 = (*(float *)(this + 0x1810) - *(float *)(this + 0x1814)) + (float)lVar9;
  if (fVar10 < *(float *)(*(int *)(this + 0x1824) + 0x14)) {
    return;
  }
  pfVar1 = (float *)(*(int *)(this + 0x1824) + 0x18);
  if (*pfVar1 <= fVar10 && fVar10 != *pfVar1) {
    return;
  }
  (**(code **)*lagcompensation)(lagcompensation,this_00,0,&vec3_origin,&vec3_angle,0);
  (**(code **)(*(int *)this + 0x6d0))(local_4c,this);
  fVar12 = *(float *)(*(int *)(this + 0x1824) + 0x14);
  fVar10 = (fVar10 - fVar12) / (*(float *)(*(int *)(this + 0x1824) + 0x18) - fVar12);
  if (fVar10 <= 0.0) {
    fVar10 = 0.0;
  }
  if (1.0 <= fVar10) {
    fVar10 = 1.0;
  }
  *(float *)(this + 0x1828) = fVar10;
  VectorAngles(local_4c,(QAngle *)&local_40);
  fVar10 = 0.0;
  uVar8 = *(uint *)(*(int *)(this + 0x1824) + 0xc);
  fVar12 = fVar10;
  if (uVar8 - 2 < 6) {
    uVar6 = 1 << ((byte)(uVar8 - 2) & 0x1f);
    fVar12 = 45.0;
    if (((uVar6 & 0x32) == 0) && (fVar12 = fVar10, (uVar6 & 0xd) != 0)) {
      fVar12 = -45.0;
    }
  }
  fVar14 = *(float *)(this + 0x1828);
  uVar6 = *(uint *)(*(int *)(this + 0x1824) + 0x10);
  fVar11 = 1.0 - fVar14;
  fVar13 = fVar10;
  if (uVar6 - 2 < 6) {
    uVar7 = 1 << ((byte)(uVar6 - 2) & 0x1f);
    if ((uVar7 & 0x32) == 0) {
      if ((uVar7 & 0xd) != 0) {
        fVar13 = fVar14 * -45.0;
      }
    }
    else {
      fVar13 = fVar14 * 45.0;
    }
  }
  local_3c = fVar12 * fVar11 + local_3c + fVar13;
  fVar12 = fVar10;
  if (uVar8 < 8) {
    uVar8 = 1 << ((byte)uVar8 & 0x1f);
    if ((uVar8 & 0x91) == 0) {
      if ((uVar8 & 0x62) != 0) {
        fVar12 = fVar11 * 45.0;
      }
    }
    else {
      fVar12 = fVar11 * -45.0;
    }
  }
  if (uVar6 < 8) {
    uVar8 = 1 << ((byte)uVar6 & 0x1f);
    if ((uVar8 & 0x91) == 0) {
      if ((uVar8 & 0x62) != 0) {
        fVar10 = fVar14 * 45.0;
      }
    }
    else {
      fVar10 = fVar14 * -45.0;
    }
  }
  local_40 = fVar10 + fVar12 + local_40;
  AngleVectors((QAngle *)&local_40,(Vector *)&local_34);
  fVar10 = *(float *)(this + 0x1818);
  if (fVar10 == vec3_origin) {
    fVar14 = *(float *)(this + 0x1820);
    fVar12 = *(float *)(this + 0x181c);
    if ((DAT_01053d4c == *(float *)(this + 0x181c)) &&
       (fVar12 = DAT_01053d4c, fVar14 == DAT_01053d50)) goto LAB_0056af34;
  }
  else {
    fVar14 = *(float *)(this + 0x1820);
    fVar12 = *(float *)(this + 0x181c);
  }
  iVar5 = 0;
  bVar2 = false;
  while( true ) {
    fVar13 = (float)iVar5 * 0.33333334;
    local_24 = (local_30 - fVar12) * fVar13 + fVar12;
    local_20 = (local_2c - fVar14) * fVar13 + fVar14;
    local_28 = (local_34 - fVar10) * fVar13 + fVar10;
    VectorNormalize((Vector *)&local_28);
    cVar4 = TestMeleeSwingCollision(this,(Vector *)&local_28);
    if (cVar4 != '\0') {
      bVar2 = true;
    }
    iVar5 = iVar5 + 1;
    if (iVar5 == 4) break;
    fVar10 = *(float *)(this + 0x1818);
    fVar12 = *(float *)(this + 0x181c);
    fVar14 = *(float *)(this + 0x1820);
  }
  if (((bVar2) &&
      (iVar5 = CMeleeWeaponInfoStore::GetMeleeWeaponInfo
                         ((CMeleeWeaponInfoStore *)g_MeleeWeaponInfoStore,*(int *)(this + 0x17e0)),
      iVar5 != 0)) && (-1 < *(int *)(iVar5 + 0x128))) {
    CBasePlayer::RumbleEffect(this_00,(uchar)*(int *)(iVar5 + 0x128),'\0','\x04');
  }
LAB_0056af34:
  piVar3 = lagcompensation;
  *(float *)(this + 0x1818) = local_34;
  *(float *)(this + 0x181c) = local_30;
  *(float *)(this + 0x1820) = local_2c;
  (**(code **)(*piVar3 + 4))(piVar3,this_00);
  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)