L L4D2node

SurvivorLegsCoverOrphan::Update

0x0095eb10 · 2667 bytes · __thiscall

_ZN23SurvivorLegsCoverOrphan6UpdateEP11SurvivorBotf

Decompiled

undefined (3 params)

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

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

{
  INextBot *pIVar1;
  uint *puVar2;
  code *pcVar3;
  CTerrorPlayer *pCVar4;
  char cVar5;
  int iVar6;
  undefined4 uVar7;
  int *piVar8;
  int iVar9;
  undefined *puVar10;
  uint uVar11;
  CBaseEntity *pCVar12;
  int in_GS_OFFSET;
  longdouble lVar13;
  double local_16c;
  double local_164;
  undefined4 local_154;
  undefined4 local_150;
  undefined4 local_148;
  undefined4 local_144;
  int 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);
  uVar11 = *(uint *)(param_1 + 0x34);
  if ((((uVar11 == 0xffffffff) ||
       (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc)) ||
      (*(uint *)(puVar10 + 8) != uVar11 >> 0xc)) ||
     (piVar8 = *(int **)(puVar10 + 4), piVar8 == (int *)0x0)) {
    *(undefined4 *)this = 3;
    *(undefined4 *)(this + 4) = 0;
    *(char **)(this + 8) = "Orphan is gone";
  }
  else {
    cVar5 = (**(code **)(*piVar8 + 300))(piVar8);
    if (cVar5 == '\0') {
      if (*(float *)(param_1 + 0x4848) <= 0.0) {
        local_164 = 99999.8984375;
      }
      else {
        lVar13 = (longdouble)IntervalTimer::Now();
        local_164 = (double)((float)lVar13 - *(float *)(param_1 + 0x4848));
      }
      uVar11 = *(uint *)(param_1 + 0x34);
      if (((uVar11 == 0xffffffff) ||
          (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc))
         || (*(uint *)(puVar10 + 8) != uVar11 >> 0xc)) {
        iVar6 = 0;
      }
      else {
        iVar6 = *(int *)(puVar10 + 4);
      }
      uVar7 = SurvivorCharacterName(*(undefined4 *)(iVar6 + 0x2ba0));
      CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s,TimeToReunite:%f",uVar7,local_164);
      pcVar3 = *(code **)(*(int *)param_2 + 0x7b4);
      CAI_Concept::CAI_Concept
                ((CAI_Concept *)&local_13c,"SurvivorBotOrphanedFriendDiedBeforeReunite");
      (*pcVar3)(param_2,(CAI_Concept *)&local_13c,1,local_127,0,0,0);
      *(undefined4 *)this = 3;
      *(undefined4 *)(this + 4) = 0;
      *(char **)(this + 8) = "Orphan is dead";
    }
    else {
      piVar8 = (int *)(**(code **)(*(int *)param_2 + 0x9a0))(param_2);
      cVar5 = (**(code **)(*piVar8 + 0xd4))(piVar8);
      if (cVar5 == '\0') {
        local_16c._0_4_ = g_pEntityList;
        uVar11 = *(uint *)(param_1 + 0x34);
        iVar6 = 0;
        if (((uVar11 != 0xffffffff) &&
            (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar10 + 8) == uVar11 >> 0xc)) {
          iVar6 = *(int *)(puVar10 + 4);
        }
        if (0.0 < *(float *)(iVar6 + 0x2f64)) {
          lVar13 = (longdouble)IntervalTimer::Now();
          if ((float)lVar13 - *(float *)(iVar6 + 0x2f64) < 0.5) {
            pCVar4 = (CTerrorPlayer *)0x0;
            uVar11 = *(uint *)(param_1 + 0x34);
            if (((uVar11 != 0xffffffff) &&
                (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10,
                puVar10 != (undefined *)0xfffffffc)) && (*(uint *)(puVar10 + 8) == uVar11 >> 0xc)) {
              pCVar4 = *(CTerrorPlayer **)(puVar10 + 4);
            }
            cVar5 = SurvivorBot::IsAbleToCoverFriend((SurvivorBot *)param_2,pCVar4);
            if (cVar5 != '\0') {
              if (0.0 < *(float *)(param_1 + 0x4848)) {
                lVar13 = (longdouble)IntervalTimer::Now();
                local_16c = (double)((float)lVar13 - *(float *)(param_1 + 0x4848));
              }
              else {
                local_16c = 99999.8984375;
              }
              local_164._0_4_ = (CTerrorPlayer *)0x0;
              uVar11 = *(uint *)(param_1 + 0x34);
              if (((uVar11 != 0xffffffff) &&
                  (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10,
                  puVar10 != (undefined *)0xfffffffc)) && (*(uint *)(puVar10 + 8) == uVar11 >> 0xc))
              {
                local_164._0_4_ = *(CTerrorPlayer **)(puVar10 + 4);
              }
              uVar7 = SurvivorCharacterName(*(undefined4 *)((int)local_164._0_4_ + 0x2ba0));
              CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s,TimeToReunite:%f",uVar7,local_16c);
              pcVar3 = *(code **)(*(int *)param_2 + 0x7b4);
              CAI_Concept::CAI_Concept
                        ((CAI_Concept *)&local_13c,"SurvivorBotReunitedWithOrphanedFriend");
              (*pcVar3)(param_2,(CAI_Concept *)&local_13c,1,local_127,0,0,0);
              piVar8 = (int *)(**(code **)(*(int *)param_2 + 0x9a4))(param_2);
              uVar11 = *(uint *)(param_1 + 0x34);
              if (((uVar11 == 0xffffffff) ||
                  (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10,
                  puVar10 == (undefined *)0xfffffffc)) || (*(uint *)(puVar10 + 8) != uVar11 >> 0xc))
              {
                uVar7 = 0;
              }
              else {
                uVar7 = *(undefined4 *)(puVar10 + 4);
              }
              (**(code **)(*piVar8 + 0xc4))
                        (piVar8,uVar7,1,0x3f800000,0,"Looking at orphan I\'ve just reunited with",1,
                         0x3e800000);
              *(undefined4 *)this = 3;
              *(undefined4 *)(this + 4) = 0;
              *(char **)(this + 8) = "Reunited with orphaned friend";
              goto LAB_0095eb70;
            }
          }
          uVar11 = *(uint *)(param_1 + 0x34);
          local_16c._0_4_ = g_pEntityList;
        }
      }
      else {
        uVar11 = *(uint *)(param_1 + 0x34);
        local_16c._0_4_ = g_pEntityList;
      }
      iVar6 = 0;
      if (((uVar11 != 0xffffffff) &&
          (puVar10 = local_16c._0_4_ + (uVar11 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
         && (*(uint *)(puVar10 + 8) == uVar11 >> 0xc)) {
        iVar6 = *(int *)(puVar10 + 4);
      }
      if (0.0 < *(float *)(iVar6 + 0x2f64)) {
        g_pEntityList = local_16c._0_4_;
        lVar13 = (longdouble)IntervalTimer::Now();
        if ((float)lVar13 - *(float *)(iVar6 + 0x2f64) < 0.1) {
          *(undefined4 *)this = 3;
          *(undefined4 *)(this + 4) = 0;
          *(char **)(this + 8) = "The orphan is no longer an orphan";
          goto LAB_0095eb70;
        }
        uVar11 = *(uint *)(param_1 + 0x34);
        local_16c._0_4_ = g_pEntityList;
      }
      local_164._0_4_ = (CTerrorPlayer *)0x0;
      if (((uVar11 != 0xffffffff) &&
          (puVar10 = local_16c._0_4_ + (uVar11 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
         && (*(uint *)(puVar10 + 8) == uVar11 >> 0xc)) {
        local_164._0_4_ = *(CTerrorPlayer **)(puVar10 + 4);
      }
      g_pEntityList = local_16c._0_4_;
      cVar5 = SurvivorBot::IsReachable((SurvivorBot *)param_2,local_164._0_4_);
      if (cVar5 == '\0') {
        if (*(float *)(param_1 + 0x4848) <= 0.0) {
          local_164 = 99999.8984375;
        }
        else {
          lVar13 = (longdouble)IntervalTimer::Now();
          local_164 = (double)((float)lVar13 - *(float *)(param_1 + 0x4848));
        }
        uVar11 = *(uint *)(param_1 + 0x34);
        if (((uVar11 == 0xffffffff) ||
            (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar10 == (undefined *)0xfffffffc))
           || (*(uint *)(puVar10 + 8) != uVar11 >> 0xc)) {
          iVar6 = 0;
        }
        else {
          iVar6 = *(int *)(puVar10 + 4);
        }
        uVar7 = SurvivorCharacterName(*(undefined4 *)(iVar6 + 0x2ba0));
        CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s,TimeToReunite:%f",uVar7,local_164);
        pcVar3 = *(code **)(*(int *)param_2 + 0x7b4);
        CAI_Concept::CAI_Concept
                  ((CAI_Concept *)&local_13c,"SurvivorBotOrphanedFriendBecameUnreachable");
        (*pcVar3)(param_2,(CAI_Concept *)&local_13c,1,local_127,0,0,0);
        *(undefined4 *)this = 3;
        *(undefined4 *)(this + 4) = 0;
        *(char **)(this + 8) = "The orphan is no longer reachable";
      }
      else {
        local_13c = &PTR_operator___00d09770;
        pIVar1 = (INextBot *)((int)param_2 + 0x4028);
        local_138 = pIVar1;
        local_134 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0xc0))(pIVar1);
        piVar8 = (int *)(**(code **)(*(int *)((int)param_2 + 0x4028) + 200))(pIVar1);
        iVar6 = (**(code **)(*piVar8 + 0xb8))(piVar8,pIVar1);
        local_12f = 0;
        local_130 = iVar6 != 0;
        uVar11 = *(uint *)(param_1 + 0x34);
        pCVar12 = (CBaseEntity *)0x0;
        if (((uVar11 != 0xffffffff) &&
            (puVar10 = g_pEntityList + (uVar11 & 0xfff) * 0x10, puVar10 != (undefined *)0xfffffffc))
           && (*(uint *)(puVar10 + 8) == uVar11 >> 0xc)) {
          pCVar12 = *(CBaseEntity **)(puVar10 + 4);
        }
        local_154 = 0;
        local_150 = 0;
        if (_towlower == 0) {
          local_140 = 0;
        }
        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;
        }
        iVar6 = _DAT_0105db00;
        local_148 = local_154;
        local_144 = local_150;
                    /* try { // try from 0095f261 to 0095f265 has its CatchHandler @ 0095f5d4 */
        if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
           (iVar9 = ThreadGetCurrentId(), iVar6 == iVar9)) {
          if ((char *)*_DAT_0105d15c != "ChasePath::Update") {
                    /* try { // try from 0095f573 to 0095f596 has its CatchHandler @ 0095f5d4 */
            _DAT_0105d15c =
                 (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1ef,(char *)0x0,0xca8906);
          }
          puVar2 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
          *puVar2 = *puVar2 | 4;
          CVProfNode::EnterScope();
          DAT_0105d158 = '\0';
        }
                    /* try { // try from 0095f295 to 0095f2a5 has its CatchHandler @ 0095f5b0 */
        ChasePath::RefreshPath
                  ((ChasePath *)(param_1 + 0x38),pIVar1,pCVar12,(IPathCost *)&local_13c,
                   (Vector *)0x0);
        PathFollower::Update((PathFollower *)(param_1 + 0x38),pIVar1);
        iVar6 = _DAT_0105db00;
        if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
           (iVar9 = ThreadGetCurrentId(), iVar6 == iVar9)) {
          cVar5 = CVProfNode::ExitScope();
          if (cVar5 != '\0') {
            _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
          }
          DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
        }
        if (local_140 != 0) {
          (**(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_0095eb70:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return this;
}

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)