L L4D2node

SurvivorElevatorEnter::Update

0x009208d0 · 1556 bytes · __thiscall

_ZN21SurvivorElevatorEnter6UpdateEP11SurvivorBotf

Decompiled

undefined (3 params)

/* SurvivorElevatorEnter::Update(SurvivorBot*, float) */

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

{
  uint uVar1;
  char cVar2;
  int iVar3;
  SurvivorTeamSituation *this_00;
  undefined4 *puVar4;
  undefined4 uVar5;
  CBaseEntity *pCVar6;
  Vector *pVVar7;
  SurvivorUseObject *pSVar8;
  CFuncElevator *this_01;
  undefined *puVar9;
  longdouble lVar10;
  int local_30 [2];
  int local_28;
  undefined4 local_24;
  undefined4 local_20;
  
  iVar3 = CTerrorPlayer::GetMovingPlatform((CTerrorPlayer *)param_2);
  if (iVar3 == 0) {
    *(undefined4 *)this = 3;
    *(undefined4 *)(this + 4) = 0;
    *(char **)(this + 8) = "No longer on an elevator";
    return this;
  }
  SurvivorBot::SaveFriendsInImmediateTrouble((Action *)&local_28);
  if ((((local_28 - 1U < 3) ||
       (SurvivorBot::UseHealingItems((Action *)&local_28), local_28 - 1U < 3)) ||
      (SurvivorBot::RescueImmobilizedFriends((Action *)&local_28), local_28 - 1U < 3)) ||
     (SurvivorBot::InteractWithUsables((Action *)&local_28), local_28 - 1U < 3)) {
    *(int *)this = local_28;
    *(undefined4 *)(this + 4) = local_24;
    *(undefined4 *)(this + 8) = local_20;
    return this;
  }
  cVar2 = CTerrorPlayer::IsOnMovingPlatformInMotion((CTerrorPlayer *)param_2);
  if (cVar2 != '\0') {
    puVar4 = ::operator_new(0x34);
    *(undefined4 *)this = 1;
    puVar4[8] = 0;
    puVar4[9] = 0;
    puVar4[10] = 0;
    puVar4[3] = 0;
    puVar4[4] = 0;
    puVar4[5] = 0;
    puVar4[6] = 0;
    puVar4[7] = 0;
    puVar4[2] = 0;
    *(undefined1 *)(puVar4 + 0xc) = 0;
    *(undefined1 *)((int)puVar4 + 0x31) = 0;
    puVar4[0xb] = 0;
    *puVar4 = &PTR__SurvivorElevatorRide_00d02c88;
    puVar4[1] = &PTR__SurvivorElevatorRide_00d02dec;
    *(undefined4 **)(this + 4) = puVar4;
    *(char **)(this + 8) = "The elevator is moving";
    return this;
  }
  this_00 = (SurvivorTeamSituation *)SurvivorBot::GetTeamSituation((SurvivorBot *)param_2);
  cVar2 = SurvivorTeamSituation::IsSurvivingTeamAllBots(this_00);
  if (cVar2 != '\0') {
    lVar10 = (longdouble)IntervalTimer::Now();
    if (5.0 < (float)lVar10 - *(float *)(param_1 + 0x38)) {
      iVar3 = CTerrorPlayer::GetMovingPlatform((CTerrorPlayer *)param_2);
      if ((iVar3 == 0) ||
         (iVar3 = __dynamic_cast(iVar3,&CBaseEntity::typeinfo,&CFuncTrackTrain::typeinfo,0),
         iVar3 == 0)) {
        iVar3 = CTerrorPlayer::GetMovingPlatform((CTerrorPlayer *)param_2);
        if ((((iVar3 != 0) &&
             ((this_01 = (CFuncElevator *)
                         __dynamic_cast(iVar3,&CBaseEntity::typeinfo,&CFuncElevator::typeinfo,0),
              this_01 != (CFuncElevator *)0x0 &&
              (iVar3 = CFuncElevator::GetCurrentFloor(this_01), -1 < iVar3)))) &&
            (iVar3 < *(int *)(this_01 + 0x54c))) &&
           (iVar3 = iVar3 * 0xc + *(int *)(this_01 + 0x540), iVar3 != 0)) {
          uVar1 = *(uint *)(iVar3 + 8);
          if ((((uVar1 == 0xffffffff) ||
               (puVar9 = g_pEntityList + (uVar1 & 0xfff) * 0x10, puVar9 == (undefined *)0xfffffffc))
              || (*(uint *)(puVar9 + 8) != uVar1 >> 0xc)) ||
             (pCVar6 = *(CBaseEntity **)(puVar9 + 4), pCVar6 == (CBaseEntity *)0x0)) {
            if ((Update(SurvivorBot*,float)::buttonStr == '\0') &&
               (iVar3 = __cxa_guard_acquire(&Update(SurvivorBot*,float)::buttonStr), iVar3 != 0)) {
              DAT_0100ffe0 = 0;
              Update(SurvivorBot*,float)::buttonStr = 0;
              DAT_0100ffdc = "func_button";
              __cxa_guard_release(&Update(SurvivorBot*,float)::buttonStr);
              __cxa_atexit(CGameString::~CGameString,&Update(SurvivorBot*,float)::buttonStr,
                           &__dso_handle);
            }
            uVar5 = (**(code **)(*(int *)param_2 + 0x288))(param_2);
            if ((Update(SurvivorBot*,float)::buttonStr == 0) ||
               (iVar3 = Update(SurvivorBot*,float)::buttonStr,
               DAT_0100ffe0 != CGameString::gm_iSerialNumber)) {
              if (DAT_0100ffdc == (char *)0x0) {
                iVar3 = 0;
              }
              else {
                AllocPooledString((char *)local_30);
                Update(SurvivorBot*,float)::buttonStr = local_30[0];
                DAT_0100ffe0 = CGameString::gm_iSerialNumber;
                iVar3 = local_30[0];
              }
            }
            pCVar6 = (CBaseEntity *)
                     CGlobalEntityList::FindEntityByClassnameNearestFast
                               ((CGlobalEntityList *)gEntList,iVar3,uVar5,0x43fa0000);
            if (pCVar6 == (CBaseEntity *)0x0) goto LAB_009209b7;
          }
          pVVar7 = (Vector *)(**(code **)(*(int *)pCVar6 + 0x288))(pCVar6);
          uVar5 = CDirectorTacticalServices::GetClosestSurvivor
                            (*(CDirectorTacticalServices **)(TheDirector + 0x628),pVVar7,false,true)
          ;
          cVar2 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0xe0))((int)param_2 + 0x4028,uVar5)
          ;
          if (cVar2 != '\0') {
            pSVar8 = ::operator_new(0x68);
                    /* try { // try from 00920e32 to 00920e36 has its CatchHandler @ 00920e72 */
            SurvivorUseObject::SurvivorUseObject(pSVar8,pCVar6);
            *(undefined4 *)this = 2;
            *(SurvivorUseObject **)(this + 4) = pSVar8;
            *(char **)(this + 8) = "Pressing the button to start the elevator";
            *(undefined4 *)(param_1 + 0x20) = 0;
            *(undefined4 *)(param_1 + 0x24) = 0;
            *(undefined4 *)(param_1 + 0x28) = 0;
            *(undefined4 *)(param_1 + 0x2c) = 0;
            return this;
          }
        }
      }
      else {
        if ((Update(SurvivorBot*,float)::buttonStr == '\0') &&
           (iVar3 = __cxa_guard_acquire(&Update(SurvivorBot*,float)::buttonStr), iVar3 != 0)) {
          DAT_0100fff0 = 0;
          Update(SurvivorBot*,float)::buttonStr = 0;
          DAT_0100ffec = "func_button";
          __cxa_guard_release(&Update(SurvivorBot*,float)::buttonStr);
          __cxa_atexit(CGameString::~CGameString,&Update(SurvivorBot*,float)::buttonStr,
                       &__dso_handle);
        }
        uVar5 = (**(code **)(*(int *)param_2 + 0x288))(param_2);
        if (((Update(SurvivorBot*,float)::buttonStr == 0) ||
            (iVar3 = Update(SurvivorBot*,float)::buttonStr,
            DAT_0100fff0 != CGameString::gm_iSerialNumber)) &&
           (iVar3 = 0, DAT_0100ffec != (char *)0x0)) {
          AllocPooledString((char *)local_30);
          Update(SurvivorBot*,float)::buttonStr = local_30[0];
          DAT_0100fff0 = CGameString::gm_iSerialNumber;
          iVar3 = local_30[0];
        }
        pCVar6 = (CBaseEntity *)
                 CGlobalEntityList::FindEntityByClassnameNearestFast
                           ((CGlobalEntityList *)gEntList,iVar3,uVar5,0x43fa0000);
        if (pCVar6 == (CBaseEntity *)0x0) {
          lVar10 = (longdouble)IntervalTimer::Now();
          if ((float)lVar10 != *(float *)(param_1 + 0x38)) {
            (**(code **)(*(int *)(param_1 + 0x34) + 4))(param_1 + 0x34,param_1 + 0x38);
            *(float *)(param_1 + 0x38) = (float)lVar10;
          }
        }
        else {
          pVVar7 = (Vector *)(**(code **)(*(int *)pCVar6 + 0x288))(pCVar6);
          uVar5 = CDirectorTacticalServices::GetClosestSurvivor
                            (*(CDirectorTacticalServices **)(TheDirector + 0x628),pVVar7,false,true)
          ;
          cVar2 = (**(code **)(*(int *)((int)param_2 + 0x4028) + 0xe0))((int)param_2 + 0x4028,uVar5)
          ;
          if (cVar2 != '\0') {
            pSVar8 = ::operator_new(0x68);
                    /* try { // try from 00920bd2 to 00920bd6 has its CatchHandler @ 00920ee3 */
            SurvivorUseObject::SurvivorUseObject(pSVar8,pCVar6);
            *(undefined4 *)this = 2;
            *(SurvivorUseObject **)(this + 4) = pSVar8;
            *(char **)(this + 8) = "Pressing the button to start the track train";
            *(undefined4 *)(param_1 + 0x20) = 0;
            *(undefined4 *)(param_1 + 0x24) = 0;
            *(undefined4 *)(param_1 + 0x28) = 0;
            *(undefined4 *)(param_1 + 0x2c) = 0;
            return this;
          }
        }
      }
    }
  }
LAB_009209b7:
  *(undefined4 *)this = 0;
  *(undefined4 *)(this + 4) = 0;
  *(undefined4 *)(this + 8) = 0;
  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)