L L4D2node

CTerrorGun::Reload

0x00565370 · 883 bytes · __thiscall

_ZN10CTerrorGun6ReloadEv

Decompiled

undefined (1 param)

/* CTerrorGun::Reload() */

undefined4 __thiscall CTerrorGun::Reload(CTerrorGun *this)

{
  uint uVar1;
  CBaseEdict *pCVar2;
  char cVar3;
  CTerrorPlayer *this_00;
  int iVar4;
  int iVar5;
  undefined4 uVar6;
  undefined *puVar7;
  float fVar8;
  
  this_00 = (CTerrorPlayer *)CTerrorWeapon::GetPlayerOwner((CTerrorWeapon *)this);
  if (this_00 != (CTerrorPlayer *)0x0) {
    uVar1 = *(uint *)(this_00 + 0x2e28);
    if (((((uVar1 == 0xffffffff) ||
          (puVar7 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar7 == (undefined *)0xfffffffc)) ||
         (*(uint *)(puVar7 + 8) != uVar1 >> 0xc)) || (*(int *)(puVar7 + 4) == 0)) &&
       (cVar3 = CTerrorPlayer::IsPerformingAction(this_00,0), cVar3 == '\0')) {
      if ((*(float *)(gpGlobals + 0xc) < *(float *)(this + 0x13fc)) &&
         (this[0x17e2] == (CTerrorGun)0x0)) {
        fVar8 = *(float *)(gpGlobals + 0xc) + 1.0;
        if (fVar8 == *(float *)(this + 0x152c)) {
          return 0;
        }
        if (this[0x6c] == (CTerrorGun)0x0) {
          pCVar2 = *(CBaseEdict **)(this + 0x30);
          if (pCVar2 != (CBaseEdict *)0x0) {
            *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
            iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
            *(undefined2 *)(iVar4 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
        }
        *(float *)(this + 0x152c) = fVar8;
        return 0;
      }
      cVar3 = CTerrorWeapon::Reload((CTerrorWeapon *)this);
      iVar4 = gpGlobals;
      fVar8 = *(float *)(gpGlobals + 0xc);
      if (fVar8 != *(float *)(this + 0x1400)) {
        if (this[0x6c] == (CTerrorGun)0x0) {
          pCVar2 = *(CBaseEdict **)(this + 0x30);
          if (pCVar2 != (CBaseEdict *)0x0) {
            *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
            iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
            *(undefined2 *)(iVar4 + 2) = 0;
            iVar4 = gpGlobals;
          }
        }
        else {
          this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
        }
        *(float *)(this + 0x1400) = fVar8;
        fVar8 = *(float *)(iVar4 + 0xc);
      }
      if (fVar8 != *(float *)(this + 0x1550)) {
        if (this[0x6c] == (CTerrorGun)0x0) {
          pCVar2 = *(CBaseEdict **)(this + 0x30);
          if (pCVar2 != (CBaseEdict *)0x0) {
            *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
            iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
            *(undefined2 *)(iVar4 + 2) = 0;
          }
        }
        else {
          this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
        }
        *(float *)(this + 0x1550) = fVar8;
      }
      if (cVar3 != '\0') {
        if (*(float *)(this + 0x152c) != 0.0) {
          if (this[0x6c] == (CTerrorGun)0x0) {
            pCVar2 = *(CBaseEdict **)(this + 0x30);
            if (pCVar2 != (CBaseEdict *)0x0) {
              *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
              iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
              *(undefined2 *)(iVar4 + 2) = 0;
            }
          }
          else {
            this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
          }
          *(undefined4 *)(this + 0x152c) = 0;
        }
        iVar4 = CBasePlayer::GetFOV((CBasePlayer *)this_00);
        iVar5 = (**(code **)(*(int *)this + 0x714))(this);
        if (iVar4 == iVar5) {
          CBasePlayer::SetFOV((CBasePlayer *)this_00,(CBaseEntity *)this_00,0,0.1,0);
        }
        iVar4 = CBaseCombatCharacter::GetAmmoCount
                          ((CBaseCombatCharacter *)this_00,*(int *)(this + 0x1418));
        if (iVar4 == 999) {
          uVar6 = *(undefined4 *)(this + 0x1420);
        }
        else {
          CBaseCombatCharacter::SetAmmoCount
                    ((CBaseCombatCharacter *)this_00,iVar4 + *(int *)(this + 0x1420),
                     *(int *)(this + 0x1418));
          uVar6 = 0;
          if (*(int *)(this + 0x1420) != 0) {
            if (this[0x6c] == (CTerrorGun)0x0) {
              pCVar2 = *(CBaseEdict **)(this + 0x30);
              if (pCVar2 != (CBaseEdict *)0x0) {
                *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
                iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
                *(undefined2 *)(iVar4 + 2) = 0;
              }
            }
            else {
              this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
            }
            *(undefined4 *)(this + 0x1420) = 0;
            uVar6 = 0;
          }
        }
        (**(code **)(*(int *)this_00 + 0x84c))
                  (this_00,this[0x145d],uVar6,*(int *)(this + 0x17dc) != 0);
        CWeaponCSBase::SendReloadEvents();
        return 1;
      }
    }
    fVar8 = *(float *)(gpGlobals + 0xc) + 1.0;
    if (fVar8 != *(float *)(this + 0x152c)) {
      if (this[0x6c] == (CTerrorGun)0x0) {
        pCVar2 = *(CBaseEdict **)(this + 0x30);
        if (pCVar2 != (CBaseEdict *)0x0) {
          *(uint *)pCVar2 = *(uint *)pCVar2 | 0x101;
          iVar4 = CBaseEdict::GetChangeAccessor(pCVar2);
          *(undefined2 *)(iVar4 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CTerrorGun)((byte)this[0x70] | 1);
      }
      *(float *)(this + 0x152c) = fVar8;
    }
  }
  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)