L L4D2node

CSoundPatch::AddPlayerPost

0x004c0be0 · 574 bytes · __thiscall

_ZN11CSoundPatch13AddPlayerPostEP11CBasePlayer

Decompiled

undefined (2 params)

/* CSoundPatch::AddPlayerPost(CBasePlayer*) */

void __thiscall CSoundPatch::AddPlayerPost(CSoundPatch *this,CBasePlayer *param_1)

{
  uint uVar1;
  int iVar2;
  undefined *puVar3;
  int iVar4;
  undefined **local_80 [8];
  int local_60;
  undefined1 *local_5c;
  float local_58;
  undefined4 local_54;
  uint local_50;
  int local_4c;
  CSoundPatch *local_48;
  undefined4 local_44;
  undefined4 local_40;
  undefined1 local_3c;
  undefined1 local_3b;
  undefined1 local_3a;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_2c;
  undefined4 local_28;
  undefined4 local_24;
  undefined2 local_20;
  
  if (((byte)this[100] & 1) == 0) {
    return;
  }
  if (*(int *)(param_1 + 0x30) == 0) {
    local_60 = 0;
  }
  else {
    local_60 = *(int *)(param_1 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
    if (local_60 < 0) {
      return;
    }
  }
  iVar4 = *(int *)(this + 0x74);
  if (0 < iVar4) {
    if (local_60 == **(int **)(this + 0x68)) {
      return;
    }
    iVar2 = 0;
    do {
      iVar2 = iVar2 + 1;
      if (iVar2 == iVar4) goto LAB_004c0c48;
    } while (local_60 != (*(int **)(this + 0x68))[iVar2]);
    if (iVar2 != -1) {
      return;
    }
  }
LAB_004c0c48:
  CUtlVector<int,CUtlMemory<int,int>>::InsertBefore
            ((CUtlVector<int,CUtlMemory<int,int>> *)(this + 0x68),iVar4,&local_60);
  CRecipientFilter::CRecipientFilter((CRecipientFilter *)local_80);
  local_80[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
                    /* try { // try from 004c0c7a to 004c0c7e has its CatchHandler @ 004c0e37 */
  CRecipientFilter::AddRecipient((CRecipientFilter *)local_80,param_1);
  local_48 = (CSoundPatch *)0x0;
  local_20 = 0xffff;
  local_60 = *(int *)(this + 0x3c);
  local_44 = 0;
  uVar1 = *(uint *)(this + 0x38);
  local_40 = 0;
  local_58 = *(float *)(this + 0x10) * *(float *)(this + 0x5c);
  local_3c = 1;
  local_5c = &DAT_00d539c2;
  if (*(undefined1 **)(this + 0x30) != (undefined1 *)0x0) {
    local_5c = *(undefined1 **)(this + 0x30);
  }
  local_3b = 0;
  local_3a = 0;
  local_54 = *(undefined4 *)(this + 0x24);
  local_38 = 0xffffffff;
  local_34 = 0;
  local_30 = 0;
  local_2c = 0;
  local_28 = 0;
  local_50 = *(uint *)(this + 0x54) | 1;
  local_24 = 0;
  local_4c = (int)*(float *)this;
  if ((((uVar1 != 0xffffffff) &&
       (puVar3 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar3 != (undefined *)0xfffffffc)) &&
      (*(uint *)(puVar3 + 8) == uVar1 >> 0xc)) && (iVar4 = *(int *)(puVar3 + 4), iVar4 != 0)) {
    if ((*(int *)(iVar4 + 0x30) == 0) ||
       (*(int *)(iVar4 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 == 0)) {
      local_48 = this + 0x44;
      if (uVar1 >> 0xc != *(uint *)(puVar3 + 8)) goto LAB_004c0d47;
      iVar4 = *(int *)(puVar3 + 4);
    }
    if (iVar4 != 0) {
      if (*(int *)(iVar4 + 0x30) == 0) {
        iVar4 = 0;
      }
      else {
        iVar4 = *(int *)(iVar4 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
      }
      goto LAB_004c0d4c;
    }
  }
LAB_004c0d47:
  iVar4 = -1;
LAB_004c0d4c:
                    /* try { // try from 004c0d5a to 004c0d5e has its CatchHandler @ 004c0e49 */
  CBaseEntity::EmitSound((IRecipientFilter *)local_80,iVar4,(EmitSound_t *)&local_60);
  local_28 = 0;
  CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_34);
  local_24 = local_34;
  CUtlMemory<Vector,int>::Purge((CUtlMemory<Vector,int> *)&local_34);
  local_80[0] = &PTR__CSingleUserRecipientFilter_00c08ea8;
  CRecipientFilter::~CRecipientFilter((CRecipientFilter *)local_80);
  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)