L L4D2node

CBaseCombatWeapon::WeaponSound

0x00406610 · 1294 bytes · __thiscall

_ZN17CBaseCombatWeapon11WeaponSoundE13WeaponSound_tf

Decompiled

undefined (3 params)

/* CBaseCombatWeapon::WeaponSound(WeaponSound_t, float) */

void __thiscall CBaseCombatWeapon::WeaponSound(CBaseCombatWeapon *this,int param_2,float param_3)

{
  char cVar1;
  char *pcVar2;
  int iVar3;
  int *piVar4;
  CBasePlayer *pCVar5;
  int iVar6;
  CBaseEntity *pCVar7;
  CBaseEntity *this_00;
  undefined1 *puVar8;
  int in_GS_OFFSET;
  float local_108;
  Vector local_f4 [12];
  undefined **local_e8 [8];
  undefined4 local_c8;
  undefined4 local_c4;
  undefined4 local_c0;
  undefined4 local_bc;
  undefined4 local_b8;
  int local_b4;
  char local_b0;
  undefined4 local_ac;
  undefined1 local_a8;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  pcVar2 = (char *)(**(code **)(*(int *)this + 0x540))();
  puVar8 = &stack0xfffffed4;
  if ((pcVar2 == (char *)0x0) || (puVar8 = &stack0xfffffed4, *pcVar2 == '\0')) goto LAB_00406647;
  local_c8 = 0;
  local_c4 = 0x3f800000;
  local_c0 = 100;
  local_bc = 100;
  local_b8 = 100;
  local_b4 = 0x4b;
  local_a8 = 0;
  local_b0 = '\0';
  local_ac = 0;
  local_28 = 0;
  local_24 = 0;
  cVar1 = CBaseEntity::GetParametersForSound(pcVar2,(CSoundParameters *)&local_c8,(char *)0x0);
  puVar8 = &stack0xfffffed4;
  if (cVar1 == '\0') goto LAB_00406647;
  if (local_b0 == '\0') {
    iVar6 = GetOwner(this);
    iVar3 = local_b4;
    if (iVar6 == 0) {
      (**(code **)(*(int *)this + 0x28c))();
      CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_e8);
      local_e8[0] = &PTR__CPASFilter_00bfaf28;
                    /* try { // try from 00406a43 to 00406a47 has its CatchHandler @ 00406b65 */
      CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)local_e8,local_f4);
      local_e8[0] = &PTR__CPASAttenuationFilter_00c08ec8;
      local_108 = 4.0;
      if (0x32 < iVar3) {
        local_108 = 20.0 / (float)(iVar3 + -0x32);
      }
                    /* try { // try from 00406a9b to 00406ac3 has its CatchHandler @ 00406b85 */
      (**(code **)(*(int *)this + 0x28c))();
      CPASAttenuationFilter::Filter((CPASAttenuationFilter *)local_e8,local_f4,local_108);
                    /* try { // try from 00406ac9 to 00406b21 has its CatchHandler @ 00406b69 */
      cVar1 = (**(code **)(*(int *)this + 0x3a4))();
      if ((cVar1 != '\0') && (CBaseEntity::m_pPredictionPlayer != 0)) {
        CRecipientFilter::UsePredictionRules((CRecipientFilter *)local_e8);
      }
      if (*(int *)(this + 0x30) == 0) {
        iVar3 = 0;
      }
      else {
        iVar3 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
      CBaseEntity::EmitSound
                ((IRecipientFilter *)local_e8,iVar3,pcVar2,(Vector *)0x0,param_3,(float *)0x0);
    }
    else {
      piVar4 = (int *)GetOwner(this);
      (**(code **)(*piVar4 + 0x28c))();
      CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_e8);
      local_e8[0] = &PTR__CPASFilter_00bfaf28;
                    /* try { // try from 00406864 to 00406868 has its CatchHandler @ 00406b67 */
      CRecipientFilter::AddRecipientsByPAS((CRecipientFilter *)local_e8,local_f4);
      local_e8[0] = &PTR__CPASAttenuationFilter_00c08ec8;
      local_108 = 4.0;
      if (0x32 < iVar3) {
        local_108 = 20.0 / (float)(iVar3 + -0x32);
      }
                    /* try { // try from 004068a5 to 004068cd has its CatchHandler @ 00406b89 */
      (**(code **)(*piVar4 + 0x28c))();
      CPASAttenuationFilter::Filter((CPASAttenuationFilter *)local_e8,local_f4,local_108);
                    /* try { // try from 004068d3 to 0040699e has its CatchHandler @ 00406b87 */
      cVar1 = (**(code **)(*(int *)this + 0x3a4))();
      if ((cVar1 != '\0') && (CBaseEntity::m_pPredictionPlayer != 0)) {
        CRecipientFilter::UsePredictionRules((CRecipientFilter *)local_e8);
      }
      iVar3 = GetOwner(this);
      if (*(int *)(iVar3 + 0x30) == 0) {
        iVar3 = 0;
      }
      else {
        iVar3 = *(int *)(iVar3 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
      CBaseEntity::EmitSound
                ((IRecipientFilter *)local_e8,iVar3,pcVar2,(Vector *)0x0,param_3,(float *)0x0);
      if (param_2 == 0) {
        pCVar7 = (CBaseEntity *)GetOwner(this);
        this_00 = (CBaseEntity *)GetOwner(this);
        if (((byte)this_00[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(this_00);
        }
        CSoundEnt::InsertSound(1,(Vector *)(this_00 + 0x2e0),500,0.2,pCVar7,0,(CBaseEntity *)0x0);
      }
    }
    puVar8 = &stack0xfffffecc;
    local_e8[0] = &PTR__CPASFilter_00bfaf28;
    CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_e8);
    goto LAB_00406647;
  }
  iVar3 = GetOwner(this);
  puVar8 = &stack0xfffffed4;
  if (iVar3 == 0) goto LAB_00406647;
  piVar4 = (int *)GetOwner(this);
  cVar1 = (**(code **)(*piVar4 + 0x16c))();
  puVar8 = &stack0xfffffed4;
  if (cVar1 == '\0') goto LAB_00406647;
  pCVar5 = (CBasePlayer *)GetOwner(this);
  if (pCVar5 == (CBasePlayer *)0x0) {
LAB_004069f0:
    pCVar5 = (CBasePlayer *)0x0;
  }
  else {
    cVar1 = (**(code **)(*(int *)pCVar5 + 0x16c))();
    if (cVar1 == '\0') goto LAB_004069f0;
  }
  CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_e8);
  local_e8[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
                    /* try { // try from 0040676e to 00406772 has its CatchHandler @ 00406b37 */
  CRecipientFilter::AddRecipient((CRecipientFilter *)local_e8,pCVar5);
                    /* try { // try from 00406778 to 004067dc has its CatchHandler @ 00406b49 */
  cVar1 = (**(code **)(*(int *)this + 0x3a4))();
  if ((cVar1 != '\0') && (CBaseEntity::m_pPredictionPlayer != 0)) {
    CRecipientFilter::UsePredictionRules((CRecipientFilter *)local_e8);
  }
  iVar3 = GetOwner(this);
  if (*(int *)(iVar3 + 0x30) == 0) {
    iVar3 = 0;
  }
  else {
    iVar3 = *(int *)(iVar3 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
  }
  CBaseEntity::EmitSound
            ((IRecipientFilter *)local_e8,iVar3,pcVar2,(Vector *)0x0,param_3,(float *)0x0);
  local_e8[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
  CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_e8);
  puVar8 = &stack0xfffffed4;
LAB_00406647:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  *(undefined1 **)(puVar8 + -4) = &LAB_00406b37;
  __stack_chk_fail();
}

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)