L L4D2node

CBaseCombatWeapon::CheckReload

0x00407520 · 872 bytes · __thiscall

_ZN17CBaseCombatWeapon11CheckReloadEv

Decompiled

undefined (1 param)

/* CBaseCombatWeapon::CheckReload() */

void __thiscall CBaseCombatWeapon::CheckReload(CBaseCombatWeapon *this)

{
  CBaseEdict *pCVar1;
  char cVar2;
  int iVar3;
  CBaseCombatCharacter *this_00;
  int iVar4;
  float fVar5;
  
  if (this[0x145d] == (CBaseCombatWeapon)0x0) {
    if ((this[0x1459] != (CBaseCombatWeapon)0x0) &&
       (*(float *)(this + 0x13fc) <= *(float *)(gpGlobals + 0xc))) {
      (**(code **)(*(int *)this + 0x460))(this);
      iVar3 = gpGlobals;
      fVar5 = *(float *)(gpGlobals + 0xc);
      if (fVar5 != *(float *)(this + 0x13fc)) {
        if (this[0x6c] == (CBaseCombatWeapon)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar3 + 2) = 0;
            iVar3 = gpGlobals;
          }
        }
        else {
          this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
        }
        *(float *)(this + 0x13fc) = fVar5;
        fVar5 = *(float *)(iVar3 + 0xc);
      }
      if (fVar5 != *(float *)(this + 0x1400)) {
        if (this[0x6c] == (CBaseCombatWeapon)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar3 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
        }
        *(float *)(this + 0x1400) = fVar5;
      }
      if (this[0x1459] != (CBaseCombatWeapon)0x0) {
        if (this[0x6c] == (CBaseCombatWeapon)0x0) {
          pCVar1 = *(CBaseEdict **)(this + 0x30);
          if (pCVar1 != (CBaseEdict *)0x0) {
            *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
            iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
            *(undefined2 *)(iVar3 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
        }
        this[0x1459] = (CBaseCombatWeapon)0x0;
      }
    }
  }
  else {
    this_00 = (CBaseCombatCharacter *)GetOwner(this);
    if (this_00 != (CBaseCombatCharacter *)0x0) {
      cVar2 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
      if ((cVar2 != '\0') && (this[0x1459] != (CBaseCombatWeapon)0x0)) {
        if ((((*(uint *)(this + 0x1404) | *(uint *)(this_00 + 0x1cb0)) & 0x801) == 0) ||
           (*(int *)(this + 0x1420) < 1)) {
          if (*(float *)(this + 0x13fc) <= *(float *)(gpGlobals + 0xc)) {
            iVar3 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418));
            if (0 < iVar3) {
              iVar3 = *(int *)(this + 0x1420);
              iVar4 = (**(code **)(*(int *)this + 0x510))(this);
              if ((iVar3 < iVar4) && (this[0x1428] == (CBaseCombatWeapon)0x0)) {
                iVar3 = *(int *)(this + 0x1420);
                if (this[0x6c] == (CBaseCombatWeapon)0x0) {
                  pCVar1 = *(CBaseEdict **)(this + 0x30);
                  if (pCVar1 != (CBaseEdict *)0x0) {
                    *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
                    iVar4 = CBaseEdict::GetChangeAccessor(pCVar1);
                    *(undefined2 *)(iVar4 + 2) = 0;
                  }
                }
                else {
                  this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
                }
                *(int *)(this + 0x1420) = iVar3 + 1;
                (**(code **)(*(int *)this_00 + 0x450))(this_00,1,*(undefined4 *)(this + 0x1418));
                    /* WARNING: Could not recover jumptable at 0x00407742. Too many branches */
                    /* WARNING: Treating indirect jump as call */
                (**(code **)(*(int *)this + 0x468))();
                return;
              }
            }
                    /* WARNING: Could not recover jumptable at 0x0040775a. Too many branches */
                    /* WARNING: Treating indirect jump as call */
            (**(code **)(*(int *)this + 0x460))();
            return;
          }
        }
        else {
          (**(code **)(*(int *)this + 0x464))(this);
          iVar3 = gpGlobals;
          fVar5 = *(float *)(gpGlobals + 0xc);
          if (fVar5 != *(float *)(this_00 + 0x17dc)) {
            if (this_00[0x6c] == (CBaseCombatCharacter)0x0) {
              pCVar1 = *(CBaseEdict **)(this_00 + 0x30);
              if (pCVar1 != (CBaseEdict *)0x0) {
                *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
                iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
                *(undefined2 *)(iVar3 + 2) = 0;
                iVar3 = gpGlobals;
              }
            }
            else {
              this_00[0x70] = (CBaseCombatCharacter)((byte)this_00[0x70] | 1);
            }
            *(float *)(this_00 + 0x17dc) = fVar5;
            fVar5 = *(float *)(iVar3 + 0xc);
          }
          if (fVar5 != *(float *)(this + 0x13fc)) {
            if (this[0x6c] == (CBaseCombatWeapon)0x0) {
              pCVar1 = *(CBaseEdict **)(this + 0x30);
              if (pCVar1 != (CBaseEdict *)0x0) {
                *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
                iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
                *(undefined2 *)(iVar3 + 2) = 0;
                iVar3 = gpGlobals;
              }
            }
            else {
              this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
            }
            *(float *)(this + 0x13fc) = fVar5;
            fVar5 = *(float *)(iVar3 + 0xc);
          }
          if (fVar5 != *(float *)(this + 0x1400)) {
            if (this[0x6c] == (CBaseCombatWeapon)0x0) {
              pCVar1 = *(CBaseEdict **)(this + 0x30);
              if (pCVar1 != (CBaseEdict *)0x0) {
                *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
                iVar3 = CBaseEdict::GetChangeAccessor(pCVar1);
                *(undefined2 *)(iVar3 + 2) = 0;
              }
            }
            else {
              this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
            }
            *(float *)(this + 0x1400) = fVar5;
          }
        }
      }
    }
  }
  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)