TerrorNavArea::ComputeVisibility
0x00974b40 · 2946 bytes · __thiscall
_ZNK13TerrorNavArea17ComputeVisibilityEPKS_bbPb
Decompiled
undefined (5 params)
/* TerrorNavArea::ComputeVisibility(TerrorNavArea const*, bool, bool, bool*) const */
byte __thiscall
TerrorNavArea::ComputeVisibility
(TerrorNavArea *this,TerrorNavArea *param_1,bool param_2,bool param_3,bool *param_4)
{
char cVar1;
byte bVar2;
byte bVar3;
longdouble lVar4;
float fVar5;
float fVar6;
float fVar7;
float fVar8;
float fVar9;
float fVar10;
float fVar11;
float local_148;
float local_124;
float local_120;
float local_11c;
float local_118;
float local_114;
undefined4 local_110;
float local_10c;
float local_108;
undefined4 local_104;
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;
undefined **local_dc [4];
float local_cc;
float local_c8;
float local_c4;
float local_bc;
float local_b8;
float local_b4;
float local_ac;
float local_a8;
float local_a4;
float local_9c;
float local_98;
float local_94;
undefined4 local_8c;
undefined1 local_88;
undefined1 local_87;
float local_70;
float local_6c;
float local_68;
float local_64;
float local_60;
float local_5c;
float local_44;
fVar5 = (*(float *)(param_1 + 0x34) - *(float *)(this + 0x34)) *
(*(float *)(param_1 + 0x34) - *(float *)(this + 0x34)) +
(*(float *)(param_1 + 0x30) - *(float *)(this + 0x30)) *
(*(float *)(param_1 + 0x30) - *(float *)(this + 0x30)) +
(*(float *)(param_1 + 0x2c) - *(float *)(this + 0x2c)) *
(*(float *)(param_1 + 0x2c) - *(float *)(this + 0x2c));
fVar10 = *(float *)(NavMaxViewDistance._28_4_ + 0x2c);
if ((fVar10 <= 1e-05) || (bVar3 = 0, fVar5 <= fVar10 * fVar10)) {
if (!param_2) {
SetupPVS(this);
}
if (param_3) {
local_60 = *(float *)(param_1 + 0x30);
local_5c = *(float *)(param_1 + 0x34) + 53.25;
local_64 = *(float *)(param_1 + 0x2c);
fVar10 = *(float *)(param_1 + 8);
fVar8 = *(float *)(param_1 + 4);
fVar7 = *(float *)(param_1 + 0xc) + 53.25;
fVar6 = fVar8;
if ((local_64 <= fVar8) && (fVar6 = local_64, local_64 < fVar8)) {
local_64 = fVar8;
}
fVar9 = fVar10;
if ((local_60 <= fVar10) && (fVar9 = local_60, local_60 < fVar10)) {
local_60 = fVar10;
}
local_68 = fVar7;
if ((local_5c <= fVar7) && (local_68 = local_5c, local_5c < fVar7)) {
local_5c = fVar7;
}
local_cc = *(float *)(param_1 + 0x10);
fVar7 = *(float *)(param_1 + 0x24) + 53.25;
local_70 = local_cc;
if ((fVar6 <= local_cc) && (local_70 = fVar6, local_64 < local_cc)) {
local_64 = local_cc;
}
local_6c = fVar10;
if ((fVar9 <= fVar10) && (local_6c = fVar9, local_60 < fVar10)) {
local_60 = fVar10;
}
fVar10 = fVar7;
if ((local_68 <= fVar7) && (fVar10 = local_68, local_5c < fVar7)) {
local_5c = fVar7;
}
local_68 = fVar10;
fVar6 = *(float *)(param_1 + 0x28) + 53.25;
local_c8 = *(float *)(param_1 + 0x14);
fVar10 = fVar8;
if ((local_70 <= fVar8) && (fVar10 = local_70, local_64 < fVar8)) {
local_64 = fVar8;
}
local_70 = fVar10;
fVar10 = local_c8;
if ((local_6c <= local_c8) && (fVar10 = local_6c, local_60 < local_c8)) {
local_60 = local_c8;
}
local_6c = fVar10;
fVar10 = fVar6;
if ((local_68 <= fVar6) && (fVar10 = local_68, local_5c < fVar6)) {
local_5c = fVar6;
}
local_68 = fVar10;
local_c4 = *(float *)(param_1 + 0x18) + 53.25;
fVar10 = local_cc;
if ((local_70 <= local_cc) && (fVar10 = local_70, local_64 < local_cc)) {
local_64 = local_cc;
}
local_70 = fVar10;
fVar10 = local_c8;
if ((local_6c <= local_c8) && (fVar10 = local_6c, local_60 < local_c8)) {
local_60 = local_c8;
}
local_6c = fVar10;
fVar10 = local_c4;
if ((local_68 <= local_c4) && (fVar10 = local_68, local_5c < local_c4)) {
local_5c = local_c4;
}
local_68 = fVar10;
cVar1 = (**(code **)(*engine + 0x3c))(engine,&local_70,&local_64,m_PVS,m_nPVSSize);
if (cVar1 == '\0') {
if (param_4 != (bool *)0x0) {
*param_4 = true;
}
return 0;
}
if (param_4 != (bool *)0x0) {
*param_4 = false;
}
}
local_124 = *(float *)(this + 0x2c);
fVar6 = *(float *)(this + 4) - local_124;
local_120 = *(float *)(this + 0x30);
fVar11 = *(float *)(this + 0xc) + 53.25;
fVar7 = *(float *)(this + 8) - local_120;
fVar10 = *(float *)(this + 0x18) + 53.25;
fVar9 = *(float *)(this + 0x24) + 53.25;
local_118 = *(float *)(param_1 + 4);
fVar8 = fVar11;
if (fVar10 <= fVar11) {
fVar8 = fVar10;
}
if (fVar10 <= fVar11) {
fVar10 = fVar11;
}
fVar11 = *(float *)(this + 0x28) + 53.25;
local_114 = *(float *)(param_1 + 8);
if (fVar9 <= fVar8) {
fVar8 = fVar9;
}
local_11c = *(float *)(this + 0x34) + 53.25;
if (fVar10 <= fVar9) {
fVar10 = fVar9;
}
if (fVar11 <= fVar8) {
fVar8 = fVar11;
}
local_110 = *(undefined4 *)(param_1 + 0xc);
if (fVar10 <= fVar11) {
fVar10 = fVar11;
}
fVar8 = fVar8 - local_11c;
fVar9 = *(float *)(this + 0x10) - local_124;
fVar11 = (fVar10 + 0.1) - local_11c;
fVar10 = *(float *)(this + 0x14) - local_120;
local_10c = *(float *)(param_1 + 0x10);
local_108 = *(float *)(param_1 + 0x14);
local_104 = *(undefined4 *)(param_1 + 0x18);
CalcClosestPointOnAABB
((Vector *)&local_118,(Vector *)&local_10c,(Vector *)&local_124,(Vector *)&local_100);
lVar4 = (longdouble)CNavArea::GetZ((CNavArea *)param_1,local_100,local_fc);
local_f8 = (float)lVar4 + 53.25;
CTraceFilterSimple::CTraceFilterSimple
((CTraceFilterSimple *)local_dc,(IHandleEntity *)0x0,0,
(_func_bool_IHandleEntity_ptr_int *)0x0);
local_dc[0] = &PTR_ShouldHitEntity_00c54558;
local_8c = 0;
local_bc = local_100 - local_124;
local_b4 = local_f8 - local_11c;
local_b8 = local_fc - local_120;
local_87 = local_bc * local_bc + local_b4 * local_b4 + local_b8 * local_b8 != 0.0;
local_9c = (fVar9 - fVar6) * 0.5;
local_98 = (fVar10 - fVar7) * 0.5;
local_94 = (fVar11 - fVar8) * 0.5;
local_a4 = (fVar8 + fVar11) * 0.5;
local_c4 = local_11c + local_a4;
local_88 = local_98 * local_98 + local_9c * local_9c + local_94 * local_94 < 1e-06;
local_a8 = (fVar7 + fVar10) * 0.5;
local_ac = (fVar6 + fVar9) * 0.5;
local_c8 = local_120 + local_a8;
local_a8 = -local_a8;
local_cc = local_124 + local_ac;
local_ac = -local_ac;
local_a4 = -local_a4;
(**(code **)(*enginetrace + 0x14))
(enginetrace,&local_cc,0x2006041,(CTraceFilterSimple *)local_dc,(Vector *)&local_70);
if (*(int *)(r_visualizetraces._28_4_ + 0x30) != 0) {
DebugDrawLine((Vector *)&local_70,(Vector *)&local_64,0xff,0xff,0,true,-1.0);
}
bVar3 = 2;
if ((local_44 != 1.0) &&
((((local_64 <= local_118 || (local_10c <= local_64)) || (local_60 <= local_114)) ||
(local_108 <= local_60)))) {
local_cc = *(float *)(this + 0x2c);
local_c8 = *(float *)(this + 0x30);
local_c4 = *(float *)(this + 0x34) + 53.25;
cVar1 = IsPartiallyVisible(param_1,(Vector *)&local_cc);
local_f4 = *(float *)(this + 0x2c) - *(float *)(param_1 + 0x2c);
bVar3 = ~-(cVar1 == '\0') & 3;
local_f0 = *(float *)(this + 0x30) - *(float *)(param_1 + 0x30);
local_ec = *(float *)(this + 0x34) - *(float *)(param_1 + 0x34);
VectorNormalize((Vector *)&local_f4);
fVar8 = *(float *)(this + 0x14);
fVar10 = *(float *)(NavPotentiallyVisibleDotTolerance._28_4_ + 0x2c);
if (25.0 <= fVar8 - *(float *)(this + 8)) {
fVar6 = *(float *)(this + 0x10);
local_148 = 12.5;
local_e8 = *(float *)(this + 4);
LAB_00975464:
if (25.0 <= fVar6 - local_e8) {
if (bVar3 == 1) {
return 1;
}
fVar8 = 12.5;
do {
local_e8 = local_e8 + fVar8;
local_e4 = *(float *)(this + 8) + local_148;
local_e0 = *(float *)(this + 0xc) + 53.25;
lVar4 = (longdouble)CNavArea::GetZ((CNavArea *)this,local_e8,local_e4);
local_e0 = (float)lVar4 + 53.25;
if (fVar5 <= 1e+06) {
LAB_009755e7:
cVar1 = IsPartiallyVisible(param_1,(Vector *)&local_e8);
bVar2 = bVar3 & 0xfd;
bVar3 = bVar3 | 1;
if (cVar1 == '\0') {
bVar3 = bVar2;
}
}
else {
local_cc = local_e8 - *(float *)(this + 0x2c);
local_c4 = (-53.25 - *(float *)(this + 0x34)) + local_e0;
local_c8 = local_e4 - *(float *)(this + 0x30);
VectorNormalize((Vector *)&local_cc);
if (local_f0 * local_c8 + local_f4 * local_cc + local_ec * local_c4 < fVar10)
goto LAB_009755e7;
}
fVar6 = *(float *)(this + 0x10);
local_e8 = *(float *)(this + 4);
fVar8 = fVar8 + 25.0;
if ((fVar6 - local_e8) - 12.5 < fVar8) goto code_r0x00975641;
if (bVar3 == 1) {
return 1;
}
} while( true );
}
goto LAB_00975646;
}
}
}
return bVar3;
code_r0x00975641:
fVar8 = *(float *)(this + 0x14);
LAB_00975646:
local_148 = local_148 + 25.0;
if ((fVar8 - *(float *)(this + 8)) - 12.5 < local_148) {
return bVar3;
}
goto LAB_00975464;
}
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.