L L4D2node

SurvivorLegsRetreat::ComputePath

0x00959300 · 1869 bytes · __thiscall

_ZN19SurvivorLegsRetreat11ComputePathEP11SurvivorBot

Decompiled

undefined (2 params)

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

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

{
  uint *puVar1;
  byte bVar2;
  uint uVar3;
  char cVar4;
  int iVar5;
  INextBot *pIVar6;
  Path *this_00;
  Vector *pVVar7;
  int iVar8;
  int iVar9;
  CBaseEntity *pCVar10;
  SurvivorLegsRetreat *pSVar11;
  undefined *puVar12;
  SurvivorBot *pSVar13;
  CBaseEntity *this_01;
  int iVar14;
  longdouble lVar15;
  float fVar16;
  float fVar17;
  float fVar18;
  undefined4 local_354;
  undefined4 local_350;
  float local_348;
  float local_344;
  float local_340;
  SurvivorBot *local_33c;
  undefined4 local_338;
  float local_334;
  float local_330;
  float local_32c;
  CBaseEntity *local_328;
  float local_324;
  
  pCVar10 = (CBaseEntity *)0x0;
  uVar3 = *(uint *)(this + 0x4820);
  if (((uVar3 != 0xffffffff) &&
      (puVar12 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar12 + 8) == uVar3 >> 0xc)) {
    pCVar10 = *(CBaseEntity **)(puVar12 + 4);
  }
  this_01 = (CBaseEntity *)0x0;
  lVar15 = (longdouble)SurvivorBot::GetAvoidRange(param_1,pCVar10);
  local_324 = (float)lVar15;
  uVar3 = *(uint *)(this + 0x4820);
  if (((uVar3 != 0xffffffff) &&
      (puVar12 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
     (*(uint *)(puVar12 + 8) == uVar3 >> 0xc)) {
    this_01 = *(CBaseEntity **)(puVar12 + 4);
  }
  pSVar13 = (SurvivorBot *)0x0;
  if (param_1 != (SurvivorBot *)0x0) {
    pSVar13 = param_1 + 0x4028;
  }
  local_33c = pSVar13;
  local_338 = (**(code **)(*(int *)pSVar13 + 0xc0))(pSVar13);
  local_328 = this_01;
  pCVar10 = (CBaseEntity *)(**(code **)(*(int *)pSVar13 + 0xb4))(pSVar13);
  if (((byte)pCVar10[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(pCVar10);
  }
  if (((byte)this_01[0x14d] & 8) != 0) {
    CBaseEntity::CalcAbsolutePosition(this_01);
  }
  local_330 = *(float *)(this_01 + 0x2e4) - *(float *)(pCVar10 + 0x2e4);
  local_32c = *(float *)(this_01 + 0x2e8) - *(float *)(pCVar10 + 0x2e8);
  local_334 = *(float *)(this_01 + 0x2e0) - *(float *)(pCVar10 + 0x2e0);
  VectorNormalize((Vector *)&local_334);
  iVar5 = RetreatPathBuilder::ComputePath((RetreatPathBuilder *)&local_33c);
  if (iVar5 == 0) {
    if (((byte)param_1[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
    }
    pCVar10 = (CBaseEntity *)0x0;
    uVar3 = *(uint *)(this + 0x4820);
    if (((uVar3 != 0xffffffff) &&
        (puVar12 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar12 != (undefined *)0xfffffffc)) &&
       (*(uint *)(puVar12 + 8) == uVar3 >> 0xc)) {
      pCVar10 = *(CBaseEntity **)(puVar12 + 4);
    }
    if (((byte)pCVar10[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition(pCVar10);
    }
    local_348 = *(float *)(param_1 + 0x2e0);
    local_344 = *(float *)(param_1 + 0x2e4);
    fVar18 = *(float *)(pCVar10 + 0x2e0) - local_348;
    local_340 = *(float *)(param_1 + 0x2e8);
    fVar17 = *(float *)(pCVar10 + 0x2e4) - local_344;
    fVar16 = *(float *)(pCVar10 + 0x2e8) - local_340;
    if (((byte)param_1[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)param_1);
      local_348 = *(float *)(param_1 + 0x2e0);
      local_344 = *(float *)(param_1 + 0x2e4);
      local_340 = *(float *)(param_1 + 0x2e8);
    }
    local_348 = local_348 - fVar18;
    local_344 = local_344 - fVar17;
    local_340 = local_340 - fVar16;
    Path::BuildTrivialPath
              ((Path *)(this + 0x34),(INextBot *)(param_1 + 0x4028),(Vector *)&local_348);
    return;
  }
  pIVar6 = (INextBot *)(param_1 + 0x4028);
  if (param_1 == (SurvivorBot *)0x0) {
    pIVar6 = (INextBot *)0x0;
  }
  local_354 = 0;
  local_350 = 0;
  this_00 = (Path *)(this + 0x34);
  if (_towlower == 0) {
    local_340 = 0.0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_354,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x1ff
               ,&Path::AssemblePrecomputedPath(INextBot*,Vector_const&,CNavArea*)::tm_fmt,"(%s)%s",
               "NextBot","AssemblePrecomputedPath");
    local_340 = (float)_towlower;
  }
  iVar9 = _DAT_0105db00;
  local_348 = (float)local_354;
  local_344 = (float)local_350;
                    /* try { // try from 0095971e to 0095977e has its CatchHandler @ 00959a52 */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar14 = ThreadGetCurrentId(), iVar9 == iVar14)) {
    if ((char *)*_DAT_0105d15c != "AssemblePrecomputedPath") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa16f,(char *)0x0,0xca8906);
    }
    puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 00959560 to 009596a7 has its CatchHandler @ 00959a6a */
  pVVar7 = (Vector *)(**(code **)(*(int *)pIVar6 + 0xd4))(pIVar6);
  iVar14 = 0;
  iVar9 = iVar5;
  do {
    iVar9 = *(int *)(iVar9 + 0x78);
    iVar14 = iVar14 + 1;
  } while (iVar9 != 0);
  if (iVar14 < 0x100) {
    if (iVar14 == 1) {
                    /* try { // try from 009598b9 to 009598bd has its CatchHandler @ 00959a6a */
      Path::BuildTrivialPath(this_00,pIVar6,(Vector *)(iVar5 + 0x2c));
      goto LAB_009596a8;
    }
    *(int *)(this + 0x4438) = iVar14;
  }
  else {
    iVar14 = 0xff;
    *(undefined4 *)(this + 0x4438) = 0xff;
  }
  iVar8 = iVar14;
  pSVar11 = this + (iVar14 + -1) * 0x44 + 0x38;
  iVar9 = iVar5;
  do {
    *(int *)pSVar11 = iVar9;
    iVar8 = iVar8 + -1;
    bVar2 = *(byte *)(iVar9 + 0x7c);
    *(int *)(pSVar11 + 0x18) = 0;
    *(uint *)(pSVar11 + 4) = bVar2 & 0xf;
    iVar9 = *(int *)(iVar9 + 0x78);
    if (iVar9 == 0) break;
    pSVar11 = pSVar11 + -0x44;
  } while (iVar8 != 0);
  iVar14 = iVar14 * 0x44;
  *(int *)(this + iVar14 + 0x38) = iVar5;
  *(undefined4 *)(this_00 + iVar14 + 0xc) = *(undefined4 *)(iVar5 + 0x2c);
  *(undefined4 *)(this_00 + iVar14 + 0x10) = *(undefined4 *)(iVar5 + 0x30);
  *(undefined4 *)(this_00 + iVar14 + 0x14) = *(undefined4 *)(iVar5 + 0x34);
  iVar5 = *(int *)(this + 0x4438);
  *(undefined4 *)(this + iVar5 * 0x44 + 0x4c) = 0;
  *(undefined4 *)(this + iVar5 * 0x44 + 0x3c) = 9;
  *(undefined4 *)(this + iVar5 * 0x44 + 0x50) = 0;
  *(int *)(this + 0x4438) = iVar5 + 1;
  cVar4 = Path::ComputePathDetails(this_00,pIVar6,pVVar7);
  if (cVar4 != '\0') {
                    /* try { // try from 009597c2 to 009597e6 has its CatchHandler @ 00959a6a */
    Path::Optimize((INextBot *)this_00);
    Path::PostProcess(this_00);
    (**(code **)(*(int *)(this + 0x34) + 100))(this_00,pIVar6,0);
    iVar5 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar9 = ThreadGetCurrentId(), iVar5 == iVar9)) {
      cVar4 = CVProfNode::ExitScope();
      if (cVar4 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_340 == 0.0) {
      return;
    }
    (**(code **)((int)local_340 + 0x54))(local_340,local_348,local_344,0,0,0);
    return;
  }
  (**(code **)(*(int *)(this + 0x34) + 0x48))(this_00);
  (**(code **)(*(int *)(this + 0x34) + 100))(this_00,pIVar6,2);
LAB_009596a8:
  iVar5 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar9 = ThreadGetCurrentId(), iVar5 == iVar9)) {
    cVar4 = CVProfNode::ExitScope();
    if (cVar4 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_340 != 0.0) {
    (**(code **)((int)local_340 + 0x54))(local_340,local_348,local_344,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)