L L4D2node

SurvivorBehavior::Update

0x00927770 · 1707 bytes · __thiscall

_ZN16SurvivorBehavior6UpdateEP11SurvivorBotf

Decompiled

undefined (3 params)

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

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

{
  float fVar1;
  char cVar2;
  SurvivorTeamSituation *this_00;
  TerrorNavArea *pTVar3;
  int iVar4;
  undefined4 *puVar5;
  uint uVar6;
  SurvivorCloseDoor *this_01;
  undefined *puVar7;
  uint uVar8;
  int *piVar9;
  CBasePropDoor *pCVar10;
  SurvivorBehavior *pSVar11;
  byte bVar12;
  longdouble lVar13;
  CTerrorPlayer *pCVar14;
  SurvivorBot *pSVar15;
  int local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  bVar12 = 0;
  this_00 = (SurvivorTeamSituation *)SurvivorBot::GetTeamSituation((SurvivorBot *)param_2);
  cVar2 = CDirector::HasAnySurvivorLeftSafeArea(TheDirector);
  if ((cVar2 == '\0') && (param_1[0x6c] == (SurvivorBot)0x0)) {
    param_1[0x6c] = (SurvivorBot)0x1;
    puVar5 = ::operator_new(0x5c);
    *(undefined4 *)this = 2;
    puVar5[8] = 0;
    puVar5[9] = 0;
    puVar5[10] = 0;
    puVar5[3] = 0;
    puVar5[4] = 0;
    puVar5[5] = 0;
    puVar5[6] = 0;
    puVar5[7] = 0;
    puVar5[2] = 0;
    *(undefined1 *)(puVar5 + 0xc) = 0;
    *(undefined1 *)((int)puVar5 + 0x31) = 0;
    puVar5[0xb] = 0;
    *puVar5 = &PTR__SurvivorCheckpointLeaving_00d005a8;
    puVar5[1] = &PTR__SurvivorCheckpointLeaving_00d00710;
    puVar5[0xd] = &PTR_NetworkStateChanged_00c0b6e0;
    puVar5[0xe] = 0;
    puVar5[0xf] = 0xbf800000;
    puVar5[0x10] = &PTR_NetworkStateChanged_00c0b6e0;
    puVar5[0x11] = 0;
    puVar5[0x12] = 0xbf800000;
    *(undefined4 **)(this + 4) = puVar5;
    *(undefined4 *)(param_1 + 0x20) = 0;
    *(undefined4 *)(param_1 + 0x24) = 0;
    *(undefined4 *)(param_1 + 0x28) = 0;
    *(undefined4 *)(param_1 + 0x2c) = 0;
    *(char **)(this + 8) = "Haven\'t left the initial checkpoint yet";
    return this;
  }
  if (*(int *)(param_1 + 0x5c) != 0) {
    pTVar3 = (TerrorNavArea *)(**(code **)(*(int *)param_2 + 0x52c))(param_2);
    cVar2 = Checkpoint::ContainsArea(*(Checkpoint **)(param_1 + 0x5c),pTVar3);
    if ((cVar2 != '\0') &&
       (cVar2 = SurvivorBot::ShouldLeaveSaferoomToHelpTeammates(), cVar2 == '\0')) {
      puVar5 = ::operator_new(0x50);
      *(undefined4 *)this = 2;
      puVar5[8] = 0;
      puVar5[9] = 0;
      puVar5[10] = 0;
      puVar5[3] = 0;
      puVar5[4] = 0;
      puVar5[5] = 0;
      puVar5[6] = 0;
      puVar5[7] = 0;
      puVar5[2] = 0;
      *(undefined1 *)(puVar5 + 0xc) = 0;
      *(undefined1 *)((int)puVar5 + 0x31) = 0;
      puVar5[0xb] = 0;
      *puVar5 = &PTR__SurvivorCheckpointReached_00d00888;
      puVar5[1] = &PTR__SurvivorCheckpointReached_00d009f0;
      puVar5[0xe] = &PTR_NetworkStateChanged_00c0b6e0;
      puVar5[0xf] = 0;
      puVar5[0x10] = 0xbf800000;
      puVar5[0x11] = &PTR_NetworkStateChanged_00c0b6e0;
      puVar5[0x12] = 0;
      puVar5[0x13] = 0xbf800000;
      *(undefined4 **)(this + 4) = puVar5;
      *(undefined4 *)(param_1 + 0x20) = 0;
      *(undefined4 *)(param_1 + 0x24) = 0;
      *(undefined4 *)(param_1 + 0x28) = 0;
      *(undefined4 *)(param_1 + 0x2c) = 0;
      *(char **)(this + 8) = "I reached the checkpoint!";
      return this;
    }
  }
  iVar4 = CTerrorPlayer::GetMovingPlatform((CTerrorPlayer *)param_2);
  if (iVar4 != 0) {
    puVar5 = ::operator_new(0x3c);
    *(undefined4 *)this = 2;
    puVar5[8] = 0;
    puVar5[9] = 0;
    puVar5[10] = 0;
    puVar5[3] = 0;
    puVar5[4] = 0;
    puVar5[5] = 0;
    puVar5[6] = 0;
    puVar5[7] = 0;
    puVar5[2] = 0;
    *(undefined1 *)(puVar5 + 0xc) = 0;
    *(undefined1 *)((int)puVar5 + 0x31) = 0;
    puVar5[0xb] = 0;
    *puVar5 = &PTR__SurvivorElevatorEnter_00d02a68;
    puVar5[1] = &PTR__SurvivorElevatorEnter_00d02bcc;
    puVar5[0xd] = &PTR_NetworkStateChanged_00c23e10;
    puVar5[0xe] = 0xbf800000;
    *(undefined4 **)(this + 4) = puVar5;
    *(undefined4 *)(param_1 + 0x20) = 0;
    *(undefined4 *)(param_1 + 0x24) = 0;
    *(undefined4 *)(param_1 + 0x28) = 0;
    *(undefined4 *)(param_1 + 0x2c) = 0;
    *(char **)(this + 8) = "I entered an elevator";
    return this;
  }
  cVar2 = SurvivorBot::IsAvailable((SurvivorBot *)param_2);
  if (cVar2 == '\0') goto LAB_00927a4c;
  pSVar15 = param_1;
  SurvivorBot::SaveFriendsInImmediateTrouble((Action *)&local_28);
  if (local_28 - 1U < 3) {
LAB_00927a89:
    *(int *)this = local_28;
    *(undefined4 *)(this + 4) = local_24;
    *(undefined4 *)(this + 8) = local_20;
    return this;
  }
  lVar13 = (longdouble)CountdownTimer::Now();
  if (*(float *)(param_1 + 0x3c) <= (float)lVar13) {
    lVar13 = (longdouble)RandomFloat(0x3f800000,0x40000000,pSVar15);
    fVar1 = (float)lVar13;
    lVar13 = (longdouble)CountdownTimer::Now();
    if ((float)lVar13 + fVar1 != *(float *)(param_1 + 0x3c)) {
      (**(code **)(*(int *)(param_1 + 0x34) + 4))(param_1 + 0x34,param_1 + 0x3c);
      *(float *)(param_1 + 0x3c) = (float)lVar13 + fVar1;
    }
    if (fVar1 != *(float *)(param_1 + 0x38)) {
      (**(code **)(*(int *)(param_1 + 0x34) + 4))(param_1 + 0x34,param_1 + 0x38);
      *(float *)(param_1 + 0x38) = fVar1;
    }
    SurvivorBot::UseHealingItems((Action *)&local_28);
    if ((local_28 - 1U < 3) ||
       (SurvivorBot::RescueImmobilizedFriends((Action *)&local_28), local_28 - 1U < 3))
    goto LAB_00927a89;
    SurvivorBot::ScavengeNearbyItems((Action *)&local_28);
    if ((local_28 - 1U < 3) ||
       (pSVar15 = param_1, SurvivorBot::InteractWithUsables((Action *)&local_28), local_28 - 1U < 3)
       ) {
      piVar9 = &local_28;
      pSVar11 = this;
      for (iVar4 = 3; iVar4 != 0; iVar4 = iVar4 + -1) {
        *(int *)pSVar11 = *piVar9;
        piVar9 = piVar9 + (uint)bVar12 * -2 + 1;
        pSVar11 = pSVar11 + (uint)bVar12 * -8 + 4;
      }
      return this;
    }
  }
  cVar2 = CTerrorPlayer::IsInCombat((CTerrorPlayer *)param_2,false);
  uVar6 = *(uint *)(this_00 + 0x50);
  if ((((((uVar6 != 0xffffffff) &&
         (puVar7 = g_pEntityList + (uVar6 & 0xfff) * 0x10, puVar7 != (undefined *)0xfffffffc)) &&
        (*(uint *)(puVar7 + 8) == uVar6 >> 0xc)) &&
       (pCVar14 = *(CTerrorPlayer **)(puVar7 + 4), pCVar14 != (CTerrorPlayer *)0x0)) &&
      ((piVar9 = (int *)SurvivorTeamSituation::GetPathToFriend(this_00,pCVar14),
       piVar9 == (int *)0x0 ||
       (lVar13 = (longdouble)(**(code **)(*piVar9 + 8))(piVar9,pCVar14,pSVar15),
       750.0 < (float)lVar13)))) || (cVar2 != '\0')) {
    if (*(float *)(param_1 + 0x7c) != -1.0) {
      CountdownTimer::NetworkVar_m_timestamp::NetworkStateChanged(param_1 + 0x7c);
      *(undefined4 *)(param_1 + 0x7c) = 0xbf800000;
    }
    goto LAB_00927a4c;
  }
  if (*(float *)(param_1 + 0x7c) <= 0.0) goto LAB_00927a4c;
  lVar13 = (longdouble)CountdownTimer::Now();
  if (((float)lVar13 < *(float *)(param_1 + 0x7c)) ||
     (uVar6 = *(uint *)(param_1 + 0x70), uVar6 == 0xffffffff)) goto LAB_00927a4c;
  uVar8 = uVar6 & 0xfff;
  piVar9 = (int *)(g_pEntityList + uVar8 * 0x10 + 4);
  if ((piVar9 == (int *)0x0) ||
     ((*(uint *)(g_pEntityList + uVar8 * 0x10 + 8) != uVar6 >> 0xc ||
      (*(int *)(g_pEntityList + uVar8 * 0x10 + 4) == 0)))) goto LAB_00927a4c;
  if (*(float *)(param_1 + 0x7c) == -1.0) {
LAB_00927c91:
    if (piVar9[1] == uVar6 >> 0xc) {
      iVar4 = *piVar9;
    }
    else {
      iVar4 = 0;
    }
    if (*(int *)(&DAT_000015f4 + iVar4) != 2) goto LAB_00927a4c;
    if (piVar9[1] != uVar6 >> 0xc) goto LAB_00927cb8;
    iVar4 = *piVar9;
LAB_00927cba:
    if (*(int *)(&DAT_000015f4 + iVar4) == 3) {
LAB_00927a4c:
      *(undefined4 *)this = 0;
      *(undefined4 *)(this + 4) = 0;
      *(undefined4 *)(this + 8) = 0;
      return this;
    }
    if ((piVar9 != (int *)0x0) && (piVar9[1] == uVar6 >> 0xc)) {
      pCVar10 = (CBasePropDoor *)*piVar9;
      goto LAB_00927cd5;
    }
  }
  else {
    CountdownTimer::NetworkVar_m_timestamp::NetworkStateChanged(param_1 + 0x7c);
    uVar6 = *(uint *)(param_1 + 0x70);
    *(undefined4 *)(param_1 + 0x7c) = 0xbf800000;
    if (uVar6 != 0xffffffff) {
      piVar9 = (int *)(g_pEntityList + (uVar6 & 0xfff) * 0x10 + 4);
      if (piVar9 != (int *)0x0) goto LAB_00927c91;
      if (_DAT_000015f4 != 2) goto LAB_00927a4c;
LAB_00927cb8:
      iVar4 = 0;
      goto LAB_00927cba;
    }
    if (_DAT_000015f4 != 2) goto LAB_00927a4c;
  }
  pCVar10 = (CBasePropDoor *)0x0;
LAB_00927cd5:
  this_01 = ::operator_new(0x44);
                    /* try { // try from 00927cf0 to 00927cf4 has its CatchHandler @ 00927e18 */
  SurvivorCloseDoor::SurvivorCloseDoor(this_01,pCVar10);
  *(undefined4 *)(param_1 + 0x20) = 0;
  *(undefined4 *)(param_1 + 0x24) = 0;
  *(undefined4 *)(param_1 + 0x28) = 0;
  *(undefined4 *)(param_1 + 0x2c) = 0;
  *(undefined4 *)this = 2;
  *(SurvivorCloseDoor **)(this + 4) = this_01;
  *(char **)(this + 8) = "Closing door behind us";
  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)