L L4D2node

ForEachSurvivor<GhostProximityScan>

0x009eadf0 · 1305 bytes · __cdecl

_Z15ForEachSurvivorI18GhostProximityScanEbRT_

Decompiled

bool (1 param)

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

bool ForEachSurvivor<GhostProximityScan>(GhostProximityScan *param_1)

{
  float *pfVar1;
  float *pfVar2;
  float *pfVar3;
  CBaseEntity *pCVar4;
  char cVar5;
  bool bVar6;
  CBaseEntity *this;
  int iVar7;
  CNavArea *pCVar8;
  CNavArea *pCVar9;
  CBaseEntity *pCVar10;
  int iVar11;
  float fVar12;
  float fVar13;
  float fVar14;
  float fVar15;
  float local_44;
  float local_40;
  ShortestPathCost local_35;
  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<GhostProximityScan>(GhostProximityScan&)::tm_fmt,"(%s)%s",
               "Unaccounted","ForEachSurvivor");
    local_20 = ___atan2f_finite;
  }
  iVar11 = _DAT_0105db00;
  local_28 = local_34;
  local_24 = local_30;
                    /* try { // try from 009eaf86 to 009eafd4 has its CatchHandler @ 009eb314 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar7 = ThreadGetCurrentId(), iVar11 == iVar7)) {
    if ((char *)*_DAT_0105d15c != "ForEachSurvivor") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc21c28,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  if (*(int *)(gpGlobals + 0x14) < 1) {
LAB_009eaf24:
    bVar6 = true;
LAB_009eaf29:
    iVar11 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar7 = ThreadGetCurrentId(), iVar11 == iVar7)) {
      cVar5 = CVProfNode::ExitScope();
      if (cVar5 != '\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 bVar6;
  }
  iVar11 = 1;
LAB_009eaef5:
  this = (CBaseEntity *)UTIL_PlayerByIndex(iVar11);
  if ((this != (CBaseEntity *)0x0) && (*(int *)(this + 0x30) != 0)) {
    if (*(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 == 0) {
      iVar11 = iVar11 + 1;
      if (*(int *)(gpGlobals + 0x14) < iVar11) goto LAB_009eaf24;
      goto LAB_009eaef5;
    }
                    /* try { // try from 009eaebd to 009eaefc has its CatchHandler @ 009eb329 */
    cVar5 = (**(code **)(*(int *)this + 0x16c))(this);
    if (((cVar5 != '\0') && (*(int *)(this + 0x1f6c) != 2)) &&
       (iVar7 = CBaseEntity::GetTeamNumber(this), iVar7 == 2)) {
                    /* try { // try from 009eb02d to 009eb301 has its CatchHandler @ 009eb329 */
      iVar7 = CBaseEntity::GetTeamNumber(this);
      cVar5 = IsASurvivorTeam(iVar7);
      if ((cVar5 != '\0') && (cVar5 = (**(code **)(*(int *)this + 300))(this), cVar5 != '\0')) {
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(this);
        }
        fVar15 = *(float *)(this + 0x2e8);
        pCVar10 = *(CBaseEntity **)param_1;
        if (((byte)pCVar10[0x14d] & 8) == 0) {
          local_44 = ABS(fVar15 - *(float *)(pCVar10 + 0x2e8));
          local_40 = *(float *)(param_1 + 8) - local_44;
        }
        else {
          CBaseEntity::CalcAbsolutePosition(pCVar10);
          pCVar4 = pCVar10 + 0x2e8;
          pCVar10 = *(CBaseEntity **)param_1;
          local_44 = ABS(fVar15 - *(float *)pCVar4);
          local_40 = *(float *)(param_1 + 8) - local_44;
          if (((byte)pCVar10[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(pCVar10);
          }
        }
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(this);
        }
        if (local_40 * local_40 <
            (*(float *)(this + 0x2e0) - *(float *)(pCVar10 + 0x2e0)) *
            (*(float *)(this + 0x2e0) - *(float *)(pCVar10 + 0x2e0)) +
            (*(float *)(this + 0x2e4) - *(float *)(pCVar10 + 0x2e4)) *
            (*(float *)(this + 0x2e4) - *(float *)(pCVar10 + 0x2e4))) goto LAB_009eaee8;
        if (((byte)this[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(this);
        }
        fVar15 = *(float *)(this + 0x2e8);
        pCVar10 = *(CBaseEntity **)param_1;
        if (((byte)pCVar10[0x14d] & 8) != 0) {
          CBaseEntity::CalcAbsolutePosition(pCVar10);
        }
        if (ABS(fVar15 - *(float *)(pCVar10 + 0x2e8)) <=
            (*(float *)(param_1 + 8) - local_44) + (*(float *)(param_1 + 8) - local_44)) {
          pCVar8 = (CNavArea *)(**(code **)(**(int **)param_1 + 0x52c))(*(int **)param_1);
          pCVar9 = (CNavArea *)(**(code **)(*(int *)this + 0x52c))(this);
          if ((pCVar9 == (CNavArea *)0x0) || (pCVar8 == (CNavArea *)0x0)) {
LAB_009eb307:
            fVar15 = -1.0;
          }
          else if (pCVar8 == pCVar9) {
LAB_009eb2e0:
            fVar15 = 0.0;
          }
          else {
            bVar6 = NavAreaBuildPath<ShortestPathCost>
                              (pCVar9,pCVar8,(Vector *)0x0,(Vector *)0x0,&local_35,(CNavArea **)0x0,
                               0.0,-1,false);
            if (!bVar6) goto LAB_009eb307;
            iVar7 = *(int *)(pCVar8 + 0x78);
            if (iVar7 == 0) goto LAB_009eb2e0;
            fVar15 = 0.0;
            fVar12 = *(float *)(pCVar8 + 0x2c);
            fVar13 = *(float *)(pCVar8 + 0x34);
            fVar14 = *(float *)(pCVar8 + 0x30);
            do {
              pfVar1 = (float *)(iVar7 + 0x2c);
              pfVar2 = (float *)(iVar7 + 0x30);
              fVar12 = fVar12 - *pfVar1;
              pfVar3 = (float *)(iVar7 + 0x34);
              fVar14 = fVar14 - *pfVar2;
              iVar7 = *(int *)(iVar7 + 0x78);
              fVar13 = fVar13 - *pfVar3;
              fVar15 = fVar15 + SQRT(fVar12 * fVar12 + fVar14 * fVar14 + fVar13 * fVar13);
              fVar12 = *pfVar1;
              fVar13 = *pfVar3;
              fVar14 = *pfVar2;
            } while (iVar7 != 0);
          }
          if (fVar15 < *(float *)(ZombieGhostTravelDistance._28_4_ + 0x2c)) {
            bVar6 = false;
            param_1[4] = (GhostProximityScan)0x1;
            goto LAB_009eaf29;
          }
        }
      }
    }
  }
LAB_009eaee8:
  iVar11 = iVar11 + 1;
  if (*(int *)(gpGlobals + 0x14) < iVar11) goto LAB_009eaf24;
  goto LAB_009eaef5;
}

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)