L L4D2node

InfectedAmbientMob::OnStart

0x00a27160 · 1647 bytes · __thiscall

_ZN18InfectedAmbientMob7OnStartEP8InfectedP6ActionIS0_E

Decompiled

undefined (3 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* InfectedAmbientMob::OnStart(Infected*, Action<Infected>*) */

void __thiscall
InfectedAmbientMob::OnStart(InfectedAmbientMob *this,Infected *param_1,Action *param_2)

{
  Vector *pVVar1;
  uint *puVar2;
  CNavArea CVar3;
  bool bVar4;
  char cVar5;
  PathFollower *this_00;
  Vector *pVVar6;
  int *piVar7;
  CNavArea *pCVar8;
  CNavArea *pCVar9;
  CBaseEntity *pCVar10;
  int iVar11;
  int iVar12;
  Infected *pIVar13;
  INextBot *pIVar14;
  longdouble lVar15;
  CNavArea *local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_54;
  undefined4 local_50;
  int local_4c;
  float local_48;
  float local_44;
  float local_40;
  undefined4 local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined **local_30;
  Action *local_2c;
  undefined4 local_24;
  float local_20;
  
  this_00 = (PathFollower *)(param_1 + 0x44);
  PathFollower::Invalidate(this_00);
  local_30 = &PTR_operator___00d22370;
  local_2c = (Action *)0x0;
  if (param_2 != (Action *)0x0) {
    local_2c = param_2 + 0x1a3c;
  }
  local_24 = (**(code **)(*(int *)local_2c + 0xc0))(local_2c);
  lVar15 = (longdouble)RandomFloat(0,0x3f400000);
  local_20 = (float)lVar15;
  pCVar10 = *(CBaseEntity **)(param_1 + 0x40);
  if (((byte)pCVar10[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(pCVar10);
  }
  pVVar1 = (Vector *)(pCVar10 + 0x2e0);
  local_5c = 0;
  local_58 = 0;
  pIVar14 = (INextBot *)0x0;
  if (param_2 != (Action *)0x0) {
    pIVar14 = (INextBot *)(param_2 + 0x1a3c);
  }
  if (_towlower == 0) {
    local_4c = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_5c,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x113,
               &Path::
                Compute<InfectedAmbientMobPathCost>(INextBot*,Vector_const&,InfectedAmbientMobPathCost&,float)
                ::tm_fmt,"(%s)%s","NextBotSpiky","Path::Compute(goal)");
    local_4c = _towlower;
  }
  iVar11 = _DAT_0105db00;
  local_54 = local_5c;
  local_50 = local_58;
  if ((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) {
                    /* try { // try from 00a2761e to 00a2767e has its CatchHandler @ 00a277e2 */
    iVar12 = ThreadGetCurrentId();
    if (iVar11 == iVar12) {
      if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
        _DAT_0105d15c =
             (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1b7,(char *)0x0,0xbfa1cb);
      }
      puVar2 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
      *puVar2 = *puVar2 | 4;
      CVProfNode::EnterScope();
      DAT_0105d158 = '\0';
    }
  }
                    /* try { // try from 00a272ab to 00a2753f has its CatchHandler @ 00a277f7 */
  (**(code **)(*(int *)(param_1 + 0x44) + 0x48))(this_00);
  pVVar6 = (Vector *)(**(code **)(*(int *)pIVar14 + 0xd4))(pIVar14);
  piVar7 = (int *)(**(code **)(*(int *)pIVar14 + 0xb4))(pIVar14);
  pCVar8 = (CNavArea *)(**(code **)(*piVar7 + 0x52c))(piVar7);
  if (pCVar8 == (CNavArea *)0x0) {
    (**(code **)(*(int *)(param_1 + 0x44) + 100))(this_00,pIVar14,2);
    goto LAB_00a27540;
  }
  pCVar9 = (CNavArea *)CNavMesh::GetNearestNavArea(TheNavMesh,pVVar1,true,200.0,true,true,false);
  if (pCVar8 != pCVar9) {
    local_48 = *(float *)(pCVar10 + 0x2e0);
    local_44 = *(float *)(pCVar10 + 0x2e4);
    local_40 = *(float *)(pCVar10 + 0x2e8);
    if (pCVar9 == (CNavArea *)0x0) {
      CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_48,&local_40,(Vector *)0x0);
    }
    else {
      lVar15 = (longdouble)CNavArea::GetZ(pCVar9,local_48,local_44);
      local_40 = (float)lVar15;
    }
    pCVar10 = (CBaseEntity *)(**(code **)(*(int *)pIVar14 + 0xb4))(pIVar14);
    if (((byte)pCVar10[0x14d] & 8) != 0) {
                    /* try { // try from 00a276d5 to 00a276d9 has its CatchHandler @ 00a277f7 */
      CBaseEntity::CalcAbsolutePosition(pCVar10);
    }
    local_3c = *(undefined4 *)(pCVar10 + 0x2e0);
    local_60 = (CNavArea *)0x0;
    local_38 = *(undefined4 *)(pCVar10 + 0x2e4);
    local_34 = *(undefined4 *)(pCVar10 + 0x2e8);
    pCVar10 = (CBaseEntity *)(**(code **)(*(int *)pIVar14 + 0xb4))(pIVar14);
    iVar11 = CBaseEntity::GetTeamNumber(pCVar10);
    bVar4 = NavAreaBuildPath<InfectedAmbientMobPathCost>
                      (pCVar8,pCVar9,(Vector *)&local_3c,pVVar1,
                       (InfectedAmbientMobPathCost *)&local_30,&local_60,0.0,iVar11,false);
    if (local_60 == (CNavArea *)0x0) goto LAB_00a27540;
    if (pCVar8 != local_60) {
      iVar11 = 1;
      pCVar9 = local_60;
      do {
        pCVar9 = *(CNavArea **)(pCVar9 + 0x78);
        if (pCVar9 == (CNavArea *)0x0) break;
        iVar11 = iVar11 + 1;
      } while (pCVar8 != pCVar9);
      if (iVar11 < 0x100) {
        if (iVar11 == 1) goto LAB_00a2777f;
        *(int *)(param_1 + 0x4448) = iVar11;
      }
      else {
        iVar11 = 0xff;
        *(undefined4 *)(param_1 + 0x4448) = 0xff;
      }
      pCVar8 = local_60;
      iVar12 = iVar11;
      pIVar13 = param_1 + (iVar11 + -1) * 0x44 + 0x48;
      do {
        *(CNavArea **)pIVar13 = pCVar8;
        iVar12 = iVar12 + -1;
        CVar3 = pCVar8[0x7c];
        *(undefined4 *)(pIVar13 + 0x18) = 0;
        *(uint *)(pIVar13 + 4) = (byte)CVar3 & 0xf;
        pCVar8 = *(CNavArea **)(pCVar8 + 0x78);
        if (pCVar8 == (CNavArea *)0x0) break;
        pIVar13 = pIVar13 + -0x44;
      } while (iVar12 != 0);
      iVar11 = iVar11 * 0x44;
      *(CNavArea **)(param_1 + iVar11 + 0x48) = local_60;
      *(float *)(this_00 + iVar11 + 0xc) = local_48;
      *(float *)(this_00 + iVar11 + 0x10) = local_44;
      *(float *)(this_00 + iVar11 + 0x14) = local_40;
      iVar11 = *(int *)(param_1 + 0x4448);
      *(undefined4 *)(param_1 + iVar11 * 0x44 + 0x5c) = 0;
      *(undefined4 *)(param_1 + iVar11 * 0x44 + 0x4c) = 9;
      *(undefined4 *)(param_1 + iVar11 * 0x44 + 0x60) = 0;
      *(int *)(param_1 + 0x4448) = iVar11 + 1;
      cVar5 = Path::ComputePathDetails((Path *)this_00,pIVar14,pVVar6);
      if (cVar5 == '\0') {
        (**(code **)(*(int *)(param_1 + 0x44) + 0x48))(this_00);
        (**(code **)(*(int *)(param_1 + 0x44) + 100))(this_00,pIVar14,2);
      }
      else {
                    /* try { // try from 00a2774f to 00a277dc has its CatchHandler @ 00a277f7 */
        Path::Optimize((INextBot *)this_00);
        Path::PostProcess((Path *)this_00);
        (**(code **)(*(int *)(param_1 + 0x44) + 100))(this_00,pIVar14,!bVar4);
      }
      goto LAB_00a27540;
    }
  }
LAB_00a2777f:
  Path::BuildTrivialPath((Path *)this_00,pIVar14,pVVar1);
LAB_00a27540:
  iVar11 = _DAT_0105db00;
  if ((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) {
    iVar12 = ThreadGetCurrentId();
    if (iVar11 == iVar12) {
      cVar5 = CVProfNode::ExitScope();
      if (cVar5 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
  }
  if (local_4c != 0) {
    (**(code **)(local_4c + 0x54))(local_4c,local_54,local_50,0,0,0);
  }
  *(uint *)(param_2 + 0x1c74) = *(uint *)(param_2 + 0x1c74) | 0x80;
  lVar15 = (longdouble)CountdownTimer::Now();
  if ((float)lVar15 + 1.0 != *(float *)(param_1 + 0x3c)) {
    (**(code **)(*(int *)(param_1 + 0x34) + 4))(param_1 + 0x34,param_1 + 0x3c);
    *(float *)(param_1 + 0x3c) = (float)lVar15 + 1.0;
  }
  if (*(float *)(param_1 + 0x38) != 1.0) {
    (**(code **)(*(int *)(param_1 + 0x34) + 4))(param_1 + 0x34,param_1 + 0x38);
    *(undefined4 *)(param_1 + 0x38) = 0x3f800000;
  }
  *(undefined4 *)this = 0;
  *(undefined4 *)(this + 4) = 0;
  *(undefined4 *)(this + 8) = 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)