CBasePlayer::PreThink
0x007ae570 · 1142 bytes · __thiscall
_ZN11CBasePlayer8PreThinkEv
Decompiled
undefined (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* CBasePlayer::PreThink() */
void __thiscall CBasePlayer::PreThink(CBasePlayer *this)
{
char cVar1;
int iVar2;
CHintSystem *this_00;
char *__nptr;
int iVar3;
uint uVar4;
bool bVar5;
double dVar6;
undefined4 local_5c;
undefined4 local_58;
undefined4 local_54;
undefined4 local_50;
int local_4c;
undefined1 local_48 [24];
undefined4 local_30;
undefined4 local_2c;
undefined4 local_28;
undefined4 local_24;
undefined1 local_20;
CBasePlayer local_1e;
if (g_fGameOver != '\0') {
return;
}
if (*(int *)(this + 0x1f7c) != 0) {
return;
}
iVar2 = (**(code **)(*(int *)this + 0x74c))(this);
if (iVar2 != 0) {
this_00 = (CHintSystem *)(**(code **)(*(int *)this + 0x74c))(this);
CHintSystem::Update(this_00);
}
ItemPreFrame(this);
WaterMove(this);
if ((g_pGameRules == (int *)0x0) ||
(cVar1 = (**(code **)(*g_pGameRules + 200))(g_pGameRules), cVar1 == '\0')) {
uVar4 = *(uint *)(this + 0x1a7c) | 2;
if (*(uint *)(this + 0x1a7c) == uVar4) goto LAB_007ae631;
}
else {
uVar4 = *(uint *)(this + 0x1a7c) & 0xfffffffd;
if (*(uint *)(this + 0x1a7c) == uVar4) goto LAB_007ae631;
}
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1a7c);
*(uint *)(this + 0x1a7c) = uVar4;
LAB_007ae631:
(**(code **)(*(int *)this + 0x5dc))(this);
CheckTimeBasedDamage(this);
CheckSuitUpdate(this);
iVar2 = (**(code **)(*(int *)this + 0x648))(this);
if (3 < iVar2) {
(**(code **)(*(int *)this + 0x668))(this);
}
if ('\0' < (char)this[0x104]) {
(**(code **)(*(int *)this + 0x538))(this);
return;
}
HandleFuncTrain(this);
uVar4 = *(uint *)(this + 0x1cb0);
if ((uVar4 & 2) != 0) {
(**(code **)(*(int *)this + 0x588))(this);
uVar4 = *(uint *)(this + 0x1cb0);
}
if ((((uVar4 & 4) != 0) || (((byte)this[0x150] & 2) != 0)) || (((byte)this[0x1d20] & 2) != 0)) {
(**(code **)(*(int *)this + 0x58c))(this);
}
(**(code **)(*(int *)this + 0x538))(this);
cVar1 = (**(code **)(*(int *)this + 0x710))(this);
if (cVar1 != '\0') {
iVar2 = 0;
if (*(int *)(this + 0x30) != 0) {
iVar2 = *(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
__nptr = (char *)(**(code **)(*engine + 0xe0))(engine,iVar2,"joy_autoaimdampen");
dVar6 = strtod(__nptr,(char **)0x0);
if (0.0 < dVar6) {
iVar3 = CBaseCombatCharacter::GetActiveWeapon((CBaseCombatCharacter *)this);
iVar2 = ___atan2f_finite;
if (iVar3 == 0) {
return;
}
if (*(float *)(gpGlobals + 0xc) - *(float *)(this + 0x1f80) <= -0.001) {
return;
}
local_5c = 0;
local_58 = 0;
bVar5 = ___atan2f_finite == 0;
*(float *)(this + 0x1f80) = *(float *)(gpGlobals + 0xc) + 0.1;
if (bVar5) {
local_4c = 0;
}
else {
(**(code **)(iVar2 + 0x50))
(iVar2,&local_5c,0,0,0,0,"/data/src/game/server/player.cpp",0xf8a,
&PreThink()::tm_fmt,"(%s)%s","Unaccounted","autoaiming");
local_4c = ___atan2f_finite;
}
iVar2 = _DAT_0105db00;
local_54 = local_5c;
local_50 = local_58;
/* try { // try from 007ae813 to 007ae817 has its CatchHandler @ 007ae9fe */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar3 = ThreadGetCurrentId(), iVar2 == iVar3)) {
if ((char *)*_DAT_0105d15c != "autoaiming") {
/* try { // try from 007ae9e0 to 007ae9f1 has its CatchHandler @ 007ae9fe */
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xcb858f,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
local_30 = 0xffffffff;
local_24 = 0xbf800000;
local_2c = 0x3f800000;
local_20 = 1;
local_28 = *(undefined4 *)(autoaim_max_dist._28_4_ + 0x2c);
/* try { // try from 007ae854 to 007ae883 has its CatchHandler @ 007aea13 */
(**(code **)(*(int *)this + 0x70c))(this,local_48);
if (local_1e != this[0x1ad1]) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1ad1);
this[0x1ad1] = local_1e;
}
iVar2 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar3 = ThreadGetCurrentId(), iVar2 == iVar3)) {
cVar1 = CVProfNode::ExitScope();
if (cVar1 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_4c == 0) {
return;
}
(**(code **)(local_4c + 0x54))(local_4c,local_54,local_50,0,0,0);
return;
}
}
if (this[0x1ad1] != (CBasePlayer)0x0) {
(**(code **)(*(int *)(this + 0x1a40) + 4))(this + 0x1a40,this + 0x1ad1);
this[0x1ad1] = (CBasePlayer)0x0;
}
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.