L L4D2node

CNavMesh::SnapToGrid

0x00709e70 · 156 bytes · __thiscall

_ZNK8CNavMesh10SnapToGridEfb

Decompiled

undefined (3 params)

/* CNavMesh::SnapToGrid(float, bool) const */

longdouble __thiscall CNavMesh::SnapToGrid(CNavMesh *this,float param_1,bool param_2)

{
  float fVar1;
  int iVar2;
  int iVar3;
  float fVar4;
  
  if (*(int *)(TheNavMesh + 0x528) == 0) {
    iVar2 = GetGridSize(param_2);
    fVar4 = (float)iVar2;
    iVar3 = (int)fVar4;
    if (iVar2 == 0) {
      return (longdouble)param_1;
    }
  }
  else {
    fVar4 = 25.0;
    iVar3 = 0x19;
  }
  fVar1 = fVar4;
  if (param_1 < 0.0) {
    fVar1 = -fVar4;
  }
  return (longdouble)((float)((int)(param_1 + fVar1 * 0.5) / iVar3) * fVar4);
}

SourceMod gamedata

paste into addons/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.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)