SurvivorLegsMoveToVantagePoint::UpdatePath
0x00961010 · 2276 bytes · __thiscall
_ZN30SurvivorLegsMoveToVantagePoint10UpdatePathEP11SurvivorBot
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* SurvivorLegsMoveToVantagePoint::UpdatePath(SurvivorBot*) */
bool __thiscall
SurvivorLegsMoveToVantagePoint::UpdatePath
(SurvivorLegsMoveToVantagePoint *this,SurvivorBot *param_1)
{
Path *this_00;
INextBot *pIVar1;
uint *puVar2;
float fVar3;
CNavArea CVar4;
uint uVar5;
char cVar6;
bool bVar7;
bool bVar8;
int *piVar9;
TerrorNavArea *pTVar10;
int iVar11;
int iVar12;
Vector *pVVar13;
CNavArea *pCVar14;
CNavArea *pCVar15;
CBaseEntity *pCVar16;
undefined *puVar17;
SurvivorLegsMoveToVantagePoint *pSVar18;
longdouble lVar19;
int local_7c;
undefined4 local_78;
CNavArea *local_68;
undefined4 local_64;
undefined4 local_60;
float local_5c;
float local_58;
float local_54;
undefined4 local_50;
undefined4 local_4c;
int local_48;
float local_44;
float local_40;
float local_3c;
undefined4 local_38;
undefined4 local_34;
undefined4 local_30;
undefined **local_2c;
INextBot *local_28;
undefined4 local_24;
undefined1 local_20;
undefined1 local_1f;
lVar19 = (longdouble)CountdownTimer::Now();
if ((float)lVar19 < *(float *)(this + 0x4820)) {
return true;
}
piVar9 = (int *)(**(code **)(*(int *)param_1 + 0x9a0))(param_1);
cVar6 = (**(code **)(*piVar9 + 0xd4))(piVar9);
if (cVar6 != '\0') {
return true;
}
lVar19 = (longdouble)RandomFloat(0x3e99999a,0x3f000000);
fVar3 = (float)lVar19;
lVar19 = (longdouble)CountdownTimer::Now();
if ((float)lVar19 + fVar3 != *(float *)(this + 0x4820)) {
(**(code **)(*(int *)(this + 0x4818) + 4))(this + 0x4818,this + 0x4820);
*(float *)(this + 0x4820) = (float)lVar19 + fVar3;
}
if (fVar3 != *(float *)(this + 0x481c)) {
(**(code **)(*(int *)(this + 0x4818) + 4))(this + 0x4818,this + 0x481c);
*(float *)(this + 0x481c) = fVar3;
}
uVar5 = *(uint *)(this + 0x34);
piVar9 = (int *)0x0;
if (((uVar5 != 0xffffffff) &&
(puVar17 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar17 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar17 + 8) == uVar5 >> 0xc)) {
piVar9 = *(int **)(puVar17 + 4);
}
pTVar10 = (TerrorNavArea *)(**(code **)(*piVar9 + 0x52c))(piVar9);
iVar11 = CDirectorTacticalServices::FindClosestVantagePoint
(*(CDirectorTacticalServices **)(TheDirector + 0x628),
(CBaseCombatCharacter *)param_1,pTVar10,1000.0,-1.0);
bVar8 = false;
if (iVar11 == 0) {
PathFollower::Invalidate((PathFollower *)(this + 0x38));
return false;
}
pIVar1 = (INextBot *)(param_1 + 0x4028);
local_2c = &PTR_operator___00d09770;
local_28 = pIVar1;
local_24 = (**(code **)(*(int *)(param_1 + 0x4028) + 0xc0))(pIVar1);
piVar9 = (int *)(**(code **)(*(int *)(param_1 + 0x4028) + 200))(pIVar1);
iVar12 = (**(code **)(*piVar9 + 0xb8))(piVar9,pIVar1);
local_1f = 0;
local_20 = iVar12 != 0;
iVar12 = (**(code **)(*(int *)param_1 + 0x52c))(param_1);
if (iVar11 == iVar12) {
piVar9 = (int *)(**(code **)(*(int *)param_1 + 0x9ac))(param_1);
uVar5 = *(uint *)(this + 0x34);
local_78 = 0;
if (((uVar5 != 0xffffffff) &&
(puVar17 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar17 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar17 + 8) == uVar5 >> 0xc)) {
local_78 = *(undefined4 *)(puVar17 + 4);
}
cVar6 = (**(code **)(*piVar9 + 0xd0))(piVar9,local_78,1,0);
if (cVar6 == '\0') {
uVar5 = *(uint *)(this + 0x34);
pCVar16 = (CBaseEntity *)0x0;
if (((uVar5 != 0xffffffff) &&
(puVar17 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar17 != (undefined *)0xfffffffc)) &&
(*(uint *)(puVar17 + 8) == uVar5 >> 0xc)) {
pCVar16 = *(CBaseEntity **)(puVar17 + 4);
}
if (((byte)pCVar16[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar16);
}
bVar8 = Path::Compute<SurvivorBotPathCost>
((Path *)(this + 0x38),pIVar1,(Vector *)(pCVar16 + 0x2e0),
(SurvivorBotPathCost *)&local_2c,0.0);
return bVar8;
}
}
iVar12 = RandomInt(0,3);
if (iVar12 == 2) {
local_5c = *(float *)(iVar11 + 0x10);
local_58 = *(float *)(iVar11 + 0x14);
local_54 = *(float *)(iVar11 + 0x18);
}
else if (iVar12 == 3) {
local_5c = *(float *)(iVar11 + 4);
local_58 = *(float *)(iVar11 + 0x14);
local_54 = *(float *)(iVar11 + 0x28);
}
else if (iVar12 == 1) {
local_58 = *(float *)(iVar11 + 8);
local_54 = *(float *)(iVar11 + 0x24);
local_5c = *(float *)(iVar11 + 0x10);
}
else {
local_5c = *(float *)(iVar11 + 4);
local_58 = *(float *)(iVar11 + 8);
local_54 = *(float *)(iVar11 + 0xc);
}
this_00 = (Path *)(this + 0x38);
local_64 = 0;
local_60 = 0;
if (_towlower == 0) {
local_48 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_64,0,0,0,0,"/data/src/game/server/nextbot/path/nextbotpath.h",0x113,
&Path::
Compute<SurvivorBotPathCost>(INextBot*,Vector_const&,SurvivorBotPathCost&,float)::
tm_fmt,"(%s)%s","NextBotSpiky","Path::Compute(goal)");
local_48 = _towlower;
}
iVar11 = _DAT_0105db00;
local_50 = local_64;
local_4c = local_60;
/* try { // try from 009612e0 to 009612e4 has its CatchHandler @ 00961926 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar12 = ThreadGetCurrentId(), iVar11 == iVar12)) {
if ((char *)*_DAT_0105d15c != "Path::Compute(goal)") {
/* try { // try from 0096170f to 00961732 has its CatchHandler @ 00961926 */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xbfa1b7,(char *)0x0,0xbfa1cb);
}
puVar2 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar2 = *puVar2 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
/* try { // try from 009612f6 to 009615a8 has its CatchHandler @ 00961905 */
(**(code **)(*(int *)(this + 0x38) + 0x48))(this_00);
pVVar13 = (Vector *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xd4))(pIVar1);
piVar9 = (int *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xb4))(pIVar1);
pCVar14 = (CNavArea *)(**(code **)(*piVar9 + 0x52c))(piVar9);
if (pCVar14 == (CNavArea *)0x0) {
/* try { // try from 0096186e to 009618b6 has its CatchHandler @ 00961905 */
(**(code **)(*(int *)(this + 0x38) + 100))(this_00,pIVar1,2);
goto LAB_009615a9;
}
pCVar15 = (CNavArea *)
CNavMesh::GetNearestNavArea(TheNavMesh,(Vector *)&local_5c,true,200.0,true,true,false);
if (pCVar14 == pCVar15) {
/* try { // try from 009618ea to 009618ee has its CatchHandler @ 00961905 */
Path::BuildTrivialPath(this_00,pIVar1,(Vector *)&local_5c);
bVar8 = true;
goto LAB_009615a9;
}
local_44 = local_5c;
local_40 = local_58;
local_3c = local_54;
if (pCVar15 == (CNavArea *)0x0) {
CNavMesh::GetGroundHeight(TheNavMesh,(Vector *)&local_44,&local_3c,(Vector *)0x0);
}
else {
lVar19 = (longdouble)CNavArea::GetZ(pCVar15,local_5c,local_58);
local_3c = (float)lVar19;
}
pCVar16 = (CBaseEntity *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xb4))(pIVar1);
if (((byte)pCVar16[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar16);
}
local_68 = (CNavArea *)0x0;
local_38 = *(undefined4 *)(pCVar16 + 0x2e0);
local_34 = *(undefined4 *)(pCVar16 + 0x2e4);
local_30 = *(undefined4 *)(pCVar16 + 0x2e8);
pCVar16 = (CBaseEntity *)(**(code **)(*(int *)(param_1 + 0x4028) + 0xb4))(pIVar1);
iVar11 = CBaseEntity::GetTeamNumber(pCVar16);
bVar7 = NavAreaBuildPath<SurvivorBotPathCost>
(pCVar14,pCVar15,(Vector *)&local_38,(Vector *)&local_5c,
(SurvivorBotPathCost *)&local_2c,&local_68,0.0,iVar11,false);
if (local_68 == (CNavArea *)0x0) goto LAB_009615a9;
if (pCVar14 == local_68) {
LAB_0096189e:
Path::BuildTrivialPath(this_00,pIVar1,(Vector *)&local_5c);
bVar8 = bVar7;
}
else {
local_7c = 1;
pCVar15 = local_68;
do {
pCVar15 = *(CNavArea **)(pCVar15 + 0x78);
if (pCVar15 == (CNavArea *)0x0) break;
local_7c = local_7c + 1;
} while (pCVar14 != pCVar15);
if (local_7c < 0x100) {
if (local_7c == 1) goto LAB_0096189e;
*(int *)(this + 0x443c) = local_7c;
}
else {
*(undefined4 *)(this + 0x443c) = 0xff;
local_7c = 0xff;
}
pCVar14 = local_68;
iVar11 = local_7c;
pSVar18 = this + (local_7c + -1) * 0x44 + 0x3c;
do {
*(CNavArea **)pSVar18 = pCVar14;
iVar11 = iVar11 + -1;
CVar4 = pCVar14[0x7c];
*(undefined4 *)(pSVar18 + 0x18) = 0;
*(uint *)(pSVar18 + 4) = (byte)CVar4 & 0xf;
pCVar14 = *(CNavArea **)(pCVar14 + 0x78);
if (pCVar14 == (CNavArea *)0x0) break;
pSVar18 = pSVar18 + -0x44;
} while (iVar11 != 0);
local_7c = local_7c * 0x44;
*(CNavArea **)(this + local_7c + 0x3c) = local_68;
*(float *)(this_00 + local_7c + 0xc) = local_44;
*(float *)(this_00 + local_7c + 0x10) = local_40;
*(float *)(this_00 + local_7c + 0x14) = local_3c;
iVar11 = *(int *)(this + 0x443c);
*(undefined4 *)(this + iVar11 * 0x44 + 0x50) = 0;
*(undefined4 *)(this + iVar11 * 0x44 + 0x40) = 9;
*(undefined4 *)(this + iVar11 * 0x44 + 0x54) = 0;
*(int *)(this + 0x443c) = iVar11 + 1;
cVar6 = Path::ComputePathDetails(this_00,pIVar1,pVVar13);
if (cVar6 == '\0') {
(**(code **)(*(int *)(this + 0x38) + 0x48))(this_00);
(**(code **)(*(int *)(this + 0x38) + 100))(this_00,pIVar1,2);
}
else {
/* try { // try from 00961642 to 00961671 has its CatchHandler @ 00961905 */
Path::Optimize((INextBot *)this_00);
Path::PostProcess(this_00);
(**(code **)(*(int *)(this + 0x38) + 100))(this_00,pIVar1,!bVar7);
bVar8 = bVar7;
}
}
LAB_009615a9:
iVar11 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar12 = ThreadGetCurrentId(), iVar11 == iVar12)) {
cVar6 = CVProfNode::ExitScope();
if (cVar6 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_48 != 0) {
(**(code **)(local_48 + 0x54))(local_48,local_50,local_4c,0,0,0);
return bVar8;
}
return bVar8;
}
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.