nav_select_view_distance
0x00979960 · 967 bytes · __cdecl
_ZL24nav_select_view_distanceRK8CCommand
Decompiled
undefined (1 param)
/* nav_select_view_distance(CCommand const&) */
void nav_select_view_distance(CCommand *param_1)
{
int *piVar1;
float fVar2;
CNavArea *pCVar3;
int iVar4;
CNavMesh *pCVar5;
char cVar6;
CBaseEntity *this;
int iVar7;
undefined4 uVar8;
int iVar9;
int iVar10;
int iVar11;
int iVar12;
int iVar13;
float fVar14;
int local_48;
CNavArea *local_38;
char local_34;
int *local_30;
undefined4 local_2c;
undefined4 local_28;
int local_24;
int *local_20;
cVar6 = UTIL_IsCommandIssuedByServerAdmin();
if ((cVar6 == '\0') || (this = (CBaseEntity *)UTIL_GetCommandClient(), this == (CBaseEntity *)0x0)
) {
return;
}
CNavMesh::ClearSelectedSet(TheNavMesh);
CBaseEntity::EmitSound(this,"EDIT_PLACE_PICK",0.0,(float *)0x0);
local_34 = '\0';
local_28 = 0;
local_24 = 0;
local_2c = 1000;
fVar2 = *(float *)(NavMaxViewDistance._28_4_ + 0x2c);
local_30 = malloc(4000);
local_20 = local_30;
if (((byte)this[0x14d] & 8) != 0) {
/* try { // try from 00979a04 to 00979c9b has its CatchHandler @ 00979d36 */
CBaseEntity::CalcAbsolutePosition(this);
}
pCVar5 = TheNavMesh;
if ((CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
searchMarker == '\0') &&
(iVar9 = __cxa_guard_acquire(&CNavMesh::
ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)
::searchMarker), iVar9 != 0)) {
/* try { // try from 00979cf4 to 00979cf8 has its CatchHandler @ 00979d4b */
CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
searchMarker = RandomInt(0,0x100000);
__cxa_guard_release(&CNavMesh::
ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)
::searchMarker);
}
iVar9 = CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
searchMarker + 1;
if (CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
searchMarker + 1 == 0) {
iVar9 = CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
searchMarker + 2;
}
CNavMesh::ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
searchMarker = iVar9;
fVar14 = 1.0 / *(float *)(pCVar5 + 0x20);
iVar9 = (int)((*(float *)(this + 0x2e0) - *(float *)(pCVar5 + 0x2c)) * fVar14);
if (iVar9 < 0) {
iVar9 = 0;
}
else if (*(int *)(pCVar5 + 0x24) <= iVar9) {
iVar9 = *(int *)(pCVar5 + 0x24) + -1;
}
iVar7 = (int)((*(float *)(this + 0x2e4) - *(float *)(pCVar5 + 0x30)) * fVar14);
if (iVar7 < 0) {
iVar7 = 0;
}
else if (*(int *)(pCVar5 + 0x28) <= iVar7) {
iVar7 = *(int *)(pCVar5 + 0x28) + -1;
}
iVar10 = (int)(fVar14 * fVar2);
if ((float)iVar10 < fVar14 * fVar2) {
iVar10 = iVar10 + 1;
}
if (fVar2 == 0.0) {
iVar10 = *(int *)(pCVar5 + 0x24);
if (*(int *)(pCVar5 + 0x24) <= *(int *)(pCVar5 + 0x28)) {
iVar10 = *(int *)(pCVar5 + 0x28);
}
}
iVar13 = iVar9 - iVar10;
local_48 = local_24;
do {
if (iVar9 + iVar10 < iVar13) {
iVar9 = 0;
if (0 < local_48) {
do {
CNavMesh::AddToSelectedSet(TheNavMesh,(CNavArea *)local_30[iVar9]);
iVar9 = iVar9 + 1;
} while (iVar9 < local_24);
}
uVar8 = CNavMesh::GetSelecteSetSize(TheNavMesh);
Msg("%d areas selected\n",uVar8);
local_24 = 0;
CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_30);
local_20 = local_30;
CUtlMemory<CNavArea*,int>::Purge((CUtlMemory<CNavArea*,int> *)&local_30);
return;
}
if ((-1 < iVar13) && (iVar4 = iVar7 - iVar10, iVar13 < *(int *)(pCVar5 + 0x24))) {
for (; iVar4 <= iVar7 + iVar10; iVar4 = iVar4 + 1) {
if (((-1 < iVar4) && (iVar4 < *(int *)(pCVar5 + 0x28))) &&
(piVar1 = (int *)(*(int *)(pCVar5 + 0xc) +
(iVar4 * *(int *)(pCVar5 + 0x24) + iVar13) * 0x14), 0 < piVar1[3])) {
iVar12 = 0;
LAB_00979b74:
do {
pCVar3 = *(CNavArea **)(*piVar1 + iVar12 * 4);
if ((*(int *)(pCVar3 + 0x74) !=
CNavMesh::
ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
searchMarker) &&
((*(int *)(pCVar3 + 0x74) =
CNavMesh::
ForAllAreasInRadius<NavAreaCollector>(NavAreaCollector&,Vector_const&,float)::
searchMarker,
(*(float *)(pCVar3 + 0x30) - *(float *)(this + 0x2e4)) *
(*(float *)(pCVar3 + 0x30) - *(float *)(this + 0x2e4)) +
(*(float *)(pCVar3 + 0x2c) - *(float *)(this + 0x2e0)) *
(*(float *)(pCVar3 + 0x2c) - *(float *)(this + 0x2e0)) +
(*(float *)(pCVar3 + 0x34) - *(float *)(this + 0x2e8)) *
(*(float *)(pCVar3 + 0x34) - *(float *)(this + 0x2e8)) <= fVar2 * fVar2 ||
(fVar2 * fVar2 == 0.0)))) {
local_38 = pCVar3;
if ((local_34 == '\0') || (local_48 < 1)) {
LAB_00979c03:
CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>>::InsertBefore
((CUtlVector<CNavArea*,CUtlMemory<CNavArea*,int>> *)&local_30,local_48,
&local_38);
iVar12 = iVar12 + 1;
local_48 = local_24;
if (piVar1[3] <= iVar12) break;
goto LAB_00979b74;
}
if (pCVar3 != (CNavArea *)*local_30) {
iVar11 = 0;
do {
iVar11 = iVar11 + 1;
if (iVar11 == local_48) goto LAB_00979c03;
} while (pCVar3 != (CNavArea *)local_30[iVar11]);
if (iVar11 < 0) goto LAB_00979c03;
}
}
iVar12 = iVar12 + 1;
} while (iVar12 < piVar1[3]);
}
}
}
iVar13 = iVar13 + 1;
} 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.