L L4D2node

CEnvSoundscape::UpdateForPlayer

0x0082ebd0 · 2180 bytes · __thiscall

_ZN14CEnvSoundscape15UpdateForPlayerER11ss_update_t

Decompiled

undefined (2 params)

/* CEnvSoundscape::UpdateForPlayer(ss_update_t&) */

void __thiscall CEnvSoundscape::UpdateForPlayer(CEnvSoundscape *this,ss_update_t *param_1)

{
  Vector *pVVar1;
  uint uVar2;
  char cVar3;
  int iVar4;
  Vector *pVVar5;
  CBasePlayer *pCVar6;
  char *pcVar7;
  uint uVar8;
  ushort in_FPUStatusWord;
  float fVar9;
  float fVar10;
  float fVar11;
  float fVar12;
  float fVar13;
  double dVar14;
  float local_e8;
  float local_e4;
  float local_e0;
  CTraceFilterSimple local_dc [16];
  undefined4 local_cc;
  undefined4 local_c8;
  undefined4 local_c4;
  float local_bc;
  float local_b8;
  float local_b4;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a4;
  undefined4 local_9c;
  undefined4 local_98;
  undefined4 local_94;
  undefined4 local_8c;
  undefined1 local_88;
  undefined1 local_87;
  undefined4 local_70;
  undefined4 local_6c;
  undefined4 local_68;
  Vector local_64 [32];
  float local_44;
  char local_39;
  
  if ((this[0x48c] == (CEnvSoundscape)0x0) && (cVar3 = IsEnabled(), cVar3 != '\0')) {
    (**(code **)(*(int *)this + 0x240))();
    fVar12 = *(float *)(param_1 + 8) - local_e8;
    fVar10 = *(float *)(param_1 + 0x10) - local_e0;
    fVar11 = *(float *)(param_1 + 0xc) - local_e4;
    fVar9 = fVar12 * fVar12 + fVar10 * fVar10 + fVar11 * fVar11;
    fVar13 = SQRT(fVar9);
    if (*(CEnvSoundscape **)(param_1 + 4) == this) {
      param_1[0x1c] = (ss_update_t)0x0;
      *(float *)(param_1 + 0x14) = fVar13;
      if ((fVar13 < *(float *)(this + 0x458)) || (*(float *)(this + 0x458) == -1.0)) {
        *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) + 1;
        local_87 = fVar9 != 0.0;
        local_94 = 0;
        local_98 = 0;
        local_9c = 0;
        local_a4 = 0;
        local_a8 = 0;
        local_ac = 0;
        local_8c = 0;
        local_88 = 1;
        local_bc = fVar12;
        local_b8 = fVar11;
        local_b4 = fVar10;
        CTraceFilterSimple::CTraceFilterSimple
                  (local_dc,*(IHandleEntity **)param_1,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
        (**(code **)(*enginetrace + 0x14))
                  (enginetrace,&local_cc,0x403b,local_dc,(Vector *)&local_70);
        if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
          DebugDrawLine((Vector *)&local_70,local_64,0xff,0,0,true,-1.0);
        }
        if ((local_44 == 1.0) && (local_39 == '\0')) {
          param_1[0x1c] = (ss_update_t)0x1;
        }
      }
    }
    else if (((param_1[0x1c] == (ss_update_t)0x0) || (fVar13 < *(float *)(param_1 + 0x14))) &&
            ((fVar13 < *(float *)(this + 0x458) || (*(float *)(this + 0x458) == -1.0)))) {
      *(int *)(param_1 + 0x18) = *(int *)(param_1 + 0x18) + 1;
      local_87 = fVar9 != 0.0;
      local_94 = 0;
      local_98 = 0;
      local_9c = 0;
      local_a4 = 0;
      local_a8 = 0;
      local_ac = 0;
      local_8c = 0;
      local_88 = 1;
      local_bc = fVar12;
      local_b8 = fVar11;
      local_b4 = fVar10;
      CTraceFilterSimple::CTraceFilterSimple
                (local_dc,*(IHandleEntity **)param_1,0,(_func_bool_IHandleEntity_ptr_int *)0x0);
      (**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x403b,local_dc,(Vector *)&local_70);
      if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
        DebugDrawLine((Vector *)&local_70,local_64,0xff,0,0,true,-1.0);
      }
      if ((local_44 == 1.0) && (local_39 == '\0')) {
        WriteAudioParamsTo(this,(audioparams_t *)(*(int *)param_1 + 0x1b9c));
        *(CEnvSoundscape **)(param_1 + 4) = this;
        param_1[0x1c] = (ss_update_t)0x1;
        *(float *)(param_1 + 0x14) = fVar13;
      }
    }
    if (*(int *)(soundscape_debug._28_4_ + 0x30) != 0) {
      local_70 = 0x41200000;
      local_6c = 0x41200000;
      local_68 = 0x41200000;
      local_cc = 0xc1200000;
      local_c8 = 0xc1200000;
      local_c4 = 0xc1200000;
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      pVVar1 = (Vector *)(this + 0x2e0);
      NDebugOverlay::Box(pVVar1,(Vector *)&local_cc,(Vector *)&local_70,0xff,0,0xff,0x40,0.01023);
      pCVar6 = *(CBasePlayer **)param_1;
      if (pCVar6 != (CBasePlayer *)0x0) {
        if (*(int *)(this + 0x30) == 0) {
          iVar4 = 0;
        }
        else {
          iVar4 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
        }
        if (*(int *)(pCVar6 + 0x1c08) == iVar4) {
          cVar3 = InRangeOfPlayer(this,pCVar6);
          if (cVar3 == '\0') {
            pVVar5 = (Vector *)(**(code **)(**(int **)param_1 + 0x288))(*(int **)param_1);
            if (((byte)this[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
            }
            NDebugOverlay::Line(pVVar1,pVVar5,0xff,0xaa,0,true,0.01023);
          }
          else {
            pVVar5 = (Vector *)(**(code **)(**(int **)param_1 + 0x288))(*(int **)param_1);
            if (((byte)this[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
            }
            NDebugOverlay::Line(pVVar1,pVVar5,0,0xff,0,true,0.01023);
          }
          uVar2 = *(uint *)(pCVar6 + 0x1c04);
          dVar14 = (double)*(float *)(gpGlobals + 0xc);
          do {
            dVar14 = dVar14 - (dVar14 / 2.0) * 2.0;
          } while ((in_FPUStatusWord & 0x400) != 0);
          dVar14 = sin((dVar14 + -1.0) * 3.141592653589793);
          uVar8 = 0;
          pCVar6 = pCVar6 + 0x1ba0;
          do {
            if ((uVar2 >> (uVar8 & 0x1f) & 1) != 0) {
              if (((byte)this[0x14d] & 8) != 0) {
                CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
              }
              NDebugOverlay::Line(pVVar1,(Vector *)pCVar6,0,0x20,0xff,false,0.01023);
              NDebugOverlay::Cross3D
                        ((Vector *)pCVar6,(float)(dVar14 + dVar14) + 16.0,0,0,0xff,false,0.01023);
            }
            uVar8 = uVar8 + 1;
            pCVar6 = pCVar6 + 0xc;
          } while (uVar8 != 8);
        }
        else {
          cVar3 = InRangeOfPlayer(this,pCVar6);
          iVar4 = **(int **)param_1;
          if (cVar3 == '\0') {
            pVVar5 = (Vector *)(**(code **)(iVar4 + 0x288))(*(int **)param_1);
            if (((byte)this[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
            }
            NDebugOverlay::Line(pVVar1,pVVar5,0xff,0,0,true,0.01023);
          }
          else {
            pVVar5 = (Vector *)(**(code **)(iVar4 + 0x288))();
            if (((byte)this[0x14d] & 8) != 0) {
              CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
            }
            NDebugOverlay::Line(pVVar1,pVVar5,0xff,0xff,0xff,true,0.01023);
          }
        }
      }
      pcVar7 = "";
      if (*(char **)(this + 0x45c) != (char *)0x0) {
        pcVar7 = *(char **)(this + 0x45c);
      }
      if (((byte)this[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
      }
      NDebugOverlay::EntityTextAtPosition(pVVar1,0,pcVar7,0.01023,0xff,0xff,0xff,0xff);
      return;
    }
  }
  else if (*(CEnvSoundscape **)(param_1 + 4) == this) {
    *(undefined4 *)(param_1 + 4) = 0;
    *(undefined4 *)(param_1 + 0x14) = 0;
    param_1[0x1c] = (ss_update_t)0x0;
    return;
  }
  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)