L L4D2node

CSoundEnt::Think

0x0082ceb0 · 2722 bytes · __thiscall

_ZN9CSoundEnt5ThinkEv

Decompiled

undefined (1 param)

/* CSoundEnt::Think() */

void __thiscall CSoundEnt::Think(CSoundEnt *this)

{
  CSound *this_00;
  short sVar1;
  int iVar2;
  int iVar3;
  int iVar4;
  undefined4 uVar5;
  undefined4 uVar6;
  uint uVar7;
  uint uVar8;
  float *pfVar9;
  Vector *pVVar10;
  undefined *puVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  ulonglong uVar15;
  int local_50;
  float local_4c;
  float local_48;
  float local_44;
  float local_40;
  float local_3c;
  float local_38;
  float local_34;
  float local_30;
  float local_2c;
  float local_28;
  float local_24;
  float local_20;
  
  CBaseEntity::SetNextThink((CBaseEntity *)this,*(float *)(gpGlobals + 0xc) + 0.1,(char *)0x0);
  local_50 = -1;
  iVar3 = *(int *)(this + 0x444);
  do {
    while( true ) {
      iVar2 = iVar3;
      if (iVar2 == -1) {
        return;
      }
      if ((*(float *)(gpGlobals + 0xc) < *(float *)(this + iVar2 * 0x34 + 0x464)) ||
         (this[iVar2 * 0x34 + 0x46a] != (CSoundEnt)0x0)) break;
LAB_0082cf39:
      sVar1 = *(short *)(this + iVar2 * 0x34 + 0x468);
      iVar3 = *(int *)(displaysoundlist._28_4_ + 0x30);
      if (iVar3 == 1) {
        Msg("  Removed Sound: %d (Time:%f)\n",*(undefined4 *)(this + iVar2 * 0x34 + 0x45c),
            (double)*(float *)(gpGlobals + 0xc));
        iVar3 = *(int *)(displaysoundlist._28_4_ + 0x30);
      }
      iVar4 = g_pSoundEnt;
      if ((iVar3 == 2) && ((*(uint *)(this + iVar2 * 0x34 + 0x45c) & 8) != 0)) {
        Msg("  Removed Danger Sound: %d (time:%f)\n",*(uint *)(this + iVar2 * 0x34 + 0x45c),
            (double)*(float *)(gpGlobals + 0xc));
        iVar4 = g_pSoundEnt;
      }
      iVar3 = (int)sVar1;
      g_pSoundEnt = iVar4;
      if (iVar4 != 0) {
        if (local_50 == -1) {
          *(int *)(iVar4 + 0x444) = (int)*(short *)(iVar4 + 0x468 + iVar2 * 0x34);
        }
        else {
          *(undefined2 *)(iVar4 + 0x468 + local_50 * 0x34) =
               *(undefined2 *)(iVar4 + 0x468 + iVar2 * 0x34);
        }
        *(short *)(iVar4 + 0x468 + iVar2 * 0x34) = (short)*(undefined4 *)(iVar4 + 0x440);
        *(int *)(iVar4 + 0x440) = iVar2;
      }
    }
    iVar3 = iVar2 * 0x34;
    this_00 = (CSound *)(this + iVar3 + 0x44c);
    if ((this[iVar3 + 0x47c] != (CSoundEnt)0x0) &&
       ((((uVar7 = *(uint *)(this + iVar3 + 0x44c), uVar7 == 0xffffffff ||
          (puVar11 = g_pEntityList + (uVar7 & 0xfff) * 0x10, puVar11 == (undefined *)0xfffffffc)) ||
         (*(uint *)(puVar11 + 8) != uVar7 >> 0xc)) || (*(int *)(puVar11 + 4) == 0))))
    goto LAB_0082cf39;
    if (*(int *)(displaysoundlist._28_4_ + 0x30) != 0) {
      (**(code **)(*(int *)this + 0x24c))(this,&local_4c,&local_40);
      if ((*(int *)(displaysoundlist._28_4_ + 0x30) == 1) ||
         ((*(int *)(displaysoundlist._28_4_ + 0x30) == 2 &&
          ((*(uint *)(this + iVar3 + 0x45c) & 8) != 0)))) {
        fVar12 = (float)*(int *)(this + iVar3 + 0x454);
        uVar7 = -(uint)((*(uint *)(this + iVar3 + 0x45c) & 8) == 0);
        uVar8 = uVar7 & 0xff;
        fVar14 = local_4c * fVar12;
        fVar13 = local_48 * fVar12;
        fVar12 = fVar12 * local_44;
        pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
        local_28 = fVar14 + *pfVar9;
        local_24 = fVar13 + pfVar9[1];
        local_20 = fVar12 + pfVar9[2];
        pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
        NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0xff,uVar8,0,false,0.1);
        fVar12 = (float)*(int *)(this + iVar3 + 0x454);
        fVar13 = local_4c * fVar12;
        fVar14 = local_48 * fVar12;
        fVar12 = fVar12 * local_44;
        pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
        local_28 = *pfVar9 - fVar13;
        local_24 = pfVar9[1] - fVar14;
        local_20 = pfVar9[2] - fVar12;
        pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
        NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0xff,uVar8,0,false,0.1);
        fVar12 = (float)*(int *)(this + iVar3 + 0x454);
        fVar14 = local_40 * fVar12;
        fVar13 = local_3c * fVar12;
        fVar12 = fVar12 * local_38;
        pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
        local_28 = fVar14 + *pfVar9;
        local_24 = fVar13 + pfVar9[1];
        local_20 = fVar12 + pfVar9[2];
        pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
        NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0xff,uVar8,0,false,0.1);
        fVar12 = (float)*(int *)(this + iVar3 + 0x454);
        fVar13 = local_40 * fVar12;
        fVar14 = local_3c * fVar12;
        fVar12 = fVar12 * local_38;
        pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
        local_28 = *pfVar9 - fVar13;
        local_24 = pfVar9[1] - fVar14;
        local_20 = pfVar9[2] - fVar12;
        pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
        NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0xff,uVar8,0,false,0.1);
        fVar12 = (float)*(int *)(this + iVar3 + 0x454);
        fVar14 = local_34 * fVar12;
        fVar13 = local_30 * fVar12;
        fVar12 = fVar12 * local_2c;
        pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
        local_28 = fVar14 + *pfVar9;
        local_24 = fVar13 + pfVar9[1];
        local_20 = fVar12 + pfVar9[2];
        pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
        NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0xff,uVar8,0,false,0.1);
        fVar12 = (float)*(int *)(this + iVar3 + 0x454);
        fVar13 = local_34 * fVar12;
        fVar14 = local_30 * fVar12;
        fVar12 = fVar12 * local_2c;
        pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
        local_28 = *pfVar9 - fVar13;
        local_24 = pfVar9[1] - fVar14;
        local_20 = pfVar9[2] - fVar12;
        pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
        uVar15 = CONCAT44(uVar7,0xff) & 0xffffffffff;
        NDebugOverlay::Line(pVVar10,(Vector *)&local_28,(int)uVar15,(int)(uVar15 >> 0x20),0,false,
                            0.1);
        if (*(float *)(this + iVar3 + 0x458) != 1.0) {
          fVar13 = (float)*(int *)(this + iVar3 + 0x454) * *(float *)(this + iVar3 + 0x458);
          fVar14 = local_48 * fVar13;
          fVar12 = local_4c * fVar13;
          fVar13 = fVar13 * local_44;
          pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
          local_28 = fVar12 + *pfVar9;
          local_24 = fVar14 + pfVar9[1];
          local_20 = fVar13 + pfVar9[2];
          pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
          NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0,0x96,0xff,false,0.1);
          fVar12 = (float)*(int *)(this + iVar3 + 0x454) * *(float *)(this + iVar3 + 0x458);
          fVar14 = local_48 * fVar12;
          fVar13 = local_4c * fVar12;
          fVar12 = fVar12 * local_44;
          pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
          local_28 = *pfVar9 - fVar13;
          local_24 = pfVar9[1] - fVar14;
          local_20 = pfVar9[2] - fVar12;
          pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
          NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0,0x96,0xff,false,0.1);
          fVar12 = (float)*(int *)(this + iVar3 + 0x454) * *(float *)(this + iVar3 + 0x458);
          fVar13 = local_40 * fVar12;
          fVar14 = local_3c * fVar12;
          fVar12 = fVar12 * local_38;
          pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
          local_28 = fVar13 + *pfVar9;
          local_24 = fVar14 + pfVar9[1];
          local_20 = fVar12 + pfVar9[2];
          pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
          NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0,0x96,0xff,false,0.1);
          fVar12 = (float)*(int *)(this + iVar3 + 0x454) * *(float *)(this + iVar3 + 0x458);
          fVar14 = local_3c * fVar12;
          fVar13 = local_40 * fVar12;
          fVar12 = fVar12 * local_38;
          pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
          local_28 = *pfVar9 - fVar13;
          local_24 = pfVar9[1] - fVar14;
          local_20 = pfVar9[2] - fVar12;
          pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
          NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0,0x96,0xff,false,0.1);
          fVar12 = (float)*(int *)(this + iVar3 + 0x454) * *(float *)(this + iVar3 + 0x458);
          fVar13 = local_34 * fVar12;
          fVar14 = local_30 * fVar12;
          fVar12 = fVar12 * local_2c;
          pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
          local_28 = fVar13 + *pfVar9;
          local_24 = fVar14 + pfVar9[1];
          local_20 = fVar12 + pfVar9[2];
          pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
          NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0,0x96,0xff,false,0.1);
          fVar12 = (float)*(int *)(this + iVar3 + 0x454) * *(float *)(this + iVar3 + 0x458);
          fVar13 = local_34 * fVar12;
          fVar14 = local_30 * fVar12;
          fVar12 = fVar12 * local_2c;
          pfVar9 = (float *)CSound::GetSoundOrigin(this_00);
          local_28 = *pfVar9 - fVar13;
          local_24 = pfVar9[1] - fVar14;
          local_20 = pfVar9[2] - fVar12;
          pVVar10 = (Vector *)CSound::GetSoundOrigin(this_00);
          NDebugOverlay::Line(pVVar10,(Vector *)&local_28,0,0x96,0xff,false,0.1);
        }
      }
      iVar4 = ISoundsInList(this,2);
      iVar3 = *(int *)(this + 0x448);
      uVar5 = ISoundsInList(this,1);
      uVar6 = ISoundsInList(this,2);
      DevMsg(2,"Soundlist: %d / %d  (%d)\n",uVar6,uVar5,iVar4 - iVar3);
      uVar5 = ISoundsInList(this,2);
      *(undefined4 *)(this + 0x448) = uVar5;
    }
    iVar3 = (int)*(short *)(this + iVar2 * 0x34 + 0x468);
    local_50 = iVar2;
  } 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)