ChasePath::PredictSubjectPosition
0x0075e1c0 · 1489 bytes · __cdecl
_ZNK9ChasePath22PredictSubjectPositionEP8INextBotP11CBaseEntity
Decompiled
undefined (2 params)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* ChasePath::PredictSubjectPosition(INextBot*, CBaseEntity*) const */
INextBot * ChasePath::PredictSubjectPosition(INextBot *param_1,CBaseEntity *param_2)
{
char cVar1;
int *piVar2;
float *pfVar3;
int *piVar4;
CNavArea *this;
int iVar5;
longdouble lVar6;
longdouble lVar7;
float fVar8;
float fVar9;
float fVar10;
float fVar11;
int *in_stack_0000000c;
CBaseEntity *in_stack_00000010;
float local_2c;
float local_28;
float local_24;
float local_20;
piVar2 = (int *)(**(code **)(*in_stack_0000000c + 0xc0))();
if (((byte)in_stack_00000010[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(in_stack_00000010);
}
pfVar3 = (float *)(**(code **)(*in_stack_0000000c + 0xd4))();
fVar9 = *(float *)(in_stack_00000010 + 0x2e0) - *pfVar3;
fVar8 = *(float *)(in_stack_00000010 + 0x2e4) - pfVar3[1];
fVar10 = fVar9 * fVar9 + fVar8 * fVar8;
lVar6 = (longdouble)(**(code **)(*(int *)param_2 + 0x88))(param_2);
if (fVar10 <= (float)lVar6 * (float)lVar6) {
fVar10 = SQRT(fVar10);
fVar11 = 1.0 / (fVar10 + 0.0001);
fVar9 = fVar9 * fVar11;
fVar11 = fVar11 * fVar8;
lVar6 = (longdouble)(**(code **)(*piVar2 + 0x13c))(piVar2);
fVar8 = fVar10 / ((float)lVar6 + 0.0001) + 0.5;
if (((byte)in_stack_00000010[0x14d] & 0x10) != 0) {
CBaseEntity::CalcAbsoluteVelocity(in_stack_00000010);
}
local_28 = *(float *)(in_stack_00000010 + 0x274) * fVar8;
fVar8 = fVar8 * *(float *)(in_stack_00000010 + 0x278);
local_24 = 0.0;
if (fVar11 * fVar8 + fVar9 * local_28 < 0.0) {
fVar10 = SQRT(fVar9 * fVar9 + fVar11 * fVar11);
if (fVar10 == 0.0) {
local_28 = -0.0;
}
else {
fVar9 = fVar9 * (1.0 / fVar10);
fVar10 = -((1.0 / fVar10) * fVar11);
local_24 = local_28 * fVar10 + fVar8 * fVar9;
local_28 = fVar10 * local_24;
local_24 = local_24 * fVar9;
fVar10 = local_28 * local_28 + local_24 * local_24;
}
}
else {
fVar10 = fVar8 * fVar8 + local_28 * local_28;
local_24 = fVar8;
}
local_28 = local_28 + *(float *)(in_stack_00000010 + 0x2e0);
local_24 = local_24 + *(float *)(in_stack_00000010 + 0x2e4);
local_20 = *(float *)(in_stack_00000010 + 0x2e8);
if ((36.0 < fVar10) &&
(cVar1 = (**(code **)(*piVar2 + 0x158))
(piVar2,in_stack_00000010 + 0x2e0,&local_28,0,&local_2c), cVar1 == '\0'))
{
local_24 = (local_24 - *(float *)(in_stack_00000010 + 0x2e4)) * local_2c +
*(float *)(in_stack_00000010 + 0x2e4);
local_20 = (local_20 - *(float *)(in_stack_00000010 + 0x2e8)) * local_2c +
*(float *)(in_stack_00000010 + 0x2e8);
local_28 = (local_28 - *(float *)(in_stack_00000010 + 0x2e0)) * local_2c +
*(float *)(in_stack_00000010 + 0x2e0);
}
piVar4 = (int *)(**(code **)(*(int *)in_stack_00000010 + 0x144))();
if ((((piVar4 == (int *)0x0) || (3.0 < ABS(local_28 - *(float *)(in_stack_00000010 + 0x2e0))))
|| (3.0 < ABS(local_24 - *(float *)(in_stack_00000010 + 0x2e4)))) ||
(3.0 < ABS(local_20 - *(float *)(in_stack_00000010 + 0x2e8)))) {
if ((PredictSubjectPosition(INextBot*,CBaseEntity*)::cache == '\0') &&
(iVar5 = __cxa_guard_acquire(&PredictSubjectPosition(INextBot*,CBaseEntity*)::cache),
iVar5 != 0)) {
_DAT_00fead4c = 0;
DAT_00fead5c = 0;
_DAT_00fead6c = 0;
_DAT_00fead7c = 0;
__cxa_guard_release(&PredictSubjectPosition(INextBot*,CBaseEntity*)::cache);
}
if (*(int *)(gpGlobals + 0x54) == PredictSubjectPosition(INextBot*,CBaseEntity*)::iServer) {
piVar4 = (int *)&DAT_00fead4c;
do {
this = (CNavArea *)*piVar4;
if (((this != (CNavArea *)0x0) && (ABS((float)piVar4[-3] - local_28) <= 2.0)) &&
((ABS((float)piVar4[-2] - local_24) <= 2.0 &&
(fVar8 = (float)piVar4[-3], fVar9 = (float)piVar4[-2], fVar10 = (float)piVar4[-1],
ABS((float)piVar4[-1] - local_20) <= 2.0)))) goto LAB_0075e4f6;
piVar4 = piVar4 + 4;
} while (piVar4 != (int *)(::vec4_invalid + 4));
}
else {
_DAT_00fead4c = 0;
DAT_00fead5c = 0;
_DAT_00fead6c = 0;
_DAT_00fead7c = 0;
PredictSubjectPosition(INextBot*,CBaseEntity*)::iServer = *(int *)(gpGlobals + 0x54);
}
this = (CNavArea *)
CNavMesh::GetNearestNavArea
(TheNavMesh,(Vector *)&local_28,false,10000.0,false,true,false);
if (this == (CNavArea *)0x0) goto LAB_0075e263;
(&PredictSubjectPosition(INextBot*,CBaseEntity*)::cache)
[PredictSubjectPosition(INextBot*,CBaseEntity*)::iNext * 4] = local_28;
(&DAT_00fead44)[PredictSubjectPosition(INextBot*,CBaseEntity*)::iNext * 4] = local_24;
(&DAT_00fead48)[PredictSubjectPosition(INextBot*,CBaseEntity*)::iNext * 4] = local_20;
*(CNavArea **)(&DAT_00fead4c + PredictSubjectPosition(INextBot*,CBaseEntity*)::iNext * 0x10) =
this;
PredictSubjectPosition(INextBot*,CBaseEntity*)::iNext =
PredictSubjectPosition(INextBot*,CBaseEntity*)::iNext + 1 & 3;
fVar8 = local_28;
fVar9 = local_24;
fVar10 = local_20;
}
else {
local_28 = *(float *)(in_stack_00000010 + 0x2e0);
local_24 = *(float *)(in_stack_00000010 + 0x2e4);
local_20 = *(float *)(in_stack_00000010 + 0x2e8);
this = (CNavArea *)(**(code **)(*piVar4 + 0x52c))(piVar4);
fVar8 = local_28;
fVar9 = local_24;
fVar10 = local_20;
if (this == (CNavArea *)0x0) goto LAB_0075e263;
}
LAB_0075e4f6:
local_20 = fVar10;
local_24 = fVar9;
local_28 = fVar8;
lVar6 = (longdouble)CNavArea::GetZ(this,local_28,local_24);
fVar8 = local_20;
lVar7 = (longdouble)(**(code **)(*piVar2 + 0x134))(piVar2);
if (fVar8 - (float)lVar7 <= (float)lVar6) {
*(float *)param_1 = local_28;
*(float *)(param_1 + 4) = local_24;
*(float *)(param_1 + 8) = local_20;
return param_1;
}
}
LAB_0075e263:
*(undefined4 *)param_1 = *(undefined4 *)(in_stack_00000010 + 0x2e0);
*(undefined4 *)(param_1 + 4) = *(undefined4 *)(in_stack_00000010 + 0x2e4);
*(undefined4 *)(param_1 + 8) = *(undefined4 *)(in_stack_00000010 + 0x2e8);
return param_1;
}
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.