L L4D2node

CCSPlayer::BumpWeapon

0x00654850 · 857 bytes · __thiscall

_ZN9CCSPlayer10BumpWeaponEP17CBaseCombatWeapon

Decompiled

undefined (2 params)

/* CCSPlayer::BumpWeapon(CBaseCombatWeapon*) */

undefined4 __thiscall CCSPlayer::BumpWeapon(CCSPlayer *this,CBaseCombatWeapon *param_1)

{
  code *pcVar1;
  CBaseEdict *this_00;
  char cVar2;
  CBaseCombatWeapon *this_01;
  int iVar3;
  int *piVar4;
  undefined4 uVar5;
  char *pcVar6;
  undefined4 *puVar7;
  int iVar8;
  int iVar9;
  byte *pbVar10;
  undefined4 uVar11;
  byte *pbVar12;
  byte *pbVar13;
  bool bVar14;
  bool bVar15;
  byte bVar16;
  
  bVar16 = 0;
  if ((param_1 == (CBaseCombatWeapon *)0x0) ||
     (this_01 = (CBaseCombatWeapon *)
                __dynamic_cast(param_1,&CBaseCombatWeapon::typeinfo,&CWeaponCSBase::typeinfo,0),
     this_01 == (CBaseCombatWeapon *)0x0)) {
    CCollisionProperty::SetSolidFlags
              ((CCollisionProperty *)(param_1 + 0x194),(uint)(*(ushort *)(param_1 + 0x1b4) | 4));
    CBaseEntity::AddEffects((CBaseEntity *)param_1,0x20);
    (**(code **)(*(int *)this + 0x468))(this,param_1);
    return 1;
  }
  iVar3 = CBaseCombatWeapon::GetOwner(this_01);
  if (((iVar3 == 0) && (cVar2 = (**(code **)(*(int *)this + 0x464))(this,this_01), cVar2 != '\0'))
     && (uVar11 = (**(code **)(*g_pGameRules + 0x14c))(g_pGameRules,this,this_01),
        (char)uVar11 != '\0')) {
    iVar3 = CWeaponCSBase::GetCSWpnData((CWeaponCSBase *)this_01);
    bVar14 = *(int *)(iVar3 + 0x894) == 7;
    if (bVar14) {
      pcVar6 = "";
      if (*(char **)(this_01 + 0x7c) != (char *)0x0) {
        pcVar6 = *(char **)(this_01 + 0x7c);
      }
      piVar4 = (int *)CBaseCombatCharacter::Weapon_OwnsThisType
                                ((CBaseCombatCharacter *)this,pcVar6,0);
      if (piVar4 != (int *)0x0) {
        iVar3 = (**(code **)(*piVar4 + 0x55c))(piVar4);
        iVar8 = 0;
        if (iVar3 != -1) {
          iVar8 = CBaseCombatCharacter::GetAmmoCount((CBaseCombatCharacter *)this,iVar3);
        }
        puVar7 = (undefined4 *)GetAmmoDef();
        iVar3 = (**(code **)*puVar7)(puVar7,iVar3,this);
        if (iVar3 <= iVar8) goto LAB_0065489f;
      }
    }
    else {
      cVar2 = (**(code **)(*(int *)this + 0x480))(this,this_01);
      if (cVar2 != '\0') goto LAB_0065489f;
    }
    (**(code **)(*(int *)this_01 + 0x5b0))(this_01);
    CCollisionProperty::SetSolidFlags
              ((CCollisionProperty *)(this_01 + 0x194),(uint)(*(ushort *)(this_01 + 0x1b4) | 4));
    CBaseEntity::AddEffects((CBaseEntity *)this_01,0x20);
    (**(code **)(*(int *)this + 0x468))(this,this_01);
    iVar3 = *(int *)(this_01 + 0x14fc);
    if (((iVar3 != 0) && (!bVar14)) &&
       (iVar8 = (**(code **)(*(int *)this_01 + 0x55c))(this_01), iVar8 != -1)) {
      if (*(int *)(this_01 + 0x14fc) != 0) {
        if (this_01[0x6c] == (CBaseCombatWeapon)0x0) {
          this_00 = *(CBaseEdict **)(this_01 + 0x30);
          if (this_00 != (CBaseEdict *)0x0) {
            *(uint *)this_00 = *(uint *)this_00 | 0x101;
            iVar9 = CBaseEdict::GetChangeAccessor(this_00);
            *(undefined2 *)(iVar9 + 2) = 0;
          }
        }
        else {
          this_01[0x70] = (CBaseCombatWeapon)((byte)this_01[0x70] | 1);
        }
        *(undefined4 *)(this_01 + 0x14fc) = 0;
      }
      CBaseCombatCharacter::SetAmmoCount((CBaseCombatCharacter *)this,iVar3,iVar8);
    }
    piVar4 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"item_pickup",0,0);
    if (piVar4 != (int *)0x0) {
      pbVar10 = *(byte **)(this_01 + 0x7c);
      bVar14 = false;
      if (pbVar10 == (byte *)0x0) {
        pbVar10 = &DAT_00d539c2;
      }
      else {
        iVar3 = 7;
        bVar15 = false;
        pbVar12 = pbVar10;
        pbVar13 = (byte *)"weapon_";
        do {
          if (iVar3 == 0) break;
          iVar3 = iVar3 + -1;
          bVar14 = *pbVar12 < *pbVar13;
          bVar15 = *pbVar12 == *pbVar13;
          pbVar12 = pbVar12 + (uint)bVar16 * -2 + 1;
          pbVar13 = pbVar13 + (uint)bVar16 * -2 + 1;
        } while (bVar15);
        if ((!bVar14 && !bVar15) == bVar14) {
          pbVar10 = pbVar10 + 7;
        }
      }
      pcVar1 = *(code **)(*piVar4 + 0x30);
      uVar5 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
      (*pcVar1)(piVar4,"userid",uVar5);
      (**(code **)(*piVar4 + 0x3c))(piVar4,"item",pbVar10);
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar4,0);
    }
  }
  else {
    if (gEvilImpulse101 != 0) {
      UTIL_Remove((CBaseEntity *)this_01);
      return 0;
    }
LAB_0065489f:
    uVar11 = 0;
  }
  return uVar11;
}

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)