CNavMesh::GetNearestNavArea
0x0073d280 · 2776 bytes · __thiscall
_ZNK8CNavMesh17GetNearestNavAreaERK6Vectorbfbbb
Decompiled
undefined (7 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CNavMesh::GetNearestNavArea(Vector const&, bool, float, bool, bool, bool) const */
CNavArea * __thiscall
CNavMesh::GetNearestNavArea
(CNavMesh *this,Vector *param_1,bool param_2,float param_3,bool param_4,bool param_5,
bool param_6)
{
int *piVar1;
CNavArea *this_00;
undefined4 uVar2;
undefined4 uVar3;
char cVar4;
int iVar5;
int iVar6;
int iVar7;
float fVar8;
float fVar9;
float fVar10;
int local_210;
int local_204;
int local_200;
float local_1f0;
float local_1ec;
int local_1e0;
CNavArea *local_1dc;
int local_1d8;
float local_1d4;
float local_1c4;
undefined4 local_1bc;
undefined4 local_1b8;
undefined4 local_1b4;
undefined4 local_1b0;
float local_1ac;
float local_1a8;
float local_1a4;
float local_1a0;
CTraceFilterSimple local_19c [16];
CTraceFilterSimple local_18c [16];
CTraceFilterSimple local_17c [16];
float local_16c;
float local_168;
float local_164;
undefined4 local_15c;
undefined4 local_158;
undefined4 local_154;
undefined4 local_14c;
undefined4 local_148;
undefined4 local_144;
undefined4 local_13c;
undefined4 local_138;
undefined4 local_134;
undefined4 local_12c;
undefined1 local_128;
undefined1 local_127;
float local_11c;
float local_118;
float local_114;
undefined4 local_10c;
undefined4 local_108;
float local_104;
undefined4 local_fc;
undefined4 local_f8;
undefined4 local_f4;
undefined4 local_ec;
undefined4 local_e8;
undefined4 local_e4;
undefined4 local_dc;
undefined1 local_d8;
undefined1 local_d7;
float local_cc;
float local_c8;
float local_c4;
float local_bc;
float local_b8;
undefined4 local_b4;
undefined4 local_ac;
undefined4 local_a8;
undefined4 local_a4;
undefined4 local_9c;
undefined4 local_98;
undefined4 local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
Vector local_70 [12];
float local_64;
float local_60;
float local_5c;
float local_44;
char local_39;
local_1bc = 0;
local_1b8 = 0;
if (___atan2f_finite == 0) {
local_200 = 0;
}
else {
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_1bc,0,0,0,0,"/data/src/game/server/nav_mesh.cpp",0x335,
&GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::tm_fmt,"(%s)%s",
"Unaccounted","CNavMesh::GetNearestNavArea");
local_200 = ___atan2f_finite;
}
uVar3 = local_1b8;
uVar2 = local_1bc;
iVar6 = _DAT_0105db00;
/* try { // try from 0073d35e to 0073d362 has its CatchHandler @ 0073dd73 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar5 = ThreadGetCurrentId(), iVar6 == iVar5)) {
if ((char *)*_DAT_0105d15c != "CNavMesh::GetNearestNavArea") {
/* try { // try from 0073ddcd to 0073ddde has its CatchHandler @ 0073dd73 */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xca5a4e,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
if (*(int *)(this + 0x18) != 0) {
local_1c4 = param_3 * param_3;
/* try { // try from 0073de00 to 0073de04 has its CatchHandler @ 0073dcc6 */
if (((!param_4) && (!param_5)) &&
(local_1dc = (CNavArea *)GetNavArea(this,param_1,120.0), local_1dc != (CNavArea *)0x0))
goto LAB_0073d731;
local_1b4 = *(undefined4 *)param_1;
local_1b0 = *(undefined4 *)(param_1 + 4);
/* try { // try from 0073d3d4 to 0073d63c has its CatchHandler @ 0073dcc6 */
cVar4 = GetGroundHeight(this,param_1,&local_1ac,(Vector *)0x0);
if (cVar4 == '\0') {
if (param_5) goto LAB_0073dd59;
local_1ac = *(float *)(param_1 + 8);
}
local_1ac = local_1ac + 35.5;
if ((GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::searchMarker == '\0') &&
(iVar6 = __cxa_guard_acquire(&GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::
searchMarker), iVar6 != 0)) {
/* try { // try from 0073dc9e to 0073dca2 has its CatchHandler @ 0073dd60 */
GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::searchMarker =
RandomInt(0,0x100000);
__cxa_guard_release(&GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::searchMarker)
;
}
iVar6 = GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::searchMarker + 1;
if (GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::searchMarker + 1 == 0) {
iVar6 = GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::searchMarker + 2;
}
GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::searchMarker = iVar6;
fVar8 = 1.0 / *(float *)(this + 0x20);
iVar6 = (int)((*(float *)param_1 - *(float *)(this + 0x2c)) * fVar8);
if (iVar6 < 0) {
local_204 = 0;
}
else {
local_204 = *(int *)(this + 0x24) + -1;
if (iVar6 < *(int *)(this + 0x24)) {
local_204 = iVar6;
}
}
iVar6 = (int)((*(float *)(param_1 + 4) - *(float *)(this + 0x30)) * fVar8);
if (iVar6 < 0) {
local_210 = 0;
}
else {
local_210 = *(int *)(this + 0x28) + -1;
if (iVar6 < *(int *)(this + 0x28)) {
local_210 = iVar6;
}
}
local_1e0 = (int)(fVar8 * param_3);
if ((float)local_1e0 < fVar8 * param_3) {
local_1e0 = local_1e0 + 1;
}
if (-1 < local_1e0) {
local_1d8 = 0;
local_1dc = (CNavArea *)0x0;
do {
for (iVar6 = local_204 - local_1d8; iVar6 <= local_1d8 + local_204; iVar6 = iVar6 + 1) {
if ((-1 < iVar6) && (iVar6 < *(int *)(this + 0x24))) {
for (iVar5 = local_210 - local_1d8; iVar5 <= local_1d8 + local_210; iVar5 = iVar5 + 1) {
if ((((-1 < iVar5) && (iVar5 < *(int *)(this + 0x28))) &&
((iVar6 <= local_204 - local_1d8 ||
(((local_1d8 + local_204 <= iVar6 || (iVar5 <= local_210 - local_1d8)) ||
(local_1d8 + local_210 <= iVar5)))))) &&
(piVar1 = (int *)(*(int *)(this + 0xc) +
(iVar5 * *(int *)(this + 0x24) + iVar6) * 0x14), 0 < piVar1[3])) {
iVar7 = 0;
LAB_0073d5ec:
do {
this_00 = *(CNavArea **)(*piVar1 + iVar7 * 4);
if ((*(int *)(this_00 + 0x74) !=
GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::searchMarker) &&
(cVar4 = CNavArea::IsBlocked(this_00,-1,param_6), cVar4 == '\0')) {
*(int *)(this_00 + 0x74) =
GetNearestNavArea(Vector_const&,bool,float,bool,bool,bool)::searchMarker;
CNavArea::GetClosestPointOnArea
(this_00,(Vector *)&local_1b4,(Vector *)&local_1a8);
fVar10 = local_1a8 - *(float *)param_1;
fVar9 = local_1a4 - *(float *)(param_1 + 4);
fVar8 = local_1a0 - *(float *)(param_1 + 8);
fVar8 = fVar8 * fVar8 + fVar9 * fVar9 + fVar10 * fVar10;
if (fVar8 < local_1c4) {
if (param_4) {
local_15c = 0;
local_158 = 0;
local_154 = 0x41900000;
local_127 = 1;
local_134 = 0;
local_138 = 0;
local_13c = 0;
local_12c = 0;
local_128 = 1;
local_144 = 0;
local_148 = 0;
local_14c = 0;
local_16c = *(float *)param_1;
local_168 = *(float *)(param_1 + 4);
local_164 = *(float *)(param_1 + 8);
/* try { // try from 0073d84b to 0073dbde has its CatchHandler @ 0073dcc6 */
CTraceFilterSimple::CTraceFilterSimple
(local_19c,(IHandleEntity *)0x0,0,
(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_16c,0x2420b,local_19c,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,(Vector *)&local_64,0xff,0,0,true,-1.0);
}
if (local_39 == '\0') {
local_1ec = *(float *)param_1;
local_1f0 = *(float *)(param_1 + 4);
local_1d4 = *(float *)(param_1 + 8);
}
else {
local_1f0 = local_60;
local_1ec = local_64;
local_1d4 = local_5c + 1.0;
}
if (18.0 < ABS(local_1a0 - local_1d4)) {
local_114 = local_1a0 + 18.0;
local_10c = 0;
local_108 = 0;
local_e4 = 0;
local_104 = local_1d4 - local_114;
local_e8 = 0;
local_ec = 0;
local_f4 = 0;
local_f8 = 0;
local_fc = 0;
local_d7 = local_104 * local_104 != 0.0;
local_11c = local_1a8;
local_dc = 0;
local_d8 = 1;
local_118 = local_1a4;
CTraceFilterSimple::CTraceFilterSimple
(local_18c,(IHandleEntity *)0x0,0,
(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_11c,0x2420b,local_18c,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,(Vector *)&local_64,0xff,0,0,true,-1.0);
}
if (local_44 != 1.0) goto LAB_0073d5e0;
}
local_cc = local_1ec;
local_b8 = local_1a4 - local_1f0;
local_bc = local_1a8 - local_1ec;
local_b4 = 0x41900000;
local_94 = 0;
local_98 = 0;
local_9c = 0;
local_8c = 0;
local_88 = 1;
local_a4 = 0;
local_a8 = 0;
local_87 = local_b8 * local_b8 + local_bc * local_bc != -324.0;
local_c8 = local_1f0;
local_ac = 0;
local_c4 = local_1d4;
CTraceFilterSimple::CTraceFilterSimple
(local_17c,(IHandleEntity *)0x0,0,
(_func_bool_IHandleEntity_ptr_int *)0x0);
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_cc,0x2420b,local_17c,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,(Vector *)&local_64,0xff,0,0,true,-1.0);
}
if (local_44 != 1.0) goto LAB_0073d5e0;
}
iVar7 = iVar7 + 1;
local_1e0 = local_1d8 + 1;
local_1dc = this_00;
local_1c4 = fVar8;
if (piVar1[3] <= iVar7) break;
goto LAB_0073d5ec;
}
}
LAB_0073d5e0:
iVar7 = iVar7 + 1;
} while (iVar7 < piVar1[3]);
}
}
}
}
local_1d8 = local_1d8 + 1;
} while (local_1d8 <= local_1e0);
goto LAB_0073d731;
}
}
LAB_0073dd59:
local_1dc = (CNavArea *)0x0;
LAB_0073d731:
iVar6 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar5 = ThreadGetCurrentId(), iVar6 == iVar5)) {
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_200 != 0) {
(**(code **)(local_200 + 0x54))(local_200,uVar2,uVar3,0,0,0);
}
return local_1dc;
}
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.