L L4D2node

ZombieBotLocomotion::Update

0x00a56490 · 2612 bytes · __thiscall

_ZN19ZombieBotLocomotion6UpdateEv

Decompiled

undefined (1 param)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* ZombieBotLocomotion::Update() */

void __thiscall ZombieBotLocomotion::Update(ZombieBotLocomotion *this)

{
  uint *puVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  undefined4 uVar5;
  char cVar6;
  char cVar7;
  float *pfVar8;
  int *piVar9;
  undefined4 *puVar10;
  INextBot *this_00;
  Vector *pVVar11;
  int iVar12;
  int *piVar13;
  CBaseEntity *pCVar14;
  longdouble lVar15;
  float fVar16;
  float fVar17;
  float fVar18;
  float fVar19;
  float fVar20;
  float fVar21;
  float fVar22;
  int iVar23;
  float local_5c;
  undefined4 local_4c;
  undefined4 local_48;
  undefined4 local_40;
  undefined4 local_3c;
  int local_38;
  float local_34;
  float local_30;
  float local_2c;
  undefined4 local_28;
  float local_24;
  undefined4 local_20;
  
  local_4c = 0;
  local_48 = 0;
  if (_towlower == 0) {
    local_38 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_4c,0,0,0,0,
               "/data/src/game/server/terror/zombiebot/zombiebotlocomotion.cpp",0xd0,
               &Update()::tm_fmt,"(%s)%s","NextBot","ZombieBotLocomotion::Update");
    local_38 = _towlower;
  }
  iVar23 = _DAT_0105db00;
  local_40 = local_4c;
  local_3c = local_48;
                    /* try { // try from 00a56a06 to 00a56a66 has its CatchHandler @ 00a56f27 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar12 = ThreadGetCurrentId(), iVar23 == iVar12)) {
    if ((char *)*_DAT_0105d15c != "ZombieBotLocomotion::Update") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd2876b,(char *)0x0,0xca8906);
    }
    puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 00a5654a to 00a5699d has its CatchHandler @ 00a56f3c */
  ILocomotion::Update((ILocomotion *)this);
  fVar2 = *(float *)(this + 8);
  ApplyAccumulatedApproach(this);
  pfVar8 = (float *)(**(code **)(*(int *)this + 300))(this);
  fVar20 = *pfVar8;
  fVar17 = pfVar8[1];
  fVar3 = pfVar8[2];
  piVar9 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
  piVar9 = (int *)(**(code **)(*piVar9 + 0xc4))(piVar9);
  cVar6 = TraverseLadder(this);
  iVar23 = _DAT_0105db00;
  if (cVar6 == '\0') {
    cVar6 = (**(code **)(*piVar9 + 0x104))(piVar9);
    if (cVar6 == '\0') {
      *(undefined4 *)(this + 0x94) = 0;
      *(undefined4 *)(this + 0x98) = 0;
      *(undefined4 *)(this + 0x6c) = 0;
      *(undefined4 *)(this + 0x70) = 0;
    }
    cVar6 = (**(code **)(*(int *)this + 0xf8))(this);
    cVar7 = (**(code **)(*piVar9 + 0xe8))(piVar9,2);
    if (cVar7 == '\0') {
      uVar5 = *(undefined4 *)(this + 0x9c);
                    /* try { // try from 00a56bcb to 00a56bfe has its CatchHandler @ 00a56f3c */
      cVar7 = (**(code **)(*(int *)this + 0xf8))(this);
      if (cVar7 == '\0') {
        *(float *)(this + 0x9c) = *(float *)(this + 0x9c) - *(float *)(NextBotGravity._28_4_ + 0x2c)
        ;
      }
      cVar7 = (**(code **)(*(int *)this + 200))(this);
      if ((cVar7 == '\0') || (*(float *)(this + 0x74) <= 0.0)) {
        UpdateGroundConstraint(this);
        cVar7 = (**(code **)(*(int *)this + 0xf8))(this);
        if (cVar7 != '\0') {
          *(undefined4 *)(this + 0x9c) = uVar5;
        }
      }
    }
    pfVar8 = (float *)(**(code **)(*(int *)this + 300))(this);
    local_34 = *pfVar8;
    fVar4 = *(float *)(this + 0x120);
    fVar21 = -*(float *)(this + 0x11c);
    local_30 = pfVar8[1];
    local_2c = pfVar8[2];
    cVar7 = (**(code **)(*(int *)this + 0xf8))(this);
    if (cVar7 != '\0') {
      fVar22 = *(float *)(this + 0x70) * fVar21 + *(float *)(this + 0x6c) * fVar4;
      fVar18 = *(float *)(this + 0x120) * *(float *)(this + 0x70) +
               *(float *)(this + 0x11c) * *(float *)(this + 0x6c) +
               *(float *)(this + 0x124) * *(float *)(this + 0x74);
      fVar16 = DAT_01053d4c;
      fVar19 = vec3_origin;
      if (fVar18 < 0.0) {
        fVar19 = *(float *)(this + 0x11c) * -*(float *)(NextBotFrictionForward._28_4_ + 0x2c) *
                 fVar18;
        fVar16 = -*(float *)(NextBotFrictionForward._28_4_ + 0x2c) * *(float *)(this + 0x120) *
                 fVar18;
      }
      fVar18 = *(float *)(NextBotFrictionSideways._28_4_ + 0x2c);
      *(float *)(this + 0x94) = fVar4 * -fVar18 * fVar22 + *(float *)(this + 0x94) + fVar19;
      *(float *)(this + 0x98) = -fVar18 * fVar21 * fVar22 + *(float *)(this + 0x98) + fVar16;
    }
    cVar7 = (**(code **)(*piVar9 + 0xe8))(piVar9,1);
    if (cVar7 == '\0') {
      fVar19 = *(float *)(this + 0x94) * fVar2 + *(float *)(this + 0x6c);
      fVar16 = *(float *)(this + 0x98) * fVar2 + *(float *)(this + 0x70);
      *(float *)(this + 0x6c) = fVar19;
      *(float *)(this + 0x70) = fVar16;
      local_34 = fVar19 * fVar2 + local_34;
      local_30 = fVar16 * fVar2 + local_30;
    }
    else {
      *(undefined4 *)(this + 0x94) = 0;
      *(undefined4 *)(this + 0x98) = 0;
      piVar13 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
      pCVar14 = (CBaseEntity *)(**(code **)(*piVar13 + 0xb4))(piVar13);
      if (((byte)pCVar14[0x14d] & 0x10) != 0) {
        CBaseEntity::CalcAbsoluteVelocity(pCVar14);
      }
      *(undefined4 *)(this + 0x6c) = *(undefined4 *)(pCVar14 + 0x274);
      piVar13 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
      pCVar14 = (CBaseEntity *)(**(code **)(*piVar13 + 0xb4))(piVar13);
      if (((byte)pCVar14[0x14d] & 0x10) != 0) {
        CBaseEntity::CalcAbsoluteVelocity(pCVar14);
      }
      *(undefined4 *)(this + 0x70) = *(undefined4 *)(pCVar14 + 0x278);
    }
    cVar7 = (**(code **)(*piVar9 + 0xe8))(piVar9,2);
    if (cVar7 == '\0') {
      fVar16 = *(float *)(this + 0x9c) * fVar2 + *(float *)(this + 0x74);
      *(float *)(this + 0x74) = fVar16;
      local_2c = fVar16 * fVar2 + local_2c;
    }
    else {
      *(undefined4 *)(this + 0x9c) = 0;
      piVar13 = (int *)(**(code **)(*(int *)this + 0xb0))(this);
      pCVar14 = (CBaseEntity *)(**(code **)(*piVar13 + 0xb4))(piVar13);
      if (((byte)pCVar14[0x14d] & 0x10) != 0) {
        CBaseEntity::CalcAbsoluteVelocity(pCVar14);
      }
      *(undefined4 *)(this + 0x74) = *(undefined4 *)(pCVar14 + 0x27c);
    }
    UpdatePosition(this,(Vector *)&local_34);
    pfVar8 = (float *)(**(code **)(*(int *)this + 300))(this);
    fVar16 = pfVar8[1];
    fVar19 = pfVar8[2];
    fVar18 = *pfVar8;
    fVar22 = 1.0 / fVar2;
    cVar7 = (**(code **)(*piVar9 + 0xe8))(piVar9,1);
    if (cVar7 == '\0') {
      *(float *)(this + 0x6c) = (fVar18 - fVar20) * fVar22;
      *(float *)(this + 0x70) = (fVar16 - fVar17) * fVar22;
    }
    cVar7 = (**(code **)(*piVar9 + 0xe8))(piVar9,2);
    if (cVar7 == '\0') {
      *(float *)(this + 0x74) = (fVar19 - fVar3) * fVar22;
    }
    fVar20 = *(float *)(this + 0x6c);
    local_5c = *(float *)(this + 0x70);
    fVar17 = SQRT(local_5c * local_5c + fVar20 * fVar20);
    if (fVar17 == 0.0) {
      local_5c = 0.0;
      fVar20 = 0.0;
    }
    else {
      fVar20 = fVar20 * (1.0 / fVar17);
      local_5c = (1.0 / fVar17) * local_5c;
    }
    *(float *)(this + 0xa4) = fVar17;
    cVar7 = (**(code **)(*(int *)this + 0xf8))(this);
    if (cVar7 == '\0') {
      if (*(float *)(this + 0x70) * *(float *)(this + 0x70) +
          *(float *)(this + 0x6c) * *(float *)(this + 0x6c) +
          *(float *)(this + 0x74) * *(float *)(this + 0x74) < 1.0) {
        pfVar8 = (float *)(**(code **)(*(int *)this + 0x108))(this);
        lVar15 = (longdouble)(**(code **)(*(int *)this + 0x13c))(this);
        fVar3 = (float)lVar15;
        fVar20 = pfVar8[2];
        fVar17 = *pfVar8;
        *(float *)(this + 0x70) = pfVar8[1] * fVar3;
        *(float *)(this + 0x74) = fVar20 * fVar3;
        *(float *)(this + 0x6c) = fVar3 * fVar17;
      }
    }
    else {
      fVar17 = *(float *)(this + 0xa4);
      lVar15 = (longdouble)(**(code **)(*(int *)this + 0x13c))(this);
      if ((float)lVar15 < fVar17) {
        lVar15 = (longdouble)(**(code **)(*(int *)this + 0x13c))(this);
        fVar17 = (float)lVar15;
        *(float *)(this + 0xa4) = fVar17;
        *(float *)(this + 0x6c) = fVar20 * fVar17;
        *(float *)(this + 0x70) = fVar17 * local_5c;
      }
      if (cVar6 == '\0') {
        *(undefined4 *)(this + 0x74) = 0;
        *(undefined4 *)(this + 0x9c) = 0;
      }
    }
    CBaseEntity::SetAbsVelocity(*(CBaseEntity **)(this + 0x78),(Vector *)(this + 0x6c));
    puVar10 = (undefined4 *)(**(code **)(*(int *)this + 0x128))(this);
    local_28 = *puVar10;
    fVar20 = *(float *)(this + 0x98);
    fVar17 = *(float *)(this + 0x94);
    local_24 = (float)puVar10[1];
    local_20 = puVar10[2];
    fVar3 = *(float *)(NextBotAcceleration._28_4_ + 0x2c);
    fVar19 = *(float *)(NextBotLeanMaxAngle._28_4_ + 0x2c);
    fVar16 = *(float *)(this + 0xa4);
    lVar15 = (longdouble)(**(code **)(*(int *)this + 0x13c))(this);
    local_24 = fVar2 * *(float *)(NextBotLeanRate._28_4_ + 0x2c) *
               (-((fVar19 * fVar16) / (float)lVar15) * ((fVar4 * fVar17 + fVar21 * fVar20) / fVar3)
               - local_24) + local_24;
    (**(code **)(*(int *)this + 0x124))(this,&local_28);
    *(float *)(this + 0x94) = vec3_origin;
    *(float *)(this + 0x98) = DAT_01053d4c;
    *(undefined4 *)(this + 0x9c) = DAT_01053d50;
    this_00 = (INextBot *)(**(code **)(*(int *)this + 0xb0))(this);
    cVar6 = INextBot::IsDebugging(this_00,0x10);
    if (cVar6 != '\0') {
      cVar6 = (**(code **)(*(int *)this + 0xf8))(this);
      if (cVar6 == '\0') {
        pVVar11 = (Vector *)(**(code **)(*(int *)this + 300))();
        iVar23 = 0xff;
      }
      else {
                    /* try { // try from 00a56cb8 to 00a56efa has its CatchHandler @ 00a56f3c */
        pVVar11 = (Vector *)(**(code **)(*(int *)this + 300))(this);
        iVar23 = 0;
      }
      NDebugOverlay::Cross3D(pVVar11,1.0,0,0xff,iVar23,true,15.0);
    }
    iVar23 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar12 = ThreadGetCurrentId(), iVar23 == iVar12)) {
      cVar6 = CVProfNode::ExitScope();
      if (cVar6 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_38 != 0) {
      (**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
      return;
    }
  }
  else {
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar12 = ThreadGetCurrentId(), iVar23 == iVar12)) {
      cVar6 = CVProfNode::ExitScope();
      if (cVar6 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_38 != 0) {
      (**(code **)(local_38 + 0x54))(local_38,local_40,local_3c,0,0,0);
    }
  }
  return;
}

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)