L L4D2node

CTerrorWeapon::DoSwing

0x00572010 · 1561 bytes · __thiscall

_ZN13CTerrorWeapon7DoSwingEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CTerrorWeapon::DoSwing() */

void __thiscall CTerrorWeapon::DoSwing(CTerrorWeapon *this)

{
  int iVar1;
  int *piVar2;
  char cVar3;
  int iVar4;
  uint uVar5;
  longdouble lVar6;
  float fVar7;
  float fVar8;
  float fVar9;
  float fVar10;
  float fVar11;
  float local_70;
  undefined4 local_64;
  undefined4 local_60;
  undefined4 local_58;
  undefined4 local_54;
  int local_50;
  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;
  
  local_64 = 0;
  local_60 = 0;
  if (___atan2f_finite == 0) {
    local_50 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_64,0,0,0,0,
               "/data/src/game/server/../../game/shared/terror/weapons/terrorweapon.cpp",0x828,
               &DoSwing()::tm_fmt,"(%s)%s","Unaccounted","CTerrorWeapon::DoSwing");
    local_50 = ___atan2f_finite;
  }
  iVar1 = _DAT_0105db00;
  local_58 = local_64;
  local_54 = local_60;
                    /* try { // try from 0057241e to 0057246c has its CatchHandler @ 00572643 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar4 = ThreadGetCurrentId(), iVar1 == iVar4)) {
    if ((char *)*_DAT_0105d15c != "CTerrorWeapon::DoSwing") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc51e0a,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 005720ca to 005723b1 has its CatchHandler @ 00572658 */
  iVar4 = GetPlayerOwner(this);
  iVar1 = _DAT_0105db00;
  if (iVar4 == 0) {
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar4 = ThreadGetCurrentId(), iVar1 == iVar4)) {
      cVar3 = CVProfNode::ExitScope();
      if (cVar3 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_50 == 0) {
      return;
    }
    (**(code **)(local_50 + 0x54))(local_50,local_58,local_54,0,0,0);
    return;
  }
  (**(code **)*lagcompensation)(lagcompensation,iVar4,0,&vec3_origin,&vec3_angle,0);
  (**(code **)(*(int *)this + 0x6d0))(local_4c,this);
  lVar6 = (longdouble)CountdownTimer::Now();
  if (((*(float *)(this + 0x1564) - *(float *)(this + 0x1568)) + (float)lVar6) /
      (float)(-(uint)(0.0 < *(float *)(this + 0x1568)) & (uint)*(float *)(this + 0x1564)) <= 1.0) {
                    /* try { // try from 005724f1 to 0057253d has its CatchHandler @ 00572658 */
    lVar6 = (longdouble)CountdownTimer::Now();
    if (((*(float *)(this + 0x1564) - *(float *)(this + 0x1568)) + (float)lVar6) /
        (float)((uint)*(float *)(this + 0x1564) & -(uint)(0.0 < *(float *)(this + 0x1568))) < 0.0) {
      local_70 = 0.0;
    }
    else {
      lVar6 = (longdouble)CountdownTimer::Now();
      local_70 = ((float)lVar6 + (*(float *)(this + 0x1564) - *(float *)(this + 0x1568))) /
                 (float)(-(uint)(0.0 < *(float *)(this + 0x1568)) & (uint)*(float *)(this + 0x1564))
      ;
    }
  }
  else {
    local_70 = 1.0;
  }
  VectorAngles(local_4c,(QAngle *)&local_40);
  lVar6 = (longdouble)(**(code **)(*(int *)this + 0x6e8))(this);
  local_3c = (float)lVar6 * (1.0 - local_70) + local_3c;
  lVar6 = (longdouble)(**(code **)(*(int *)this + 0x6ec))(this);
  local_3c = (float)lVar6 * local_70 + local_3c;
  lVar6 = (longdouble)(**(code **)(*(int *)this + 0x6f0))(this);
  local_40 = (float)lVar6 * (1.0 - local_70) + local_40;
  lVar6 = (longdouble)(**(code **)(*(int *)this + 0x6f4))(this);
  local_40 = (float)lVar6 * local_70 + local_40;
  AngleVectors((QAngle *)&local_40,(Vector *)&local_34);
  fVar11 = *(float *)(this + 0x156c);
  if (fVar11 == vec3_origin) {
    fVar9 = *(float *)(this + 0x1570);
    fVar10 = *(float *)(this + 0x1574);
    if (DAT_01053d4c != fVar9) goto LAB_0057225b;
    if (fVar10 == DAT_01053d50) goto LAB_00572377;
    iVar1 = *(int *)(this + 0x178c);
    fVar9 = DAT_01053d4c;
  }
  else {
    fVar9 = *(float *)(this + 0x1570);
    fVar10 = *(float *)(this + 0x1574);
LAB_0057225b:
    iVar1 = *(int *)(this + 0x178c);
  }
  if (iVar1 == 0) {
    fVar7 = 4.0;
    local_70 = 5.60519e-45;
  }
  else {
    fVar7 = 3.0;
    local_70 = 4.2039e-45;
  }
  uVar5 = (uint)(iVar1 != 0);
  while( true ) {
    fVar8 = (float)(int)uVar5 * (1.0 / fVar7);
    local_24 = (local_30 - fVar9) * fVar8 + fVar9;
    local_20 = (local_2c - fVar10) * fVar8 + fVar10;
    local_28 = (local_34 - fVar11) * fVar8 + fVar11;
    VectorNormalize((Vector *)&local_28);
    cVar3 = TestSwingCollision(this,(Vector *)&local_28);
    if ((cVar3 != '\0') && (*(float *)(this + 0x1568) != -1.0)) {
      (**(code **)(*(int *)(this + 0x1560) + 4))(this + 0x1560,this + 0x1568);
      *(undefined4 *)(this + 0x1568) = 0xbf800000;
    }
    if ((int)local_70 < (int)(uVar5 + 1)) break;
    uVar5 = uVar5 + 1;
    fVar11 = *(float *)(this + 0x156c);
    fVar9 = *(float *)(this + 0x1570);
    fVar10 = *(float *)(this + 0x1574);
  }
  *(int *)(this + 0x178c) = *(int *)(this + 0x178c) + 1;
LAB_00572377:
  piVar2 = lagcompensation;
  *(float *)(this + 0x156c) = local_34;
  *(float *)(this + 0x1570) = local_30;
  *(float *)(this + 0x1574) = local_2c;
  (**(code **)(*piVar2 + 4))(piVar2,iVar4);
  iVar1 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar4 = ThreadGetCurrentId(), iVar1 == iVar4)) {
    cVar3 = CVProfNode::ExitScope();
    if (cVar3 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_50 != 0) {
    (**(code **)(local_50 + 0x54))(local_50,local_58,local_54,0,0,0);
  }
  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)