L L4D2node

ForEachPlayer<ChargeImpactDistributor>

0x004d6510 · 1147 bytes · __cdecl

_Z13ForEachPlayerI23ChargeImpactDistributorEbRT_

Decompiled

bool (1 param)

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

bool ForEachPlayer<ChargeImpactDistributor>(ChargeImpactDistributor *param_1)

{
  uint uVar1;
  char cVar2;
  CBaseEntity *this;
  int iVar3;
  undefined *puVar4;
  float *pfVar5;
  float *pfVar6;
  int iVar7;
  CBaseEntity *this_00;
  float fVar8;
  undefined4 local_ac;
  undefined4 local_a8;
  undefined4 local_a0;
  undefined4 local_9c;
  int local_98;
  uint local_94;
  uint local_90;
  uint local_8c;
  uint local_88;
  uint local_84;
  uint local_80;
  CTakeDamageInfo local_7c [108];
  
  local_ac = 0;
  local_a8 = 0;
  if (___atan2f_finite == 0) {
    local_98 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_ac,0,0,0,0,"/data/src/game/server/player.h",0x595,
               &ForEachPlayer<ChargeImpactDistributor>(ChargeImpactDistributor&)::tm_fmt,"(%s)%s",
               "Unaccounted","ForEachPlayer");
    local_98 = ___atan2f_finite;
  }
  iVar7 = _DAT_0105db00;
  local_a0 = local_ac;
  local_9c = local_a8;
                    /* try { // try from 004d66e6 to 004d6734 has its CatchHandler @ 004d69c1 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar3 = ThreadGetCurrentId(), iVar7 == iVar3)) {
    if ((char *)*_DAT_0105d15c != "ForEachPlayer") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc0d94f,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  if (0 < *(int *)(gpGlobals + 0x14)) {
    iVar7 = 1;
    do {
      while ((this = (CBaseEntity *)UTIL_PlayerByIndex(iVar7), this == (CBaseEntity *)0x0 ||
             (*(int *)(this + 0x30) == 0))) {
LAB_004d6638:
        iVar7 = iVar7 + 1;
        if (*(int *)(gpGlobals + 0x14) < iVar7) goto LAB_004d6674;
      }
      if (*(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0) {
                    /* try { // try from 004d65fd to 004d664c has its CatchHandler @ 004d699d */
        cVar2 = (**(code **)(*(int *)this + 0x16c))(this);
                    /* try { // try from 004d678f to 004d698b has its CatchHandler @ 004d699d */
        if (((cVar2 != '\0') && (*(int *)(this + 0x1f6c) != 2)) &&
           ((cVar2 = (**(code **)(*(int *)this + 0x16c))(this), cVar2 != '\0' &&
            ((cVar2 = (**(code **)(*(int *)this + 300))(this), cVar2 != '\0' &&
             (cVar2 = (**(code **)(*(int *)this + 0x7e8))(this), cVar2 == '\0')))))) {
          iVar3 = CBaseEntity::GetTeamNumber(this);
          cVar2 = IsASurvivorTeam(iVar3);
          if ((cVar2 == '\0') ||
             (*(char *)(*(int *)(param_1 + 4) + 0x49c + *(int *)(this + 0x2ba0)) == '\0')) {
            uVar1 = *(uint *)(*(int *)(param_1 + 4) + 0x44c);
            this_00 = (CBaseEntity *)0x0;
            if (((uVar1 != 0xffffffff) &&
                (puVar4 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar4 != (undefined *)0xfffffffc)
                ) && (*(uint *)(puVar4 + 8) == uVar1 >> 0xc)) {
              this_00 = *(CBaseEntity **)(puVar4 + 4);
            }
            pfVar5 = (float *)(**(code **)(*(int *)this_00 + 0x288))(this_00);
            pfVar6 = (float *)(**(code **)(*(int *)this + 0x288))(this);
            fVar8 = SQRT((*pfVar6 - *pfVar5) * (*pfVar6 - *pfVar5) +
                         (pfVar6[2] - pfVar5[2]) * (pfVar6[2] - pfVar5[2]) +
                         (pfVar6[1] - pfVar5[1]) * (pfVar6[1] - pfVar5[1]));
            if (fVar8 < *(float *)param_1 || fVar8 == *(float *)param_1) {
              if (((byte)this_00[0x14d] & 8) != 0) {
                CBaseEntity::CalcAbsolutePosition(this_00);
              }
              local_94 = *(uint *)(this_00 + 0x2e0);
              local_90 = *(uint *)(this_00 + 0x2e4);
              local_8c = *(uint *)(this_00 + 0x2e8);
              CTerrorPlayer::OnStaggered
                        ((CTerrorPlayer *)this,(CBaseEntity *)0x0,(Vector *)&local_94);
              CTakeDamageInfo::CTakeDamageInfo(local_7c,this_00,this_00,2.0,0x80,0);
              if (((byte)this_00[0x14d] & 8) != 0) {
                CBaseEntity::CalcAbsolutePosition(this_00);
              }
              local_80 = local_8c ^ 0x80000000;
              local_84 = local_90 ^ 0x80000000;
              local_88 = local_94 ^ 0x80000000;
              CalculateMeleeDamageForce
                        (local_7c,(Vector *)&local_88,(Vector *)(this_00 + 0x2e0),0.01);
              CBaseEntity::TakeDamage(this,local_7c);
            }
          }
        }
        goto LAB_004d6638;
      }
      iVar7 = iVar7 + 1;
    } while (iVar7 <= *(int *)(gpGlobals + 0x14));
  }
LAB_004d6674:
  iVar7 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar3 = ThreadGetCurrentId(), iVar7 == iVar3)) {
    cVar2 = CVProfNode::ExitScope();
    if (cVar2 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_98 != 0) {
    (**(code **)(local_98 + 0x54))(local_98,local_a0,local_9c,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)