L L4D2node

SurvivorLegsRegroup::Update

0x0095e530 · 1426 bytes · __thiscall

_ZN19SurvivorLegsRegroup6UpdateEP11SurvivorBotf

Decompiled

undefined (3 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* SurvivorLegsRegroup::Update(SurvivorBot*, float) */

SurvivorLegsRegroup * __thiscall
SurvivorLegsRegroup::Update(SurvivorLegsRegroup *this,SurvivorBot *param_1,float param_2)

{
  INextBot *pIVar1;
  uint *puVar2;
  uint uVar3;
  code *pcVar4;
  char cVar5;
  SurvivorTeamSituation *this_00;
  int *piVar6;
  int iVar7;
  int iVar8;
  undefined *puVar9;
  SurvivorTeamSituation *this_01;
  int in_GS_OFFSET;
  longdouble lVar10;
  float fVar11;
  double dVar12;
  float fVar13;
  float fVar14;
  float fVar15;
  CBaseEntity *local_164;
  undefined4 local_154;
  undefined4 local_150;
  undefined4 local_148;
  undefined4 local_144;
  SurvivorTeamSituation *local_140;
  undefined **local_13c;
  INextBot *local_138;
  undefined4 local_134;
  undefined1 local_130;
  undefined1 local_12f;
  CFmtStrN<256> local_12c [5];
  undefined1 local_127 [263];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  this_00 = (SurvivorTeamSituation *)SurvivorBot::GetTeamSituation((SurvivorBot *)param_2);
  uVar3 = *(uint *)(param_1 + 0x34);
  if ((((uVar3 == 0xffffffff) ||
       (puVar9 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar9 + 8) != uVar3 >> 0xc)) ||
     (local_164 = *(CBaseEntity **)(puVar9 + 4), local_164 == (CBaseEntity *)0x0)) {
    this_01 = this_00;
    local_164 = (CBaseEntity *)SurvivorTeamSituation::GetClosestReachableFriend(this_00);
    if (local_164 == (CBaseEntity *)0x0) {
      *(undefined4 *)this = 3;
      *(undefined4 *)(this + 4) = 0;
      *(char **)(this + 8) = "No reachable teammates left alive";
      goto LAB_0095e5b7;
    }
  }
  piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9a0))(param_2);
  cVar5 = (**(code **)(*piVar6 + 0x118))(piVar6);
  if (cVar5 == '\0') {
    piVar6 = (int *)(**(code **)(*(int *)param_2 + 0x9a0))(param_2);
    cVar5 = (**(code **)(*piVar6 + 0xf8))(piVar6);
    if (cVar5 != '\0') {
      fVar15 = *(float *)(SurvivorBotSeparationDangerMinRange._28_4_ + 0x2c);
      iVar7 = *(int *)((int)param_2 + 0x2ba0);
      cVar5 = SurvivorBot::IsEscortingHumanPlayers((SurvivorBot *)param_2);
      if (cVar5 == '\0') {
        fVar15 = (float)iVar7 * 10.0 + fVar15;
      }
      else {
        lVar10 = (longdouble)SurvivorBot::GetEscortRange();
        fVar15 = (float)lVar10;
      }
      if (((byte)local_164[0x14d] & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition(local_164);
      }
      if ((*(byte *)((int)param_2 + 0x14d) & 8) != 0) {
        CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_2);
      }
      fVar14 = *(float *)((int)param_2 + 0x2e0) - *(float *)(local_164 + 0x2e0);
      fVar11 = *(float *)((int)param_2 + 0x2e4) - *(float *)(local_164 + 0x2e4);
      fVar13 = *(float *)((int)param_2 + 0x2e8) - *(float *)(local_164 + 0x2e8);
      if (fVar11 * fVar11 + fVar14 * fVar14 + fVar13 * fVar13 < fVar15 * fVar15) {
        lVar10 = (longdouble)SurvivorTeamSituation::GetTimeSinceAnyFriendVisible(this_00);
        if ((float)lVar10 < 0.5) {
          this_01 = (SurvivorTeamSituation *)param_2;
          cVar5 = SurvivorBot::IsEscortingHumanPlayers((SurvivorBot *)param_2);
          if (cVar5 == '\0') {
            if (*(float *)(param_1 + 0x4848) <= 0.0) {
              dVar12 = 99999.8984375;
            }
            else {
              lVar10 = (longdouble)IntervalTimer::Now();
              dVar12 = (double)((float)lVar10 - *(float *)(param_1 + 0x4848));
            }
            CFmtStrN<256>::CFmtStrN(local_12c,"TimeToReunite:%f",dVar12);
            pcVar4 = *(code **)(*(int *)param_2 + 0x7b4);
            CAI_Concept::CAI_Concept((CAI_Concept *)&local_13c,"SurvivorBotHasRegroupedWithTeam");
            (*pcVar4)(param_2,(CAI_Concept *)&local_13c,1,local_127,0,0,0);
            this_01 = (SurvivorTeamSituation *)param_2;
          }
          *(undefined4 *)this = 3;
          *(undefined4 *)(this + 4) = 0;
          *(char **)(this + 8) = "Near our team again";
          goto LAB_0095e5b7;
        }
      }
    }
  }
  pIVar1 = (INextBot *)((int)param_2 + 0x4028);
  local_13c = &PTR_operator___00d09770;
  local_138 = pIVar1;
  local_134 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0xc0))(pIVar1);
  piVar6 = (int *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 200))(pIVar1);
  iVar7 = (**(code **)(*piVar6 + 0xb8))(piVar6,pIVar1);
  local_12f = 0;
  local_154 = 0;
  local_130 = iVar7 != 0;
  local_150 = 0;
  this_01 = (SurvivorTeamSituation *)(param_1 + 0x38);
  if (_towlower == (SurvivorTeamSituation *)0x0) {
    local_140 = (SurvivorTeamSituation *)0x0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_154,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotchasepath.h",
               0x68,&ChasePath::Update(INextBot*,CBaseEntity*,IPathCost_const&,Vector*)::tm_fmt,
               "(%s)%s","NextBot","ChasePath::Update");
    local_140 = _towlower;
  }
  iVar7 = _DAT_0105db00;
  local_148 = local_154;
  local_144 = local_150;
  if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 0095e730 to 0095e734 has its CatchHandler @ 0095eb01 */
    iVar8 = ThreadGetCurrentId();
    if (iVar7 == iVar8) {
      if (*(char **)_DAT_0105d15c != "ChasePath::Update") {
                    /* try { // try from 0095ea60 to 0095ea83 has its CatchHandler @ 0095eb01 */
        _DAT_0105d15c =
             (SurvivorTeamSituation *)
             CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1ef,(char *)0x0,0xca8906);
      }
      puVar2 = (uint *)(_DAT_0105d1e8 + 4 + *(int *)(_DAT_0105d15c + 0x70) * 8);
      *puVar2 = *puVar2 | 4;
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
  }
                    /* try { // try from 0095e764 to 0095e774 has its CatchHandler @ 0095eadd */
  ChasePath::RefreshPath
            ((ChasePath *)this_01,pIVar1,local_164,(IPathCost *)&local_13c,(Vector *)0x0);
  PathFollower::Update((PathFollower *)this_01,pIVar1);
  iVar7 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    iVar8 = ThreadGetCurrentId();
    if (iVar7 == iVar8) {
      this_01 = _DAT_0105d15c;
      cVar5 = CVProfNode::ExitScope();
      if (cVar5 != '\0') {
        _DAT_0105d15c = *(SurvivorTeamSituation **)(_DAT_0105d15c + 100);
      }
      DAT_0105d158 = _DAT_0105d15c == (SurvivorTeamSituation *)0x105d160;
    }
  }
  if (local_140 != (SurvivorTeamSituation *)0x0) {
    this_01 = local_140;
    (**(code **)(local_140 + 0x54))(local_140,local_148,local_144,0,0,0);
  }
  *(undefined4 *)this = 0;
  *(undefined4 *)(this + 4) = 0;
  *(undefined4 *)(this + 8) = 0;
LAB_0095e5b7:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return this;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail(this_01);
}

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)