CNavMesh::PostLoad
0x0071fc60 · 1580 bytes · __thiscall
_ZN8CNavMesh8PostLoadEj
Decompiled
undefined (2 params)
/* CNavMesh::PostLoad(unsigned int) */
undefined4 __thiscall CNavMesh::PostLoad(CNavMesh *this,uint param_1)
{
int *piVar1;
undefined4 *puVar2;
char cVar3;
int iVar4;
CNavArea *pCVar5;
int *piVar6;
int iVar7;
int iVar8;
int iVar9;
int iVar10;
float fVar11;
int local_1874;
int local_1870;
int local_186c;
CUtlMemory<OneWayLink_t,int> *local_1868;
int local_1864;
int local_1860;
int local_1858;
int local_1850;
CNavArea *local_1844;
int local_1840;
CNavArea *local_183c;
int local_1838;
undefined1 *local_1834;
undefined4 local_1830;
undefined4 local_182c;
undefined4 local_1828;
undefined1 local_1824 [6144];
size_t local_24;
undefined1 *local_20;
iVar7 = 0;
free(*(void **)(this + 0x5d8));
iVar8 = DAT_00fe6000;
*(undefined4 *)(this + 0x5d8) = 0;
if (0 < iVar8) {
do {
piVar6 = *(int **)(TheNavAreas + iVar7 * 4);
iVar7 = iVar7 + 1;
(**(code **)(*piVar6 + 0x38))(piVar6);
} while (iVar7 < DAT_00fe6000);
}
iVar8 = 0;
if (0 < *TheHidingSpots) {
do {
iVar7 = iVar8 + 1;
iVar8 = iVar8 + 1;
HidingSpot::PostLoad((HidingSpot *)TheHidingSpots[iVar7]);
} while (iVar8 < *TheHidingSpots);
}
if (param_1 < 8) {
if (0 < DAT_00fe6000) {
iVar8 = 0;
do {
piVar6 = *(int **)(TheNavAreas + iVar8 * 4);
iVar8 = iVar8 + 1;
(**(code **)(*piVar6 + 0x68))(piVar6);
} while (iVar8 < DAT_00fe6000);
goto LAB_0071fd0f;
}
}
else {
LAB_0071fd0f:
local_1834 = local_1824;
local_24 = 0;
local_1830 = 0x200;
local_182c = 0xffffffff;
local_1828 = 0;
if (0 < DAT_00fe6000) {
local_186c = 0;
local_20 = local_1834;
do {
pCVar5 = *(CNavArea **)(TheNavAreas + local_186c * 4);
fVar11 = 1.0 / *(float *)(this + 0x20);
iVar8 = (int)((*(float *)(pCVar5 + 4) - *(float *)(this + 0x2c)) * fVar11);
if (iVar8 < 0) {
local_1874 = 0;
}
else {
local_1874 = *(int *)(this + 0x24) + -1;
if (iVar8 < *(int *)(this + 0x24)) {
local_1874 = iVar8;
}
}
iVar8 = (int)((*(float *)(pCVar5 + 8) - *(float *)(this + 0x30)) * fVar11);
if (iVar8 < 0) {
local_1860 = 0;
}
else {
local_1860 = *(int *)(this + 0x28) + -1;
if (iVar8 < *(int *)(this + 0x28)) {
local_1860 = iVar8;
}
}
iVar8 = (int)((*(float *)(pCVar5 + 0x10) - *(float *)(this + 0x2c)) * fVar11);
if (iVar8 < 0) {
local_1864 = 0;
}
else {
local_1864 = *(int *)(this + 0x24) + -1;
if (iVar8 < *(int *)(this + 0x24)) {
local_1864 = iVar8;
}
}
iVar8 = (int)((*(float *)(pCVar5 + 0x14) - *(float *)(this + 0x30)) * fVar11);
if (iVar8 < 0) {
local_1870 = 0;
}
else {
local_1870 = *(int *)(this + 0x28) + -1;
if (iVar8 < *(int *)(this + 0x28)) {
local_1870 = iVar8;
}
}
if (local_1860 <= local_1870) {
do {
if (local_1874 <= local_1864) {
local_1858 = local_1874;
do {
piVar6 = (int *)(*(int *)(this + 0xc) +
(local_1860 * *(int *)(this + 0x24) + local_1858) * 0x14);
iVar8 = piVar6[3];
iVar7 = *piVar6;
iVar9 = 0;
if (0 < iVar8) {
do {
local_1844 = *(CNavArea **)(iVar7 + iVar9 * 4);
/* try { // try from 0071feda to 0071ff2f has its CatchHandler @ 0071ff87 */
if ((pCVar5 != local_1844) &&
(cVar3 = CNavArea::IsOverlapping(pCVar5,local_1844), cVar3 != '\0')) {
iVar10 = *(int *)(pCVar5 + 0x104);
if (iVar10 < 1) {
LAB_0071ff14:
CUtlVector<CNavArea*,CUtlMemoryConservative<CNavArea*>>::InsertBefore
((CUtlVector<CNavArea*,CUtlMemoryConservative<CNavArea*>> *)
(pCVar5 + 0xfc),iVar10,&local_1844);
}
else if ((CNavArea *)**(undefined4 **)(pCVar5 + 0xfc) != local_1844) {
iVar4 = 0;
do {
iVar4 = iVar4 + 1;
if (iVar4 == iVar10) goto LAB_0071ff14;
} while ((CNavArea *)(*(undefined4 **)(pCVar5 + 0xfc))[iVar4] != local_1844)
;
if (iVar4 == -1) goto LAB_0071ff14;
}
}
iVar9 = iVar9 + 1;
} while (iVar9 != iVar8);
}
local_1858 = local_1858 + 1;
} while (local_1858 <= local_1864);
}
local_1860 = local_1860 + 1;
} while (local_1860 <= local_1870);
pCVar5 = *(CNavArea **)(TheNavAreas + local_186c * 4);
}
iVar8 = 0;
local_183c = pCVar5;
do {
pCVar5 = local_183c + iVar8 * 4 + 0x58;
piVar6 = *(int **)(local_183c + iVar8 * 4 + 0x58);
if (0 < *piVar6) {
iVar7 = (&CSWTCH_1322)[iVar8];
local_1850 = 0;
do {
local_1840 = piVar6[local_1850 * 2 + 1];
piVar6 = *(int **)(local_1840 + iVar7 * 4 + 0x58);
local_1838 = iVar7;
if (*piVar6 < 1) {
LAB_00720059:
/* try { // try from 00720073 to 00720164 has its CatchHandler @ 0071ff87 */
CUtlVector<OneWayLink_t,CUtlMemoryFixedGrowable<OneWayLink_t,512u,int>>::
InsertBefore((CUtlVector<OneWayLink_t,CUtlMemoryFixedGrowable<OneWayLink_t,512u,int>>
*)&local_1834,local_24,(OneWayLink_t *)&local_1840);
}
else if (*(int *)(piVar6[1] + 0x8c) != *(int *)(local_183c + 0x8c)) {
iVar9 = 0;
do {
iVar9 = iVar9 + 1;
if (iVar9 == *piVar6) goto LAB_00720059;
} while (*(int *)(piVar6[iVar9 * 2 + 1] + 0x8c) != *(int *)(local_183c + 0x8c));
}
local_1850 = local_1850 + 1;
piVar6 = *(int **)pCVar5;
} while (local_1850 < *piVar6);
}
iVar8 = iVar8 + 1;
} while (iVar8 != 4);
local_186c = local_186c + 1;
} while (local_186c < DAT_00fe6000);
if (1 < (int)local_24) {
if (local_1834 == (undefined1 *)0x0) {
iVar8 = local_24 - 1;
do {
if (0 < iVar8) {
iVar7 = 1;
piVar6 = (int *)0x0;
do {
piVar1 = piVar6 + 3;
iVar9 = *piVar6;
iVar10 = (iVar9 - *piVar1 >> 2) * -0x381c0e07;
if (iVar10 == 0) {
iVar10 = piVar6[2] - piVar6[5];
}
if (iVar10 < 0) {
iVar10 = piVar6[1];
*piVar6 = *piVar1;
iVar4 = piVar6[2];
piVar6[1] = piVar6[4];
piVar6[2] = piVar6[5];
*piVar1 = iVar9;
piVar6[5] = iVar4;
piVar6[4] = iVar10;
}
iVar7 = iVar7 + 1;
piVar6 = piVar1;
} while (iVar8 + 1 != iVar7);
}
iVar8 = iVar8 + -1;
} while (iVar8 != -1);
}
else {
qsort(local_1834,local_24,0xc,OneWayLink_t::Compare);
}
}
iVar8 = 0;
if (0 < (int)local_24) {
do {
puVar2 = (undefined4 *)(local_1834 + iVar8 * 0xc);
CNavArea::AddIncomingConnection((CNavArea *)*puVar2,puVar2[1],puVar2[2]);
iVar8 = iVar8 + 1;
} while (iVar8 < (int)local_24);
}
goto LAB_00720137;
}
}
local_1834 = local_1824;
local_24 = 0;
local_1828 = 0;
local_182c = 0xffffffff;
local_1830 = 0x200;
local_20 = local_1834;
LAB_00720137:
local_1868 = (CUtlMemory<OneWayLink_t,int> *)&local_1834;
ValidateNavAreaConnections();
iVar8 = 0;
if (0 < *(int *)(this + 0x5a8)) {
do {
piVar6 = *(int **)(*(int *)(this + 0x59c) + iVar8 * 4);
(**(code **)(*piVar6 + 0x10))(piVar6);
iVar8 = iVar8 + 1;
} while (iVar8 < *(int *)(this + 0x5a8));
}
local_24 = 0;
this[0x4c] = (CNavMesh)0x1;
CUtlMemory<OneWayLink_t,int>::Purge(local_1868);
local_20 = local_1834;
CUtlMemory<OneWayLink_t,int>::Purge(local_1868);
return 0;
}
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.