L L4D2node

CGameMovement::CheckVelocity

0x00457b70 · 428 bytes · __thiscall

_ZN13CGameMovement13CheckVelocityEv

Decompiled

undefined (1 param)

/* CGameMovement::CheckVelocity() */

void __thiscall CGameMovement::CheckVelocity(CGameMovement *this)

{
  int iVar1;
  float fVar2;
  uint uVar3;
  int iVar4;
  undefined4 uVar5;
  int iVar6;
  uint local_28 [6];
  
  iVar6 = 0;
  iVar4 = *(int *)(this + 8);
  local_28[0] = *(uint *)(iVar4 + 0x9c);
  local_28[1] = *(undefined4 *)(iVar4 + 0xa0);
  local_28[2] = *(undefined4 *)(iVar4 + 0xa4);
  while( true ) {
    iVar1 = iVar6 * 4;
    if ((*(uint *)(iVar4 + 0x40 + iVar1) & 0x7f800000) == 0x7f800000) {
      uVar5 = DescribeAxis(iVar6);
      DevMsg(1,"PM  Got a NaN velocity %s\n",uVar5);
      *(undefined4 *)(*(int *)(this + 8) + 0x40 + iVar1) = 0;
      uVar3 = local_28[iVar6];
    }
    else {
      uVar3 = local_28[iVar6];
    }
    if ((uVar3 & 0x7f800000) == 0x7f800000) {
      uVar5 = DescribeAxis(iVar6);
      DevMsg(1,"PM  Got a NaN origin on %s\n",uVar5);
      local_28[iVar6] = 0;
      iVar4 = *(int *)(this + 8);
      *(uint *)(iVar4 + 0x9c) = local_28[0];
      *(uint *)(iVar4 + 0xa0) = local_28[1];
      *(uint *)(iVar4 + 0xa4) = local_28[2];
    }
    fVar2 = *(float *)(*(int *)(this + 8) + 0x40 + iVar1);
    if (*(float *)(sv_maxvelocity._28_4_ + 0x2c) < fVar2) {
      uVar5 = DescribeAxis(iVar6);
      DevMsg(1,"PM  Got a velocity too high on %s\n",uVar5);
      *(undefined4 *)(*(int *)(this + 8) + 0x40 + iVar1) =
           *(undefined4 *)(sv_maxvelocity._28_4_ + 0x2c);
    }
    else if (fVar2 < -*(float *)(sv_maxvelocity._28_4_ + 0x2c)) {
      uVar5 = DescribeAxis(iVar6);
      DevMsg(1,"PM  Got a velocity too low on %s\n",uVar5);
      *(uint *)(*(int *)(this + 8) + 0x40 + iVar1) =
           *(uint *)(sv_maxvelocity._28_4_ + 0x2c) ^ 0x80000000;
    }
    iVar6 = iVar6 + 1;
    if (iVar6 == 3) break;
    iVar4 = *(int *)(this + 8);
  }
  return;
}

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)