ForEachPlayer<ProximityCheck>
0x004e1e00 · 2060 bytes · __cdecl
_Z13ForEachPlayerI14ProximityCheckEbRT_
Decompiled
bool (1 param)
/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
/* bool ForEachPlayer<ProximityCheck>(ProximityCheck&) */
bool ForEachPlayer<ProximityCheck>(ProximityCheck *param_1)
{
float fVar1;
float fVar2;
float fVar3;
float fVar4;
float fVar5;
char cVar6;
CBaseEntity *pCVar7;
int iVar8;
int iVar9;
float *pfVar10;
CBaseEntity *pCVar11;
int iVar12;
CBaseEntity *this;
bool bVar13;
longdouble lVar14;
float fVar15;
CBaseEntity *local_124;
float local_120;
undefined4 local_11c;
undefined4 local_118;
undefined4 local_114;
undefined4 local_110;
int local_10c;
float local_108;
float local_104;
float local_100;
float local_fc;
float local_f8;
float local_f4;
undefined **local_f0 [4];
undefined4 local_e0 [3];
undefined4 local_d4;
undefined4 local_d0;
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;
char local_39;
local_11c = 0;
local_118 = 0;
if (___atan2f_finite == 0) {
local_10c = 0;
}
else {
(**(code **)(___atan2f_finite + 0x50))
(___atan2f_finite,&local_11c,0,0,0,0,"/data/src/game/server/player.h",0x595,
&ForEachPlayer<ProximityCheck>(ProximityCheck&)::tm_fmt,"(%s)%s","Unaccounted",
"ForEachPlayer");
local_10c = ___atan2f_finite;
}
iVar12 = _DAT_0105db00;
local_114 = local_11c;
local_110 = local_118;
/* try { // try from 004e1fd6 to 004e2024 has its CatchHandler @ 004e2680 */
if (((_DAT_0105d154 != 0) || (DAT_0105d158 == '\0')) &&
(iVar8 = ThreadGetCurrentId(), iVar12 == iVar8)) {
if ((char *)*_DAT_0105d15c != "ForEachPlayer") {
_DAT_0105d15c =
(int *)CVProfNode::GetSubNode((char *)_DAT_0105d15c,0xc0d94f,(char *)0x1,0xbfafa1);
}
CVProfNode::EnterScope();
DAT_0105d158 = '\0';
}
if (*(int *)(gpGlobals + 0x14) < 1) {
LAB_004e1f64:
bVar13 = true;
LAB_004e1f69:
iVar12 = _DAT_0105db00;
if (((DAT_0105d158 == '\0') || (_DAT_0105d154 != 0)) &&
(iVar8 = ThreadGetCurrentId(), iVar12 == iVar8)) {
cVar6 = CVProfNode::ExitScope();
if (cVar6 != '\0') {
_DAT_0105d15c = (int *)_DAT_0105d15c[0x19];
}
DAT_0105d158 = _DAT_0105d15c == (int *)0x105d160;
}
if (local_10c != 0) {
(**(code **)(local_10c + 0x54))(local_10c,local_114,local_110,0,0,0);
}
return bVar13;
}
iVar12 = 1;
LAB_004e1f35:
pCVar7 = (CBaseEntity *)UTIL_PlayerByIndex(iVar12);
if ((pCVar7 != (CBaseEntity *)0x0) && (*(int *)(pCVar7 + 0x30) != 0)) {
if (*(int *)(pCVar7 + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 == 0) {
iVar12 = iVar12 + 1;
if (*(int *)(gpGlobals + 0x14) < iVar12) goto LAB_004e1f64;
goto LAB_004e1f35;
}
/* try { // try from 004e1eed to 004e1f3c has its CatchHandler @ 004e267c */
cVar6 = (**(code **)(*(int *)pCVar7 + 0x16c))(pCVar7);
if ((cVar6 != '\0') && (*(int *)(pCVar7 + 0x1f6c) != 2)) {
cVar6 = (**(code **)(*(int *)pCVar7 + 0x16c))(pCVar7);
this = (CBaseEntity *)0x0;
if (cVar6 != '\0') {
this = pCVar7;
}
cVar6 = (**(code **)(*(int *)this + 300))(this);
/* try { // try from 004e2085 to 004e2375 has its CatchHandler @ 004e267c */
if (((cVar6 != '\0') && (cVar6 = (**(code **)(*(int *)this + 0x7e8))(this), cVar6 == '\0')) &&
(pCVar7 = (CBaseEntity *)CBaseGrenade::GetThrower(*(CBaseGrenade **)param_1),
this != pCVar7)) {
iVar8 = CBaseGrenade::GetThrower(*(CBaseGrenade **)param_1);
if (iVar8 != 0) {
pCVar7 = (CBaseEntity *)CBaseGrenade::GetThrower(*(CBaseGrenade **)param_1);
iVar8 = CBaseEntity::GetTeamNumber(pCVar7);
iVar9 = CBaseEntity::GetTeamNumber(this);
if (iVar8 == iVar9) goto LAB_004e1f28;
}
iVar8 = (**(code **)(*(int *)this + 0x52c))(this);
if ((iVar8 != 0) && ((*(byte *)(iVar8 + 0x12d) & 8) != 0)) goto LAB_004e1f28;
local_120 = *(float *)(ZombieTankRockRadius._28_4_ + 0x2c);
iVar8 = GetDifficulty();
if (iVar8 == 0) {
local_120 = local_120 * 0.75;
}
pCVar7 = *(CBaseEntity **)param_1;
local_124 = pCVar7;
if (((byte)pCVar7[0x14d] & 8) != 0) {
/* try { // try from 004e25be to 004e2617 has its CatchHandler @ 004e267c */
CBaseEntity::CalcAbsolutePosition(pCVar7);
local_124 = *(CBaseEntity **)param_1;
}
pfVar10 = (float *)(**(code **)(*(int *)this + 0x288))(this);
fVar15 = *pfVar10;
fVar1 = pfVar10[1];
fVar2 = pfVar10[2];
fVar3 = *(float *)(local_124 + 0x1a78);
fVar4 = *(float *)(local_124 + 0x1a7c);
local_fc = *(float *)(pCVar7 + 0x2e0) - fVar3;
fVar5 = *(float *)(local_124 + 0x1a80);
local_f8 = *(float *)(pCVar7 + 0x2e4) - fVar4;
local_f4 = *(float *)(pCVar7 + 0x2e8) - fVar5;
lVar14 = (longdouble)VectorNormalize((Vector *)&local_fc);
fVar15 = (fVar1 - fVar4) * local_f8 + (fVar15 - fVar3) * local_fc +
(fVar2 - fVar5) * local_f4;
if (fVar15 < 0.0) {
local_108 = *(float *)(local_124 + 0x1a78);
local_104 = *(float *)(local_124 + 0x1a7c);
local_100 = *(float *)(local_124 + 0x1a80);
}
else if ((float)lVar14 < fVar15) {
local_108 = *(float *)(pCVar7 + 0x2e0);
local_104 = *(float *)(pCVar7 + 0x2e4);
local_100 = *(float *)(pCVar7 + 0x2e8);
}
else {
local_104 = local_f8 * fVar15 + *(float *)(local_124 + 0x1a7c);
local_100 = local_f4 * fVar15 + *(float *)(local_124 + 0x1a80);
local_108 = fVar15 * local_fc + *(float *)(local_124 + 0x1a78);
}
if (*(int *)(ZombieTankRockDebug._28_4_ + 0x30) != 0) {
pCVar7 = *(CBaseEntity **)param_1;
pCVar11 = pCVar7;
if (((byte)pCVar7[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(pCVar7);
pCVar11 = *(CBaseEntity **)param_1;
}
NDebugOverlay::Line((Vector *)(pCVar11 + 0x1a78),(Vector *)(pCVar7 + 0x2e0),0xff,0,0,true,
10.0);
}
pfVar10 = (float *)(**(code **)(*(int *)this + 0x288))(this);
if ((*pfVar10 - local_108) * (*pfVar10 - local_108) +
(pfVar10[2] - local_100) * (pfVar10[2] - local_100) +
(pfVar10[1] - local_104) * (pfVar10[1] - local_104) < local_120 * local_120) {
CTraceFilterSimpleList::CTraceFilterSimpleList((CTraceFilterSimpleList *)local_f0,0);
/* try { // try from 004e2382 to 004e251c has its CatchHandler @ 004e2622 */
CTraceFilterSimpleList::AddEntityToIgnore
((CTraceFilterSimpleList *)local_f0,*(IHandleEntity **)param_1);
CTraceFilterSimpleList::AddEntityToIgnore
((CTraceFilterSimpleList *)local_f0,(IHandleEntity *)this);
pfVar10 = (float *)(**(code **)(*(int *)this + 0x288))(this);
local_bc = *pfVar10 - local_108;
local_cc = local_108;
local_c8 = local_104;
local_b8 = pfVar10[1] - local_104;
local_88 = 1;
local_94 = 0;
local_b4 = pfVar10[2] - local_100;
local_98 = 0;
local_9c = 0;
local_8c = 0;
local_a4 = 0;
local_a8 = 0;
local_ac = 0;
local_c4 = local_100;
local_87 = local_b8 * local_b8 + local_b4 * local_b4 + local_bc * local_bc != 0.0;
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_cc,0x200400b,(CTraceFilterSimpleList *)local_f0,local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine(local_70,local_64,0xff,0,0,true,-1.0);
}
if ((local_39 == '\0') && (1.0 <= local_44)) {
CBaseEntity::SetAbsOrigin(*(CBaseEntity **)param_1,(Vector *)&local_108);
(**(code **)(**(int **)param_1 + 0x568))(*(int **)param_1,this);
}
local_f0[0] = &PTR_ShouldHitEntity_00c54590;
local_d4 = 0;
CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_e0);
local_d0 = local_e0[0];
CUtlMemory<IHandleEntity*,int>::Purge((CUtlMemory<IHandleEntity*,int> *)local_e0);
bVar13 = false;
goto LAB_004e1f69;
}
}
}
}
LAB_004e1f28:
iVar12 = iVar12 + 1;
if (*(int *)(gpGlobals + 0x14) < iVar12) goto LAB_004e1f64;
goto LAB_004e1f35;
}
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.