PlayerBody::Upkeep
0x0076a930 · 2409 bytes · __thiscall
_ZN10PlayerBody6UpkeepEv
Decompiled
undefined (1 param)
/* PlayerBody::Upkeep() */
void __thiscall PlayerBody::Upkeep(PlayerBody *this)
{
float fVar1;
float fVar2;
float fVar3;
code *pcVar4;
uint uVar5;
code *pcVar6;
char cVar7;
int *piVar8;
float *pfVar9;
INextBot *this_00;
int iVar10;
int *piVar11;
undefined4 uVar12;
float *pfVar13;
int *piVar14;
undefined4 *puVar15;
undefined *puVar16;
double *pdVar17;
longdouble lVar18;
float fVar19;
float fVar20;
float fVar21;
double dVar22;
float fStackY_b8;
int iStackY_b4;
float 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;
if ((*(int *)(bot_mimic._28_4_ + 0x30) == 0) &&
(fVar1 = *(float *)(gpGlobals + 0x10), 1e-05 <= fVar1)) {
piVar8 = (int *)(**(code **)(*(int *)this + 0xb0))();
piVar8 = (int *)(**(code **)(*piVar8 + 0xb4))();
pfVar9 = (float *)(**(code **)(*piVar8 + 0x238))();
fVar2 = *pfVar9;
fVar3 = pfVar9[1];
fVar20 = pfVar9[2];
lVar18 = (longdouble)AngleDiff(fVar2,*(float *)(this + 0x94));
if ((fVar1 * *(float *)(NextBotHeadAimSteadyMaxRate._28_4_ + 0x2c) < ABS((float)lVar18)) ||
(lVar18 = (longdouble)AngleDiff(fVar3,*(float *)(this + 0x98)),
fVar1 * *(float *)(NextBotHeadAimSteadyMaxRate._28_4_ + 0x2c) < ABS((float)lVar18))) {
if (*(float *)(this + 0x90) != -1.0) {
(**(code **)(*(int *)(this + 0x8c) + 4))();
*(undefined4 *)(this + 0x90) = 0xbf800000;
}
}
else if (*(float *)(this + 0x90) <= 0.0) {
lVar18 = (longdouble)IntervalTimer::Now();
if ((float)lVar18 != *(float *)(this + 0x90)) {
(**(code **)(*(int *)(this + 0x8c) + 4))();
*(float *)(this + 0x90) = (float)lVar18;
}
}
this_00 = (INextBot *)(**(code **)(*(int *)this + 0xb0))();
cVar7 = INextBot::IsDebugging(this_00,2);
pdVar17 = (double *)&stack0xffffff54;
if ((cVar7 != '\0') &&
(cVar7 = (**(code **)(*(int *)this + 0xcc))(), pdVar17 = (double *)&stack0xffffff54,
cVar7 != '\0')) {
lVar18 = (longdouble)(**(code **)(*(int *)this + 0xd0))();
fVar19 = (float)lVar18 * 0.33333334;
if (fVar19 <= 0.0) {
fVar19 = 0.0;
}
(**(code **)(*piVar8 + 0x234))();
pdVar17 = (double *)&stack0xffffff50;
if (1.0 <= fVar19) {
fVar19 = 1.0;
}
NDebugOverlay::Circle((Vector *)&local_28,fVar19 * 10.0,0,0xff,0,0xff,true,fVar1 + fVar1);
}
*(float *)(this + 0x94) = fVar2;
*(float *)(this + 0x98) = fVar3;
*(float *)(this + 0x9c) = fVar20;
if (this[0x7d] != (PlayerBody)0x0) {
*(PlayerBody **)pdVar17 = this + 100;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ae5b;
lVar18 = (longdouble)CountdownTimer::Now();
if (*(float *)(this + 0x6c) <= (float)lVar18) {
return;
}
}
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0x134);
*(undefined4 *)((int)pdVar17 + -4) = 0x76aa67;
iVar10 = (*pcVar4)();
if ((*(byte *)(iVar10 + 0x150) & 0x20) == 0) {
uVar5 = *(uint *)(this + 0x5c);
if ((((uVar5 != 0xffffffff) &&
(puVar16 = g_pEntityList + (uVar5 & 0xfff) * 0x10, puVar16 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar16 + 8) == uVar5 >> 0xc)) &&
(piVar11 = *(int **)(puVar16 + 4), piVar11 != (int *)0x0)) {
iVar10 = *piVar11;
*(int **)pdVar17 = piVar11;
pcVar4 = *(code **)(iVar10 + 0x144);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b190;
iVar10 = (*pcVar4)();
if (iVar10 == 0) {
iVar10 = *piVar11;
*(int **)pdVar17 = piVar11;
pcVar4 = *(code **)(iVar10 + 0x288);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b282;
puVar15 = (undefined4 *)(*pcVar4)();
*(undefined4 *)(this + 0x50) = *puVar15;
*(undefined4 *)(this + 0x54) = puVar15[1];
*(undefined4 *)(this + 0x58) = puVar15[2];
}
else {
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0xb0);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b1a3;
piVar14 = (int *)(*pcVar4)();
iVar10 = *piVar14;
*(int **)pdVar17 = piVar14;
pcVar4 = *(code **)(iVar10 + 200);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b1ae;
piVar14 = (int *)(*pcVar4)();
pcVar4 = *(code **)(*piVar14 + 0xc0);
iVar10 = *piVar11;
*(int **)pdVar17 = piVar11;
pcVar6 = *(code **)(iVar10 + 0x144);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b1c9;
fVar20 = (float)(*pcVar6)();
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar6 = *(code **)(iVar10 + 0xb0);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b1da;
fVar19 = (float)(*pcVar6)();
*(float *)((int)pdVar17 + 8) = fVar19;
*(float *)((int)pdVar17 + 0xc) = fVar20;
*(int **)((int)pdVar17 + 4) = piVar14;
*(float **)pdVar17 = &local_28;
*(undefined4 *)((int)pdVar17 + -4) = 0x76b1f8;
(*pcVar4)();
pdVar17 = (double *)((int)pdVar17 + -4);
*(float *)(this + 0x50) = local_28;
*(float *)(this + 0x54) = local_24;
*(float *)(this + 0x58) = local_20;
}
if ((*(byte *)((int)piVar11 + 0x14d) & 0x10) != 0) {
*(int **)pdVar17 = piVar11;
*(undefined4 *)((int)pdVar17 + -4) = 0x76b275;
CBaseEntity::CalcAbsoluteVelocity(*(CBaseEntity **)pdVar17);
}
fVar20 = (float)piVar11[0x9f];
fVar19 = (float)piVar11[0x9d];
*(float *)(this + 0x54) = (float)piVar11[0x9e] * 0.15 + *(float *)(this + 0x54);
*(float *)(this + 0x58) = fVar20 * 0.15 + *(float *)(this + 0x58);
*(float *)(this + 0x50) = fVar19 * 0.15 + *(float *)(this + 0x50);
}
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0xb8);
*(undefined4 *)((int)pdVar17 + -4) = 0x76aab6;
pfVar9 = (float *)(*pcVar4)();
local_40 = *(float *)(this + 0x50) - *pfVar9;
local_3c = *(float *)(this + 0x54) - pfVar9[1];
local_38 = *(float *)(this + 0x58) - pfVar9[2];
*(float **)pdVar17 = &local_40;
*(undefined4 *)((int)pdVar17 + -4) = 0x76aaea;
VectorNormalize(*(Vector **)pdVar17);
*(float **)pdVar17 = &local_40;
*(float **)((int)pdVar17 + 4) = &local_34;
*(undefined4 *)((int)pdVar17 + -4) = 0x76aafb;
VectorAngles(*(Vector **)pdVar17,*(QAngle **)((int)pdVar17 + 4));
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0x134);
*(undefined4 *)((int)pdVar17 + -4) = 0x76ab06;
piVar11 = (int *)(*pcVar4)();
if (piVar11 != (int *)0x0) {
iVar10 = *piVar11;
*(int **)pdVar17 = piVar11;
pcVar4 = *(code **)(iVar10 + 0x16c);
*(undefined4 *)((int)pdVar17 + -4) = 0x76ab1b;
cVar7 = (*pcVar4)();
if (cVar7 != '\0') {
*(int **)pdVar17 = piVar11;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ab2b;
iVar10 = CTerrorPlayer::GetMountedGun(*(CTerrorPlayer **)pdVar17);
if (iVar10 != 0) {
*(int *)pdVar17 = iVar10;
*(float **)((int)pdVar17 + 0x14) = &local_44;
*(float **)(pdVar17 + 2) = &local_48;
*(float **)((int)pdVar17 + 0xc) = &local_4c;
*(float **)(pdVar17 + 1) = &local_50;
*(float **)((int)pdVar17 + 4) = &local_28;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ab5e;
CPropMountedGun::GetAngleConstraints
(*(CPropMountedGun **)pdVar17,*(QAngle **)((int)pdVar17 + 4),
*(float **)(pdVar17 + 1),*(float **)((int)pdVar17 + 0xc),
*(float **)(pdVar17 + 2),*(float **)((int)pdVar17 + 0x14));
fVar19 = local_34 - local_28;
*(float *)pdVar17 = local_30 - local_24;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ab81;
lVar18 = (longdouble)AngleNormalize(*(float *)pdVar17);
fVar20 = (float)lVar18;
*(float *)pdVar17 = fVar19;
*(undefined4 *)((int)pdVar17 + -4) = 0x76aba0;
lVar18 = (longdouble)AngleNormalize(*(float *)pdVar17);
fVar19 = (float)lVar18;
if ((fVar20 <= local_4c) && (local_4c = fVar20, fVar20 <= local_50)) {
local_4c = local_50;
}
if ((fVar19 <= local_44) && (local_44 = fVar19, fVar19 <= local_48)) {
local_44 = local_48;
}
local_34 = local_44 + local_28;
local_30 = local_4c + local_24;
local_2c = local_20;
}
}
}
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0xbc);
*(undefined4 *)((int)pdVar17 + -4) = 0x76abff;
pfVar9 = (float *)(*pcVar4)();
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0xb0);
*(undefined4 *)((int)pdVar17 + -4) = 0x76ac0c;
uVar12 = (*pcVar4)();
*(float *)((int)pdVar17 + 4) = 2.8026e-45;
*(undefined4 *)pdVar17 = uVar12;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ac1c;
cVar7 = INextBot::IsDebugging(*(INextBot **)pdVar17,(uint)*(float *)((int)pdVar17 + 4));
if (cVar7 != '\0') {
fVar20 = *pfVar9;
fVar19 = pfVar9[1];
iVar10 = *(int *)this;
fVar21 = pfVar9[2];
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0xb8);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b0ac;
pfVar13 = (float *)(*pcVar4)();
local_28 = fVar20 * 100.0 + *pfVar13;
local_24 = fVar19 * 100.0 + pfVar13[1];
local_20 = fVar21 * 100.0 + pfVar13[2];
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0xb8);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b0e6;
uVar12 = (*pcVar4)();
*(float *)((int)pdVar17 + 0x14) = 0.0;
*(undefined4 *)pdVar17 = uVar12;
*(float *)(pdVar17 + 2) = 0.0;
*(float *)(pdVar17 + 3) = fVar1;
*(float **)((int)pdVar17 + 4) = &local_28;
*(float *)((int)pdVar17 + 0xc) = 3.57331e-43;
*(float *)(pdVar17 + 1) = 3.57331e-43;
*(undefined4 *)((int)pdVar17 + -4) = 0x76b120;
NDebugOverlay::Line(*(Vector **)pdVar17,*(Vector **)((int)pdVar17 + 4),
(int)*(float *)(pdVar17 + 1),(int)*(float *)((int)pdVar17 + 0xc),
(int)*(float *)(pdVar17 + 2),*(bool *)((int)pdVar17 + 0x14),
*(float *)(pdVar17 + 3));
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0xb8);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b12b;
uVar12 = (*pcVar4)();
*(float *)((int)pdVar17 + 0x14) = 0.0;
*(float *)(pdVar17 + 3) = fVar1;
*(float *)(pdVar17 + 2) = 0.0;
*(float *)((int)pdVar17 + 0xc) = 3.57331e-43;
*(float *)(pdVar17 + 1) = 0.0;
*(PlayerBody **)((int)pdVar17 + 4) = this + 0x50;
*(undefined4 *)pdVar17 = uVar12;
*(undefined4 *)((int)pdVar17 + -4) = 0x76b165;
NDebugOverlay::Line(*(Vector **)pdVar17,*(Vector **)((int)pdVar17 + 4),
(int)*(float *)(pdVar17 + 1),(int)*(float *)((int)pdVar17 + 0xc),
(int)*(float *)(pdVar17 + 2),*(bool *)((int)pdVar17 + 0x14),
*(float *)(pdVar17 + 3));
}
fVar20 = local_3c * pfVar9[1] + local_40 * *pfVar9 + local_38 * pfVar9[2];
if (fVar20 <= 0.98) {
this[0x7c] = (PlayerBody)0x0;
}
else {
this[0x7c] = (PlayerBody)0x1;
this[0x7d] = (PlayerBody)0x1;
if (*(undefined4 **)(this + 0x78) != (undefined4 *)0x0) {
pcVar4 = *(code **)**(undefined4 **)(this + 0x78);
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar6 = *(code **)(iVar10 + 0xb0);
*(undefined4 *)((int)pdVar17 + -4) = 0x76ac79;
fVar19 = (float)(*pcVar6)();
uVar12 = *(undefined4 *)(this + 0x78);
*(float *)((int)pdVar17 + 4) = fVar19;
*(undefined4 *)pdVar17 = uVar12;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ac85;
(*pcVar4)();
*(undefined4 *)(this + 0x78) = 0;
}
}
iVar10 = *(int *)this;
*(PlayerBody **)pdVar17 = this;
pcVar4 = *(code **)(iVar10 + 0xd4);
*(undefined4 *)((int)pdVar17 + -4) = 0x76aca4;
lVar18 = (longdouble)(*pcVar4)();
fVar19 = (float)lVar18;
if (0.7 < fVar20) {
*pdVar17 = (double)(((fVar20 + -0.7) * -3.2666667 + 1.0) * 1.57);
*(undefined4 *)((int)pdVar17 + -4) = 0x76acf5;
dVar22 = sin(*pdVar17);
fVar19 = (float)(dVar22 * (double)fVar19);
}
fVar20 = 99999.9;
if (0.0 < *(float *)(this + 0x74)) {
*(PlayerBody **)pdVar17 = this + 0x70;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ad3b;
lVar18 = (longdouble)IntervalTimer::Now();
fVar20 = (float)lVar18 - *(float *)(this + 0x74);
}
fVar21 = *(float *)(this + 0x88);
if (fVar20 < fVar21) {
fVar20 = 99999.9;
if (0.0 < *(float *)(this + 0x74)) {
*(PlayerBody **)pdVar17 = this + 0x70;
*(undefined4 *)((int)pdVar17 + -4) = 0x76b039;
lVar18 = (longdouble)IntervalTimer::Now();
fVar21 = *(float *)(this + 0x88);
fVar20 = (float)lVar18 - *(float *)(this + 0x74);
}
fVar19 = fVar19 * (fVar20 / fVar21);
}
piVar11 = *(int **)(this + 0x14);
if ((*(byte *)(piVar11 + 0x54) & 0x20) == 0) {
fVar19 = fVar19 * fVar1;
}
else {
iVar10 = *piVar11;
*(int **)pdVar17 = piVar11;
pcVar4 = *(code **)(iVar10 + 0x16c);
*(undefined4 *)((int)pdVar17 + -4) = 0x76ad7c;
cVar7 = (*pcVar4)();
if (cVar7 != '\0') {
*(int **)pdVar17 = piVar11;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ad88;
iVar10 = CBaseEntity::GetTeamNumber(*(CBaseEntity **)pdVar17);
if (iVar10 == 3) {
iVar10 = *piVar11;
*(int **)pdVar17 = piVar11;
pcVar4 = *(code **)(iVar10 + 0x544);
*(undefined4 *)((int)pdVar17 + -4) = 0x76b2af;
(*pcVar4)();
}
}
fVar19 = 0.0;
}
*(float *)(pdVar17 + 1) = fVar19;
*(float *)((int)pdVar17 + 4) = fVar3;
*(float *)pdVar17 = local_30;
*(undefined4 *)((int)pdVar17 + -4) = 0x76adb9;
lVar18 = (longdouble)
ApproachAngle(*(float *)pdVar17,*(float *)((int)pdVar17 + 4),*(float *)(pdVar17 + 1))
;
local_24 = (float)lVar18;
*(float *)(pdVar17 + 1) = fVar19;
*(float *)((int)pdVar17 + 4) = fVar2;
*(float *)pdVar17 = local_34;
*(undefined4 *)((int)pdVar17 + -4) = 0x76adeb;
lVar18 = (longdouble)
ApproachAngle(*(float *)pdVar17,*(float *)((int)pdVar17 + 4),*(float *)(pdVar17 + 1))
;
*(int **)pdVar17 = piVar8;
local_28 = (float)lVar18;
local_20 = 0.0;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ae07;
pfVar9 = (float *)CBasePlayer::GetPunchAngle(*(CBasePlayer **)pdVar17);
local_28 = local_28 - *pfVar9;
local_24 = local_24 - pfVar9[1];
local_20 = local_20 - pfVar9[2];
*(int **)pdVar17 = piVar8;
*(float **)((int)pdVar17 + 4) = &local_28;
*(undefined4 *)((int)pdVar17 + -4) = 0x76ae42;
CBasePlayer::SnapEyeAngles(*(CBasePlayer **)pdVar17,*(QAngle **)((int)pdVar17 + 4));
}
}
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.