L L4D2node

CSoundscapeSystem::LevelInitPostEntity

0x008312e0 · 1429 bytes · __thiscall

_ZN17CSoundscapeSystem19LevelInitPostEntityEv

Decompiled

undefined (1 param)

/* CSoundscapeSystem::LevelInitPostEntity() */

void __thiscall CSoundscapeSystem::LevelInitPostEntity(CSoundscapeSystem *this)

{
  int iVar1;
  Vector *pVVar2;
  ushort *puVar3;
  float fVar4;
  ushort uVar5;
  CBaseEntity *this_00;
  code *pcVar6;
  uint uVar7;
  int *piVar8;
  undefined4 uVar9;
  int iVar10;
  short *psVar11;
  short sVar12;
  uint uVar13;
  int in_GS_OFFSET;
  longdouble lVar14;
  CUtlMemory<bbox_t,int> *local_4088;
  CUtlMemory<short,int> *local_4084;
  CUtlMemory<short,int> *local_4080;
  int local_4078;
  short local_406a;
  undefined4 local_4068;
  undefined4 local_4064;
  undefined4 local_4060;
  void *local_405c;
  undefined4 local_4058;
  undefined4 local_4054;
  int local_4050;
  void *local_404c;
  int local_4048 [5];
  int local_4034 [5];
  byte local_4020 [16384];
  int local_20;
  
  local_405c = (void *)0x0;
  local_4058 = 0;
  local_4054 = 0;
  local_4050 = 0;
  local_404c = (void *)0x0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
                    /* try { // try from 00831348 to 0083138b has its CatchHandler @ 0083184d */
  uVar7 = (**(code **)(*engine + 0x1e8))(engine);
  local_4050 = 0;
  if (uVar7 != 0) {
    CUtlVector<bbox_t,CUtlMemory<bbox_t,int>>::GrowVector
              ((CUtlVector<bbox_t,CUtlMemory<bbox_t,int>> *)&local_405c,uVar7);
    if ((0 < (int)(local_4050 - uVar7)) && (0 < (int)uVar7)) {
                    /* try { // try from 008317f5 to 00831825 has its CatchHandler @ 0083184d */
      _V_memmove((void *)((int)local_405c + uVar7 * 0x18),local_405c,(local_4050 - uVar7) * 0x18);
    }
  }
  local_4088 = (CUtlMemory<bbox_t,int> *)&local_405c;
  (**(code **)(*engine + 0x1ec))(engine,local_405c,uVar7);
  *(undefined4 *)(this + 0x34) = 0;
  if (uVar7 != 0) {
    CUtlVector<clusterSoundscapeList_t,CUtlMemory<clusterSoundscapeList_t,int>>::GrowVector
              ((CUtlVector<clusterSoundscapeList_t,CUtlMemory<clusterSoundscapeList_t,int>> *)
               (this + 0x28),uVar7);
    if ((int)(*(int *)(this + 0x34) - uVar7) < 1) {
      if ((int)uVar7 < 1) goto LAB_008313a1;
    }
    else {
      if ((int)uVar7 < 1) goto LAB_008313a1;
      _V_memmove((void *)((int)*(void **)(this + 0x28) + uVar7 * 4),*(void **)(this + 0x28),
                 (*(int *)(this + 0x34) - uVar7) * 4);
    }
    uVar13 = 0;
    do {
      *(undefined2 *)(*(int *)(this + 0x28) + uVar13 * 4) = 0;
      *(undefined2 *)(*(int *)(this + 0x28) + 2 + uVar13 * 4) = 0;
      uVar13 = uVar13 + 1;
    } while (uVar13 != uVar7);
  }
LAB_008313a1:
  local_4048[0] = 0;
  local_4048[1] = 0;
  local_4048[2] = 0;
  local_4048[3] = 0;
  local_4048[4] = 0;
  local_4034[0] = 0;
  local_4034[1] = 0;
  local_4034[2] = 0;
  local_4034[3] = 0;
  local_4034[4] = 0;
  if (*(int *)(this + 0x20) < 1) {
    *(undefined4 *)(this + 0x48) = 0;
  }
  else {
    local_4078 = 0;
    do {
      piVar8 = (int *)(local_4078 * 4 + *(int *)(this + 0x14));
      this_00 = (CBaseEntity *)*piVar8;
      if (this_00 != (CBaseEntity *)0x0) {
        if (((byte)this_00[0x14d] & 8) != 0) {
                    /* try { // try from 0083146e to 0083176a has its CatchHandler @ 008318ad */
          CBaseEntity::CalcAbsolutePosition(this_00);
          piVar8 = (int *)(local_4078 * 4 + *(int *)(this + 0x14));
        }
        local_4068 = *(undefined4 *)(this_00 + 0x2e0);
        local_4064 = *(undefined4 *)(this_00 + 0x2e4);
        local_4060 = *(undefined4 *)(this_00 + 0x2e8);
        fVar4 = *(float *)(*piVar8 + 0x458);
        pcVar6 = *(code **)(*engine + 0x34);
        uVar9 = (**(code **)(*engine + 0x30))(engine,(Vector *)&local_4068);
        (*pcVar6)(engine,uVar9,0x4000,local_4020);
        uVar13 = 0;
        if (0 < (int)uVar7) {
          do {
            while (((local_4020[(int)uVar13 >> 3] >> (uVar13 & 7) & 1) == 0 ||
                   (pVVar2 = (Vector *)((int)local_405c + uVar13 * 0x18),
                   lVar14 = (longdouble)
                            CalcSqrDistanceToAABB(pVVar2,pVVar2 + 0xc,(Vector *)&local_4068),
                   fVar4 * fVar4 <= (float)lVar14))) {
              uVar13 = uVar13 + 1;
              if (uVar13 == uVar7) goto LAB_008315d0;
            }
            psVar11 = (short *)(*(int *)(this + 0x28) + uVar13 * 4);
            *psVar11 = *psVar11 + 1;
            local_406a = (short)uVar13;
            CUtlVector<short,CUtlMemory<short,int>>::InsertBefore
                      ((CUtlVector<short,CUtlMemory<short,int>> *)local_4048,local_4048[3],
                       &local_406a);
            local_406a = (short)local_4078;
            CUtlVector<short,CUtlMemory<short,int>>::InsertBefore
                      ((CUtlVector<short,CUtlMemory<short,int>> *)local_4034,local_4034[3],
                       &local_406a);
            uVar13 = uVar13 + 1;
          } while (uVar13 != uVar7);
        }
      }
LAB_008315d0:
      iVar10 = local_4034[3];
      local_4078 = local_4078 + 1;
    } while (local_4078 < *(int *)(this + 0x20));
    *(undefined4 *)(this + 0x48) = 0;
    if (local_4034[3] != 0) {
      CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>>::GrowVector
                ((CUtlVector<unsigned_short,CUtlMemory<unsigned_short,int>> *)(this + 0x3c),
                 local_4034[3]);
      if ((0 < *(int *)(this + 0x48) - iVar10) && (0 < iVar10)) {
        _V_memmove((void *)((int)*(void **)(this + 0x3c) + iVar10 * 2),*(void **)(this + 0x3c),
                   (*(int *)(this + 0x48) - iVar10) * 2);
      }
    }
  }
  local_4080 = (CUtlMemory<short,int> *)local_4048;
  local_4084 = (CUtlMemory<short,int> *)local_4034;
  uVar13 = 0;
  sVar12 = 0;
  if (0 < (int)uVar7) {
    do {
      iVar10 = uVar13 * 4;
      uVar13 = uVar13 + 1;
      *(short *)(*(int *)(this + 0x28) + 2 + iVar10) = sVar12;
      psVar11 = (short *)(iVar10 + *(int *)(this + 0x28));
      sVar12 = sVar12 + *psVar11;
      *psVar11 = 0;
    } while (uVar13 != uVar7);
  }
  iVar10 = 0;
  if (0 < local_4034[3]) {
    do {
      puVar3 = (ushort *)(*(int *)(this + 0x28) + *(short *)(local_4048[0] + iVar10 * 2) * 4);
      uVar5 = *puVar3;
      *puVar3 = uVar5 + 1;
      iVar1 = iVar10 * 2;
      iVar10 = iVar10 + 1;
      *(undefined2 *)(*(int *)(this + 0x3c) + ((uint)puVar3[1] + (uint)uVar5) * 2) =
           *(undefined2 *)(local_4034[0] + iVar1);
    } while (iVar10 < local_4034[3]);
  }
  local_4034[3] = 0;
  CUtlMemory<short,int>::Purge(local_4084);
  local_4034[4] = local_4034[0];
  CUtlMemory<short,int>::Purge(local_4084);
  local_4048[3] = 0;
  CUtlMemory<short,int>::Purge(local_4080);
  local_4048[4] = local_4048[0];
  CUtlMemory<short,int>::Purge(local_4080);
  local_4050 = 0;
  CUtlMemory<bbox_t,int>::Purge(local_4088);
  local_404c = local_405c;
  CUtlMemory<bbox_t,int>::Purge(local_4088);
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  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)