L L4D2node

ForEachSurvivor<VisibleSurvivorsInRangeScan>

0x00a467f0 · 1608 bytes · __cdecl

_Z15ForEachSurvivorI27VisibleSurvivorsInRangeScanEbRT_

Decompiled

bool (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* bool ForEachSurvivor<VisibleSurvivorsInRangeScan>(VisibleSurvivorsInRangeScan&) */

bool ForEachSurvivor<VisibleSurvivorsInRangeScan>(VisibleSurvivorsInRangeScan *param_1)

{
  uint uVar1;
  char cVar2;
  CBaseEntity *this;
  int iVar3;
  float *pfVar4;
  undefined *puVar5;
  int iVar6;
  float fVar7;
  CBaseEntity *local_f8;
  undefined4 local_f4;
  undefined4 local_f0;
  undefined4 local_e8;
  undefined4 local_e4;
  int local_e0;
  undefined **local_dc [4];
  float local_cc;
  float local_c8;
  float 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;
  Vector local_70 [12];
  Vector local_64 [32];
  float local_44;
  char local_39;
  
  local_f4 = 0;
  local_f0 = 0;
  if (___atan2f_finite == 0) {
    local_e0 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_f4,0,0,0,0,"/data/src/game/server/terror/terrorplayer.h",
               0xb2c,&ForEachSurvivor<VisibleSurvivorsInRangeScan>(VisibleSurvivorsInRangeScan&)::
                      tm_fmt,"(%s)%s","Unaccounted","ForEachSurvivor");
    local_e0 = ___atan2f_finite;
  }
  iVar6 = _DAT_0105db00;
  local_e8 = local_f4;
  local_e4 = local_f0;
                    /* try { // try from 00a469be to 00a46a0c has its CatchHandler @ 00a46e55 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar3 = ThreadGetCurrentId(), iVar6 == iVar3)) {
    if ((char *)*_DAT_0105d15c != "ForEachSurvivor") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc21c28,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  if (0 < *(int *)(gpGlobals + 0x14)) {
    iVar6 = 1;
    do {
      while ((this = (CBaseEntity *)UTIL_PlayerByIndex(iVar6), this == (CBaseEntity *)0x0 ||
             (*(int *)(this + 0x30) == 0))) {
LAB_00a46910:
        iVar6 = iVar6 + 1;
        if (*(int *)(gpGlobals + 0x14) < iVar6) goto LAB_00a4694c;
      }
      if (*(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0) {
                    /* try { // try from 00a468e5 to 00a46924 has its CatchHandler @ 00a46e6d */
        cVar2 = (**(code **)(*(int *)this + 0x16c))(this);
        if (((cVar2 != '\0') && (*(int *)(this + 0x1f6c) != 2)) &&
           (iVar3 = CBaseEntity::GetTeamNumber(this), iVar3 == 2)) {
          local_f8 = this;
                    /* try { // try from 00a46a72 to 00a46d2a has its CatchHandler @ 00a46e6d */
          if (((((this != *(CBaseEntity **)(param_1 + 0x1c)) &&
                (cVar2 = (**(code **)(*(int *)this + 300))(this), cVar2 != '\0')) &&
               (iVar3 = CBaseEntity::GetTeamNumber(local_f8), iVar3 == 2)) &&
              ((param_1[0x20] == (VisibleSurvivorsInRangeScan)0x0 ||
               ((((cVar2 = (**(code **)(*(int *)local_f8 + 0x7e8))(local_f8), cVar2 == '\0' &&
                  (((uVar1 = *(uint *)(local_f8 + 0x3e68), uVar1 == 0xffffffff ||
                    (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10,
                    puVar5 == (undefined *)0xfffffffc)) ||
                   ((*(uint *)(puVar5 + 8) != uVar1 >> 0xc || (*(int *)(puVar5 + 4) == 0)))))) &&
                 (((uVar1 = *(uint *)(local_f8 + 0x33c4), uVar1 == 0xffffffff ||
                   (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10,
                   puVar5 == (undefined *)0xfffffffc)) ||
                  ((*(uint *)(puVar5 + 8) != uVar1 >> 0xc || (*(int *)(puVar5 + 4) == 0)))))) &&
                (((((uVar1 = *(uint *)(local_f8 + 0x3e48), uVar1 == 0xffffffff ||
                    (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10,
                    puVar5 == (undefined *)0xfffffffc)) || (*(uint *)(puVar5 + 8) != uVar1 >> 0xc))
                  || (*(int *)(puVar5 + 4) == 0)) &&
                 (((uVar1 = *(uint *)(local_f8 + 0x3ee0), uVar1 == 0xffffffff ||
                   (puVar5 = g_pEntityList + (uVar1 & 0xfff) * 0x10,
                   puVar5 == (undefined *)0xfffffffc)) ||
                  ((*(uint *)(puVar5 + 8) != uVar1 >> 0xc || (*(int *)(puVar5 + 4) == 0))))))))))))
             && (((param_1[0x21] == (VisibleSurvivorsInRangeScan)0x0 ||
                  (iVar3 = (**(code **)(*(int *)local_f8 + 0x52c))(local_f8), iVar3 == 0)) ||
                 ((*(byte *)(iVar3 + 0x12d) & 0x80) == 0)))) {
            pfVar4 = (float *)(**(code **)(*(int *)local_f8 + 0x288))(local_f8);
            fVar7 = (*pfVar4 - *(float *)(param_1 + 4)) * (*pfVar4 - *(float *)(param_1 + 4)) +
                    (pfVar4[2] - *(float *)(param_1 + 0xc)) *
                    (pfVar4[2] - *(float *)(param_1 + 0xc)) +
                    (pfVar4[1] - *(float *)(param_1 + 8)) * (pfVar4[1] - *(float *)(param_1 + 8));
            if (fVar7 < *(float *)(param_1 + 0x18)) {
              *(float *)(param_1 + 0x18) = fVar7;
            }
            if (fVar7 < *(float *)param_1) {
              CTraceFilterSimple::CTraceFilterSimple
                        ((CTraceFilterSimple *)local_dc,(IHandleEntity *)0x0,0,
                         IgnoreActorsTraceFilterFunction);
              local_dc[0] = &PTR_ShouldHitEntity_00c23430;
              pfVar4 = (float *)(**(code **)(*(int *)local_f8 + 0x288))(local_f8);
              local_cc = *(float *)(param_1 + 4);
              local_c8 = *(float *)(param_1 + 8);
              local_bc = *pfVar4 - local_cc;
              local_c4 = *(float *)(param_1 + 0xc);
              local_b8 = pfVar4[1] - local_c8;
              local_88 = 1;
              local_8c = 0;
              local_b4 = pfVar4[2] - local_c4;
              local_94 = 0;
              local_98 = 0;
              local_9c = 0;
              local_87 = local_b8 * local_b8 + local_bc * local_bc + local_b4 * local_b4 != 0.0;
              local_a4 = 0;
              local_a8 = 0;
              local_ac = 0;
              (**(code **)(*enginetrace + 0x14))
                        (enginetrace,&local_cc,0x2006041,(CTraceFilterSimple *)local_dc,local_70);
              if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
                DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
              }
              if ((1.0 <= local_44) && (local_39 == '\0')) {
                CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::InsertBefore
                          ((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)
                           (param_1 + 0x24),*(int *)(param_1 + 0x30),(CTerrorPlayer **)&local_f8);
                if (fVar7 < *(float *)(param_1 + 0x14)) {
                  *(float *)(param_1 + 0x14) = fVar7;
                  *(CBaseEntity **)(param_1 + 0x10) = local_f8;
                }
                goto LAB_00a46910;
              }
            }
          }
          CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::InsertBefore
                    ((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)(param_1 + 0x38),
                     *(int *)(param_1 + 0x44),(CTerrorPlayer **)&local_f8);
        }
        goto LAB_00a46910;
      }
      iVar6 = iVar6 + 1;
    } while (iVar6 <= *(int *)(gpGlobals + 0x14));
  }
LAB_00a4694c:
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar3 = ThreadGetCurrentId(), iVar6 == iVar3)) {
    cVar2 = CVProfNode::ExitScope();
    if (cVar2 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_e0 != 0) {
    (**(code **)(local_e0 + 0x54))(local_e0,local_e8,local_e4,0,0,0);
  }
  return 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)