L L4D2node

ForEachSurvivor<VisibleSurvivorScan>

0x00a03d50 · 1033 bytes · __cdecl

_Z15ForEachSurvivorI19VisibleSurvivorScanEbRT_

Decompiled

bool (1 param)

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

bool ForEachSurvivor<VisibleSurvivorScan>(VisibleSurvivorScan *param_1)

{
  CBaseEntity *this;
  char cVar1;
  char cVar2;
  CBaseEntity *pCVar3;
  int iVar4;
  CBaseEntity *pCVar5;
  int iVar6;
  int local_40;
  CBaseEntity *local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined4 local_28;
  undefined4 local_24;
  int local_20;
  
  local_34 = 0;
  local_30 = 0;
  if (___atan2f_finite == 0) {
    local_20 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_34,0,0,0,0,"/data/src/game/server/terror/terrorplayer.h",
               0xb2c,&ForEachSurvivor<VisibleSurvivorScan>(VisibleSurvivorScan&)::tm_fmt,"(%s)%s",
               "Unaccounted","ForEachSurvivor");
    local_20 = ___atan2f_finite;
  }
  iVar6 = _DAT_0105db00;
  local_28 = local_34;
  local_24 = local_30;
                    /* try { // try from 00a03ef6 to 00a03f44 has its CatchHandler @ 00a04175 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar4 = ThreadGetCurrentId(), iVar6 == iVar4)) {
    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 ((pCVar3 = (CBaseEntity *)UTIL_PlayerByIndex(iVar6), pCVar3 == (CBaseEntity *)0x0 ||
             (*(int *)(pCVar3 + 0x30) == 0))) {
LAB_00a03e50:
        iVar6 = iVar6 + 1;
        if (*(int *)(gpGlobals + 0x14) < iVar6) goto LAB_00a03e8c;
      }
      if (*(int *)(pCVar3 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0) {
                    /* try { // try from 00a03e25 to 00a03e64 has its CatchHandler @ 00a0418a */
        cVar1 = (**(code **)(*(int *)pCVar3 + 0x16c))(pCVar3);
        if (((cVar1 != '\0') && (*(int *)(pCVar3 + 0x1f6c) != 2)) &&
           (iVar4 = CBaseEntity::GetTeamNumber(pCVar3), iVar4 == 2)) {
          local_38 = pCVar3;
                    /* try { // try from 00a03fa0 to 00a04168 has its CatchHandler @ 00a0418a */
          iVar4 = CBaseEntity::GetTeamNumber(pCVar3);
          cVar1 = IsASurvivorTeam(iVar4);
          if (cVar1 != '\0') {
            if (*(int *)(local_38 + 0x30) == 0) {
              local_40 = 0;
            }
            else {
              local_40 = *(int *)(local_38 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
            }
            iVar4 = *(int *)(*(CBaseCombatCharacter **)(param_1 + 0x3c) + 0x30);
            if (iVar4 == 0) {
              iVar4 = 0;
            }
            else {
              iVar4 = iVar4 - *(int *)(gpGlobals + 0x58) >> 4;
            }
            if (local_40 != iVar4) {
              cVar1 = CBaseCombatCharacter::IsAbleToSee
                                (*(CBaseCombatCharacter **)(param_1 + 0x3c),local_38,1);
              cVar2 = (**(code **)(*(int *)local_38 + 300))(local_38);
              pCVar3 = local_38;
              if (cVar2 == '\0') {
                if (cVar1 != '\0') {
                  CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::InsertBefore
                            ((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)
                             (param_1 + 0x28),*(int *)(param_1 + 0x34),(CTerrorPlayer **)&local_38);
                }
              }
              else {
                if (cVar1 != '\0') {
                  if (((byte)local_38[0x14d] & 8) != 0) {
                    CBaseEntity::CalcAbsolutePosition(local_38);
                  }
                  this = *(CBaseEntity **)(param_1 + 0x3c);
                  pCVar5 = this;
                  if (((byte)this[0x14d] & 8) != 0) {
                    CBaseEntity::CalcAbsolutePosition(this);
                    pCVar5 = *(CBaseEntity **)(param_1 + 0x3c);
                  }
                  if ((*(float *)(this + 0x2e0) - *(float *)(pCVar3 + 0x2e0)) *
                      (*(float *)(this + 0x2e0) - *(float *)(pCVar3 + 0x2e0)) +
                      (*(float *)(this + 0x2e8) - *(float *)(pCVar3 + 0x2e8)) *
                      (*(float *)(this + 0x2e8) - *(float *)(pCVar3 + 0x2e8)) +
                      (*(float *)(this + 0x2e4) - *(float *)(pCVar3 + 0x2e4)) *
                      (*(float *)(this + 0x2e4) - *(float *)(pCVar3 + 0x2e4)) <
                      *(float *)(param_1 + 0x40)) {
                    param_1[0x44] = (VisibleSurvivorScan)0x0;
                  }
                  cVar1 = (**(code **)(*(int *)pCVar5 + 0x424))(pCVar5,local_38);
                  if (cVar1 != '\0') {
                    CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::InsertBefore
                              ((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)param_1,
                               *(int *)(param_1 + 0xc),(CTerrorPlayer **)&local_38);
                    goto LAB_00a03e50;
                  }
                }
                CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>>::InsertBefore
                          ((CUtlVector<CTerrorPlayer*,CUtlMemory<CTerrorPlayer*,int>> *)
                           (param_1 + 0x14),*(int *)(param_1 + 0x20),(CTerrorPlayer **)&local_38);
              }
            }
          }
        }
        goto LAB_00a03e50;
      }
      iVar6 = iVar6 + 1;
    } while (iVar6 <= *(int *)(gpGlobals + 0x14));
  }
LAB_00a03e8c:
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar4 = ThreadGetCurrentId(), iVar6 == iVar4)) {
    cVar1 = CVProfNode::ExitScope();
    if (cVar1 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_20 != 0) {
    (**(code **)(local_20 + 0x54))(local_20,local_28,local_24,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)