L L4D2node

ForEachPlayer<SetHumanTeamFunctor>

0x0043a1c0 · 773 bytes · __cdecl

_Z13ForEachPlayerI19SetHumanTeamFunctorEbRT_

Decompiled

bool (1 param)

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

bool ForEachPlayer<SetHumanTeamFunctor>(SetHumanTeamFunctor *param_1)

{
  undefined4 uVar1;
  undefined4 uVar2;
  char cVar3;
  CBaseEntity *this;
  int iVar4;
  int iVar5;
  bool bVar6;
  int local_30;
  undefined4 local_24;
  undefined4 local_20;
  
  local_24 = 0;
  local_20 = 0;
  if (___atan2f_finite == 0) {
    local_30 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_24,0,0,0,0,"/data/src/game/server/player.h",0x595,
               &ForEachPlayer<SetHumanTeamFunctor>(SetHumanTeamFunctor&)::tm_fmt,"(%s)%s",
               "Unaccounted","ForEachPlayer");
    local_30 = ___atan2f_finite;
  }
  uVar2 = local_20;
  uVar1 = local_24;
  iVar5 = _DAT_0105db00;
                    /* try { // try from 0043a386 to 0043a3d4 has its CatchHandler @ 0043a4e0 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar4 = ThreadGetCurrentId(), iVar5 == iVar4)) {
    if ((char *)*_DAT_0105d15c != "ForEachPlayer") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc0d94f,(char *)0x1,0xbfafa1);
    }
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
  if (*(int *)(gpGlobals + 0x14) < 1) {
LAB_0043a31c:
    bVar6 = true;
LAB_0043a321:
    iVar5 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar4 = ThreadGetCurrentId(), iVar5 == iVar4)) {
      cVar3 = CVProfNode::ExitScope();
      if (cVar3 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_30 != 0) {
      (**(code **)(local_30 + 0x54))(local_30,uVar1,uVar2,0,0,0);
    }
    return bVar6;
  }
  iVar5 = 1;
LAB_0043a2ed:
  this = (CBaseEntity *)UTIL_PlayerByIndex(iVar5);
  if ((this != (CBaseEntity *)0x0) && (*(int *)(this + 0x30) != 0)) {
    if (*(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 == 0) {
      iVar5 = iVar5 + 1;
      if (*(int *)(gpGlobals + 0x14) < iVar5) goto LAB_0043a31c;
      goto LAB_0043a2ed;
    }
                    /* try { // try from 0043a2a5 to 0043a2f4 has its CatchHandler @ 0043a51d */
    cVar3 = (**(code **)(*(int *)this + 0x16c))(this);
                    /* try { // try from 0043a433 to 0043a4da has its CatchHandler @ 0043a51d */
    if (((cVar3 != '\0') && (*(int *)(this + 0x1f6c) != 2)) &&
       ((cVar3 = (**(code **)(*(int *)this + 0x16c))(this), cVar3 != '\0' &&
        (((cVar3 = (**(code **)(*(int *)this + 0x778))(this), cVar3 == '\0' &&
          (iVar4 = CBaseEntity::GetTeamNumber(this), iVar4 == *(int *)(param_1 + 4))) &&
         (*(int *)(this + 0x23bc) != 3)))))) {
      cVar3 = (**(code **)(*(int *)g_pGameRules + 0x2a8))(g_pGameRules,*(undefined4 *)param_1);
      bVar6 = false;
      if (cVar3 == '\0') {
        iVar4 = *(int *)param_1;
        cVar3 = CCSGameRules::TeamStacked(g_pGameRules,iVar4,*(int *)(param_1 + 4));
        if (cVar3 == '\0') {
          CCSPlayer::SwitchTeam((CCSPlayer *)this,iVar4);
          CRecipientFilter::AddRecipient((CRecipientFilter *)(param_1 + 8),(CBasePlayer *)this);
          CRecipientFilter::RemoveRecipient
                    ((CRecipientFilter *)(param_1 + 0x28),(CBasePlayer *)this);
          goto LAB_0043a2e0;
        }
        bVar6 = false;
      }
      goto LAB_0043a321;
    }
  }
LAB_0043a2e0:
  iVar5 = iVar5 + 1;
  if (*(int *)(gpGlobals + 0x14) < iVar5) goto LAB_0043a31c;
  goto LAB_0043a2ed;
}

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)