CHLTVDirector::AnalyzePlayers
0x006da080 · 1816 bytes · __thiscall
_ZN13CHLTVDirector14AnalyzePlayersEv
Decompiled
undefined (1 param)
/* CHLTVDirector::AnalyzePlayers() */
void __thiscall CHLTVDirector::AnalyzePlayers(CHLTVDirector *this)
{
float fVar1;
float fVar2;
float fVar3;
CBaseEntity *this_00;
CBaseEntity *this_01;
QAngle *pQVar4;
int *piVar5;
int iVar6;
int iVar7;
float fVar8;
float fVar9;
float fVar10;
float fVar11;
float fVar12;
int local_148;
int local_140;
int local_13c;
float local_138;
float local_134;
float local_130;
float local_12c;
float local_124;
float local_100;
float local_fc;
float local_f8;
float local_f4;
float local_f0;
float local_ec;
float local_e8;
float local_e4;
float local_e0;
CTraceFilterSimple local_dc [16];
float local_cc;
float local_c8;
float local_c4;
float local_bc;
float local_b8;
float local_b4;
undefined4 local_ac;
undefined4 local_a8;
undefined4 local_a4;
undefined4 local_9c;
undefined4 local_98;
undefined4 local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
Vector local_70 [12];
Vector local_64 [32];
float local_44;
(**(code **)(*(int *)this + 0x7c))(this);
InitRandomOrder(*(int *)(this + 0x148));
if (0 < *(int *)(this + 0x148)) {
local_148 = 0;
do {
iVar6 = (&s_RndOrder)[local_148];
this_00 = *(CBaseEntity **)(this + iVar6 * 4 + 0x14c);
if (((byte)this_00[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_00);
}
fVar1 = *(float *)(this_00 + 0x2e0);
fVar2 = *(float *)(this_00 + 0x2e8);
fVar3 = *(float *)(this_00 + 0x2e4);
pQVar4 = (QAngle *)(**(code **)(*(int *)this_00 + 0x238))(this_00);
AngleVectors(pQVar4,(Vector *)&local_100);
local_100 = -local_100;
local_fc = -local_fc;
local_f8 = -local_f8;
if (*(int *)(this + 0x148) < 1) {
local_140 = 0;
local_124 = 0.0;
}
else {
local_12c = 0.0;
iVar7 = 0;
local_134 = 0.0;
local_130 = 0.0;
local_13c = 0;
local_138 = 0.0;
local_140 = 0;
local_124 = 0.0;
do {
if (iVar6 != iVar7) {
this_01 = *(CBaseEntity **)(this + iVar7 * 4 + 0x14c);
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
}
fVar10 = *(float *)(this_01 + 0x2e4) - fVar3;
fVar9 = *(float *)(this_01 + 0x2e8) - fVar2;
fVar11 = *(float *)(this_01 + 0x2e0) - fVar1;
fVar8 = fVar10 * fVar10 + fVar9 * fVar9 + fVar11 * fVar11;
fVar12 = SQRT(fVar8);
if ((4.0 <= fVar12) && (fVar12 <= 1024.0)) {
if (((byte)this_01[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(this_01);
fVar11 = *(float *)(this_01 + 0x2e0) - fVar1;
fVar10 = *(float *)(this_01 + 0x2e4) - fVar3;
fVar9 = *(float *)(this_01 + 0x2e8) - fVar2;
fVar8 = fVar11 * fVar11 + fVar10 * fVar10 + fVar9 * fVar9;
}
local_87 = fVar8 != 0.0;
local_94 = 0;
local_98 = 0;
local_9c = 0;
local_8c = 0;
local_88 = 1;
local_a4 = 0;
local_a8 = 0;
local_ac = 0;
local_cc = fVar1;
local_c8 = fVar3;
local_c4 = fVar2;
local_bc = fVar11;
local_b8 = fVar10;
local_b4 = fVar9;
CTraceFilterSimple::CTraceFilterSimple
(local_dc,(IHandleEntity *)this_01,0,(_func_bool_IHandleEntity_ptr_int *)0x0
);
(**(code **)(*enginetrace + 0x14))(enginetrace,&local_cc,0x200400b,local_dc,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
}
if (1.0 <= local_44) {
local_13c = local_13c + 1;
pQVar4 = (QAngle *)(**(code **)(*(int *)this_01 + 0x238))(this_01);
AngleVectors(pQVar4,(Vector *)&local_cc);
local_f4 = local_100;
local_f0 = local_fc;
local_ec = local_f8;
local_e8 = local_cc;
local_e4 = local_c8;
local_e0 = local_c4;
VectorNormalize((Vector *)&local_f4);
VectorNormalize((Vector *)&local_e8);
fVar8 = (local_e8 * local_f4 + local_e4 * local_f0 + 1.0 + local_e0 * local_ec) *
0.5;
fVar8 = fVar8 * fVar8;
if (local_138 < fVar8) {
local_138 = fVar8;
if (*(int *)(this_01 + 0x30) == 0) {
local_140 = 0;
}
else {
local_140 = *(int *)(this_01 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
}
local_134 = local_134 + local_c8;
local_12c = local_12c + local_c4;
local_124 = fVar8 / SQRT(fVar12) + local_124;
local_130 = local_130 + local_cc;
}
}
}
iVar7 = iVar7 + 1;
} while (iVar7 < *(int *)(this + 0x148));
if (local_13c != 0) {
local_124 = (SQRT(local_12c * local_12c + local_130 * local_130 + local_134 * local_134) /
(float)local_13c) * local_124;
}
}
piVar5 = (int *)(**(code **)(*gameeventmanager + 0x1c))
(gameeventmanager,"hltv_rank_entity",0,0);
if (piVar5 != (int *)0x0) {
if (*(int *)(this_00 + 0x30) == 0) {
iVar6 = 0;
}
else {
iVar6 = *(int *)(this_00 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4;
}
(**(code **)(*piVar5 + 0x30))(piVar5,"index",iVar6);
(**(code **)(*piVar5 + 0x38))(piVar5,&DAT_00c9394f,local_124);
(**(code **)(*piVar5 + 0x30))(piVar5,"target",local_140);
(**(code **)(*gameeventmanager + 0x20))(gameeventmanager,piVar5,0);
}
local_148 = local_148 + 1;
} while (local_148 < *(int *)(this + 0x148));
}
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.