NavAreaBuildPath<ShortestPathCost>
0x007211f0 · 2504 bytes · __cdecl
_Z16NavAreaBuildPathI16ShortestPathCostEbP8CNavAreaS2_PK6VectorS5_RT_PS2_fib
Decompiled
bool (9 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* bool NavAreaBuildPath<ShortestPathCost>(CNavArea*, CNavArea*, Vector const*, Vector const*,
ShortestPathCost&, CNavArea**, float, int, bool) */
bool NavAreaBuildPath<ShortestPathCost>
(CNavArea *param_1,CNavArea *param_2,Vector *param_3,Vector *param_4,
ShortestPathCost *param_5,CNavArea **param_6,float param_7,int param_8,bool param_9)
{
uint *puVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
float fVar6;
float fVar7;
int iVar8;
undefined4 uVar9;
undefined4 uVar10;
char cVar11;
CNavArea *pCVar12;
int iVar13;
int *piVar14;
int iVar15;
bool bVar16;
CNavArea *this;
bool bVar17;
float fVar18;
float fVar19;
float fVar20;
float fVar21;
float fVar22;
float fVar23;
undefined1 auVar24 [16];
int local_6c;
float local_68;
int local_64;
char local_52;
CNavArea *local_50;
int local_48;
CNavArea *local_44;
int local_40;
int local_3c;
float local_34;
int local_30;
undefined4 local_24;
undefined4 local_20;
local_24 = 0;
local_20 = 0;
if (_towlower == 0) {
local_6c = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_24,0,0,0,0,"/data/src/game/server/nav_pathfind.h",0x67,
&NavAreaBuildPath<ShortestPathCost>(CNavArea*,CNavArea*,Vector_const*,Vector_const*,ShortestPathCost&,CNavArea**,float,int,bool)
::tm_fmt,"(%s)%s","NavAreaBuildPath","NavAreaBuildPath");
local_6c = _towlower;
}
uVar10 = local_20;
uVar9 = local_24;
iVar8 = _DAT_0105db00;
/* try { // try from 0072154e to 007215ae has its CatchHandler @ 00721c8f */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar13 = ThreadGetCurrentId(), iVar8 == iVar13)) {
if ((char *)*_DAT_0105d15c != "NavAreaBuildPath") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xca5c91,(char *)0x0,0xca5c91);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
if (param_6 != (CNavArea **)0x0) {
*param_6 = param_1;
}
iVar8 = g_DebugPathfindCounter;
g_DebugPathfindCounter = g_DebugPathfindCounter + -1;
if (param_1 == (CNavArea *)0x0) {
LAB_007214e5:
bVar16 = false;
}
else {
/* try { // try from 007212ed to 007214d2 has its CatchHandler @ 00721c04 */
if ((param_2 == (CNavArea *)0x0) ||
(local_52 = CNavArea::IsBlocked(param_2,param_8,param_9), local_52 == '\0')) {
local_52 = param_2 == (CNavArea *)0x0;
if ((bool)local_52) goto LAB_00721621;
}
else {
param_2 = (CNavArea *)0x0;
if (local_52 != '\0') {
LAB_00721621:
if (param_4 == (Vector *)0x0) goto LAB_007214e5;
}
}
*(undefined4 *)(param_1 + 0x78) = 0;
param_1[0x7c] = (CNavArea)((byte)param_1[0x7c] & 0xf0 | 9);
if (param_1 != param_2) {
pCVar12 = param_1 + 0x2c;
if (param_3 != (Vector *)0x0) {
pCVar12 = (CNavArea *)param_3;
}
fVar2 = *(float *)pCVar12;
fVar3 = *(float *)(pCVar12 + 8);
fVar4 = *(float *)(pCVar12 + 4);
pCVar12 = param_2 + 0x2c;
if (param_4 != (Vector *)0x0) {
pCVar12 = (CNavArea *)param_4;
}
fVar5 = *(float *)pCVar12;
fVar6 = *(float *)(pCVar12 + 4);
fVar7 = *(float *)(pCVar12 + 8);
CNavArea::ClearSearchLists();
*(undefined4 *)(param_1 + 0x44) = 0;
*(undefined4 *)(param_1 + 0x80) = 0;
*(float *)(param_1 + 0x40) =
SQRT((*(float *)(param_1 + 0x30) - fVar6) * (*(float *)(param_1 + 0x30) - fVar6) +
(*(float *)(param_1 + 0x34) - fVar7) * (*(float *)(param_1 + 0x34) - fVar7) +
(*(float *)(param_1 + 0x2c) - fVar5) * (*(float *)(param_1 + 0x2c) - fVar5));
CNavArea::AddToOpenList(param_1);
if (param_6 != (CNavArea **)0x0) {
*param_6 = param_1;
}
fVar18 = fVar5 - fVar2;
fVar21 = fVar7 - fVar3;
fVar20 = fVar6 - fVar4;
local_68 = *(float *)(param_1 + 0x40);
LAB_007214db:
do {
pCVar12 = CNavArea::m_openList;
if (CNavArea::m_openList == (CNavArea *)0x0) goto LAB_007214e5;
CNavArea::RemoveFromOpenList(CNavArea::m_openList);
*(undefined4 *)(pCVar12 + 0x4c) = 0;
*(undefined4 *)(pCVar12 + 0x48) = 0;
if (0 < iVar8) {
(**(code **)(*(int *)pCVar12 + 0x54))(pCVar12,0,0xff,0,0x80,0x41f00000,1);
}
cVar11 = CNavArea::IsBlocked(pCVar12,param_8,param_9);
if (cVar11 == '\0') {
if ((param_2 != pCVar12) &&
(((local_52 == '\0' || (param_4 == (Vector *)0x0)) ||
(cVar11 = CNavArea::Contains(pCVar12,param_4), cVar11 == '\0')))) {
local_44 = pCVar12 + 0x58;
local_64 = 0;
iVar13 = 0;
local_50 = (CNavArea *)0x0;
bVar16 = true;
local_3c = 0;
local_30 = 0;
LAB_00721670:
if (local_30 != 0) goto LAB_00721880;
do {
piVar14 = *(int **)local_44;
if (*piVar14 <= iVar13) {
do {
local_3c = local_3c + 1;
if (local_3c == 4) {
local_50 = pCVar12 + 0x68;
local_64 = 0;
iVar13 = 0;
local_30 = 1;
goto LAB_00721920;
}
iVar13 = 0;
local_44 = pCVar12 + local_3c * 4 + 0x58;
piVar14 = *(int **)local_44;
} while (*piVar14 < 1);
}
this = (CNavArea *)piVar14[iVar13 * 2 + 1];
if ((param_1 == pCVar12) || (this == param_2)) {
if (param_1 == pCVar12) {
local_34 = SQRT(fVar18 * fVar18 + fVar21 * fVar21 + fVar20 * fVar20);
if (this == param_2) goto LAB_007216c9;
fVar22 = *(float *)(this + 0x2c) - fVar2;
fVar23 = *(float *)(this + 0x30) - fVar4;
fVar19 = *(float *)(this + 0x34) - fVar3;
}
else {
fVar22 = fVar5 - *(float *)(pCVar12 + 0x2c);
fVar19 = fVar6 - *(float *)(pCVar12 + 0x30);
fVar23 = fVar7 - *(float *)(pCVar12 + 0x34);
}
local_34 = SQRT(fVar22 * fVar22 + fVar19 * fVar19 + fVar23 * fVar23);
}
else {
local_34 = (float)piVar14[iVar13 * 2 + 2];
}
LAB_007216c9:
iVar13 = iVar13 + 1;
local_40 = 0;
local_48 = local_3c;
while( true ) {
/* try { // try from 007216ee to 00721be5 has its CatchHandler @ 00721c04 */
if ((this == pCVar12) ||
(cVar11 = CNavArea::IsBlocked(this,param_8,param_9), cVar11 != '\0'))
goto LAB_00721670;
if (local_40 == 0) {
if (local_34 <= 0.0) {
local_34 = SQRT((*(float *)(this + 0x34) - *(float *)(pCVar12 + 0x34)) *
(*(float *)(this + 0x34) - *(float *)(pCVar12 + 0x34)) +
(*(float *)(this + 0x30) - *(float *)(pCVar12 + 0x30)) *
(*(float *)(this + 0x30) - *(float *)(pCVar12 + 0x30)) +
(*(float *)(this + 0x2c) - *(float *)(pCVar12 + 0x2c)) *
(*(float *)(this + 0x2c) - *(float *)(pCVar12 + 0x2c)));
}
}
else {
local_34 = *(float *)(local_40 + 0x1c);
}
fVar23 = 0.0;
fVar22 = local_34 + *(float *)(pCVar12 + 0x44);
if ((*(uint *)(this + 0x54) & 1) != 0) {
fVar22 = fVar22 + local_34 * 20.0;
}
if ((*(uint *)(this + 0x54) & 2) != 0) {
fVar22 = fVar22 + local_34 * 5.0;
}
if (fVar22 < 0.0) goto LAB_00721670;
if (0.0 < param_7) {
fVar19 = SQRT((*(float *)(this + 0x34) - *(float *)(pCVar12 + 0x34)) *
(*(float *)(this + 0x34) - *(float *)(pCVar12 + 0x34)) +
(*(float *)(this + 0x2c) - *(float *)(pCVar12 + 0x2c)) *
(*(float *)(this + 0x2c) - *(float *)(pCVar12 + 0x2c)) +
(*(float *)(this + 0x30) - *(float *)(pCVar12 + 0x30)) *
(*(float *)(this + 0x30) - *(float *)(pCVar12 + 0x30))) +
*(float *)(pCVar12 + 0x80);
if (param_7 < fVar19) goto LAB_00721670;
*(float *)(this + 0x80) = fVar19;
}
iVar15 = *(int *)(this + 0x50);
if (((iVar15 == CNavArea::m_masterMarker) ||
(CNavArea::m_masterMarker == *(int *)(this + 0x3c))) &&
(*(float *)(this + 0x44) <= fVar22)) goto LAB_00721670;
fVar19 = (*(float *)(this + 0x30) - fVar6) * (*(float *)(this + 0x30) - fVar6) +
(*(float *)(this + 0x2c) - fVar5) * (*(float *)(this + 0x2c) - fVar5) +
(*(float *)(this + 0x34) - fVar7) * (*(float *)(this + 0x34) - fVar7);
if (0.0 < fVar19) {
auVar24 = rsqrtss(ZEXT416((uint)fVar19),ZEXT416((uint)fVar19));
fVar23 = auVar24._0_4_ * fVar19;
}
if ((fVar23 < local_68) && (param_6 != (CNavArea **)0x0)) {
*param_6 = this;
iVar15 = *(int *)(this + 0x50);
local_68 = fVar23;
}
bVar17 = CNavArea::m_masterMarker == iVar15;
*(float *)(this + 0x44) = fVar22;
*(float *)(this + 0x40) = fVar23 + fVar22;
if (bVar17) {
CNavArea::UpdateOnOpenList(this);
}
else {
CNavArea::AddToOpenList(this);
}
*(CNavArea **)(this + 0x78) = pCVar12;
this[0x7c] = (CNavArea)((byte)this[0x7c] & 0xf0 | (byte)local_48 & 0xf);
if (local_30 == 0) break;
LAB_00721880:
if (local_30 == 1) {
LAB_00721920:
do {
piVar14 = *(int **)local_50;
if (*piVar14 <= iVar13) {
do {
if (!bVar16) {
iVar13 = 0;
local_30 = 2;
goto LAB_0072188a;
}
local_50 = pCVar12 + 0x6c;
iVar13 = 0;
bVar16 = false;
piVar14 = *(int **)local_50;
} while (*piVar14 < 1);
}
local_40 = piVar14[iVar13 + 1];
if (bVar16) {
if (local_64 == 0) {
this = *(CNavArea **)(local_40 + 0x24);
}
else if (local_64 == 1) {
this = *(CNavArea **)(local_40 + 0x28);
}
else {
if (local_64 != 2) {
iVar13 = iVar13 + 1;
local_64 = 0;
goto LAB_00721920;
}
this = *(CNavArea **)(local_40 + 0x2c);
}
local_64 = local_64 + 1;
local_48 = 4;
}
else {
this = *(CNavArea **)(local_40 + 0x34);
iVar13 = iVar13 + 1;
local_48 = 5;
}
} while (this == (CNavArea *)0x0);
local_34 = -1.0;
}
else {
LAB_0072188a:
if (((byte)pCVar12[0x57] & 0x40) == 0) {
LAB_00721a5f:
*(int *)(pCVar12 + 0x3c) = CNavArea::m_masterMarker;
goto LAB_007214db;
}
if (CNavArea::GetElevatorAreas()::empty == '\0') {
iVar15 = __cxa_guard_acquire(&CNavArea::GetElevatorAreas()::empty);
if (iVar15 != 0) {
if ((CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::StaticData()::staticData == '\0') &&
(iVar15 = __cxa_guard_acquire(&
CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::StaticData()::staticData), iVar15 != 0)) {
__cxa_guard_release(&CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::StaticData()::staticData);
}
CNavArea::GetElevatorAreas()::empty =
&CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::StaticData()::staticData;
__cxa_guard_release(&CNavArea::GetElevatorAreas()::empty);
__cxa_atexit(CUtlVectorUltraConservative<NavConnect,CUtlVectorUltraConservativeAllocator>
::~CUtlVectorUltraConservative,
&CNavArea::GetElevatorAreas()::empty,&__dso_handle);
}
if ((*(uint *)(pCVar12 + 0x54) & 0x40000000) == 0) goto LAB_00721a5f;
}
if ((*(int *)(pCVar12 + 0x84) == 0) || (**(int **)(pCVar12 + 0x88) <= iVar13))
goto LAB_00721a5f;
this = (CNavArea *)(*(int **)(pCVar12 + 0x88))[iVar13 * 2 + 1];
iVar13 = iVar13 + 1;
local_40 = 0;
if (*(float *)(this + 0x34) < *(float *)(pCVar12 + 0x34) ||
*(float *)(this + 0x34) == *(float *)(pCVar12 + 0x34)) {
local_48 = 8;
local_34 = -1.0;
}
else {
local_48 = 7;
local_34 = -1.0;
}
}
}
} while( true );
}
if (param_6 == (CNavArea **)0x0) break;
*param_6 = pCVar12;
bVar16 = true;
goto LAB_007214e7;
}
} while( true );
}
bVar16 = true;
}
LAB_007214e7:
iVar8 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar13 = ThreadGetCurrentId(), iVar8 == iVar13)) {
cVar11 = CVProfNode::ExitScope();
if (cVar11 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_6c != 0) {
(**(code **)(local_6c + 0x54))(local_6c,uVar9,uVar10,0,0,0);
}
return bVar16;
}
SourceMod gamedata
paste intoaddons/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.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.