L L4D2node

CBaseCombatWeapon::ReloadOrSwitchWeapons

0x004073b0 · 349 bytes · __thiscall

_ZN17CBaseCombatWeapon21ReloadOrSwitchWeaponsEv

Decompiled

undefined (1 param)

/* CBaseCombatWeapon::ReloadOrSwitchWeapons() */

undefined4 __thiscall CBaseCombatWeapon::ReloadOrSwitchWeapons(CBaseCombatWeapon *this)

{
  float fVar1;
  CBaseEdict *this_00;
  char cVar2;
  int *piVar3;
  uint uVar4;
  undefined4 uVar5;
  int iVar6;
  
  piVar3 = (int *)GetOwner(this);
  if ((piVar3 == (int *)0x0) || (cVar2 = (**(code **)(*piVar3 + 0x16c))(piVar3), cVar2 == '\0')) {
    piVar3 = (int *)0x0;
  }
  this[0x145a] = (CBaseCombatWeapon)0x0;
  cVar2 = (**(code **)(*(int *)this + 0x40c))(this);
  if (((cVar2 != '\0') ||
      (fVar1 = *(float *)(gpGlobals + 0xc),
      fVar1 < *(float *)(this + 0x13fc) || fVar1 == *(float *)(this + 0x13fc))) ||
     (fVar1 < *(float *)(this + 0x1400) || fVar1 == *(float *)(this + 0x1400))) {
    cVar2 = (**(code **)(*(int *)this + 0x548))(this);
    if (((cVar2 != '\0') && (*(int *)(this + 0x1420) == 0)) &&
       ((uVar4 = (**(code **)(*(int *)this + 0x52c))(this), (uVar4 & 2) == 0 &&
        ((fVar1 = *(float *)(gpGlobals + 0xc),
         *(float *)(this + 0x13fc) <= fVar1 && fVar1 != *(float *)(this + 0x13fc) &&
         (*(float *)(this + 0x1400) <= fVar1 && fVar1 != *(float *)(this + 0x1400))))))) {
                    /* WARNING: Could not recover jumptable at 0x0040748d. Too many branches */
                    /* WARNING: Treating indirect jump as call */
      uVar5 = (**(code **)(*(int *)this + 0x468))();
      return uVar5;
    }
  }
  else {
    uVar4 = (**(code **)(*(int *)this + 0x52c))(this);
    if (((uVar4 & 4) == 0) &&
       (uVar5 = (**(code **)(*g_pGameRules + 0x6c))(g_pGameRules,piVar3,this), (char)uVar5 != '\0'))
    {
      fVar1 = *(float *)(gpGlobals + 0xc) + 0.3;
      if (fVar1 == *(float *)(this + 0x13fc)) {
        return uVar5;
      }
      if (this[0x6c] == (CBaseCombatWeapon)0x0) {
        this_00 = *(CBaseEdict **)(this + 0x30);
        if (this_00 != (CBaseEdict *)0x0) {
          *(uint *)this_00 = *(uint *)this_00 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(this_00);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x13fc) = fVar1;
      return uVar5;
    }
  }
  return 0;
}

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)