L L4D2node

CTerrorWeapon::TrySwing

0x0056dc40 · 1302 bytes · __thiscall

_ZN13CTerrorWeapon8TrySwingEfff

Decompiled

undefined (4 params)

/* CTerrorWeapon::TrySwing(float, float, float) */

void __thiscall
CTerrorWeapon::TrySwing(CTerrorWeapon *this,float param_1,float param_2,float param_3)

{
  code *pcVar1;
  undefined4 uVar2;
  char cVar3;
  CTerrorPlayer *this_00;
  int iVar4;
  int iVar5;
  ushort extraout_DX;
  ushort uVar6;
  undefined *puVar7;
  undefined4 *puVar8;
  float *pfVar9;
  undefined4 *puVar10;
  undefined1 *puVar11;
  undefined1 *puVar12;
  undefined1 *puVar13;
  longdouble lVar14;
  uint uVar15;
  float fVar16;
  float fVar17;
  float afStackY_58 [3];
  
  puVar11 = &stack0xfffffffc;
  puVar12 = &stack0xfffffffc;
  pfVar9 = (float *)&stack0xffffffb4;
  afStackY_58[2] = 7.976938e-39;
  cVar3 = (**(code **)(*(int *)this + 0x610))();
  if (cVar3 == '\0') {
    afStackY_58[2] = 7.976976e-39;
    this_00 = (CTerrorPlayer *)GetPlayerOwner(this);
    if (this_00 != (CTerrorPlayer *)0x0) {
      afStackY_58[2] = 7.977e-39;
      cVar3 = (**(code **)(*(int *)this_00 + 0x8d8))();
      if (cVar3 != '\0') {
        afStackY_58[2] = 7.97702e-39;
        cVar3 = (**(code **)(*(int *)this_00 + 0x7e8))();
        if (cVar3 == '\0') {
          afStackY_58[2] = 7.977041e-39;
          cVar3 = (**(code **)(*(int *)this_00 + 0x558))();
          if (cVar3 == '\0') {
            afStackY_58[2] = 7.977058e-39;
            cVar3 = CTerrorPlayer::IsLunging(this_00);
            if ((cVar3 == '\0') && (this_00[0x33dc] == (CTerrorPlayer)0x0)) {
              uVar15 = *(uint *)(this_00 + 0x33c4);
              if ((uVar15 != 0xffffffff) &&
                 (((puVar7 = g_pEntityList + (uVar15 & 0xfff) * 0x10,
                   puVar7 != (undefined *)0xfffffffc && (*(uint *)(puVar7 + 8) == uVar15 >> 0xc)) &&
                  (*(int *)(puVar7 + 4) != 0)))) {
                afStackY_58[2] = 7.977854e-39;
                lVar14 = (longdouble)IntervalTimer::Now();
                if (1.0 < (float)lVar14 - *(float *)(this_00 + 0x33cc)) {
                  return;
                }
              }
              afStackY_58[2] = 7.977165e-39;
              lVar14 = (longdouble)CountdownTimer::Now();
              if ((*(float *)(this_00 + 0x32dc) <= (float)lVar14) &&
                 (((uVar15 = *(uint *)(this_00 + 0x3e68), uVar15 == 0xffffffff ||
                   (puVar7 = g_pEntityList + (uVar15 & 0xfff) * 0x10,
                   puVar7 == (undefined *)0xfffffffc)) ||
                  ((*(uint *)(puVar7 + 8) != uVar15 >> 0xc || (*(int *)(puVar7 + 4) == 0)))))) {
                afStackY_58[2] = 7.977273e-39;
                cVar3 = CTerrorPlayer::IsPummelVictim(this_00);
                if ((cVar3 == '\0') && (this[0x1530] != (CTerrorWeapon)0x0)) {
                  afStackY_58[2] = 7.977325e-39;
                  SuppressHelpingHands(this,0.0);
                  afStackY_58[2] = 7.977336e-39;
                  iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)this_00);
                  afStackY_58[2] = 7.977347e-39;
                  cVar3 = IsASurvivorTeam(iVar4);
                  if (cVar3 != '\0') {
                    afStackY_58[2] = 7.97805e-39;
                    cVar3 = (**(code **)(*(int *)this_00 + 0x778))();
                    if (cVar3 == '\0') {
                      afStackY_58[2] = 7.978073e-39;
                      iVar4 = CTerrorPlayer::GetShovePenalty(this_00);
                      afStackY_58[2] = 7.978087e-39;
                      cVar3 = CTerrorPlayer::IsAdrenalineActive(this_00);
                      if (cVar3 == '\0') {
                        fVar17 = *(float *)(gpGlobals + 0xc);
                        afStackY_58[2] = 7.978164e-39;
                        lVar14 = (longdouble)CTerrorPlayer::GetNextShoveTime(this_00);
                        fVar16 = *(float *)(z_gun_swing_vs_cooldown._28_4_ + 0x2c);
                        if (fVar16 != 0.0) {
                          afStackY_58[2] = 7.978213e-39;
                          CTerrorGameRules::IsCoopMode();
                          afStackY_58[2] = 7.978247e-39;
                          cVar3 = CTerrorGameRules::IsCoopMode();
                          if (cVar3 == '\0') {
                            iVar5 = *(int *)(z_gun_swing_vs_max_penalty._28_4_ + 0x30);
                          }
                          else {
                            iVar5 = *(int *)(z_gun_swing_coop_max_penalty._28_4_ + 0x30);
                          }
                          fVar17 = fVar17 - (float)lVar14;
                          if (fVar17 <= fVar16) {
                            fVar16 = 1.0;
                          }
                          else {
                            fVar17 = fVar17 - fVar16;
                            fVar16 = *(float *)(z_gun_swing_vs_restore_time._28_4_ + 0x2c);
                            if (fVar16 == 0.0) {
                              uVar15 = -(uint)(fVar17 < 0.0);
                              fVar16 = (float)(~uVar15 & (uint)(float)iVar5 | (uint)fVar16 & uVar15)
                              ;
                            }
                            else {
                              fVar17 = fVar17 / fVar16;
                              fVar16 = 1.0;
                              if (fVar17 <= 1.0) {
                                fVar16 = fVar17;
                              }
                              if (fVar16 <= 0.0) {
                                fVar16 = 0.0;
                              }
                              fVar16 = fVar16 * (float)iVar5;
                            }
                            fVar16 = -fVar16;
                          }
                          fVar16 = (float)iVar4 + fVar16;
                          fVar17 = (float)iVar5;
                          if ((fVar16 <= (float)iVar5) && (fVar17 = fVar16, fVar16 <= 0.0)) {
                            fVar17 = 0.0;
                          }
                          afStackY_58[2] = 7.978531e-39;
                          CTerrorPlayer::SetShovePenalty(this_00,(int)fVar17);
                        }
                      }
                      else {
                        afStackY_58[2] = 7.978115e-39;
                        CTerrorPlayer::SetShovePenalty(this_00,0);
                      }
                    }
                  }
                  afStackY_58[2] = 7.977403e-39;
                  CountdownTimer::Start((CountdownTimer *)(this + 0x1560),param_2);
                  afStackY_58[2] = 7.977438e-39;
                  CountdownTimer::Start((CountdownTimer *)(this + 0x1554),param_1);
                  this[0x1578] = (CTerrorWeapon)0x1;
                  *(undefined4 *)(this + 0x1788) = 0;
                  uVar2 = vec3_origin;
                  *(undefined4 *)(this + 0x178c) = 0;
                  *(float *)(this + 0x157c) = param_3;
                  *(undefined4 *)(this + 0x156c) = uVar2;
                  *(undefined4 *)(this + 0x1570) = DAT_01053d4c;
                  *(undefined4 *)(this + 0x1574) = DAT_01053d50;
                  afStackY_58[2] = 7.977577e-39;
                  (**(code **)(*(int *)this + 0x6e4))();
                  fVar17 = param_1 + *(float *)(gpGlobals + 0xc);
                  if (this[0x1459] == (CTerrorWeapon)0x0) {
                    pfVar9 = (float *)&stack0xffffffb4;
                    puVar13 = &stack0xfffffffc;
                    uVar6 = extraout_DX;
                    if (fVar17 != *(float *)(this + 0x13fc)) {
                      pfVar9 = afStackY_58 + 2;
                      afStackY_58[2] = 7.977955e-39;
                      CServerNetworkProperty::NetworkStateChanged(extraout_DX);
                      *(int *)(this + 0x13fc) = *(int *)(puVar12 + -0x1c);
                      puVar13 = puVar12;
                    }
                    if (*(float *)(puVar13 + -0x1c) != *(float *)(this + 0x1400)) {
                      puVar10 = (undefined4 *)((int)pfVar9 + -4);
                      pfVar9 = (float *)((int)pfVar9 + -4);
                      *puVar10 = 0x56df72;
                      CServerNetworkProperty::NetworkStateChanged(uVar6);
                      *(int *)(this + 0x1400) = *(int *)(puVar13 + -0x1c);
                    }
                  }
                  else {
                    fVar16 = *(float *)(this + 0x13fc);
                    if (fVar17 <= fVar16) {
                      fVar17 = fVar16;
                    }
                    puVar13 = &stack0xfffffffc;
                    uVar6 = extraout_DX;
                    if (fVar16 != fVar17) {
                      pfVar9 = afStackY_58 + 2;
                      afStackY_58[2] = 7.977669e-39;
                      CServerNetworkProperty::NetworkStateChanged(extraout_DX);
                      *(int *)(this + 0x13fc) = *(int *)(puVar11 + -0x20);
                      puVar13 = puVar11;
                    }
                    fVar17 = *(float *)(this + 0x1400);
                    fVar16 = *(float *)(puVar13 + -0x1c);
                    if (*(float *)(puVar13 + -0x1c) <= fVar17) {
                      fVar16 = fVar17;
                    }
                    if (fVar17 != fVar16) {
                      *(float *)(puVar13 + -0x20) = fVar16;
                      puVar8 = (undefined4 *)((int)pfVar9 + -4);
                      pfVar9 = (float *)((int)pfVar9 + -4);
                      *puVar8 = 0x56deaf;
                      CServerNetworkProperty::NetworkStateChanged(uVar6);
                      *(int *)(this + 0x1400) = *(int *)(puVar13 + -0x20);
                    }
                  }
                  fVar17 = *(float *)(puVar13 + -0x28);
                  iVar4 = *(int *)this_00;
                  *pfVar9 = (float)this_00;
                  pfVar9[1] = fVar17 + *(float *)(puVar13 + -0x1c);
                  pcVar1 = *(code **)(iVar4 + 0x8dc);
                  pfVar9[-1] = 7.977793e-39;
                  (*pcVar1)();
                  iVar4 = *(int *)this;
                  *(CTerrorWeapon **)(puVar13 + 8) = this;
                    /* WARNING: Could not recover jumptable at 0x0056dee9. Too many branches */
                    /* WARNING: Treating indirect jump as call */
                  (**(code **)(iVar4 + 0x6dc))();
                  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)