L L4D2node

CBaseCombatCharacter::Weapon_EquipAmmoOnly

0x005f2570 · 516 bytes · __thiscall

_ZN20CBaseCombatCharacter20Weapon_EquipAmmoOnlyEP17CBaseCombatWeapon

Decompiled

undefined (2 params)

/* CBaseCombatCharacter::Weapon_EquipAmmoOnly(CBaseCombatWeapon*) */

bool __thiscall
CBaseCombatCharacter::Weapon_EquipAmmoOnly(CBaseCombatCharacter *this,CBaseCombatWeapon *param_1)

{
  uint uVar1;
  CBaseEntity *this_00;
  undefined4 uVar2;
  CBaseEdict *pCVar3;
  char cVar4;
  char *pcVar5;
  int iVar6;
  int iVar7;
  undefined *puVar8;
  undefined4 uVar9;
  int iVar10;
  int iVar11;
  
  iVar11 = 0;
  do {
    uVar1 = *(uint *)(this + iVar11 * 4 + 0x18f4);
    if ((((uVar1 != 0xffffffff) &&
         (puVar8 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar8 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar8 + 8) == uVar1 >> 0xc)) &&
       (this_00 = *(CBaseEntity **)(puVar8 + 4), this_00 != (CBaseEntity *)0x0)) {
      pcVar5 = *(char **)(param_1 + 0x7c);
      if (pcVar5 == (char *)0x0) {
        pcVar5 = "";
      }
      if ((pcVar5 == *(char **)(this_00 + 0x7c)) ||
         (cVar4 = CBaseEntity::ClassMatchesComplex(this_00,pcVar5), cVar4 != '\0')) {
        cVar4 = (**(code **)(*(int *)param_1 + 0x548))(param_1);
        if (cVar4 == '\0') {
          uVar2 = *(undefined4 *)(param_1 + 0x144c);
          cVar4 = (**(code **)(*(int *)param_1 + 0x54c))(param_1);
        }
        else {
          uVar2 = *(undefined4 *)(param_1 + 0x1420);
          cVar4 = (**(code **)(*(int *)param_1 + 0x54c))(param_1);
        }
        if (cVar4 == '\0') {
          uVar9 = *(undefined4 *)(param_1 + 0x1450);
        }
        else {
          uVar9 = *(undefined4 *)(param_1 + 0x1424);
        }
        iVar11 = (**(code **)(*(int *)this + 0x44c))(this,uVar2,*(undefined4 *)(param_1 + 0x1418),0)
        ;
        iVar6 = (**(code **)(*(int *)this + 0x44c))(this,uVar9,*(undefined4 *)(param_1 + 0x141c),0);
        cVar4 = (**(code **)(*(int *)param_1 + 0x548))(param_1);
        if (cVar4 == '\0') {
          *(int *)(param_1 + 0x144c) = *(int *)(param_1 + 0x144c) - iVar11;
        }
        else {
          iVar10 = *(int *)(param_1 + 0x1420) - iVar11;
          if (*(int *)(param_1 + 0x1420) != iVar10) {
            if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
              pCVar3 = *(CBaseEdict **)(param_1 + 0x30);
              if (pCVar3 != (CBaseEdict *)0x0) {
                *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
                iVar7 = CBaseEdict::GetChangeAccessor(pCVar3);
                *(undefined2 *)(iVar7 + 2) = 0;
              }
            }
            else {
              param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
            }
            *(int *)(param_1 + 0x1420) = iVar10;
          }
        }
        cVar4 = (**(code **)(*(int *)param_1 + 0x54c))(param_1);
        if (cVar4 == '\0') {
          *(int *)(param_1 + 0x1450) = *(int *)(param_1 + 0x1450) - iVar6;
        }
        else {
          iVar10 = *(int *)(param_1 + 0x1424) - iVar6;
          if (*(int *)(param_1 + 0x1424) != iVar10) {
            if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
              pCVar3 = *(CBaseEdict **)(param_1 + 0x30);
              if (pCVar3 != (CBaseEdict *)0x0) {
                *(uint *)pCVar3 = *(uint *)pCVar3 | 0x101;
                iVar7 = CBaseEdict::GetChangeAccessor(pCVar3);
                *(undefined2 *)(iVar7 + 2) = 0;
              }
            }
            else {
              param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
            }
            *(int *)(param_1 + 0x1424) = iVar10;
          }
        }
        return 0 < iVar11 || 0 < iVar6;
      }
    }
    iVar11 = iVar11 + 1;
    if (iVar11 == 0x38) {
      return false;
    }
  } while( true );
}

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)