CBaseCombatCharacter::IsInFieldOfView
0x003ff0b0 · 576 bytes · __thiscall
_ZNK20CBaseCombatCharacter15IsInFieldOfViewEP11CBaseEntity
Decompiled
undefined (2 params)
/* CBaseCombatCharacter::IsInFieldOfView(CBaseEntity*) const */
bool __thiscall
CBaseCombatCharacter::IsInFieldOfView(CBaseCombatCharacter *this,CBaseEntity *param_1)
{
char cVar1;
QAngle *pQVar2;
int iVar3;
float *pfVar4;
double dVar5;
float local_44;
float local_3c;
float local_38;
float local_34;
float local_30;
float local_2c;
float local_28;
float local_24;
float local_20;
float local_1c;
float local_18;
float local_14;
float local_10;
if (this != (CBaseCombatCharacter *)0x0) {
cVar1 = (**(code **)(*(int *)this + 0x16c))(this);
if (cVar1 != '\0') {
iVar3 = CBasePlayer::GetFOV((CBasePlayer *)this);
dVar5 = cos((double)((float)iVar3 * 0.5));
local_44 = (float)dVar5;
goto LAB_003ff0e2;
}
}
local_44 = 0.9;
LAB_003ff0e2:
(**(code **)(*(int *)this + 0x234))(&local_30);
pQVar2 = (QAngle *)(**(code **)(*(int *)this + 0x238))(this);
AngleVectors(pQVar2,(Vector *)&local_3c);
if (((byte)param_1[0x14d] & 8) != 0) {
CBaseEntity::CalcAbsolutePosition(param_1);
}
local_24 = *(float *)(param_1 + 0x2e0) - local_30;
local_20 = *(float *)(param_1 + 0x2e4) - local_2c;
local_1c = *(float *)(param_1 + 0x2e8) - local_28;
VectorNormalize((Vector *)&local_24);
if (local_20 * local_38 + local_24 * local_3c + local_1c * local_34 < local_44) {
pfVar4 = (float *)(**(code **)(*(int *)param_1 + 0x288))(param_1);
local_20 = pfVar4[1] - local_2c;
local_1c = pfVar4[2] - local_28;
local_24 = *pfVar4 - local_30;
VectorNormalize((Vector *)&local_24);
if (local_20 * local_38 + local_24 * local_3c + local_1c * local_34 < local_44) {
(**(code **)(*(int *)param_1 + 0x234))(&local_18,param_1);
local_20 = local_14 - local_2c;
local_1c = local_10 - local_28;
local_24 = local_18 - local_30;
VectorNormalize((Vector *)&local_24);
return local_44 <= local_20 * local_38 + local_24 * local_3c + local_1c * local_34;
}
}
return 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.