L L4D2node

TerrorNavMesh::RecomputeFlowDistances

0x00984890 · 1278 bytes · __thiscall

_ZN13TerrorNavMesh22RecomputeFlowDistancesEv

Decompiled

undefined (1 param)

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

void __thiscall TerrorNavMesh::RecomputeFlowDistances(TerrorNavMesh *this)

{
  uint *puVar1;
  char cVar2;
  TerrorNavArea *pTVar3;
  undefined4 *puVar4;
  int iVar5;
  int iVar6;
  longdouble lVar7;
  longdouble lVar8;
  CTerrorPlayer *this_00;
  CTerrorPlayer *pCVar9;
  undefined4 local_44;
  undefined4 local_40;
  undefined4 local_3c;
  undefined4 local_38;
  int local_34;
  CTerrorPlayer *local_30;
  float local_2c;
  CTerrorPlayer *local_28;
  float local_24;
  int local_20;
  undefined4 local_1c;
  undefined4 local_18;
  int local_14;
  int local_10;
  
  local_44 = 0;
  local_40 = 0;
  if (_towlower == 0) {
    local_34 = 0;
  }
  else {
    (**(code **)(_towlower + 0x50))
              (_towlower,&local_44,0,0,0,0,"/data/src/game/server/terror/terrornav.cpp",0xbdd,
               &RecomputeFlowDistances()::tm_fmt,"(%s)%s","ZOMBIE",
               "TerrorNavMesh::RecomputeFlowDistances");
    local_34 = _towlower;
  }
  iVar6 = _DAT_0105db00;
  local_3c = local_44;
  local_38 = local_40;
                    /* try { // try from 00984aee to 00984b4e has its CatchHandler @ 00984dea */
  if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
     (iVar5 = ThreadGetCurrentId(), iVar6 == iVar5)) {
    if ((char *)*_DAT_0105d15c != "TerrorNavMesh::RecomputeFlowDistances") {
      _DAT_0105d15c =
           (int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xd10b54,(char *)0x0,0xc0db47);
    }
    puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
    *puVar1 = *puVar1 | 4;
    CVProfNode::EnterScope();
    DAT_0105d158 = '\0';
  }
                    /* try { // try from 00984943 to 0098495e has its CatchHandler @ 00984db8 */
  lVar7 = (longdouble)Plat_FloatTime();
  ZombieDebugPrint(0,"Recomputing Flow Distance...\n");
  local_20 = 0;
  local_1c = 0;
  local_18 = 0;
  local_14 = 0;
  local_10 = 0;
                    /* try { // try from 00984998 to 009849fa has its CatchHandler @ 00984de8 */
  local_30 = (CTerrorPlayer *)
             CDirectorTacticalServices::GetHighestFlowSurvivor
                       (*(CDirectorTacticalServices **)(TheDirector + 0x628),0);
  if (local_30 == (CTerrorPlayer *)0x0) {
    local_2c = 0.0;
  }
  else {
    lVar8 = (longdouble)CTerrorPlayer::GetFlowDistance(local_30,0);
    local_2c = (float)lVar8;
  }
  local_28 = (CTerrorPlayer *)
             CDirectorTacticalServices::GetHighestFlowSurvivor
                       (*(CDirectorTacticalServices **)(TheDirector + 0x628),0);
  if (local_28 == (CTerrorPlayer *)0x0) {
    local_24 = 0.0;
  }
  else {
    lVar8 = (longdouble)CTerrorPlayer::GetFlowDistance(local_28,0);
    local_24 = (float)lVar8;
  }
                    /* try { // try from 00984a0e to 00984a6a has its CatchHandler @ 00984dd9 */
  ForEachTerrorPlayer<ScrimmageUpdate>((ScrimmageUpdate *)&local_30);
  pTVar3 = (TerrorNavArea *)ComputeFlowDistances(this);
  this[0x60c] = (TerrorNavMesh)(pTVar3 != (TerrorNavArea *)0x0);
  WarnIfBadFlow(this,(CTerrorPlayer *)0x0);
  if (this[0x60c] != (TerrorNavMesh)0x0) {
                    /* try { // try from 00984b6c to 00984c69 has its CatchHandler @ 00984dd9 */
    ZombieManager::OnFlowDistancesRecomputed(TheZombieManager,pTVar3);
    this_00 = (CTerrorPlayer *)TheDirector;
    CDirector::OnFlowDistancesRecomputed(TheDirector);
    if (local_30 == (CTerrorPlayer *)0x0) {
      local_2c = 0.0;
      pCVar9 = local_28;
    }
    else {
      pTVar3 = (TerrorNavArea *)0x0;
      this_00 = local_30;
      lVar8 = (longdouble)CTerrorPlayer::GetFlowDistance(local_30,0);
      local_2c = (float)lVar8;
      pCVar9 = local_28;
    }
    local_28 = pCVar9;
    if (pCVar9 == (CTerrorPlayer *)0x0) {
      local_24 = 0.0;
    }
    else {
      pTVar3 = (TerrorNavArea *)0x0;
      lVar8 = (longdouble)CTerrorPlayer::GetFlowDistance(pCVar9,0);
      local_24 = (float)lVar8;
      this_00 = pCVar9;
    }
    iVar6 = 0;
    iVar5 = 0;
    if (0 < local_14) {
      do {
        puVar4 = (undefined4 *)(local_20 + iVar6);
        pTVar3 = (TerrorNavArea *)(local_2c + (float)puVar4[1]);
        this_00 = (CTerrorPlayer *)*puVar4;
        CTerrorPlayer::UpdateLineOfScrimmage(this_00,(float)pTVar3,local_24 + (float)puVar4[2]);
        iVar5 = iVar5 + 1;
        iVar6 = iVar6 + 0xc;
      } while (iVar5 < local_14);
    }
    lVar8 = (longdouble)Plat_FloatTime(this_00,pTVar3);
    ZombieDebugPrint(0,"...Flow done(%f ms)!\n",(double)(((float)lVar8 - (float)lVar7) * 1000.0));
    local_14 = 0;
    CUtlMemory<ScrimmageUpdate::PlayerFlowType,int>::Purge
              ((CUtlMemory<ScrimmageUpdate::PlayerFlowType,int> *)&local_20);
    local_10 = local_20;
    CUtlMemory<ScrimmageUpdate::PlayerFlowType,int>::Purge
              ((CUtlMemory<ScrimmageUpdate::PlayerFlowType,int> *)&local_20);
    iVar6 = _DAT_0105db00;
    if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
       (iVar5 = ThreadGetCurrentId(), iVar6 == iVar5)) {
      cVar2 = CVProfNode::ExitScope();
      if (cVar2 != '\0') {
        _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
      }
      DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
    }
    if (local_34 != 0) {
      (**(code **)(local_34 + 0x54))(local_34,local_3c,local_38,0,0,0);
    }
    return;
  }
  ZombieDebugPrint(1,"Flow Error: No starting area found via flow!\n");
  ZombieDebugPrint(0,"...Flow done!\n");
  local_14 = 0;
  CUtlMemory<ScrimmageUpdate::PlayerFlowType,int>::Purge
            ((CUtlMemory<ScrimmageUpdate::PlayerFlowType,int> *)&local_20);
  local_10 = local_20;
  CUtlMemory<ScrimmageUpdate::PlayerFlowType,int>::Purge
            ((CUtlMemory<ScrimmageUpdate::PlayerFlowType,int> *)&local_20);
  iVar6 = _DAT_0105db00;
  if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
     (iVar5 = ThreadGetCurrentId(), iVar6 == iVar5)) {
    cVar2 = CVProfNode::ExitScope();
    if (cVar2 != '\0') {
      _DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
    }
    DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
  }
  if (local_34 != 0) {
    (**(code **)(local_34 + 0x54))(local_34,local_3c,local_38,0,0,0);
    return;
  }
  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)