TerrorMeasureTravelDistance
0x00978fc0 · 450 bytes · unknown
_Z27TerrorMeasureTravelDistancev
Decompiled
undefined (0 params)
/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* TerrorMeasureTravelDistance() */
void TerrorMeasureTravelDistance(void)
{
float *pfVar1;
float *pfVar2;
float *pfVar3;
CNavArea *pCVar4;
bool bVar5;
CNavArea *pCVar6;
int iVar7;
CCSPlayer *this;
float fVar8;
float fVar9;
float fVar10;
float fVar11;
double local_24;
ShortestPathCost local_d [5];
pCVar6 = (CNavArea *)CNavMesh::GetMarkedArea(TheNavMesh);
if (pCVar6 == (CNavArea *)0x0) {
Warning("ERROR: First mark the \'from\' area.\n");
return;
}
pCVar4 = *(CNavArea **)(TheNavMesh + 0x648);
if (pCVar4 == (CNavArea *)0x0) {
Warning("ERROR: First point at the \'to\' area.\n");
return;
}
if (pCVar6 != pCVar4) {
bVar5 = NavAreaBuildPath<ShortestPathCost>
(pCVar6,pCVar4,(Vector *)0x0,(Vector *)0x0,local_d,(CNavArea **)0x0,0.0,-1,
false);
if (!bVar5) {
local_24 = -1.0;
goto LAB_009790c4;
}
iVar7 = *(int *)(pCVar4 + 0x78);
if (iVar7 != 0) {
fVar11 = 0.0;
fVar8 = *(float *)(pCVar4 + 0x30);
fVar9 = *(float *)(pCVar4 + 0x2c);
fVar10 = *(float *)(pCVar4 + 0x34);
do {
pfVar1 = (float *)(iVar7 + 0x30);
pfVar2 = (float *)(iVar7 + 0x34);
fVar8 = fVar8 - *pfVar1;
pfVar3 = (float *)(iVar7 + 0x2c);
fVar10 = fVar10 - *pfVar2;
iVar7 = *(int *)(iVar7 + 0x78);
fVar9 = fVar9 - *pfVar3;
fVar11 = fVar11 + SQRT(fVar8 * fVar8 + fVar10 * fVar10 + fVar9 * fVar9);
fVar8 = *pfVar1;
fVar9 = *pfVar3;
fVar10 = *pfVar2;
} while (iVar7 != 0);
local_24 = (double)fVar11;
goto LAB_009790c4;
}
}
local_24 = 0.0;
LAB_009790c4:
this = (CCSPlayer *)UTIL_GetListenServerHost();
if (this != (CCSPlayer *)0x0) {
V_snprintf(TerrorMeasureTravelDistance()::str,0x80,"Travel distance is %3.2f\n",local_24);
CCSPlayer::HintMessage(this,TerrorMeasureTravelDistance()::str,true,true,false);
}
Msg("Travel distance is %3.2f\n",local_24);
CNavMesh::CommandNavUnmark(TheNavMesh);
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.