L L4D2node

CBaseCombatWeapon::FinishReload

0x004078c0 · 528 bytes · __thiscall

_ZN17CBaseCombatWeapon12FinishReloadEv

Decompiled

undefined (1 param)

/* CBaseCombatWeapon::FinishReload() */

void __thiscall CBaseCombatWeapon::FinishReload(CBaseCombatWeapon *this)

{
  CBaseEdict *pCVar1;
  char cVar2;
  CBaseCombatCharacter *this_00;
  int iVar3;
  int iVar4;
  int iVar5;
  
  this_00 = (CBaseCombatCharacter *)GetOwner(this);
  if (this_00 != (CBaseCombatCharacter *)0x0) {
    cVar2 = (**(code **)(*(int *)this + 0x548))(this);
    if (cVar2 != '\0') {
      iVar3 = (**(code **)(*(int *)this + 0x510))(this);
      iVar5 = *(int *)(this + 0x1420);
      iVar4 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418));
      if (iVar3 - iVar5 < iVar4) {
        iVar3 = (**(code **)(*(int *)this + 0x510))(this);
        iVar5 = *(int *)(this + 0x1420);
        iVar3 = iVar3 - iVar5;
      }
      else {
        iVar3 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x1418));
        iVar5 = *(int *)(this + 0x1420);
      }
      if (iVar3 + iVar5 != iVar5) {
        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 + iVar5;
      }
      (**(code **)(*(int *)this_00 + 0x450))(this_00,iVar3,*(undefined4 *)(this + 0x1418));
    }
    cVar2 = (**(code **)(*(int *)this + 0x54c))(this);
    if (cVar2 != '\0') {
      iVar3 = (**(code **)(*(int *)this + 0x514))(this);
      iVar5 = *(int *)(this + 0x1424);
      iVar4 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x141c));
      if (iVar3 - iVar5 < iVar4) {
        iVar3 = (**(code **)(*(int *)this + 0x514))(this);
        iVar5 = *(int *)(this + 0x1424);
        iVar3 = iVar3 - iVar5;
      }
      else {
        iVar3 = CBaseCombatCharacter::GetAmmoCount(this_00,*(int *)(this + 0x141c));
        iVar5 = *(int *)(this + 0x1424);
      }
      if (iVar3 + iVar5 != iVar5) {
        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 + 0x1424) = iVar3 + iVar5;
      }
      (**(code **)(*(int *)this_00 + 0x450))(this_00,iVar3,*(undefined4 *)(this + 0x141c));
    }
    if ((this[0x145d] != (CBaseCombatWeapon)0x0) && (this[0x1459] != (CBaseCombatWeapon)0x0)) {
      if (this[0x6c] == (CBaseCombatWeapon)0x0) {
        pCVar1 = *(CBaseEdict **)(this + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar5 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar5 + 2) = 0;
        }
      }
      else {
        this[0x70] = (CBaseCombatWeapon)((byte)this[0x70] | 1);
      }
      this[0x1459] = (CBaseCombatWeapon)0x0;
      return;
    }
  }
  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)