L L4D2node

ForEachSurvivor<FindFriendInDanger>

0x0085c090 · 865 bytes · __cdecl

_Z15ForEachSurvivorI18FindFriendInDangerEbRT_

Decompiled

bool (1 param)

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

bool ForEachSurvivor<FindFriendInDanger>(FindFriendInDanger *param_1)

{
  int *piVar1;
  CBaseEntity *this;
  undefined4 uVar2;
  undefined4 uVar3;
  char cVar4;
  CBaseEntity *this_00;
  int iVar5;
  int iVar6;
  int iVar7;
  float fVar8;
  undefined4 local_24;
  undefined4 local_20;
  
  local_24 = 0;
  local_20 = 0;
  if (___atan2f_finite == 0) {
    iVar7 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_24,0,0,0,0,"/data/src/game/server/terror/terrorplayer.h",
               0xb2c,&ForEachSurvivor<FindFriendInDanger>(FindFriendInDanger&)::tm_fmt,"(%s)%s",
               "Unaccounted","ForEachSurvivor");
    iVar7 = ___atan2f_finite;
  }
  uVar3 = local_20;
  uVar2 = local_24;
  iVar6 = _DAT_0105db00;
                    /* try { // try from 0085c226 to 0085c274 has its CatchHandler @ 0085c40a */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar5 = ThreadGetCurrentId(), iVar6 == iVar5)) {
    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_00 = (CBaseEntity *)UTIL_PlayerByIndex(iVar6), this_00 == (CBaseEntity *)0x0 ||
             (*(int *)(this_00 + 0x30) == 0))) {
LAB_0085c188:
        iVar6 = iVar6 + 1;
        if (*(int *)(gpGlobals + 0x14) < iVar6) goto LAB_0085c1c4;
      }
      if (*(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0) {
                    /* try { // try from 0085c15d to 0085c19c has its CatchHandler @ 0085c444 */
        cVar4 = (**(code **)(*(int *)this_00 + 0x16c))(this_00);
                    /* try { // try from 0085c2cf to 0085c404 has its CatchHandler @ 0085c444 */
        if (((cVar4 != '\0') && (*(int *)(this_00 + 0x1f6c) != 2)) &&
           ((iVar5 = CBaseEntity::GetTeamNumber(this_00), iVar5 == 2 &&
            (((cVar4 = (**(code **)(*(int *)this_00 + 300))(this_00), cVar4 != '\0' &&
              (piVar1 = *(int **)param_1, piVar1 != (int *)0x0)) &&
             (cVar4 = (**(code **)(*piVar1 + 0x424))(piVar1,this_00), cVar4 != '\0')))))) {
          if (((byte)this_00[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(this_00);
          }
          this = *(CBaseEntity **)param_1;
          if (((byte)this[0x14d] & 8) != 0) {
            CBaseEntity::CalcAbsolutePosition(this);
          }
          fVar8 = (*(float *)(this + 0x2e8) - *(float *)(this_00 + 0x2e8)) *
                  (*(float *)(this + 0x2e8) - *(float *)(this_00 + 0x2e8)) +
                  (*(float *)(this + 0x2e4) - *(float *)(this_00 + 0x2e4)) *
                  (*(float *)(this + 0x2e4) - *(float *)(this_00 + 0x2e4)) +
                  (*(float *)(this + 0x2e0) - *(float *)(this_00 + 0x2e0)) *
                  (*(float *)(this + 0x2e0) - *(float *)(this_00 + 0x2e0));
          if (((fVar8 < *(float *)(param_1 + 4) || fVar8 == *(float *)(param_1 + 4)) &&
              ((*(int *)(param_1 + 0xc) == 0 || (fVar8 < *(float *)(param_1 + 8))))) &&
             (cVar4 = (**(code **)(**(int **)param_1 + 0x42c))(*(int **)param_1,this_00,0),
             cVar4 != '\0')) {
            *(CBaseEntity **)(param_1 + 0xc) = this_00;
            *(float *)(param_1 + 8) = fVar8;
          }
        }
        goto LAB_0085c188;
      }
      iVar6 = iVar6 + 1;
    } while (iVar6 <= *(int *)(gpGlobals + 0x14));
  }
LAB_0085c1c4:
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar5 = ThreadGetCurrentId(), iVar6 == iVar5)) {
    cVar4 = CVProfNode::ExitScope();
    if (cVar4 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (iVar7 != 0) {
    (**(code **)(iVar7 + 0x54))(iVar7,uVar2,uVar3,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)