L L4D2node

ModifyOrAppendGlobalCriteria

0x005d1990 · 1073 bytes · __regparm3

_ZL28ModifyOrAppendGlobalCriteriaP14AI_CriteriaSet

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* ModifyOrAppendGlobalCriteria(AI_CriteriaSet*) */

void __regparm3 ModifyOrAppendGlobalCriteria(AI_CriteriaSet *param_1)

{
  uint uVar1;
  char cVar2;
  CBaseEntity *this;
  char *pcVar3;
  int iVar4;
  int iVar5;
  int in_GS_OFFSET;
  undefined4 local_14c;
  int local_148;
  undefined4 local_144;
  undefined4 local_140;
  undefined4 local_13c;
  undefined4 local_138;
  int local_134;
  int local_130;
  CFmtStrN<256> local_12c [5];
  char local_127 [263];
  int local_20;
  
  local_144 = 0;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  local_140 = 0;
  if (___atan2f_finite == 0) {
    local_134 = 0;
  }
  else {
    (**(code **)(___atan2f_finite + 0x50))
              (___atan2f_finite,&local_144,0,0,0,0,"/data/src/game/server/terror/terrorplayer.h",
               0xb2c,&ForEachSurvivor<(anonymous_namespace)::SurvivorAliveCritFunctor>((anonymous_namespace)::SurvivorAliveCritFunctor&)
                      ::tm_fmt,"(%s)%s","Unaccounted","ForEachSurvivor");
    local_134 = ___atan2f_finite;
  }
  iVar5 = _DAT_0105db00;
  local_13c = local_144;
  local_138 = local_140;
                    /* try { // try from 005d1cbe to 005d1d0c has its CatchHandler @ 005d1dce */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar4 = ThreadGetCurrentId(), iVar5 == 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)) {
    iVar5 = 1;
    do {
      while ((this = (CBaseEntity *)UTIL_PlayerByIndex(iVar5), this == (CBaseEntity *)0x0 ||
             (*(int *)(this + 0x30) == 0))) {
LAB_005d1ab0:
        iVar5 = iVar5 + 1;
        if (*(int *)(gpGlobals + 0x14) < iVar5) goto LAB_005d1aec;
      }
      if (*(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0) {
                    /* try { // try from 005d1a85 to 005d1ac4 has its CatchHandler @ 005d1de6 */
        cVar2 = (**(code **)(*(int *)this + 0x16c))(this);
        if (((cVar2 != '\0') && (*(int *)(this + 0x1f6c) != 2)) &&
           ((iVar4 = CBaseEntity::GetTeamNumber(this), iVar4 == 2 &&
            (uVar1 = *(uint *)(this + 0x2ba0), uVar1 < 4)))) {
                    /* try { // try from 005d1d7c to 005d1dbd has its CatchHandler @ 005d1de6 */
          cVar2 = (**(code **)(*(int *)this + 300))(this);
          pcVar3 = "1";
          if (cVar2 == '\0') {
            pcVar3 = "0";
          }
          iVar4 = ConvertToExternalCharacter(uVar1);
          AI_CriteriaSet::AppendCriteria
                    (param_1,*(char **)((anonymous_namespace)::SurvivorAliveCritFunctor::
                                        m_sCharacterCriteria + iVar4 * 4),pcVar3,1.0);
        }
        goto LAB_005d1ab0;
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 <= *(int *)(gpGlobals + 0x14));
  }
LAB_005d1aec:
  iVar5 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar4 = ThreadGetCurrentId(), iVar5 == iVar4)) {
    cVar2 = CVProfNode::ExitScope();
    if (cVar2 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_134 != 0) {
    (**(code **)(local_134 + 0x54))(local_134,local_13c,local_138,0,0,0);
  }
  local_14c = 0;
  local_148 = 0;
  ForEachPlayer<LiveSurvivorCounter>((LiveSurvivorCounter *)&local_14c);
  CFmtStrN<256>::CFmtStrN(local_12c,"%d",local_148);
  AI_CriteriaSet::AppendCriteria(param_1,"NumberOfTeamAlive",local_127,1.0);
  local_144 = 2;
  local_140 = 0;
  ForEachPlayer<LiveSurvivorCounter>((LiveSurvivorCounter *)&local_144);
  CFmtStrN<256>::CFmtStrN(local_12c,"%d",local_140);
  AI_CriteriaSet::AppendCriteria(param_1,"NumberOfTeamIncapacitated",local_127,1.0);
  local_138 = 2;
  local_134 = CONCAT31(local_134._1_3_,1);
  local_130 = 0;
  local_13c = 0xffffffff;
  ForEachPlayer<PlayerCounter>((PlayerCounter *)&local_13c);
  CFmtStrN<256>::CFmtStrN(local_12c,"%d",local_130 - local_148);
  AI_CriteriaSet::AppendCriteria(param_1,"NumberOfTeamDead",local_127,1.0);
  pcVar3 = (char *)CDirector::GetGameModeBase();
  AI_CriteriaSet::AppendCriteria(param_1,"gamemode",pcVar3,1.0);
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return;
}

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)