L L4D2node

TerrorNavArea::ComputeVisToArea

0x0097b400 · 668 bytes · __cdecl

_ZN13TerrorNavArea16ComputeVisToAreaERP8CNavArea

Decompiled

undefined (1 param)

/* TerrorNavArea::ComputeVisToArea(CNavArea*&) */

void TerrorNavArea::ComputeVisToArea(CNavArea **param_1)

{
  TerrorNavArea *this;
  undefined4 uVar1;
  TerrorNavArea *pTVar2;
  char cVar3;
  ushort uVar4;
  int iVar5;
  int iVar6;
  undefined4 *puVar7;
  int iVar8;
  bool bVar9;
  ushort local_1e [7];
  
  this = (TerrorNavArea *)*param_1;
  if (this == g_pCurVisArea) {
    iVar5 = 0;
    uVar4 = 2;
  }
  else {
    iVar5 = ComputeVisibility(g_pCurVisArea,this,true,true,(bool *)local_1e);
    if (local_1e[0]._0_1_ == (AreaBindInfo)0x0) {
      if (iVar5 != 0) {
        iVar6 = ComputeVisibility(this,g_pCurVisArea,true,false,(bool *)0x0);
LAB_0097b5ad:
        bVar9 = iVar6 == 0;
        goto LAB_0097b456;
      }
      if ((*(float *)(g_pCurVisArea + 0x30) - *(float *)(this + 0x30)) *
          (*(float *)(g_pCurVisArea + 0x30) - *(float *)(this + 0x30)) +
          (*(float *)(g_pCurVisArea + 0x2c) - *(float *)(this + 0x2c)) *
          (*(float *)(g_pCurVisArea + 0x2c) - *(float *)(this + 0x2c)) +
          (*(float *)(g_pCurVisArea + 0x34) - *(float *)(this + 0x34)) *
          (*(float *)(g_pCurVisArea + 0x34) - *(float *)(this + 0x34)) < 2.25e+06) {
        iVar6 = ComputeVisibility(this,g_pCurVisArea,true,false,(bool *)0x0);
        if (iVar6 == 0) goto LAB_0097b5ad;
        iVar5 = 1;
      }
      else {
        iVar6 = 0;
      }
LAB_0097b60a:
      local_1e[0] = 0;
      if (iVar6 == 0) goto LAB_0097b537;
    }
    else {
      bVar9 = true;
      iVar6 = 0;
LAB_0097b456:
      if ((iVar5 == 0) || (!bVar9)) goto LAB_0097b60a;
      iVar6 = 1;
    }
    uVar4 = (ushort)iVar6;
  }
  if (((uint)this & 3) != 0) {
    local_1e[0] = 0;
    Error("Bad nav area pointer");
  }
  local_1e[0] = uVar4 | *(short *)(this + 0x90) << 2;
  do {
    puVar7 = DAT_010134f0;
    DAT_010134f0 = puVar7;
    if (puVar7 == (undefined4 *)0x0) {
      puVar7 = ::operator_new(0x10);
      *(undefined2 *)(puVar7 + 2) = 0;
      break;
    }
    cVar3 = ThreadInterlockedAssignIf64(&DAT_010134f0,*puVar7,DAT_010134f4 + -1,puVar7,DAT_010134f4)
    ;
  } while (cVar3 == '\0');
  *(ushort *)(puVar7 + 2) = local_1e[0];
  do {
    iVar6 = DAT_010134ec;
    uVar1 = g_ComputedVis;
    iVar8 = DAT_010134ec + 0x10001;
    *puVar7 = g_ComputedVis;
    cVar3 = ThreadInterlockedAssignIf64(&g_ComputedVis,puVar7,iVar8,uVar1,iVar6);
  } while (cVar3 == '\0');
LAB_0097b537:
  pTVar2 = g_pCurVisArea;
  if (iVar5 != 0) {
    if (((uint)g_pCurVisArea & 3) != 0) {
      Error("Bad nav area pointer");
    }
    local_1e[0] = (ushort)iVar5 | *(short *)(pTVar2 + 0x90) << 2;
    CUtlVector<TerrorNavArea::AreaBindInfo,CUtlMemoryConservative<TerrorNavArea::AreaBindInfo>>::
    InsertBefore((CUtlVector<TerrorNavArea::AreaBindInfo,CUtlMemoryConservative<TerrorNavArea::AreaBindInfo>>
                  *)(this + 0x134),*(int *)(this + 0x13c),(AreaBindInfo *)local_1e);
  }
  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)