L L4D2node

CTerrorPlayer::BumpWeapon

0x0099c200 · 2058 bytes · __thiscall

_ZN13CTerrorPlayer10BumpWeaponEP17CBaseCombatWeapon

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CTerrorPlayer::BumpWeapon(CBaseCombatWeapon*) */

char __thiscall CTerrorPlayer::BumpWeapon(CTerrorPlayer *this,CBaseCombatWeapon *param_1)

{
  CBaseEdict *pCVar1;
  code *pcVar2;
  char cVar3;
  char cVar4;
  int iVar5;
  CBaseEntity *pCVar6;
  int *piVar7;
  CTerrorPlayer *pCVar8;
  CTerrorPlayer *pCVar9;
  CBaseCSGrenade *this_00;
  int iVar10;
  int iVar11;
  undefined4 uVar12;
  byte *pbVar13;
  byte *pbVar14;
  byte *pbVar15;
  bool bVar16;
  bool bVar17;
  byte bVar18;
  longdouble lVar19;
  longdouble lVar20;
  
  bVar18 = 0;
  if (param_1 == (CBaseCombatWeapon *)0x0) {
    CCollisionProperty::SetSolidFlags((CCollisionProperty *)0x194,_DAT_000001b4 | 4);
    CBaseEntity::AddEffects((CBaseEntity *)0x0,0x20);
    (**(code **)(*(int *)this + 0x468))(this,0);
    return '\x01';
  }
  iVar5 = CBaseCombatWeapon::GetOwner(param_1);
  if (((iVar5 != 0) || (cVar3 = (**(code **)(*(int *)this + 0x464))(this,param_1), cVar3 == '\0'))
     || (cVar3 = (**(code **)(*g_pGameRules + 0x14c))(g_pGameRules,this,param_1), cVar3 == '\0')) {
    if (gEvilImpulse101 == 0) {
      return '\0';
    }
    UTIL_Remove((CBaseEntity *)param_1);
    return '\0';
  }
  pCVar6 = (CBaseEntity *)(**(code **)(*(int *)param_1 + 0x500))(param_1);
  if ((pCVar6 != (CBaseEntity *)0x0) &&
     (cVar4 = (**(code **)(*(int *)pCVar6 + 0x70c))(pCVar6), cVar4 != '\0')) {
    iVar5 = (**(code **)(*(int *)pCVar6 + 0x638))(pCVar6);
    piVar7 = (int *)CCSPlayer::GetCSWeapon((CCSPlayer *)this,iVar5);
    if ((piVar7 != (int *)0x0) &&
       (piVar7 = (int *)(**(code **)(*piVar7 + 0x500))(piVar7), piVar7 != (int *)0x0)) {
      cVar4 = (**(code **)(*piVar7 + 0x674))(piVar7);
      if (cVar4 == '\0') {
        cVar3 = (**(code **)(*piVar7 + 0x71c))(piVar7);
        if (cVar3 == '\0') {
          return '\0';
        }
        iVar5 = *(int *)(pCVar6 + 0x14fc);
        if ((iVar5 != 0) && (iVar10 = (**(code **)(*(int *)pCVar6 + 0x55c))(pCVar6), iVar10 != -1))
        {
          if (*(int *)(pCVar6 + 0x14fc) != 0) {
            if (pCVar6[0x6c] == (CBaseEntity)0x0) {
              pCVar1 = *(CBaseEdict **)(pCVar6 + 0x30);
              if (pCVar1 != (CBaseEdict *)0x0) {
                *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
                iVar11 = CBaseEdict::GetChangeAccessor(pCVar1);
                *(undefined2 *)(iVar11 + 2) = 0;
              }
            }
            else {
              pCVar6[0x70] = (CBaseEntity)((byte)pCVar6[0x70] | 1);
            }
            *(undefined4 *)(pCVar6 + 0x14fc) = 0;
          }
          CBaseCombatCharacter::SetAmmoCount((CBaseCombatCharacter *)this,iVar5,iVar10);
        }
        pCVar8 = (CTerrorPlayer *)(**(code **)(*(int *)pCVar6 + 0x5e0))(pCVar6);
        if ((((pCVar8 != (CTerrorPlayer *)0x0) &&
             (cVar4 = (**(code **)(*(int *)pCVar8 + 0x16c))(pCVar8), cVar4 != '\0')) &&
            (this != pCVar8)) &&
           ((pCVar9 = (CTerrorPlayer *)(**(code **)(*(int *)pCVar6 + 0x678))(pCVar6), this == pCVar9
            && (piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))
                                          (gameeventmanager,"weapon_given",0,0),
               piVar7 != (int *)0x0)))) {
          pcVar2 = *(code **)(*piVar7 + 0x30);
          uVar12 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
          (*pcVar2)(piVar7,"userid",uVar12);
          pcVar2 = *(code **)(*piVar7 + 0x30);
          uVar12 = (**(code **)(*engine + 0x40))(engine,*(int *)(pCVar8 + 0x30));
          (*pcVar2)(piVar7,"giver",uVar12);
          pcVar2 = *(code **)(*piVar7 + 0x30);
          uVar12 = (**(code **)(*(int *)pCVar6 + 0x638))(pCVar6);
          (*pcVar2)(piVar7,"weapon",uVar12);
          if (*(int *)(pCVar6 + 0x30) == 0) {
            iVar5 = 0;
          }
          else {
            iVar5 = *(int *)(pCVar6 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
          }
          (**(code **)(*piVar7 + 0x30))(piVar7,"weaponentid",iVar5);
          (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
        }
        cVar4 = (**(code **)(*(int *)pCVar6 + 0x674))(pCVar6);
        if (cVar4 == '\0') {
          UTIL_Remove(pCVar6);
          return cVar3;
        }
        (**(code **)(*(int *)pCVar6 + 0x720))(pCVar6,0);
        return cVar4;
      }
      cVar4 = (**(code **)(*(int *)pCVar6 + 0x674))(pCVar6);
      if (cVar4 == '\0') {
        return '\0';
      }
    }
  }
  cVar4 = (**(code **)(*(int *)this + 0x480))(this,param_1);
  if (cVar4 != '\0') {
    pcVar2 = *(code **)(*(int *)this + 0x8ec);
    uVar12 = (**(code **)(*(int *)param_1 + 0x530))(param_1);
    (*pcVar2)(this,uVar12);
  }
  cVar4 = (**(code **)(*(int *)this + 0x480))(this,param_1);
  if (cVar4 != '\0') {
    return '\0';
  }
  (**(code **)(*(int *)param_1 + 0x5b0))(param_1);
  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);
  iVar5 = *(int *)(param_1 + 0x14fc);
  iVar10 = (**(code **)(*(int *)param_1 + 0x530))(param_1);
  if (((iVar10 != 2) && (iVar5 != 0)) &&
     (iVar10 = (**(code **)(*(int *)param_1 + 0x55c))(param_1), iVar10 != -1)) {
    if (*(int *)(param_1 + 0x14fc) != 0) {
      if (param_1[0x6c] == (CBaseCombatWeapon)0x0) {
        pCVar1 = *(CBaseEdict **)(param_1 + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar11 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar11 + 2) = 0;
        }
      }
      else {
        param_1[0x70] = (CBaseCombatWeapon)((byte)param_1[0x70] | 1);
      }
      *(undefined4 *)(param_1 + 0x14fc) = 0;
    }
    CBaseCombatCharacter::SetAmmoCount((CBaseCombatCharacter *)this,iVar5,iVar10);
  }
  piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"item_pickup",0,0);
  if (piVar7 != (int *)0x0) {
    pbVar13 = *(byte **)(param_1 + 0x7c);
    bVar16 = false;
    if (pbVar13 == (byte *)0x0) {
      pbVar13 = &DAT_00d539c2;
    }
    else {
      iVar5 = 7;
      bVar17 = false;
      pbVar14 = pbVar13;
      pbVar15 = (byte *)"weapon_";
      do {
        if (iVar5 == 0) break;
        iVar5 = iVar5 + -1;
        bVar16 = *pbVar14 < *pbVar15;
        bVar17 = *pbVar14 == *pbVar15;
        pbVar14 = pbVar14 + (uint)bVar18 * -2 + 1;
        pbVar15 = pbVar15 + (uint)bVar18 * -2 + 1;
      } while (bVar17);
      if ((!bVar16 && !bVar17) == bVar16) {
        pbVar13 = pbVar13 + 7;
      }
    }
    pcVar2 = *(code **)(*piVar7 + 0x30);
    uVar12 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
    (*pcVar2)(piVar7,"userid",uVar12);
    (**(code **)(*piVar7 + 0x3c))(piVar7,"item",pbVar13);
    (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
  }
  pCVar8 = (CTerrorPlayer *)(**(code **)(*(int *)param_1 + 0x5e0))(param_1);
  if ((((pCVar8 != (CTerrorPlayer *)0x0) &&
       (cVar4 = (**(code **)(*(int *)pCVar8 + 0x16c))(pCVar8), cVar4 != '\0')) && (this != pCVar8))
     && (pCVar9 = (CTerrorPlayer *)(**(code **)(*(int *)param_1 + 0x678))(param_1), this == pCVar9))
  {
    piVar7 = (int *)(**(code **)(*gameeventmanager + 0x1c))(gameeventmanager,"weapon_given",0,0);
    if (piVar7 != (int *)0x0) {
      pcVar2 = *(code **)(*piVar7 + 0x30);
      uVar12 = (**(code **)(*engine + 0x40))(engine,*(undefined4 *)(this + 0x30));
      (*pcVar2)(piVar7,"userid",uVar12);
      pcVar2 = *(code **)(*piVar7 + 0x30);
      uVar12 = (**(code **)(*engine + 0x40))(engine,*(int *)(pCVar8 + 0x30));
      (*pcVar2)(piVar7,"giver",uVar12);
      pcVar2 = *(code **)(*piVar7 + 0x30);
      uVar12 = (**(code **)(*(int *)param_1 + 0x638))(param_1);
      (*pcVar2)(piVar7,"weapon",uVar12);
      if (*(int *)(param_1 + 0x30) == 0) {
        iVar5 = 0;
      }
      else {
        iVar5 = *(int *)(param_1 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
      (**(code **)(*piVar7 + 0x30))(piVar7,"weaponentid",iVar5);
      (**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar7,0);
    }
    iVar5 = (**(code **)(*(int *)pCVar8 + 0x52c))(pCVar8);
    if ((iVar5 != 0) &&
       (iVar5 = (**(code **)(*(int *)pCVar8 + 0x52c))(pCVar8), (*(uint *)(iVar5 + 300) & 0x880) == 0
       )) {
      iVar5 = *(int *)(this + 0x100);
      if (*(int *)(pCVar8 + 0x100) <= iVar5) {
        lVar19 = (longdouble)(**(code **)(*(int *)this + 0x7e4))(this);
        iVar10 = *(int *)(pCVar8 + 0x100);
        lVar20 = (longdouble)(**(code **)(*(int *)pCVar8 + 0x7e4))(pCVar8);
        if ((float)lVar20 + (float)iVar10 <= (float)lVar19 + (float)iVar5) goto LAB_0099c5a4;
      }
      iVar5 = *(int *)(pCVar8 + 0x3948);
      if (pCVar8[0x6c] == (CTerrorPlayer)0x0) {
        pCVar1 = *(CBaseEdict **)(pCVar8 + 0x30);
        if (pCVar1 != (CBaseEdict *)0x0) {
          *(uint *)pCVar1 = *(uint *)pCVar1 | 0x101;
          iVar10 = CBaseEdict::GetChangeAccessor(pCVar1);
          *(undefined2 *)(iVar10 + 2) = 0;
        }
      }
      else {
        pCVar8[0x70] = (CTerrorPlayer)((byte)pCVar8[0x70] | 1);
      }
      *(int *)(pCVar8 + 0x3948) = iVar5 + 1;
    }
  }
LAB_0099c5a4:
  iVar5 = CWeaponCSBase::GetCSWpnData((CWeaponCSBase *)param_1);
  if (*(int *)(iVar5 + 0x894) != 7) {
    return cVar3;
  }
  this_00 = (CBaseCSGrenade *)
            __dynamic_cast(param_1,&CTerrorWeapon::typeinfo,&CBaseCSGrenade::typeinfo,0);
  if (this_00 != (CBaseCSGrenade *)0x0) {
    CBaseCSGrenade::GiveDefaultAmmo(this_00);
    return cVar3;
  }
  return cVar3;
}

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)