nav_print_visibility_info
0x00976da0 · 1158 bytes · __cdecl
_ZL25nav_print_visibility_infoRK8CCommand
Decompiled
undefined (1 param)
/* nav_print_visibility_info(CCommand const&) */
void nav_print_visibility_info(CCommand *param_1)
{
ushort uVar1;
TerrorNavArea *this;
int iVar2;
uint uVar3;
int iVar4;
char cVar5;
int iVar6;
int iVar7;
int iVar8;
int iVar9;
int iVar10;
int iVar11;
undefined4 uVar12;
int iVar13;
int iVar14;
undefined *puVar15;
int iVar16;
CBaseEntity *pCVar17;
float fVar18;
float fVar19;
float fVar20;
float fVar21;
TerrorNavArea *local_5c;
int local_58;
int local_4c;
float local_48;
int local_44;
int local_40;
cVar5 = UTIL_IsCommandIssuedByServerAdmin();
if ((cVar5 != '\0') &&
(iVar6 = UTIL_GetCommandClient(), iVar4 = DAT_00fe6000, iVar11 = TheNavAreas, iVar6 != 0)) {
if (DAT_00fe6000 < 1) {
Msg("NavMesh Visibility List Lengths: min = %d, avg = %d, max = %d\n",999999999,0,0);
}
else {
local_48 = 0.0;
local_58 = 0;
local_5c = (TerrorNavArea *)0x0;
local_40 = 0;
iVar7 = DAT_00fe6000 + TerrorNavArea::s_nCurrVisTestCounter;
local_44 = 999999999;
iVar16 = TheNavAreas + TerrorNavArea::s_nCurrVisTestCounter * -4;
local_4c = 0;
iVar6 = TerrorNavArea::s_nCurrVisTestCounter;
do {
this = *(TerrorNavArea **)(iVar16 + iVar6 * 4);
iVar8 = TerrorNavArea::GetPotentiallyVisibleSetSize(this,true);
local_4c = local_4c + iVar8;
if (iVar8 < local_44) {
local_44 = iVar8;
}
if (iVar8 <= local_40) {
iVar8 = local_40;
}
iVar6 = iVar6 + 1;
fVar18 = 0.0;
TerrorNavArea::s_nCurrVisTestCounter = iVar6;
iVar2 = 0;
if (0 < *(int *)(this + 0x13c)) {
iVar9 = 0;
iVar13 = *(int *)(this + 0x134);
fVar21 = 0.0;
iVar14 = 0;
do {
while (iVar2 = *(int *)(iVar11 + ((int)(uint)*(ushort *)(iVar13 + iVar9 * 2) >> 2) * 4),
iVar2 == 0) {
LAB_00976e80:
iVar9 = iVar9 + 1;
fVar18 = fVar21;
iVar2 = iVar14;
if (*(int *)(this + 0x13c) <= iVar9) goto LAB_00976ef8;
}
*(int *)(iVar2 + 0x170) = iVar6;
iVar13 = *(int *)(this + 0x134);
if (((*(byte *)(iVar13 + iVar9 * 2) & 3) == 0) ||
(fVar18 = *(float *)(iVar2 + 0x2c) - *(float *)(this + 0x2c),
fVar20 = *(float *)(iVar2 + 0x30) - *(float *)(this + 0x30),
fVar19 = *(float *)(iVar2 + 0x34) - *(float *)(this + 0x34),
fVar18 = fVar18 * fVar18 + fVar20 * fVar20 + fVar19 * fVar19, fVar18 <= fVar21))
goto LAB_00976e80;
iVar9 = iVar9 + 1;
fVar21 = fVar18;
iVar14 = iVar2;
} while (iVar9 < *(int *)(this + 0x13c));
}
LAB_00976ef8:
iVar13 = *(int *)(this + 0x130);
if ((iVar13 != 0) && (0 < *(int *)(iVar13 + 0x13c))) {
iVar10 = 0;
iVar14 = *(int *)(iVar13 + 0x134);
fVar21 = fVar18;
iVar9 = iVar2;
do {
while( true ) {
iVar2 = *(int *)(iVar11 + ((int)(uint)*(ushort *)(iVar14 + iVar10 * 2) >> 2) * 4);
if ((iVar2 != 0) && (iVar6 != *(int *)(iVar2 + 0x170))) break;
LAB_00976f30:
iVar10 = iVar10 + 1;
fVar18 = fVar21;
iVar2 = iVar9;
if (*(int *)(iVar13 + 0x13c) <= iVar10) goto LAB_00976fe1;
}
*(int *)(iVar2 + 0x170) = iVar6;
iVar14 = *(int *)(iVar13 + 0x134);
uVar1 = *(ushort *)(iVar14 + iVar10 * 2);
if ((uVar1 & 3) == 0) goto LAB_00976f30;
iVar2 = *(int *)((uVar1 & 0xfffc) + iVar11);
fVar20 = *(float *)(iVar2 + 0x2c) - *(float *)(this + 0x2c);
fVar18 = *(float *)(iVar2 + 0x34) - *(float *)(this + 0x34);
fVar19 = *(float *)(iVar2 + 0x30) - *(float *)(this + 0x30);
fVar18 = fVar18 * fVar18 + fVar20 * fVar20 + fVar19 * fVar19;
if (fVar18 <= fVar21) goto LAB_00976f30;
iVar10 = iVar10 + 1;
fVar21 = fVar18;
iVar9 = iVar2;
} while (iVar10 < *(int *)(iVar13 + 0x13c));
}
LAB_00976fe1:
if ((iVar2 != 0) && (local_48 < fVar18)) {
local_5c = this;
local_58 = iVar2;
local_48 = fVar18;
}
local_40 = iVar8;
} while (iVar6 != iVar7);
Msg("NavMesh Visibility List Lengths: min = %d, avg = %d, max = %d\n",local_44,
local_4c / iVar4,iVar8);
if ((local_58 != 0) && (local_5c != (TerrorNavArea *)0x0)) {
Msg("Longest distance between at-least-partially visible areas: %d sees %d at range %.0f\n",
*(undefined4 *)(local_5c + 0x8c),*(undefined4 *)(local_58 + 0x8c),(double)SQRT(local_48)
);
}
}
pCVar17 = (CBaseEntity *)0x0;
while (pCVar17 = (CBaseEntity *)
CGlobalEntityList::FindEntityByClassname
((CGlobalEntityList *)gEntList,pCVar17,"env_fog_controller"),
pCVar17 != (CBaseEntity *)0x0) {
fVar18 = *(float *)(pCVar17 + 0x468);
fVar21 = *(float *)(pCVar17 + 0x46c);
fVar19 = *(float *)(pCVar17 + 0x464);
fVar20 = *(float *)(pCVar17 + 0x460);
uVar12 = CBaseEntity::GetDebugName(pCVar17);
Msg("fog controller %s has start: %.0f end: %.0f density: %.0f fog Z: %.0f\n",uVar12,
(double)fVar20,(double)fVar19,(double)fVar21,(double)fVar18);
}
iVar11 = FogSystem();
if (iVar11 != 0) {
iVar11 = FogSystem();
uVar3 = *(uint *)(iVar11 + 0x18);
if ((((uVar3 != 0xffffffff) &&
(puVar15 = g_pEntityList + (uVar3 & 0xfff) * 0x10, puVar15 != (undefined *)0xfffffffc))
&& (*(uint *)(puVar15 + 8) == uVar3 >> 0xc)) &&
(pCVar17 = *(CBaseEntity **)(puVar15 + 4), pCVar17 != (CBaseEntity *)0x0)) {
fVar18 = *(float *)(pCVar17 + 0x468);
fVar21 = *(float *)(pCVar17 + 0x46c);
fVar19 = *(float *)(pCVar17 + 0x464);
fVar20 = *(float *)(pCVar17 + 0x460);
uVar12 = CBaseEntity::GetDebugName(pCVar17);
Msg("master fog controller is %s - start: %.0f end: %.0f density: %.0f fog Z: %.0f\n",uVar12
,(double)fVar20,(double)fVar19,(double)fVar21,(double)fVar18);
return;
}
}
}
return;
}
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.