IsCrossingLineOfFire
0x0042e630 · 613 bytes · __cdecl
_Z20IsCrossingLineOfFireRK6VectorS1_P11CBaseEntityi
Decompiled
undefined (4 params)
/* IsCrossingLineOfFire(Vector const&, Vector const&, CBaseEntity*, int) */
undefined4 IsCrossingLineOfFire(Vector *param_1,Vector *param_2,CBaseEntity *param_3,int param_4)
{
CBasePlayer *this;
undefined4 uVar1;
float *pfVar2;
float *pfVar3;
int iVar4;
int iVar5;
float fVar6;
float fVar7;
float fVar8;
float fVar9;
float fVar10;
float fVar11;
float fVar12;
float fVar13;
float local_34;
float local_30;
float local_28;
float local_24;
float local_20;
if (0 < *(int *)(gpGlobals + 0x14)) {
iVar5 = 1;
do {
this = (CBasePlayer *)UTIL_PlayerByIndex(iVar5);
if (((((this != (CBasePlayer *)0x0) && (*(int *)(this + 0x30) != 0)) &&
(*(int *)(this + 0x30) - *(int *)(gpGlobals + 0x58) >> 4 != 0)) &&
((this != (CBasePlayer *)param_3 &&
(uVar1 = (**(code **)(*(int *)this + 300))(this), (char)uVar1 != '\0')))) &&
((param_4 == 0 ||
(iVar4 = CBaseEntity::GetTeamNumber((CBaseEntity *)this), param_4 != iVar4)))) {
pfVar2 = (float *)CBasePlayer::GetPunchAngle(this);
pfVar3 = (float *)(**(code **)(*(int *)this + 0x238))(this);
local_28 = *pfVar2 + *pfVar3;
local_24 = pfVar2[1] + pfVar3[1];
local_20 = pfVar2[2] + pfVar3[2];
AngleVectors((QAngle *)&local_28,(Vector *)&local_34);
pfVar2 = (float *)(**(code **)(*(int *)this + 0x288))(this);
fVar12 = *pfVar2;
fVar7 = pfVar2[1];
fVar9 = local_34 * 5000.0 + fVar12;
fVar8 = local_30 * 5000.0 + fVar7;
fVar11 = *(float *)param_2 - *(float *)param_1;
fVar10 = *(float *)(param_1 + 4);
fVar6 = (fVar12 - fVar9) * (*(float *)(param_2 + 4) - fVar10) + (fVar8 - fVar7) * fVar11;
if (fVar6 != 0.0) {
fVar13 = *(float *)param_1 - fVar12;
fVar12 = (fVar7 - fVar8) * fVar13 + (fVar9 - fVar12) * (fVar10 - fVar7);
if (fVar12 == 0.0) {
fVar12 = 0.0;
fVar7 = *(float *)(param_2 + 8);
fVar10 = *(float *)(param_1 + 8);
}
else {
fVar12 = fVar12 / fVar6;
if (((fVar12 < 0.0) || (1.0 < fVar12)) ||
((fVar6 = ((fVar10 - *(float *)(param_2 + 4)) * fVar13 + fVar11 * (fVar10 - fVar7)) /
fVar6, fVar6 < 0.0 || (1.0 < fVar6)))) goto LAB_0042e85e;
fVar7 = *(float *)(param_2 + 8);
fVar10 = *(float *)(param_1 + 8);
fVar12 = (fVar7 - fVar10) * fVar12 + fVar10;
}
fVar6 = fVar7;
if (fVar10 < fVar7) {
fVar6 = fVar10;
fVar10 = fVar7;
}
if ((fVar6 <= fVar12) && (fVar12 <= fVar10 + 71.0)) {
return uVar1;
}
}
}
LAB_0042e85e:
iVar5 = iVar5 + 1;
} while (iVar5 <= *(int *)(gpGlobals + 0x14));
}
return 0;
}
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.