L L4D2node

SurvivorBot::RescueImmobilizedFriends

0x0093ccd0 · 1989 bytes · __cdecl

_ZN11SurvivorBot24RescueImmobilizedFriendsEP6ActionIS_E

Decompiled

undefined (1 param)

/* SurvivorBot::RescueImmobilizedFriends(Action<SurvivorBot>*) */

Action * SurvivorBot::RescueImmobilizedFriends(Action *param_1)

{
  uint uVar1;
  code *pcVar2;
  char cVar3;
  SurvivorTeamSituation *pSVar4;
  undefined4 uVar5;
  SurvivorReviveFriend *pSVar6;
  SurvivorLiberateBesiegedFriend *pSVar7;
  SurvivorRescueBarricadedFriend *this;
  int iVar8;
  undefined *puVar9;
  CTerrorPlayer *this_00;
  CTerrorPlayer *pCVar10;
  CBaseEntity *pCVar11;
  CSurvivorRescue *this_01;
  int in_GS_OFFSET;
  longdouble lVar12;
  SurvivorBot *in_stack_00000008;
  int in_stack_0000000c;
  CTerrorPlayer *local_148;
  int local_140 [3];
  CAI_Concept local_134 [8];
  CFmtStrN<256> local_12c [268];
  int local_20;
  
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  if ((*(int *)(SurvivorBotPerfCrawl._28_4_ + 0x30) == 0) &&
     (cVar3 = IsAvailable(in_stack_00000008), cVar3 != '\0')) {
    pSVar4 = (SurvivorTeamSituation *)GetTeamSituation(in_stack_00000008);
    uVar1 = *(uint *)(pSVar4 + 0x10);
    if ((uVar1 == 0xffffffff) ||
       ((((puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc ||
          (*(uint *)(puVar9 + 8) != uVar1 >> 0xc)) ||
         (pCVar10 = *(CTerrorPlayer **)(puVar9 + 4), pCVar10 == (CTerrorPlayer *)0x0)) ||
        (cVar3 = (**(code **)(*(int *)pCVar10 + 0x16c))(pCVar10), cVar3 == '\0')))) {
      pCVar10 = (CTerrorPlayer *)0x0;
    }
    uVar1 = *(uint *)(pSVar4 + 8);
    if (((uVar1 == 0xffffffff) ||
        (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
       ((*(uint *)(puVar9 + 8) != uVar1 >> 0xc ||
        ((this_00 = *(CTerrorPlayer **)(puVar9 + 4), this_00 == (CTerrorPlayer *)0x0 ||
         (cVar3 = (**(code **)(*(int *)this_00 + 0x16c))(this_00), cVar3 == '\0')))))) {
      this_00 = (CTerrorPlayer *)0x0;
    }
    if ((pCVar10 == (CTerrorPlayer *)0x0) ||
       (cVar3 = CTerrorPlayer::HasWitchAttacker(pCVar10), cVar3 != '\0')) {
      if ((this_00 != (CTerrorPlayer *)0x0) &&
         (((cVar3 = (**(code **)(*(int *)(in_stack_00000008 + 0x4028) + 0xe0))
                              (in_stack_00000008 + 0x4028,this_00), cVar3 == '\0' &&
           (cVar3 = CTerrorPlayer::HasWitchAttacker(this_00), cVar3 == '\0')) &&
          (cVar3 = CDirector::IsFinaleVehicleReady(TheDirector), cVar3 == '\0')))) {
        pCVar10 = (CTerrorPlayer *)0x0;
        uVar1 = *(uint *)(pSVar4 + 8);
        if (((uVar1 != 0xffffffff) &&
            (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
           (*(uint *)(puVar9 + 8) == uVar1 >> 0xc)) {
          pCVar10 = *(CTerrorPlayer **)(puVar9 + 4);
        }
        lVar12 = (longdouble)CTerrorPlayer::GetTimeSinceAttackedByEnemy(pCVar10);
        if (1.5 < (float)lVar12) {
          pCVar11 = (CBaseEntity *)0x0;
          uVar1 = *(uint *)(pSVar4 + 8);
          if (((uVar1 != 0xffffffff) &&
              (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc))
             && (*(uint *)(puVar9 + 8) == uVar1 >> 0xc)) {
            pCVar11 = *(CBaseEntity **)(puVar9 + 4);
          }
          uVar5 = DescribeSubject(pCVar11);
          CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s",uVar5);
          pcVar2 = *(code **)(*(int *)in_stack_00000008 + 0x7b4);
          CAI_Concept::CAI_Concept(local_134,"SurvivorBotMovingToReviveFriend");
          (*pcVar2)();
          uVar1 = *(uint *)(pSVar4 + 8);
          if (((uVar1 == 0xffffffff) ||
              (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc))
             || (*(uint *)(puVar9 + 8) != uVar1 >> 0xc)) {
            local_148 = (CTerrorPlayer *)0x0;
          }
          else {
            local_148 = *(CTerrorPlayer **)(puVar9 + 4);
          }
          pSVar6 = ::operator_new(0x74);
                    /* try { // try from 0093d398 to 0093d39c has its CatchHandler @ 0093d4c6 */
          SurvivorReviveFriend::SurvivorReviveFriend(pSVar6,local_148);
          pSVar7 = ::operator_new(0x4c);
                    /* try { // try from 0093d3bc to 0093d3c0 has its CatchHandler @ 0093d4c4 */
          SurvivorLiberateBesiegedFriend::SurvivorLiberateBesiegedFriend
                    (pSVar7,local_148,(Action *)pSVar6);
          *(undefined4 *)param_1 = 2;
          *(SurvivorLiberateBesiegedFriend **)(param_1 + 4) = pSVar7;
          *(char **)(param_1 + 8) = "Rescuing a bot friend";
          *(undefined4 *)(in_stack_0000000c + 0x20) = 0;
          *(undefined4 *)(in_stack_0000000c + 0x24) = 0;
          *(undefined4 *)(in_stack_0000000c + 0x28) = 0;
          *(undefined4 *)(in_stack_0000000c + 0x2c) = 0;
          goto LAB_0093cd16;
        }
      }
    }
    else {
      pCVar10 = (CTerrorPlayer *)0x0;
      uVar1 = *(uint *)(pSVar4 + 0x10);
      if (((uVar1 != 0xffffffff) &&
          (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc)) &&
         (*(uint *)(puVar9 + 8) == uVar1 >> 0xc)) {
        pCVar10 = *(CTerrorPlayer **)(puVar9 + 4);
      }
      lVar12 = (longdouble)CTerrorPlayer::GetTimeSinceAttackedByEnemy(pCVar10);
      if ((1.5 < (float)lVar12) ||
         (cVar3 = CTerrorPlayer::IsBeingHeroic((CTerrorPlayer *)in_stack_00000008), cVar3 != '\0'))
      {
        pCVar11 = (CBaseEntity *)0x0;
        uVar1 = *(uint *)(pSVar4 + 0x10);
        if ((uVar1 != 0xffffffff) &&
           ((puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 != (undefined *)0xfffffffc &&
            (*(uint *)(puVar9 + 8) == uVar1 >> 0xc)))) {
          pCVar11 = *(CBaseEntity **)(puVar9 + 4);
        }
        uVar5 = DescribeSubject(pCVar11);
        CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s",uVar5);
        pcVar2 = *(code **)(*(int *)in_stack_00000008 + 0x7b4);
        CAI_Concept::CAI_Concept(local_134,"SurvivorBotMovingToReviveFriend");
        (*pcVar2)();
        uVar1 = *(uint *)(pSVar4 + 0x10);
        if (((uVar1 == 0xffffffff) ||
            (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc)) ||
           (*(uint *)(puVar9 + 8) != uVar1 >> 0xc)) {
          local_148 = (CTerrorPlayer *)0x0;
        }
        else {
          local_148 = *(CTerrorPlayer **)(puVar9 + 4);
        }
        pSVar6 = ::operator_new(0x74);
                    /* try { // try from 0093cf3d to 0093cf41 has its CatchHandler @ 0093d4da */
        SurvivorReviveFriend::SurvivorReviveFriend(pSVar6,local_148);
        pSVar7 = ::operator_new(0x4c);
                    /* try { // try from 0093cf61 to 0093cf65 has its CatchHandler @ 0093d4d8 */
        SurvivorLiberateBesiegedFriend::SurvivorLiberateBesiegedFriend
                  (pSVar7,local_148,(Action *)pSVar6);
        *(undefined4 *)param_1 = 2;
        *(SurvivorLiberateBesiegedFriend **)(param_1 + 4) = pSVar7;
        *(char **)(param_1 + 8) = "Rescuing a human friend";
        *(undefined4 *)(in_stack_0000000c + 0x20) = 0;
        *(undefined4 *)(in_stack_0000000c + 0x24) = 0;
        *(undefined4 *)(in_stack_0000000c + 0x28) = 0;
        *(undefined4 *)(in_stack_0000000c + 0x2c) = 0;
        goto LAB_0093cd16;
      }
    }
    if ((RescueImmobilizedFriends(Action<SurvivorBot>*)::infoSurvivorRescueStr == '\0') &&
       (iVar8 = __cxa_guard_acquire(&RescueImmobilizedFriends(Action<SurvivorBot>*)::
                                     infoSurvivorRescueStr), iVar8 != 0)) {
      DAT_01011c4c = 0;
      RescueImmobilizedFriends(Action<SurvivorBot>*)::infoSurvivorRescueStr = 0;
      DAT_01011c48 = "info_survivor_rescue";
      __cxa_guard_release(&RescueImmobilizedFriends(Action<SurvivorBot>*)::infoSurvivorRescueStr);
      __cxa_atexit(CGameString::~CGameString,
                   &RescueImmobilizedFriends(Action<SurvivorBot>*)::infoSurvivorRescueStr,
                   &__dso_handle);
    }
    this_01 = (CSurvivorRescue *)0x0;
    do {
      do {
        if (((RescueImmobilizedFriends(Action<SurvivorBot>*)::infoSurvivorRescueStr == 0) ||
            (iVar8 = RescueImmobilizedFriends(Action<SurvivorBot>*)::infoSurvivorRescueStr,
            DAT_01011c4c != CGameString::gm_iSerialNumber)) &&
           (iVar8 = 0, DAT_01011c48 != (char *)0x0)) {
          AllocPooledString((char *)local_140);
          RescueImmobilizedFriends(Action<SurvivorBot>*)::infoSurvivorRescueStr = local_140[0];
          DAT_01011c4c = CGameString::gm_iSerialNumber;
          iVar8 = local_140[0];
        }
        this_01 = (CSurvivorRescue *)
                  CGlobalEntityList::FindEntityByClassnameFast
                            ((CGlobalEntityList *)gEntList,this_01,iVar8);
        if (this_01 == (CSurvivorRescue *)0x0) goto LAB_0093cd02;
        cVar3 = CSurvivorRescue::IsCallingForHelp(this_01);
      } while (cVar3 == '\0');
      pcVar2 = *(code **)(*(int *)(in_stack_00000008 + 0x4028) + 0xe0);
      uVar5 = SurvivorTeamSituation::GetFriendClosestTo(pSVar4,this_01,0);
      cVar3 = (*pcVar2)(in_stack_00000008 + 0x4028,uVar5);
    } while ((cVar3 == '\0') ||
            (cVar3 = IsReachable(in_stack_00000008,(CBaseEntity *)this_01), cVar3 == '\0'));
    pCVar11 = (CBaseEntity *)CSurvivorRescue::GetSurvivor(this_01);
    uVar5 = DescribeSubject(pCVar11);
    CFmtStrN<256>::CFmtStrN(local_12c,"Subject:%s",uVar5);
    pcVar2 = *(code **)(*(int *)in_stack_00000008 + 0x7b4);
    CAI_Concept::CAI_Concept(local_134,"SurvivorBotMoveToRescueFriendFromCloset");
    (*pcVar2)();
    this = ::operator_new(0x68);
                    /* try { // try from 0093d170 to 0093d174 has its CatchHandler @ 0093d4b2 */
    SurvivorRescueBarricadedFriend::SurvivorRescueBarricadedFriend(this,(CBaseEntity *)this_01);
    *(undefined4 *)param_1 = 2;
    *(SurvivorRescueBarricadedFriend **)(param_1 + 4) = this;
    *(char **)(param_1 + 8) = "Rescuing a trapped friend";
    *(undefined4 *)(in_stack_0000000c + 0x20) = 0;
    *(undefined4 *)(in_stack_0000000c + 0x24) = 0;
    *(undefined4 *)(in_stack_0000000c + 0x28) = 0;
    *(undefined4 *)(in_stack_0000000c + 0x2c) = 0;
  }
  else {
LAB_0093cd02:
    *(undefined4 *)param_1 = 0;
    *(undefined4 *)(param_1 + 4) = 0;
    *(undefined4 *)(param_1 + 8) = 0;
  }
LAB_0093cd16:
  if (local_20 != *(int *)(in_GS_OFFSET + 0x14)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return param_1;
}

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)