CGlobalEntityList::FindEntityNearestFacing
0x0067d5a0 · 341 bytes · __thiscall
_ZN17CGlobalEntityList23FindEntityNearestFacingERK6VectorS2_f
Decompiled
undefined (4 params)
/* CGlobalEntityList::FindEntityNearestFacing(Vector const&, Vector const&, float) */
int * __thiscall
CGlobalEntityList::FindEntityNearestFacing
(CGlobalEntityList *this,Vector *param_1,Vector *param_2,float param_3)
{
int *piVar1;
int *piVar2;
float *pfVar3;
int iVar4;
char *pcVar5;
float fVar6;
int *local_34;
float local_28;
float local_24;
float local_20;
local_34 = (int *)0x0;
piVar1 = *(int **)(this + 0x10004);
do {
if (piVar1 == (int *)0x0) {
return local_34;
}
piVar2 = (int *)*piVar1;
if (piVar2 == (int *)0x0) {
DevWarning("NULL entity in global entity list!\n");
}
else if (piVar2[0xc] != 0) {
pfVar3 = (float *)(**(code **)(*piVar2 + 0x288))(piVar2);
local_28 = *pfVar3 - *(float *)param_1;
local_24 = pfVar3[1] - *(float *)(param_1 + 4);
local_20 = pfVar3[2] - *(float *)(param_1 + 8);
VectorNormalize((Vector *)&local_28);
fVar6 = local_24 * *(float *)(param_2 + 4) + local_28 * *(float *)param_2 +
local_20 * *(float *)(param_2 + 8);
if (param_3 < fVar6) {
pcVar5 = (char *)piVar2[0x1f];
if (pcVar5 == (char *)0x0) {
pcVar5 = "";
}
else if (pcVar5 == "worldspawn") goto LAB_0067d6c0;
iVar4 = _V_stricmp(pcVar5,"worldspawn");
if (iVar4 != 0) {
pcVar5 = (char *)piVar2[0x1f];
if (pcVar5 == (char *)0x0) {
pcVar5 = "";
}
else if (pcVar5 == "soundent") goto LAB_0067d6c0;
iVar4 = _V_stricmp(pcVar5,"soundent");
if (iVar4 != 0) {
param_3 = fVar6;
local_34 = piVar2;
}
}
}
}
LAB_0067d6c0:
piVar1 = (int *)piVar1[3];
} while( true );
}
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.