L L4D2node

CWeaponCSBase::ItemPostFrame

0x00440dd0 · 2474 bytes · __thiscall

_ZN13CWeaponCSBase13ItemPostFrameEv

Decompiled

undefined (1 param)

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

void __thiscall CWeaponCSBase::ItemPostFrame(CWeaponCSBase *this)

{
  float fVar1;
  byte *pbVar2;
  code *pcVar3;
  undefined4 uVar4;
  undefined4 uVar5;
  char cVar6;
  CBaseCombatCharacter *this_00;
  int iVar7;
  int iVar8;
  int iVar9;
  uint uVar10;
  int *piVar11;
  undefined4 uVar12;
  char *pcVar13;
  byte *pbVar14;
  byte *pbVar15;
  bool bVar16;
  bool bVar17;
  byte bVar18;
  CWeaponCSBase *pCVar19;
  CBaseEdict *pCVar20;
  byte *local_40;
  int local_34;
  undefined4 local_24;
  undefined4 local_20;
  
  bVar18 = 0;
  local_24 = 0;
  local_20 = 0;
  if (___atan2f_finite == 0) {
    local_34 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_24,0,0,0,0,
               "/data/src/game/server/../../game/shared/cstrike/weapon_csbase.cpp",0x294,
               &ItemPostFrame()::tm_fmt,"(%s)%s","Unaccounted","CWeaponCSBase::ItemPostFrame");
    local_34 = ___atan2f_finite;
  }
  uVar5 = local_20;
  uVar4 = local_24;
  iVar9 = _DAT_0105db00;
                    /* try { // try from 00440f06 to 00440f54 has its CatchHandler @ 0044185a */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar7 = ThreadGetCurrentId(), iVar9 == iVar7)) {
    if ((char *)*_DAT_0105d15c != "CWeaponCSBase::ItemPostFrame") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc0ff19,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 00440e86 to 00440e9c has its CatchHandler @ 004417cb */
  this_00 = (CBaseCombatCharacter *)GetPlayerOwner(this);
  if ((this_00 == (CBaseCombatCharacter *)0x0) ||
     (cVar6 = (**(code **)(*(int *)this + 0x434))(this), cVar6 == '\0')) {
LAB_00440ea5:
    iVar9 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar7 = ThreadGetCurrentId(), iVar9 == iVar7)) {
      cVar6 = CVProfNode::ExitScope();
      if (cVar6 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_34 == 0) {
      return;
    }
    (**(code **)(local_34 + 0x54))(local_34,uVar4,uVar5,0,0,0);
    return;
  }
                    /* try { // try from 00440fd5 to 0044136e has its CatchHandler @ 004417cb */
  pCVar19 = this;
  (**(code **)(*(int *)this + 0x654))(this);
  if ((this[0x1459] != (CWeaponCSBase)0x0) &&
     (*(float *)(this_00 + 0x17dc) <= *(float *)(gpGlobals + 0xc))) {
    iVar7 = (**(code **)(*(int *)this + 0x510))(this);
    iVar9 = *(int *)(this + 0x1420);
    iVar8 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418));
    if (iVar7 - iVar9 < iVar8) {
                    /* try { // try from 004413dd to 00441402 has its CatchHandler @ 004417cb */
      iVar7 = (**(code **)(*(int *)this + 0x510))(this);
      iVar9 = *(int *)(this + 0x1420);
      iVar7 = iVar7 - iVar9;
    }
    else {
      iVar7 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418));
      iVar9 = *(int *)(this + 0x1420);
    }
    if (iVar7 + iVar9 != iVar9) {
      if (this[0x6c] == (CWeaponCSBase)0x0) {
        pCVar20 = *(CBaseEdict **)(this + 0x30);
        if (pCVar20 != (CBaseEdict *)0x0) {
          *(uint *)pCVar20 = *(uint *)pCVar20 | 0x101;
          iVar8 = CBaseEdict::GetChangeAccessor(pCVar20);
          *(undefined2 *)(iVar8 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CWeaponCSBase)((byte)this[0x70] | 1);
      }
      *(int *)(this + 0x1420) = iVar7 + iVar9;
    }
    pCVar19 = (CWeaponCSBase *)this_00;
    (**(code **)(*(int *)this_00 + 0x450))(this_00,iVar7,*(undefined4 *)(this + 0x1418));
    if (this[0x1459] != (CWeaponCSBase)0x0) {
      if (this[0x6c] == (CWeaponCSBase)0x0) {
        pCVar20 = *(CBaseEdict **)(this + 0x30);
        if (pCVar20 != (CBaseEdict *)0x0) {
          *(uint *)pCVar20 = *(uint *)pCVar20 | 0x101;
          iVar9 = CBaseEdict::GetChangeAccessor(pCVar20);
          *(undefined2 *)(iVar9 + 2) = 0;
          pCVar19 = (CWeaponCSBase *)pCVar20;
        }
      }
      else {
        this[0x70] = (CWeaponCSBase)((byte)this[0x70] | 1);
      }
      this[0x1459] = (CWeaponCSBase)0x0;
    }
  }
  uVar10 = *(uint *)(this_00 + 0x1cb0);
  if (((uVar10 & 0x800) != 0) && (*(float *)(this + 0x1400) <= *(float *)(gpGlobals + 0xc))) {
    pCVar19 = this;
    cVar6 = (**(code **)(*(int *)this + 0x658))(this);
    if (cVar6 != '\0') {
      if (*(int *)(this + 0x1424) != -1) {
        iVar9 = (**(code **)(*(int *)this + 0x560))(this);
        iVar9 = CBaseCombatCharacter::GetAmmoCount(this_00,iVar9);
        if (iVar9 == 0) {
          this[0x145a] = (CWeaponCSBase)0x1;
        }
      }
      cVar6 = CCSPlayer::HasShield();
      if (cVar6 == '\0') {
        (**(code **)(*(int *)this + 0x470))(this);
        pCVar19 = this;
      }
      else {
        SecondaryAttack(this);
        pCVar19 = this;
      }
      *(uint *)(this_00 + 0x1cb0) = *(uint *)(this_00 + 0x1cb0) & 0xfffff7ff;
      goto LAB_00441370;
    }
    uVar10 = *(uint *)(this_00 + 0x1cb0);
  }
  if (((uVar10 & 1) == 0) || (*(float *)(gpGlobals + 0xc) < *(float *)(this + 0x13fc))) {
    if ((uVar10 & 0x2000) != 0) {
      pCVar19 = this;
      iVar9 = (**(code **)(*(int *)this + 0x510))(this);
      if (((iVar9 != -1) && (this[0x1459] == (CWeaponCSBase)0x0)) &&
         (*(float *)(this + 0x13fc) <= *(float *)(gpGlobals + 0xc) &&
          *(float *)(gpGlobals + 0xc) != *(float *)(this + 0x13fc))) {
        pCVar19 = (CWeaponCSBase *)this_00;
        cVar6 = CCSPlayer::IsShieldDrawn();
        if (cVar6 == '\0') {
          piVar11 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                     (gameeventmanager,"weapon_reload",0,0);
          if (piVar11 != (int *)0x0) {
            pcVar3 = *(code **)(*piVar11 + 0x30);
            uVar12 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
            (*pcVar3)(piVar11,"userid",uVar12);
            (**(code **)(*piVar11 + 0x2c))(piVar11,"manual",1);
            (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar11,0);
          }
          (**(code **)(*(int *)this + 0x468))(this);
          pCVar19 = this;
        }
        goto LAB_00441370;
      }
      uVar10 = *(uint *)(this_00 + 0x1cb0);
    }
    if ((uVar10 & 0x801) == 0) {
      if (this[0x14f0] != (CWeaponCSBase)0x0) {
        this[0x14f0] = (CWeaponCSBase)0x0;
        if (0xf < *(int *)(this_00 + 0x2850)) {
          if (this_00[0x6c] == (CBaseCombatCharacter)0x0) {
            pCVar20 = *(CBaseEdict **)(this_00 + 0x30);
            if (pCVar20 != (CBaseEdict *)0x0) {
              *(uint *)pCVar20 = *(uint *)pCVar20 | 0x101;
              iVar9 = CBaseEdict::GetChangeAccessor(pCVar20);
              *(undefined2 *)(iVar9 + 2) = 0;
            }
          }
          else {
            this_00[0x70] = (CBaseCombatCharacter)((byte)this_00[0x70] | 1);
          }
          *(undefined4 *)(this_00 + 0x2850) = 0xf;
        }
        *(float *)(this + 0x14f8) = *(float *)(gpGlobals + 0xc) + 0.4;
      }
      this[0x145a] = (CWeaponCSBase)0x0;
      iVar9 = CBaseCombatWeapon::GetWpnData((CBaseCombatWeapon *)this);
      if (*(int *)(iVar9 + 0x894) == 0) {
        if (*(int *)(this_00 + 0x2850) != 0) {
          if (this_00[0x6c] == (CBaseCombatCharacter)0x0) {
            pCVar20 = *(CBaseEdict **)(this_00 + 0x30);
            if (pCVar20 != (CBaseEdict *)0x0) {
              *(uint *)pCVar20 = *(uint *)pCVar20 | 0x101;
              iVar9 = CBaseEdict::GetChangeAccessor(pCVar20);
              *(undefined2 *)(iVar9 + 2) = 0;
            }
          }
          else {
            this_00[0x70] = (CBaseCombatCharacter)((byte)this_00[0x70] | 1);
          }
          *(undefined4 *)(this_00 + 0x2850) = 0;
        }
      }
      else if ((0 < *(int *)(this_00 + 0x2850)) &&
              (fVar1 = *(float *)(gpGlobals + 0xc),
              *(float *)(this + 0x14f8) <= fVar1 && fVar1 != *(float *)(this + 0x14f8))) {
        *(float *)(this + 0x14f8) = fVar1 + 0.0225;
        iVar9 = *(int *)(this_00 + 0x2850);
        if (this_00[0x6c] == (CBaseCombatCharacter)0x0) {
          pCVar20 = *(CBaseEdict **)(this_00 + 0x30);
          if (pCVar20 != (CBaseEdict *)0x0) {
            *(uint *)pCVar20 = *(uint *)pCVar20 | 0x101;
            iVar7 = CBaseEdict::GetChangeAccessor(pCVar20);
            *(undefined2 *)(iVar7 + 2) = 0;
          }
        }
        else {
          this_00[0x70] = (CBaseCombatCharacter)((byte)this_00[0x70] | 1);
        }
        *(int *)(this_00 + 0x2850) = iVar9 + -1;
      }
      cVar6 = IsUseable(this);
                    /* try { // try from 00441473 to 0044178e has its CatchHandler @ 004417cb */
      if (((cVar6 == '\0') &&
          (*(float *)(this + 0x13fc) <= *(float *)(gpGlobals + 0xc) &&
           *(float *)(gpGlobals + 0xc) != *(float *)(this + 0x13fc))) ||
         ((*(int *)(this + 0x1420) != 0 ||
          ((uVar10 = (**(code **)(*(int *)this + 0x52c))(this), (uVar10 & 2) != 0 ||
           (*(float *)(gpGlobals + 0xc) < *(float *)(this + 0x13fc) ||
            *(float *)(gpGlobals + 0xc) == *(float *)(this + 0x13fc))))))) {
        (**(code **)(*(int *)this + 0x450))(this);
      }
      else {
        piVar11 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                   (gameeventmanager,"weapon_reload",0,0);
        if (piVar11 != (int *)0x0) {
          pcVar3 = *(code **)(*piVar11 + 0x30);
          uVar12 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
          (*pcVar3)(piVar11,"userid",uVar12);
          (**(code **)(*piVar11 + 0x2c))(piVar11,"manual",0);
          (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar11,0);
        }
        (**(code **)(*(int *)this + 0x468))(this);
      }
      goto LAB_00440ea5;
    }
    goto LAB_00441370;
  }
  if (*(int *)(this + 0x1420) == 0) {
LAB_0044121e:
    this[0x145a] = (CWeaponCSBase)0x1;
  }
  else {
    pCVar19 = this;
    iVar9 = (**(code **)(*(int *)this + 0x510))(this);
    if (iVar9 == -1) {
      iVar9 = (**(code **)(*(int *)this + 0x55c))(this);
      pCVar19 = (CWeaponCSBase *)this_00;
      iVar9 = CBaseCombatCharacter::GetAmmoCount(this_00,iVar9);
      if (iVar9 == 0) goto LAB_0044121e;
    }
  }
  if (((this_00[0x23e0] == (CBaseCombatCharacter)0x0) && (*(int *)(this_00 + 0x23bc) == 0)) &&
     (pCVar19 = (CWeaponCSBase *)this_00, cVar6 = CCSPlayer::IsShieldDrawn(), cVar6 == '\0')) {
    iVar9 = CBaseCombatWeapon::GetWpnData((CBaseCombatWeapon *)this);
    if (*(int *)(iVar9 + 0x894) != 7) {
      pcVar3 = *(code **)(*gameeventmanager + 0x1c);
      cVar6 = (**(code **)(*(int *)this + 0x3c8))(this);
      pcVar13 = "weapon_fire";
      if (cVar6 == '\0') {
        pcVar13 = "weapon_fire_on_empty";
      }
      piVar11 = (int *)(*pcVar3)(gameeventmanager,pcVar13,0,0);
      if (piVar11 != (int *)0x0) {
        pbVar2 = *(byte **)(this + 0x7c);
        bVar16 = false;
        if (pbVar2 == (byte *)0x0) {
          local_40 = &DAT_00d539c2;
        }
        else {
          iVar9 = 7;
          bVar17 = false;
          pbVar14 = pbVar2;
          pbVar15 = (byte *)"weapon_";
          do {
            if (iVar9 == 0) break;
            iVar9 = iVar9 + -1;
            bVar16 = *pbVar14 < *pbVar15;
            bVar17 = *pbVar14 == *pbVar15;
            pbVar14 = pbVar14 + (uint)bVar18 * -2 + 1;
            pbVar15 = pbVar15 + (uint)bVar18 * -2 + 1;
          } while (bVar17);
          local_40 = pbVar2 + 7;
          if ((!bVar16 && !bVar17) != bVar16) {
            local_40 = pbVar2;
          }
        }
        pcVar3 = *(code **)(*piVar11 + 0x30);
        uVar12 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this_00 + 0x30));
        (*pcVar3)(piVar11,"userid",uVar12);
        (**(code **)(*piVar11 + 0x3c))(piVar11,"weapon",local_40);
        pcVar3 = *(code **)(*piVar11 + 0x30);
        uVar12 = (**(code **)(*(int *)this + 0x638))(this);
        (*pcVar3)(piVar11,"weaponid",uVar12);
        (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar11,0);
      }
    }
    (**(code **)(*(int *)this + 0x46c))(this);
    pCVar19 = this;
  }
LAB_00441370:
  iVar9 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar7 = ThreadGetCurrentId(pCVar19), iVar9 == iVar7)) {
    cVar6 = CVProfNode::ExitScope();
    if (cVar6 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_34 == 0) {
    return;
  }
  (**(code **)(local_34 + 0x54))(local_34,uVar4,uVar5,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)