L L4D2node

SurvivorLegsApproach::ComputePath

0x009507e0 · 1666 bytes · __thiscall

_ZN20SurvivorLegsApproach11ComputePathEP11SurvivorBot

Decompiled

undefined (2 params)

/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* SurvivorLegsApproach::ComputePath(SurvivorBot*) */

void __thiscall SurvivorLegsApproach::ComputePath(SurvivorLegsApproach *this,SurvivorBot *param_1)

{
  uint *puVar1;
  CNavArea CVar2;
  bool bVar3;
  char cVar4;
  int *piVar5;
  int iVar6;
  Vector *pVVar7;
  Path *this_00;
  Vector *pVVar8;
  CNavArea *pCVar9;
  CNavArea *pCVar10;
  CBaseEntity *pCVar11;
  int iVar12;
  SurvivorLegsApproach *pSVar13;
  INextBot *pIVar14;
  longdouble lVar15;
  CNavArea *local_60;
  undefined4 local_5c;
  undefined4 local_58;
  undefined4 local_50;
  undefined4 local_4c;
  int local_48;
  float local_44;
  float local_40;
  float local_3c;
  undefined4 local_38;
  undefined4 local_34;
  undefined4 local_30;
  undefined **local_2c;
  INextBot *local_28;
  undefined4 local_24;
  undefined1 local_20;
  undefined1 local_1f;
  
  lVar15 = (longdouble)CountdownTimer::Now();
  if ((float)lVar15 < *(float *)(this + 0x9040)) {
    return;
  }
  lVar15 = (longdouble)CountdownTimer::Now();
  if ((float)lVar15 + 0.5 != *(float *)(this + 0x9040)) {
    (**(code **)(*(int *)(this + 0x9038) + 4))(this + 0x9038,this + 0x9040);
    *(float *)(this + 0x9040) = (float)lVar15 + 0.5;
  }
  if (*(float *)(this + 0x903c) != 0.5) {
    (**(code **)(*(int *)(this + 0x9038) + 4))(this + 0x9038,this + 0x903c);
    *(undefined4 *)(this + 0x903c) = 0x3f000000;
  }
  local_2c = &PTR_operator___00d09770;
  pIVar14 = (INextBot *)0x0;
  if (param_1 != (SurvivorBot *)0x0) {
    pIVar14 = (INextBot *)(param_1 + 0x4028);
  }
  local_28 = pIVar14;
  local_24 = (**(code **)(*(int *)pIVar14 + 0xc0))(pIVar14);
  piVar5 = (int *)(**(code **)(*(int *)pIVar14 + 200))(pIVar14);
  iVar6 = (**(code **)(*piVar5 + 0xb8))(piVar5,pIVar14);
  local_1f = 0;
  local_20 = iVar6 != 0;
  local_5c = 0;
  local_58 = 0;
  pVVar7 = (Vector *)(this + 0x38);
  pIVar14 = (INextBot *)0x0;
  if (param_1 != (SurvivorBot *)0x0) {
    pIVar14 = (INextBot *)(param_1 + 0x4028);
  }
  this_00 = (Path *)(this + 0x4858);
  if (_towlower == 0) {
    local_48 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_5c,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x113,
               &Path::
                Compute<SurvivorBotPathCost>(INextBot*,Vector_const&,SurvivorBotPathCost&,float)::
                tm_fmt,"(%s)%s","NextBotSpiky","Path::Compute(goal)");
    local_48 = _towlower;
  }
  iVar6 = _DAT_0105db00;
  local_50 = local_5c;
  local_4c = local_58;
                    /* try { // try from 00950b76 to 00950bd6 has its CatchHandler @ 00950e96 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar12 = ThreadGetCurrentId(), iVar6 == iVar12)) {
    if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1b7,(char *)0x0,0xbfa1cb);
    }
    puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 00950989 to 00950ae6 has its CatchHandler @ 00950e75 */
  (**(code **)(*(int *)(this + 0x4858) + 0x48))(this_00);
  pVVar8 = (Vector *)(**(code **)(*(int *)pIVar14 + 0xd4))(pIVar14);
  piVar5 = (int *)(**(code **)(*(int *)pIVar14 + 0xb4))(pIVar14);
  pCVar9 = (CNavArea *)(**(code **)(*piVar5 + 0x52c))(piVar5);
  if (pCVar9 == (CNavArea *)0x0) {
    (**(code **)(*(int *)(this + 0x4858) + 100))(this_00,pIVar14,2);
    goto LAB_00950cf8;
  }
  pCVar10 = (CNavArea *)CNavMesh::GetNearestNavArea(TheNavMesh,pVVar7,true,200.0,true,true,false);
  if (pCVar9 != pCVar10) {
    local_44 = *(float *)(this + 0x38);
    local_40 = *(float *)(this + 0x3c);
    local_3c = *(float *)(this + 0x40);
    if (pCVar10 == (CNavArea *)0x0) {
                    /* try { // try from 00950e2a to 00950e6f has its CatchHandler @ 00950e75 */
      CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_44,&local_3c,(Vector *)0x0);
    }
    else {
      lVar15 = (longdouble)CNavArea::GetZ(pCVar10,local_44,local_40);
      local_3c = (float)lVar15;
    }
    pCVar11 = (CBaseEntity *)(**(code **)(*(int *)pIVar14 + 0xb4))(pIVar14);
    if (((byte)pCVar11[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(pCVar11);
    }
    local_38 = *(undefined4 *)(pCVar11 + 0x2e0);
    local_60 = (CNavArea *)0x0;
    local_34 = *(undefined4 *)(pCVar11 + 0x2e4);
    local_30 = *(undefined4 *)(pCVar11 + 0x2e8);
    pCVar11 = (CBaseEntity *)(**(code **)(*(int *)pIVar14 + 0xb4))(pIVar14);
    iVar6 = CBaseEntity::GetTeamNumber(pCVar11);
    bVar3 = NavAreaBuildPath<SurvivorBotPathCost>
                      (pCVar9,pCVar10,(Vector *)&local_38,pVVar7,(SurvivorBotPathCost *)&local_2c,
                       &local_60,0.0,iVar6,false);
    if (local_60 == (CNavArea *)0x0) goto LAB_00950cf8;
    if (pCVar9 != local_60) {
      iVar6 = 1;
      pCVar10 = local_60;
      do {
        pCVar10 = *(CNavArea **)(pCVar10 + 0x78);
        if (pCVar10 == (CNavArea *)0x0) break;
        iVar6 = iVar6 + 1;
      } while (pCVar9 != pCVar10);
      if (iVar6 < 0x100) {
        if (iVar6 == 1) goto LAB_00950e34;
        *(int *)(this + 0x8c5c) = iVar6;
      }
      else {
        iVar6 = 0xff;
        *(undefined4 *)(this + 0x8c5c) = 0xff;
      }
      pCVar9 = local_60;
      iVar12 = iVar6;
      pSVar13 = this + (iVar6 + -1) * 0x44 + 0x485c;
      do {
        *(CNavArea **)pSVar13 = pCVar9;
        iVar12 = iVar12 + -1;
        CVar2 = pCVar9[0x7c];
        *(undefined4 *)(pSVar13 + 0x18) = 0;
        *(uint *)(pSVar13 + 4) = (byte)CVar2 & 0xf;
        pCVar9 = *(CNavArea **)(pCVar9 + 0x78);
        if (pCVar9 == (CNavArea *)0x0) break;
        pSVar13 = pSVar13 + -0x44;
      } while (iVar12 != 0);
      iVar6 = iVar6 * 0x44;
      *(CNavArea **)(this + iVar6 + 0x485c) = local_60;
      *(float *)(this_00 + iVar6 + 0xc) = local_44;
      *(float *)(this_00 + iVar6 + 0x10) = local_40;
      *(float *)(this_00 + iVar6 + 0x14) = local_3c;
      iVar6 = *(int *)(this + 0x8c5c);
      *(undefined4 *)(this + iVar6 * 0x44 + 0x4870) = 0;
      *(undefined4 *)(this + iVar6 * 0x44 + 0x4860) = 9;
      *(undefined4 *)(this + iVar6 * 0x44 + 0x4874) = 0;
      *(int *)(this + 0x8c5c) = iVar6 + 1;
                    /* try { // try from 00950cbb to 00950cf7 has its CatchHandler @ 00950e75 */
      cVar4 = Path::ComputePathDetails(this_00,pIVar14,pVVar8);
      if (cVar4 == '\0') {
        (**(code **)(*(int *)(this + 0x4858) + 0x48))(this_00);
        (**(code **)(*(int *)(this + 0x4858) + 100))(this_00,pIVar14,2);
      }
      else {
                    /* try { // try from 00950daa to 00950dd7 has its CatchHandler @ 00950e75 */
        Path::Optimize((INextBot *)this_00);
        Path::PostProcess(this_00);
        (**(code **)(*(int *)(this + 0x4858) + 100))(this_00,pIVar14,!bVar3);
      }
      goto LAB_00950cf8;
    }
  }
LAB_00950e34:
  Path::BuildTrivialPath(this_00,pIVar14,pVVar7);
LAB_00950cf8:
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar12 = ThreadGetCurrentId(), iVar6 == iVar12)) {
    cVar4 = CVProfNode::ExitScope();
    if (cVar4 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_48 == 0) {
    return;
  }
  (**(code **)(local_48 + 0x54))(local_48,local_50,local_4c,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)