SurvivorBot::OnNavAreaChanged
0x00944380 · 1017 bytes · __thiscall
_ZN11SurvivorBot16OnNavAreaChangedEP8CNavAreaS1_
Decompiled
undefined (3 params)
/* SurvivorBot::OnNavAreaChanged(CNavArea*, CNavArea*) */
void __thiscall SurvivorBot::OnNavAreaChanged(SurvivorBot *this,CNavArea *param_1,CNavArea *param_2)
{
undefined4 *puVar1;
float fVar2;
ushort uVar3;
int iVar4;
TerrorNavArea *pTVar5;
int iVar6;
char cVar7;
int *piVar8;
int iVar9;
int iVar10;
CUtlMemory<TerrorNavArea*,int> *local_54;
int local_40 [5];
TerrorNavArea *local_2c;
float local_28;
TerrorNavArea *local_24;
float local_20;
local_40[0] = 0;
local_40[1] = 0;
local_40[2] = 0;
local_40[3] = 0;
local_40[4] = 0;
local_2c = (TerrorNavArea *)0x0;
local_28 = 0.0;
local_24 = (TerrorNavArea *)0x0;
local_20 = 1e+10;
if (param_1 != (CNavArea *)0x0) {
iVar9 = 0;
TerrorNavArea::s_nCurrVisTestCounter = TerrorNavArea::s_nCurrVisTestCounter + 1;
if (0 < *(int *)(param_1 + 0x13c)) {
do {
while ((pTVar5 = *(TerrorNavArea **)
(TheNavAreas +
((int)(uint)*(ushort *)(*(int *)(param_1 + 0x134) + iVar9 * 2) >> 2) * 4),
pTVar5 == (TerrorNavArea *)0x0 ||
(*(int *)(pTVar5 + 0x170) = TerrorNavArea::s_nCurrVisTestCounter,
(*(byte *)(*(int *)(param_1 + 0x134) + iVar9 * 2) & 2) == 0))) {
LAB_00944400:
iVar9 = iVar9 + 1;
if (*(int *)(param_1 + 0x13c) <= iVar9) goto LAB_00944500;
}
/* try { // try from 0094444b to 00944749 has its CatchHandler @ 0094479b */
cVar7 = TerrorNavArea::IsCleared(pTVar5,(CTerrorPlayer *)0x0);
iVar10 = local_40[3];
if ((cVar7 == '\0') && ((*(uint *)(pTVar5 + 300) & 0x1c00) == 0)) {
CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::GrowVector
((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)local_40,1);
CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::ShiftElementsRight
((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)local_40,iVar10,1)
;
puVar1 = (undefined4 *)(local_40[0] + iVar10 * 4);
if (puVar1 != (undefined4 *)0x0) {
*puVar1 = pTVar5;
}
}
fVar2 = *(float *)(pTVar5 + 0x154);
if (fVar2 <= -9999.0) goto LAB_00944400;
if ((local_2c == (TerrorNavArea *)0x0) ||
(*(float *)(local_2c + 0x154) <= fVar2 && fVar2 != *(float *)(local_2c + 0x154))) {
local_2c = pTVar5;
local_28 = fVar2;
}
if ((local_24 != (TerrorNavArea *)0x0) && (*(float *)(local_24 + 0x154) <= fVar2))
goto LAB_00944400;
iVar9 = iVar9 + 1;
local_24 = pTVar5;
local_20 = fVar2;
} while (iVar9 < *(int *)(param_1 + 0x13c));
}
LAB_00944500:
iVar9 = *(int *)(param_1 + 0x130);
if ((iVar9 != 0) && (0 < *(int *)(iVar9 + 0x13c))) {
iVar10 = 0;
do {
while( true ) {
iVar6 = TheNavAreas;
iVar4 = *(int *)(TheNavAreas +
((int)(uint)*(ushort *)(*(int *)(iVar9 + 0x134) + iVar10 * 2) >> 2) * 4);
if ((iVar4 != 0) && (*(int *)(iVar4 + 0x170) != TerrorNavArea::s_nCurrVisTestCounter))
break;
LAB_00944520:
iVar10 = iVar10 + 1;
if (*(int *)(iVar9 + 0x13c) <= iVar10) goto LAB_00944610;
}
*(int *)(iVar4 + 0x170) = TerrorNavArea::s_nCurrVisTestCounter;
uVar3 = *(ushort *)(*(int *)(iVar9 + 0x134) + iVar10 * 2);
if ((uVar3 & 2) == 0) goto LAB_00944520;
pTVar5 = *(TerrorNavArea **)((uVar3 & 0xfffc) + iVar6);
cVar7 = TerrorNavArea::IsCleared(pTVar5,(CTerrorPlayer *)0x0);
iVar4 = local_40[3];
if ((cVar7 == '\0') && ((*(uint *)(pTVar5 + 300) & 0x1c00) == 0)) {
CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::GrowVector
((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)local_40,1);
CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::ShiftElementsRight
((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)local_40,iVar4,1);
puVar1 = (undefined4 *)(local_40[0] + iVar4 * 4);
if (puVar1 != (undefined4 *)0x0) {
*puVar1 = pTVar5;
}
}
fVar2 = *(float *)(pTVar5 + 0x154);
if (fVar2 <= -9999.0) goto LAB_00944520;
if ((local_2c == (TerrorNavArea *)0x0) ||
(*(float *)(local_2c + 0x154) <= fVar2 && fVar2 != *(float *)(local_2c + 0x154))) {
local_2c = pTVar5;
local_28 = fVar2;
}
if ((local_24 != (TerrorNavArea *)0x0) && (*(float *)(local_24 + 0x154) <= fVar2))
goto LAB_00944520;
iVar10 = iVar10 + 1;
local_24 = pTVar5;
local_20 = fVar2;
} while (iVar10 < *(int *)(iVar9 + 0x13c));
}
LAB_00944610:
iVar10 = local_40[3];
iVar9 = *(int *)(this + 0x1aa90);
if (local_40[3] != 0) {
CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::GrowVector
((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)(this + 0x1aa84),
local_40[3]);
CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>>::ShiftElementsRight
((CUtlVector<TerrorNavArea*,CUtlMemory<TerrorNavArea*,int>> *)(this + 0x1aa84),iVar9
,iVar10);
if (0 < local_40[3]) {
iVar9 = iVar9 * 4;
iVar10 = 0;
do {
iVar4 = iVar10 * 4;
iVar10 = iVar10 + 1;
*(undefined4 *)(*(int *)(this + 0x1aa84) + iVar9) = *(undefined4 *)(local_40[0] + iVar4);
iVar9 = iVar9 + 4;
} while (iVar10 < local_40[3]);
}
}
}
local_54 = (CUtlMemory<TerrorNavArea*,int> *)local_40;
*(TerrorNavArea **)(this + 0x1aa98) = local_2c;
*(TerrorNavArea **)(this + 0x1aa9c) = local_24;
UpdateEscapePath(this);
for (piVar8 = (int *)(**(code **)(*(int *)(this + 0x4028) + 8))(this + 0x4028);
piVar8 != (int *)0x0;
piVar8 = (int *)(**(code **)(*(int *)(this + 0x4028) + 0xc))(this + 0x4028,piVar8)) {
(**(code **)(*piVar8 + 100))(piVar8,param_1,param_2);
}
CTerrorPlayer::OnNavAreaChanged((CTerrorPlayer *)this,param_1,param_2);
local_40[3] = 0;
CUtlMemory<TerrorNavArea*,int>::Purge(local_54);
local_40[4] = local_40[0];
CUtlMemory<TerrorNavArea*,int>::Purge(local_54);
return;
}
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.