L L4D2node

CBaseEntity::PhysicsCheckVelocity

0x00476c50 · 345 bytes · __thiscall

_ZN11CBaseEntity20PhysicsCheckVelocityEv

Decompiled

undefined (1 param)

/* CBaseEntity::PhysicsCheckVelocity() */

void __thiscall CBaseEntity::PhysicsCheckVelocity(CBaseEntity *this)

{
  bool bVar1;
  byte bVar3;
  undefined1 *puVar2;
  int iVar4;
  float fVar5;
  uint local_34 [3];
  float local_28 [6];
  
  bVar3 = (byte)(*(uint *)(this + 0x14c) >> 8);
  if ((*(uint *)(this + 0x14c) & 0x800) != 0) {
    CalcAbsolutePosition(this);
    bVar3 = (byte)((uint)*(undefined4 *)(this + 0x14c) >> 8);
  }
  local_34[0] = *(uint *)(this + 0x2e0);
  local_34[1] = *(undefined4 *)(this + 0x2e4);
  local_34[2] = *(undefined4 *)(this + 0x2e8);
  if ((bVar3 & 0x10) != 0) {
    CalcAbsoluteVelocity(this);
  }
  iVar4 = 0;
  bVar1 = false;
  local_28[0] = *(float *)(this + 0x274);
  local_28[1] = (float)*(undefined4 *)(this + 0x278);
  local_28[2] = (float)*(undefined4 *)(this + 0x27c);
  do {
    if (((uint)local_28[iVar4] & 0x7f800000) == 0x7f800000) {
      puVar2 = *(undefined1 **)(this + 0x7c);
      if (puVar2 == (undefined1 *)0x0) {
        puVar2 = &DAT_00d539c2;
      }
      Msg("Got a NaN velocity on %s\n",puVar2);
      local_28[iVar4] = 0.0;
      bVar1 = true;
    }
    if ((local_34[iVar4] & 0x7f800000) == 0x7f800000) {
      puVar2 = *(undefined1 **)(this + 0x7c);
      if (puVar2 == (undefined1 *)0x0) {
        puVar2 = &DAT_00d539c2;
      }
      Msg("Got a NaN origin on %s\n",puVar2);
      local_34[iVar4] = 0;
      bVar1 = true;
    }
    fVar5 = *(float *)(sv_maxvelocity._28_4_ + 0x2c);
    if ((fVar5 < local_28[iVar4]) || (fVar5 = -fVar5, local_28[iVar4] < fVar5)) {
      local_28[iVar4] = fVar5;
      bVar1 = true;
    }
    iVar4 = iVar4 + 1;
  } while (iVar4 != 3);
  if (bVar1) {
    SetAbsOrigin(this,(Vector *)local_34);
    SetAbsVelocity(this,(Vector *)local_28);
  }
  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)