L L4D2node

SurvivorIntention::UpdateThreats

0x0094c8b0 · 2902 bytes · __thiscall

_ZN17SurvivorIntention13UpdateThreatsEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* SurvivorIntention::UpdateThreats() */

void __thiscall SurvivorIntention::UpdateThreats(SurvivorIntention *this)

{
  uint uVar1;
  uint uVar2;
  uint uVar3;
  uint uVar4;
  uint uVar5;
  uint uVar6;
  uint uVar7;
  uint uVar8;
  code *pcVar9;
  CBaseEntity *this_00;
  bool bVar10;
  uint uVar11;
  char cVar12;
  int iVar13;
  int *piVar14;
  IVision *this_01;
  RecognizedActor *pRVar15;
  CBaseCombatCharacter *pCVar16;
  undefined4 uVar17;
  undefined4 uVar18;
  int iVar19;
  uint *puVar20;
  INextBot *this_02;
  undefined *puVar21;
  int iVar22;
  uint *puVar23;
  undefined4 uVar24;
  int iVar25;
  undefined4 uVar26;
  uint uVar27;
  int in_GS_OFFSET;
  longdouble lVar28;
  int local_1a4;
  int local_1a0;
  int local_190;
  int local_188;
  int *local_184;
  undefined4 local_178;
  undefined4 local_174;
  undefined4 local_170;
  int local_16c [5];
  int local_158 [11];
  CFmtStrN<256> local_12c [5];
  char local_127 [263];
  int local_20;
  
  iVar25 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if (0 < *(int *)(this + 0x70)) {
LAB_0094c96d:
    do {
      puVar21 = g_pEntityList;
      iVar13 = iVar25 * 0x2c;
      puVar23 = (uint *)(*(int *)(this + 100) + iVar13);
      uVar27 = *puVar23;
      *(undefined1 *)(puVar23 + 10) = 0;
      if ((((uVar27 == 0xffffffff) ||
           (puVar21 = puVar21 + (uVar27 & 0xfff) * 0x10, puVar21 == (undefined *)0xfffffffc)) ||
          (*(uint *)(puVar21 + 8) != uVar27 >> 0xc)) ||
         ((piVar14 = *(int **)(puVar21 + 4), piVar14 == (int *)0x0 ||
          (cVar12 = (**(code **)(*piVar14 + 300))(piVar14), cVar12 == '\0')))) {
LAB_0094c9b3:
        bVar10 = true;
      }
      else {
        local_184 = (int *)0x0;
        uVar27 = *puVar23;
        if ((uVar27 != 0xffffffff) &&
           ((puVar21 = g_pEntityList + (uVar27 & 0xfff) * 0x10, puVar21 != (undefined *)0xfffffffc
            && (*(uint *)(puVar21 + 8) == uVar27 >> 0xc)))) {
          local_184 = *(int **)(puVar21 + 4);
        }
        cVar12 = (**(code **)(*local_184 + 0x558))(local_184);
        if (cVar12 != '\0') goto LAB_0094c9b3;
        bVar10 = false;
      }
      if (0.0 < (float)puVar23[6]) {
        lVar28 = (longdouble)IntervalTimer::Now();
        if ((float)lVar28 - (float)puVar23[6] <= 30.0) goto LAB_0094ca09;
LAB_0094c921:
        iVar19 = *(int *)(this + 0x70);
        iVar22 = (iVar19 - iVar25) + -1;
        if (0 < iVar22) {
          _V_memmove((void *)(*(int *)(this + 100) + iVar13),
                     (void *)(*(int *)(this + 100) + 0x2c + iVar13),iVar22 * 0x2c);
          iVar19 = *(int *)(this + 0x70);
        }
        *(int *)(this + 0x70) = iVar19 + -1;
        if (iVar19 + -1 <= iVar25) break;
        goto LAB_0094c96d;
      }
      if (((float)puVar23[8] <= 0.0) ||
         (lVar28 = (longdouble)IntervalTimer::Now(), 5.0 < (float)lVar28 - (float)puVar23[8]))
      goto LAB_0094c921;
LAB_0094ca09:
      if (bVar10) goto LAB_0094c921;
      iVar25 = iVar25 + 1;
    } while (iVar25 < *(int *)(this + 0x70));
  }
  local_16c[0] = 0;
  local_16c[1] = 0;
  local_16c[2] = 0;
  local_16c[3] = 0;
  local_16c[4] = 0;
                    /* try { // try from 0094ca6e to 0094cc0c has its CatchHandler @ 0094d432 */
  piVar14 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
  this_01 = (IVision *)(**(code **)(*piVar14 + 0xcc))(piVar14);
  IVision::ForEachRecognized<VisibleThreatCollector>(this_01,(VisibleThreatCollector *)local_16c);
  if (0 < local_16c[3]) {
    iVar25 = 0;
    do {
      while( true ) {
        piVar14 = *(int **)(local_16c[0] + iVar25 * 4);
        cVar12 = (**(code **)(*piVar14 + 300))(piVar14);
        if (cVar12 != '\0') break;
LAB_0094cac0:
        iVar25 = iVar25 + 1;
        if (local_16c[3] <= iVar25) goto LAB_0094cb55;
      }
      piVar14 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
      cVar12 = (**(code **)(*piVar14 + 0xd8))(piVar14,*(undefined4 *)(local_16c[0] + iVar25 * 4));
      if (cVar12 == '\0') goto LAB_0094cac0;
      pCVar16 = *(CBaseCombatCharacter **)(local_16c[0] + iVar25 * 4);
      pRVar15 = (RecognizedActor *)FindRecognized(this,pCVar16);
      if (pRVar15 == (RecognizedActor *)0x0) {
                    /* try { // try from 0094cffe to 0094d0ac has its CatchHandler @ 0094d432 */
        RecognizedActor::RecognizedActor((RecognizedActor *)local_158,pCVar16);
        RecognizedActor::UpdateVisible((RecognizedActor *)local_158);
        CUtlVector<RecognizedActor,CUtlMemory<RecognizedActor,int>>::InsertBefore
                  ((CUtlVector<RecognizedActor,CUtlMemory<RecognizedActor,int>> *)(this + 100),
                   *(int *)(this + 0x70),(RecognizedActor *)local_158);
        goto LAB_0094cac0;
      }
      RecognizedActor::UpdateVisible(pRVar15);
      iVar25 = iVar25 + 1;
    } while (iVar25 < local_16c[3]);
  }
LAB_0094cb55:
  if (0 < *(int *)(this + 0x84)) {
    iVar25 = 0;
    do {
      while( true ) {
        iVar13 = iVar25 * 8;
        uVar27 = *(uint *)(iVar13 + *(int *)(this + 0x78));
        if ((((uVar27 == 0xffffffff) ||
             (puVar21 = g_pEntityList + (uVar27 & 0xfff) * 0x10, puVar21 == (undefined *)0xfffffffc)
             ) || (*(uint *)(puVar21 + 8) != uVar27 >> 0xc)) ||
           ((pCVar16 = *(CBaseCombatCharacter **)(puVar21 + 4),
            pCVar16 == (CBaseCombatCharacter *)0x0 ||
            (*(float *)(gpGlobals + 0xc) < (float)((uint *)(iVar13 + *(int *)(this + 0x78)))[1]))))
        break;
        pRVar15 = (RecognizedActor *)FindRecognized(this,pCVar16);
        if (pRVar15 == (RecognizedActor *)0x0) {
          RecognizedActor::RecognizedActor((RecognizedActor *)local_158,pCVar16);
          RecognizedActor::UpdateAudible((RecognizedActor *)local_158);
          CUtlVector<RecognizedActor,CUtlMemory<RecognizedActor,int>>::InsertBefore
                    ((CUtlVector<RecognizedActor,CUtlMemory<RecognizedActor,int>> *)(this + 100),
                     *(int *)(this + 0x70),(RecognizedActor *)local_158);
        }
        else {
          RecognizedActor::UpdateAudible(pRVar15);
        }
        iVar19 = *(int *)(this + 0x84);
        iVar22 = (iVar19 - iVar25) + -1;
        if (0 < iVar22) {
          _V_memmove((void *)(*(int *)(this + 0x78) + iVar13),
                     (void *)(*(int *)(this + 0x78) + 8 + iVar13),iVar22 * 8);
          iVar19 = *(int *)(this + 0x84);
        }
        *(int *)(this + 0x84) = iVar19 + -1;
        if (iVar19 + -1 <= iVar25) goto LAB_0094cc45;
      }
      iVar25 = iVar25 + 1;
    } while (iVar25 < *(int *)(this + 0x84));
  }
LAB_0094cc45:
  local_158[0] = 0;
  local_158[1] = 0;
  local_158[2] = 0;
  local_158[3] = 0;
  local_158[4] = 0;
                    /* try { // try from 0094cc80 to 0094ce14 has its CatchHandler @ 0094d468 */
  ForEachSurvivor<CDominatedSurvivorsScan>((CDominatedSurvivorsScan *)local_158);
  iVar25 = 0;
  if (0 < local_158[3]) {
    do {
      pCVar16 = (CBaseCombatCharacter *)
                CTerrorPlayer::GetSpecialInfectedDominatingMe
                          (*(CTerrorPlayer **)(local_158[0] + iVar25 * 4));
      AddThreat(this,pCVar16);
      iVar25 = iVar25 + 1;
    } while (iVar25 < local_158[3]);
  }
  if (1 < *(int *)(this + 0x70)) {
    local_1a4 = 0x2c;
    local_1a0 = 0;
    do {
      iVar25 = *(int *)(this + 100);
      local_188 = local_1a4;
      puVar23 = (uint *)(iVar25 + local_1a4);
      uVar5 = puVar23[4];
      uVar6 = *puVar23;
      uVar11 = puVar23[10];
      uVar27 = puVar23[1];
      uVar7 = puVar23[9];
      uVar1 = puVar23[2];
      uVar2 = puVar23[3];
      uVar3 = puVar23[6];
      uVar4 = puVar23[8];
      local_190 = local_1a0;
      while( true ) {
        uVar8 = *(uint *)(iVar25 + -0x2c + local_188);
        pcVar9 = *(code **)(*(int *)this + 0xcc);
        iVar13 = local_188 + -0x2c;
        uVar24 = 0;
        if (((uVar8 != 0xffffffff) &&
            (puVar21 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar21 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar21 + 8) == uVar8 >> 0xc)) {
          uVar24 = *(undefined4 *)(puVar21 + 4);
        }
        uVar26 = 0;
        if (((uVar6 != 0xffffffff) &&
            (puVar21 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar21 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar21 + 8) == uVar6 >> 0xc)) {
          uVar26 = *(undefined4 *)(puVar21 + 4);
        }
        piVar14 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
        uVar17 = (**(code **)(*piVar14 + 0xb4))(piVar14);
        uVar18 = (**(code **)(*(int *)this + 0xb0))(this);
        iVar25 = (*pcVar9)(this,uVar18,uVar17,uVar26,uVar24);
        if (iVar25 == 0) {
          iVar25 = *(int *)(this + 100);
          puVar23 = (uint *)(iVar25 + iVar13);
        }
        else {
          if (*(int *)(iVar25 + 0x30) == 0) {
            iVar19 = 0;
          }
          else {
            iVar19 = *(int *)(iVar25 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
          }
          iVar25 = *(int *)(this + 100);
          puVar23 = (uint *)(iVar13 + iVar25);
          uVar8 = *puVar23;
          iVar22 = _DAT_00000030;
          if (((uVar8 != 0xffffffff) &&
              (puVar21 = g_pEntityList + (uVar8 & 0xfff) * 0x10, puVar21 != (undefined *)0xfffffffc)
              ) && (*(uint *)(puVar21 + 8) == uVar8 >> 0xc)) {
            iVar22 = *(int *)(*(int *)(puVar21 + 4) + 0x30);
          }
          if (iVar22 == 0) {
            if (iVar19 == 0) goto LAB_0094d110;
          }
          else if (iVar19 == iVar22 - *(int *)(gpGlobals + 0x58) >> 4) goto LAB_0094d110;
        }
        local_190 = local_190 + -1;
        puVar20 = (uint *)(local_188 + iVar25);
        *puVar20 = *puVar23;
        puVar20[1] = puVar23[1];
        puVar20[2] = puVar23[2];
        puVar20[3] = puVar23[3];
        puVar20[4] = puVar23[4];
        puVar20[6] = puVar23[6];
        puVar20[8] = puVar23[8];
        puVar20[9] = puVar23[9];
        *(char *)(puVar20 + 10) = (char)puVar23[10];
        if (local_190 == -1) break;
        iVar25 = *(int *)(this + 100);
        local_188 = iVar13;
      }
      iVar25 = *(int *)(this + 100);
LAB_0094d110:
      local_1a4 = local_1a4 + 0x2c;
      puVar23 = (uint *)((local_190 + 1) * 0x2c + iVar25);
      puVar23[1] = uVar27;
      puVar23[2] = uVar1;
      *puVar23 = uVar6;
      puVar23[3] = uVar2;
      puVar23[6] = uVar3;
      puVar23[8] = uVar4;
      puVar23[4] = uVar5;
      *(char *)(puVar23 + 10) = (char)uVar11;
      puVar23[9] = uVar7;
      iVar25 = local_1a0 + 2;
      local_1a0 = local_1a0 + 1;
    } while (iVar25 < *(int *)(this + 0x70));
  }
                    /* try { // try from 0094d1b9 to 0094d3a5 has its CatchHandler @ 0094d468 */
  this_02 = (INextBot *)(**(code **)(*(int *)this + 0xb0))(this);
  cVar12 = INextBot::IsDebugging(this_02,2);
  if ((cVar12 != '\0') && (0 < *(int *)(this + 0x70))) {
    iVar25 = 0;
    uVar27 = 0;
    do {
      uVar1 = *(uint *)(*(int *)(this + 100) + iVar25);
      if ((((uVar1 != 0xffffffff) &&
           (puVar21 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar21 != (undefined *)0xfffffffc))
          && (*(uint *)(puVar21 + 8) == uVar1 >> 0xc)) &&
         (this_00 = *(CBaseEntity **)(puVar21 + 4), this_00 != (CBaseEntity *)0x0)) {
        if (uVar27 < 3) {
          local_188 = (&CSWTCH_3586)[uVar27];
          local_184 = (int *)0xff;
        }
        else {
          local_188 = 0xff;
          local_184 = (int *)0x0;
        }
        local_178 = 0xc2b40000;
        local_174 = 0;
        local_170 = 0;
        if (((byte)this_00[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(this_00);
        }
        NDebugOverlay::Circle
                  ((Vector *)(this_00 + 0x2e0),(QAngle *)&local_178,10.0,(int)local_184,local_188,0,
                   0xff,true,0.01023);
        if (*(char *)(*(int *)(this + 100) + 0x28 + iVar25) == '\0') {
          CFmtStrN<256>::CFmtStrN(local_12c,"(%d)",uVar27);
        }
        else {
          CFmtStrN<256>::CFmtStrN(local_12c,"%d",uVar27);
        }
        if (((byte)this_00[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(this_00);
        }
        NDebugOverlay::Text((Vector *)(this_00 + 0x2e0),local_127,false,0.01023);
      }
      uVar27 = uVar27 + 1;
      iVar25 = iVar25 + 0x2c;
    } while ((int)uVar27 < *(int *)(this + 0x70));
  }
  local_158[3] = 0;
  CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_158);
  local_158[4] = local_158[0];
  CUtlMemory<CTerrorPlayer*,int>::Purge((CUtlMemory<CTerrorPlayer*,int> *)local_158);
  local_16c[3] = 0;
  CUtlMemory<CBaseCombatCharacter*,int>::Purge((CUtlMemory<CBaseCombatCharacter*,int> *)local_16c);
  local_16c[4] = local_16c[0];
  CUtlMemory<CBaseCombatCharacter*,int>::Purge((CUtlMemory<CBaseCombatCharacter*,int> *)local_16c);
  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)