L L4D2node

CBaseShotgun::CheckReload

0x00527370 · 968 bytes · __thiscall

_ZN12CBaseShotgun11CheckReloadEv

Decompiled

undefined (1 param)

/* CBaseShotgun::CheckReload() */

void __thiscall CBaseShotgun::CheckReload(CBaseShotgun *this)

{
  uint uVar1;
  CBaseEdict *pCVar2;
  char cVar3;
  CTerrorPlayer *pCVar4;
  int iVar5;
  code *UNRECOVERED_JUMPTABLE;
  int iVar6;
  undefined *puVar7;
  
  pCVar4 = (CTerrorPlayer *)CTerrorWeapon::GetPlayerOwner((CTerrorWeapon *)this);
  if (pCVar4 == (CTerrorPlayer *)0x0) {
LAB_005274d8:
    if (this[0x1459] == (CBaseShotgun)0x0) {
      return;
    }
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    this[0x1459] = (CBaseShotgun)0x0;
    return;
  }
  cVar3 = CTerrorPlayer::IsPerformingAction(pCVar4,0);
  if (((cVar3 == '\0') &&
      ((((uVar1 = *(uint *)(pCVar4 + 0x2e28), uVar1 == 0xffffffff ||
         (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
        (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar7 + 4) == 0)))) ||
     (this[0x1459] == (CBaseShotgun)0x0)) {
    if (*(int *)(this + 0x17f4) != 1) goto LAB_005274d8;
    iVar5 = *(int *)(this + 0x180c);
    iVar6 = 0;
    if (0 < *(int *)(this + 0x1810)) {
      iVar6 = *(int *)(this + 0x1810) + -1;
    }
    if (iVar5 < 1) {
      return;
    }
    if (iVar5 < 3) {
      if (this[0x1459] != (CBaseShotgun)0x1) {
        if (this[0x6c] == (CBaseShotgun)0x0) {
          pCVar2 = *(CBaseEdict **)(this + 0x30);
          if (pCVar2 != (CBaseEdict *)0x0) {
            *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
            iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
            *(undefined2 *)(iVar5 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
        }
        this[0x1459] = (CBaseShotgun)0x1;
      }
      if (*(float *)(gpGlobals + 0xc) <=
          *(float *)(this + 0x1800) + *(float *)(this + 0x17fc) +
          (float)iVar6 * *(float *)(this + 0x1804)) {
        return;
      }
      iVar5 = *(int *)(this + 0x1810);
      if (iVar5 < *(int *)(this + 0x17f8)) {
        if (this[0x6c] == (CBaseShotgun)0x0) {
          pCVar2 = *(CBaseEdict **)(this + 0x30);
          if (pCVar2 != (CBaseEdict *)0x0) {
            *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
            iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
            *(undefined2 *)(iVar6 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
        }
        *(int *)(this + 0x1810) = iVar5 + 1;
        if (*(int *)(this + 0x180c) != 2) {
          if (this[0x6c] == (CBaseShotgun)0x0) {
            pCVar2 = *(CBaseEdict **)(this + 0x30);
            if (pCVar2 != (CBaseEdict *)0x0) {
              *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
              iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
              *(undefined2 *)(iVar5 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
          }
          *(undefined4 *)(this + 0x180c) = 2;
        }
        PlayReloadAnim(this,0x588,5,0);
      }
      else {
        if (*(int *)(this + 0x180c) != 3) {
          if (this[0x6c] == (CBaseShotgun)0x0) {
            pCVar2 = *(CBaseEdict **)(this + 0x30);
            if (pCVar2 != (CBaseEdict *)0x0) {
              *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
              iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
              *(undefined2 *)(iVar5 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
          }
          *(undefined4 *)(this + 0x180c) = 3;
        }
        PlayReloadAnim(this,0x58a,6,0);
      }
      iVar5 = *(int *)(this + 0x1420);
      if (this[0x6c] == (CBaseShotgun)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar6 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar6 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
      }
      *(int *)(this + 0x1420) = iVar5 + 1;
      (**(code **)(*(int *)pCVar4 + 0x450))(pCVar4,1,*(undefined4 *)(this + 0x1418));
      return;
    }
    if (iVar5 != 3) {
      return;
    }
    if (*(float *)(gpGlobals + 0xc) <=
        *(float *)(this + 0x1800) + *(float *)(this + 0x17fc) + *(float *)(this + 0x1808) +
        (float)(*(int *)(this + 0x17f8) + -1) * *(float *)(this + 0x1804)) {
      return;
    }
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar2 = *(CBaseEdict **)(this + 0x30);
      if (pCVar2 != (CBaseEdict *)0x0) {
        *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
        iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
        *(undefined2 *)(iVar5 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x17f4) = 0;
    if (this[0x1459] != (CBaseShotgun)0x0) {
      if (this[0x6c] == (CBaseShotgun)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
      }
      this[0x1459] = (CBaseShotgun)0x0;
    }
    UNRECOVERED_JUMPTABLE = *(code **)(*(int *)pCVar4 + 0x8f4);
  }
  else {
    UNRECOVERED_JUMPTABLE = *(code **)(*(int *)this + 0x464);
  }
                    /* WARNING: Could not recover jumptable at 0x005274cf. Too many branches */
                    /* WARNING: Treating indirect jump as call */
  (*UNRECOVERED_JUMPTABLE)();
  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)