PathFollower::Update
0x00768e40 · 3117 bytes · __thiscall
_ZN12PathFollower6UpdateEP8INextBot
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* PathFollower::Update(INextBot*) */
void __thiscall PathFollower::Update(PathFollower *this,INextBot *param_1)
{
uint *puVar1;
float fVar2;
code *pcVar3;
char cVar4;
int *piVar5;
int iVar6;
int iVar7;
undefined4 uVar8;
float *pfVar9;
float *pfVar10;
Vector *pVVar11;
int *piVar12;
CBaseEntity *this_00;
longdouble lVar13;
float fVar14;
float fVar15;
float fVar16;
char *pcVar17;
Vector *local_70;
undefined4 local_64;
undefined4 local_60;
undefined4 local_58;
undefined4 local_54;
int local_50;
float local_4c;
float local_48;
float local_44;
float local_40;
float local_3c;
float local_38;
float local_34;
float local_30;
float local_2c;
float local_28;
float local_24;
float local_20;
local_64 = 0;
local_60 = 0;
if (_towlower == 0) {
local_50 = 0;
}
else {
(**(code **)(_towlower + 0x50))
(_towlower,&local_64,0,0,0,0,
"/data/src/game/server/nextbot/path/nextbotpathfollow.cpp",0x230,
&Update(INextBot*)::tm_fmt,"(%s)%s","NextBotSpiky","PathFollower::Update");
local_50 = _towlower;
}
iVar7 = _DAT_0105db00;
local_58 = local_64;
local_54 = local_60;
/* try { // try from 00768f9e to 00768ffe has its CatchHandler @ 00769a87 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar6 = ThreadGetCurrentId(), iVar7 == iVar6)) {
if ((char *)*_DAT_0105d15c != "PathFollower::Update") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcaa67f,(char *)0x0,0xbfa1cb);
}
puVar1 = (uint *)(_DAT_0105d1e8 + 4 + _DAT_0105d15c[0x1c] * 8);
*puVar1 = *puVar1 | 4;
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
/* try { // try from 00768efe to 00768f29 has its CatchHandler @ 00769a9c */
piVar5 = (int *)(**(code **)(*(int *)param_1 + 0xc0))(param_1);
pcVar17 = (char *)this;
cVar4 = (**(code **)(*(int *)this + 0x44))(this);
if ((cVar4 == '\0') || (*(int *)(this + 0x4758) == 0)) goto LAB_00768f3f;
pcVar17 = (char *)(this + 0x4770);
lVar13 = (longdouble)CountdownTimer::Now();
if ((float)lVar13 < *(float *)(this + 0x4778)) goto LAB_00768f3f;
/* try { // try from 00769073 to 007697c7 has its CatchHandler @ 00769a9c */
cVar4 = INextBot::IsDebugging(param_1,4);
if (cVar4 != '\0') {
iVar7 = (**(code **)(*(int *)this + 0x24))(this);
uVar8 = 0;
if (iVar7 != 0) {
uVar8 = (**(code **)(*(int *)this + 0x5c))(this,iVar7);
}
(**(code **)(*(int *)this + 0x4c))(this,uVar8);
}
this[0x478c] = (PathFollower)0x0;
pcVar17 = (char *)this;
cVar4 = LadderUpdate(this,param_1);
if (cVar4 != '\0') goto LAB_00768f3f;
AdjustSpeed(this,param_1);
pcVar17 = (char *)this;
cVar4 = CheckProgress(this,param_1);
if (cVar4 == '\0') goto LAB_00768f3f;
pfVar9 = (float *)(**(code **)(*piVar5 + 300))(piVar5);
iVar7 = *(int *)(this + 0x4758);
local_4c = *(float *)(iVar7 + 8) - *pfVar9;
local_48 = *(float *)(iVar7 + 0xc) - pfVar9[1];
local_44 = *(float *)(iVar7 + 0x10) - pfVar9[2];
/* try { // try from 007697ed to 00769a79 has its CatchHandler @ 00769a9c */
if ((*(int *)(iVar7 + 0x18) == 2) &&
(iVar7 = (**(code **)(*(int *)this + 0x58))(this,iVar7), iVar7 != 0)) {
pfVar9 = (float *)(**(code **)(*piVar5 + 300))(piVar5);
local_48 = *(float *)(iVar7 + 0xc) - pfVar9[1];
local_4c = *(float *)(iVar7 + 8) - *pfVar9;
}
local_44 = 0.0;
VectorNormalize((Vector *)&local_4c);
local_38 = 0.0;
local_40 = -local_48;
local_3c = local_4c;
if ((((-0.01 < local_40) && (local_40 < 0.01)) && (-0.01 < local_4c)) && (local_4c < 0.01)) {
piVar5 = (int *)(**(code **)(*piVar5 + 0xb0))(piVar5);
(**(code **)(*piVar5 + 0x24))(piVar5,this,1);
lVar13 = (longdouble)(**(code **)(*(int *)this + 0x28))(this);
if (0.0 < (float)lVar13) {
(**(code **)(*(int *)this + 0x48))(this);
}
cVar4 = INextBot::IsDebugging(param_1,4);
pcVar17 = (char *)param_1;
if (cVar4 != '\0') {
pcVar17 = "PathFollower: OnMoveToFailure( FAIL_STUCK ) because forward and left are ZERO\n";
DevMsg("PathFollower: OnMoveToFailure( FAIL_STUCK ) because forward and left are ZERO\n");
pcVar17 = (char *)(PathFollower *)pcVar17;
}
goto LAB_00768f3f;
}
pfVar9 = (float *)(**(code **)(*piVar5 + 0x100))(piVar5);
local_44 = pfVar9[1] * local_40 - *pfVar9 * local_3c;
local_4c = local_3c * pfVar9[2] - pfVar9[1] * local_38;
local_48 = *pfVar9 * local_38 - local_40 * pfVar9[2];
local_3c = pfVar9[2] * local_4c - local_44 * *pfVar9;
local_40 = local_44 * pfVar9[1] - local_48 * pfVar9[2];
local_38 = local_48 * *pfVar9 - local_4c * pfVar9[1];
cVar4 = INextBot::IsDebugging(param_1,4);
if (cVar4 != '\0') {
fVar16 = local_4c * 25.0;
fVar14 = local_48 * 25.0;
fVar15 = local_44 * 25.0;
pfVar10 = (float *)(**(code **)(*piVar5 + 300))(piVar5);
local_28 = fVar16 + *pfVar10;
local_24 = fVar14 + pfVar10[1];
local_20 = fVar15 + pfVar10[2];
pVVar11 = (Vector *)(**(code **)(*piVar5 + 300))(piVar5);
NDebugOverlay::Line(pVVar11,(Vector *)&local_28,0xff,0,0,true,0.1);
fVar14 = *pfVar9;
fVar15 = pfVar9[1];
fVar16 = pfVar9[2];
pfVar9 = (float *)(**(code **)(*piVar5 + 300))(piVar5);
local_28 = fVar14 * 25.0 + *pfVar9;
local_24 = fVar15 * 25.0 + pfVar9[1];
local_20 = fVar16 * 25.0 + pfVar9[2];
pVVar11 = (Vector *)(**(code **)(*piVar5 + 300))(piVar5);
NDebugOverlay::Line(pVVar11,(Vector *)&local_28,0,0xff,0,true,0.1);
fVar16 = local_40 * 25.0;
fVar14 = local_3c * 25.0;
fVar15 = local_38 * 25.0;
pfVar9 = (float *)(**(code **)(*piVar5 + 300))(piVar5);
local_28 = fVar16 + *pfVar9;
local_24 = fVar14 + pfVar9[1];
local_20 = fVar15 + pfVar9[2];
pVVar11 = (Vector *)(**(code **)(*piVar5 + 300))(piVar5);
NDebugOverlay::Line(pVVar11,(Vector *)&local_28,0,0,0xff,true,0.1);
}
cVar4 = Climbing((INextBot *)this,(Segment *)param_1,*(Vector **)(this + 0x4758),
(Vector *)&local_4c,(float)&local_40);
if (cVar4 == '\0') {
pcVar17 = (char *)this;
cVar4 = (**(code **)(*(int *)this + 0x44))(this);
if (cVar4 == '\0') goto LAB_00768f3f;
JumpOverGaps((INextBot *)this,(Segment *)param_1,*(Vector **)(this + 0x4758),(Vector *)&local_4c
,(float)&local_40);
}
pcVar17 = (char *)this;
cVar4 = (**(code **)(*(int *)this + 0x44))(this);
if (cVar4 == '\0') goto LAB_00768f3f;
piVar12 = (int *)(**(code **)(*(int *)param_1 + 0xb4))(param_1);
iVar7 = (**(code **)(*piVar12 + 0x52c))(piVar12);
if (iVar7 == 0) {
local_70._0_1_ = 0;
}
else {
local_70._0_1_ = (byte)(*(uint *)(iVar7 + 0x54) >> 0xc) & 1;
}
lVar13 = (longdouble)(**(code **)(*piVar5 + 0x134))(piVar5);
iVar7 = *(int *)(this + 0x4758);
if (*(int *)(iVar7 + 0x14) != 0) goto LAB_00769591;
cVar4 = (**(code **)(*piVar5 + 200))(piVar5);
iVar7 = *(int *)(this + 0x4758);
if ((cVar4 != '\0') || ((byte)local_70 != 0)) goto LAB_00769591;
fVar14 = *(float *)(iVar7 + 0x10);
iVar7 = (**(code **)(*piVar5 + 300))(piVar5);
if ((float)lVar13 + *(float *)(iVar7 + 8) < fVar14) {
iVar7 = (**(code **)(*piVar5 + 300))(piVar5);
fVar14 = *(float *)(iVar7 + 4);
fVar15 = *(float *)(*(int *)(this + 0x4758) + 0xc);
pfVar9 = (float *)(**(code **)(*piVar5 + 300))(piVar5);
fVar16 = *pfVar9;
fVar2 = *(float *)(*(int *)(this + 0x4758) + 8);
cVar4 = (**(code **)(*piVar5 + 0x168))(piVar5);
if ((cVar4 != '\0') ||
(fVar16 = fVar16 - fVar2, fVar14 = fVar14 - fVar15, fVar14 * fVar14 + fVar16 * fVar16 < 625.0
)) {
iVar7 = (**(code **)(*(int *)this + 0x58))(this,*(undefined4 *)(this + 0x4758));
cVar4 = (**(code **)(*piVar5 + 0x168))(piVar5);
if ((cVar4 == '\0') && (iVar7 != 0)) {
fVar14 = *(float *)(iVar7 + 0x10);
iVar6 = (**(code **)(*piVar5 + 300))(piVar5);
fVar15 = *(float *)(iVar6 + 8);
lVar13 = (longdouble)(**(code **)(*piVar5 + 0x134))(piVar5);
if (fVar14 - fVar15 <= (float)lVar13) {
pcVar3 = *(code **)(*piVar5 + 0x158);
uVar8 = (**(code **)(*piVar5 + 300))(piVar5);
cVar4 = (*pcVar3)(piVar5,uVar8,iVar7 + 8,1,0);
if (cVar4 != '\0') goto LAB_00769933;
}
}
piVar5 = (int *)(**(code **)(*piVar5 + 0xb0))(piVar5);
(**(code **)(*piVar5 + 0x24))(piVar5,this,2);
lVar13 = (longdouble)(**(code **)(*(int *)this + 0x28))(this);
if (0.0 < (float)lVar13) {
(**(code **)(*(int *)this + 0x48))(this);
}
cVar4 = INextBot::IsDebugging(param_1,4);
pcVar17 = (char *)param_1;
if (cVar4 != '\0') {
pcVar17 = "PathFollower: OnMoveToFailure( FAIL_FELL_OFF )\n";
DevMsg("PathFollower: OnMoveToFailure( FAIL_FELL_OFF )\n");
}
LAB_00768f3f:
iVar7 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar6 = ThreadGetCurrentId(pcVar17), iVar7 == iVar6)) {
cVar4 = CVProfNode::ExitScope();
if (cVar4 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_50 != 0) {
(**(code **)(local_50 + 0x54))(local_50,local_58,local_54,0,0,0);
}
return;
}
}
LAB_00769933:
iVar7 = *(int *)(this + 0x4758);
LAB_00769591:
local_34 = *(float *)(iVar7 + 8);
local_30 = *(float *)(iVar7 + 0xc);
local_2c = *(float *)(iVar7 + 0x10);
pfVar9 = (float *)(**(code **)(*piVar5 + 300))(piVar5);
local_48 = local_30 - pfVar9[1];
local_4c = local_34 - *pfVar9;
local_44 = 0.0;
lVar13 = (longdouble)VectorNormalize((Vector *)&local_4c);
iVar7 = *(int *)(this + 0x4758);
local_38 = 0.0;
local_40 = -local_48;
local_3c = local_4c;
iVar6 = (**(code **)(*(int *)this + 0x60))(this);
if ((iVar7 != iVar6) &&
((50.0 < (float)lVar13 ||
((*(int *)(this + 0x4758) != 0 && (*(int *)(*(int *)(this + 0x4758) + 0x18) != 2)))))) {
Avoid((INextBot *)&local_28,(Vector *)this,(Vector *)param_1,(Vector *)&local_34);
local_34 = local_28;
local_30 = local_24;
local_2c = local_20;
}
cVar4 = (**(code **)(*piVar5 + 0xf8))(piVar5);
if (cVar4 != '\0') {
this_00 = (CBaseEntity *)(**(code **)(*(int *)param_1 + 0xb4))(param_1);
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
if (1296.0 < (*(float *)(this_00 + 0x2e4) - local_30) * (*(float *)(this_00 + 0x2e4) - local_30)
+ (*(float *)(this_00 + 0x2e0) - local_34) *
(*(float *)(this_00 + 0x2e0) - local_34) +
(*(float *)(this_00 + 0x2e8) - local_2c) * (*(float *)(this_00 + 0x2e8) - local_2c)
) {
(**(code **)(*piVar5 + 0x120))(piVar5,&local_34);
}
}
local_70 = (Vector *)&local_34;
(**(code **)(*piVar5 + 0xb4))(piVar5,local_70,0x3f800000);
if ((*(int *)(this + 0x4758) != 0) && (*(int *)(*(int *)(this + 0x4758) + 0x18) - 2U < 2)) {
piVar5 = (int *)(**(code **)(*(int *)param_1 + 0xc4))(param_1);
(**(code **)(*piVar5 + 0xec))(piVar5,0);
}
cVar4 = INextBot::IsDebugging(param_1,4);
if (cVar4 != '\0') {
NDebugOverlay::Cross3D(local_70,5.0,0x96,0x96,0xff,true,0.1);
piVar5 = (int *)(**(code **)(*(int *)param_1 + 0xb4))(param_1);
pVVar11 = (Vector *)(**(code **)(*piVar5 + 0x288))(piVar5);
NDebugOverlay::Line(pVVar11,local_70,0xff,0xff,0,true,0.1);
}
CVProfile::ExitScope((CVProfile *)&g_VProfCurrentProfile);
Tm_Zone::~Tm_Zone((Tm_Zone *)&local_58);
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.