L L4D2node

CBaseShotgun::Reload

0x00527770 · 2070 bytes · __thiscall

_ZN12CBaseShotgun6ReloadEv

Decompiled

undefined (1 param)

/* CBaseShotgun::Reload() */

undefined4 __thiscall CBaseShotgun::Reload(CBaseShotgun *this)

{
  uint uVar1;
  code *pcVar2;
  CBaseEdict *pCVar3;
  char cVar4;
  CTerrorPlayer *this_00;
  int iVar5;
  int iVar6;
  undefined4 uVar7;
  int iVar8;
  CStudioHdr *pCVar9;
  undefined *puVar10;
  CStudioHdr *pCVar11;
  longdouble lVar12;
  longdouble lVar13;
  float fVar14;
  float fVar15;
  
  this_00 = (CTerrorPlayer *)CTerrorWeapon::GetPlayerOwner((CTerrorWeapon *)this);
  if ((this_00 == (CTerrorPlayer *)0x0) || ((*(uint *)(this_00 + 0x1cb0) & 0x801) != 0)) {
    return 0;
  }
  uVar1 = *(uint *)(this_00 + 0x2e28);
  if (((((uVar1 != 0xffffffff) &&
        (puVar10 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar10 + 8) == uVar1 >> 0xc)) && (*(int *)(puVar10 + 4) != 0)) ||
     (cVar4 = CTerrorPlayer::IsPerformingAction(this_00,0), iVar8 = gpGlobals, cVar4 != '\0')) {
    fVar15 = *(float *)(gpGlobals + 0xc) + 1.0;
    if (fVar15 == *(float *)(this + 0x152c)) {
      return 0;
    }
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x152c) = fVar15;
    return 0;
  }
  fVar15 = *(float *)(gpGlobals + 0xc);
  if ((fVar15 < *(float *)(this + 0x13fc)) && (this[0x17e2] == (CBaseShotgun)0x0)) {
    if (fVar15 + 1.0 == *(float *)(this + 0x152c)) {
      return 0;
    }
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x152c) = fVar15 + 1.0;
    return 0;
  }
  if (*(int *)(this + 0x17f4) != 0) {
    return 0;
  }
  if (*(float *)(this + 0x152c) != 0.0) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
        iVar8 = gpGlobals;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x152c) = 0;
    fVar15 = *(float *)(iVar8 + 0xc);
  }
  if (fVar15 != *(float *)(this + 0x1550)) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x1550) = fVar15;
  }
  if (*(int *)(this_00 + 0x2850) != 0) {
    if (this_00[0x6c] == (CTerrorPlayer)0x0) {
      pCVar3 = *(CBaseEdict **)(this_00 + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this_00[0x70] = (CTerrorPlayer)((byte)this_00[0x70] | 1);
    }
    *(undefined4 *)(this_00 + 0x2850) = 0;
  }
  iVar5 = CBaseCombatCharacter::GetAmmoCount
                    ((CBaseCombatCharacter *)this_00,*(int *)(this + 0x1418));
  iVar6 = (**(code **)(*(int *)this + 0x510))(this);
  iVar8 = *(int *)(this + 0x1420);
  if (iVar6 - iVar8 <= iVar5) {
    iVar5 = iVar6 - iVar8;
  }
  if (iVar5 < 1) {
    return 0;
  }
  (**(code **)(*(int *)this_00 + 0x84c))(this_00,1,iVar8,iVar8 != 0);
  if (*(int *)(this + 0x17f4) != 1) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x17f4) = 1;
  }
  if (*(int *)(this + 0x17f8) != iVar5) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(int *)(this + 0x17f8) = iVar5;
  }
  fVar15 = *(float *)(gpGlobals + 0xc);
  if (fVar15 != *(float *)(this + 0x17fc)) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x17fc) = fVar15;
  }
  if (this[0x1459] != (CBaseShotgun)0x1) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    this[0x1459] = (CBaseShotgun)0x1;
  }
  pcVar2 = *(code **)(*(int *)this + 0x340);
  uVar7 = (**(code **)(*(int *)this + 0x6bc))(this,0xc1);
  iVar8 = (*pcVar2)(this,uVar7);
  pCVar11 = *(CStudioHdr **)(this + 0x13e0);
  if (pCVar11 == (CStudioHdr *)0x0) {
    iVar6 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar6 == 0) {
      pCVar11 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      pCVar11 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar9 = (CStudioHdr *)0x0;
    if (pCVar11 != (CStudioHdr *)0x0) goto LAB_005279a0;
  }
  else {
LAB_005279a0:
    pCVar9 = (CStudioHdr *)0x0;
    if (*(int *)pCVar11 != 0) {
      pCVar9 = pCVar11;
    }
  }
  lVar12 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar9,iVar8);
  lVar13 = (longdouble)(**(code **)(*(int *)this + 0x59c))(this);
  if ((float)lVar12 * (float)lVar13 != *(float *)(this + 0x1800)) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x1800) = (float)lVar12 * (float)lVar13;
  }
  iVar8 = (**(code **)(*(int *)this + 0x340))(this,0x589);
  pCVar11 = *(CStudioHdr **)(this + 0x13e0);
  if (pCVar11 == (CStudioHdr *)0x0) {
    iVar6 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar6 == 0) {
      pCVar11 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      pCVar11 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar9 = (CStudioHdr *)0x0;
    if (pCVar11 != (CStudioHdr *)0x0) goto LAB_00527a12;
  }
  else {
LAB_00527a12:
    pCVar9 = (CStudioHdr *)0x0;
    if (*(int *)pCVar11 != 0) {
      pCVar9 = pCVar11;
    }
  }
  lVar12 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar9,iVar8);
  lVar13 = (longdouble)(**(code **)(*(int *)this + 0x59c))(this);
  if ((float)lVar12 * (float)lVar13 != *(float *)(this + 0x1804)) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x1804) = (float)lVar12 * (float)lVar13;
  }
  if (*(int *)(this + 0x180c) != 1) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x180c) = 1;
  }
  PlayReloadAnim(this,0xc1,0x26,iVar5);
  if (*(int *)(this + 0x1810) != 1) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(undefined4 *)(this + 0x1810) = 1;
  }
  pcVar2 = *(code **)(*(int *)this + 0x340);
  uVar7 = (**(code **)(*(int *)this + 0x6bc))(this,0x58a);
  iVar8 = (*pcVar2)(this,uVar7);
  pCVar11 = *(CStudioHdr **)(this + 0x13e0);
  if (pCVar11 == (CStudioHdr *)0x0) {
    iVar5 = CBaseEntity::GetModel((CBaseEntity *)this);
    if (iVar5 == 0) {
      pCVar11 = *(CStudioHdr **)(this + 0x13e0);
    }
    else {
      CBaseAnimating::LockStudioHdr((CBaseAnimating *)this);
      pCVar11 = *(CStudioHdr **)(this + 0x13e0);
    }
    pCVar9 = (CStudioHdr *)0x0;
    if (pCVar11 == (CStudioHdr *)0x0) goto LAB_00527b28;
  }
  pCVar9 = (CStudioHdr *)0x0;
  if (*(int *)pCVar11 != 0) {
    pCVar9 = pCVar11;
  }
LAB_00527b28:
  lVar12 = (longdouble)CBaseAnimating::SequenceDuration((CBaseAnimating *)this,pCVar9,iVar8);
  lVar13 = (longdouble)(**(code **)(*(int *)this + 0x59c))(this);
  fVar14 = (float)lVar12 * (float)lVar13;
  fVar15 = *(float *)(this + 0x1808);
  if (fVar14 != *(float *)(this + 0x1808)) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x1808) = fVar14;
    fVar15 = fVar14;
  }
  CTerrorGun::SetNextAttackTimes
            ((CTerrorGun *)this,
             (float)(*(int *)(this + 0x17f8) + -1) * *(float *)(this + 0x1804) +
             *(float *)(this + 0x1800) + fVar15);
  fVar15 = *(float *)(gpGlobals + 0xc);
  if (fVar15 != *(float *)(this + 0x1400)) {
    if (this[0x6c] == (CBaseShotgun)0x0) {
      pCVar3 = *(CBaseEdict **)(this + 0x30);
      if (pCVar3 != (CBaseEdict *)0x0) {
        *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
        iVar8 = CBaseEdict::GetChangeAccessor(pCVar3);
        *(undefined2 *)(iVar8 + 2) = 0;
      }
    }
    else {
      this[0x70] = (CBaseShotgun)((byte)this[0x70] | 1);
    }
    *(float *)(this + 0x1400) = fVar15;
  }
  CTerrorWeapon::SuppressHelpingHands
            ((CTerrorWeapon *)this,
             (float)(*(int *)(this + 0x17f8) + -1) * *(float *)(this + 0x1804) +
             *(float *)(this + 0x1808));
  return 1;
}

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)