L L4D2node

CGrabController::ComputeMaxSpeed

0x004ebf60 · 374 bytes · __thiscall

_ZN15CGrabController15ComputeMaxSpeedEP11CBaseEntityP14IPhysicsObject

Decompiled

undefined (3 params)

/* CGrabController::ComputeMaxSpeed(CBaseEntity*, IPhysicsObject*) */

void __thiscall
CGrabController::ComputeMaxSpeed(CGrabController *this,CBaseEntity *param_1,IPhysicsObject *param_2)

{
  longdouble lVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float local_18;
  float local_14;
  float local_10;
  
  *(undefined4 *)(this + 0x3c) = 0x447a0000;
  *(undefined4 *)(this + 0x34) = 0x45610000;
  lVar1 = (longdouble)PhysGetEntityMass(param_1);
  fVar3 = (float)lVar1;
  fVar2 = *(float *)(physcannon_maxmass._28_4_ + 0x2c);
  if (fVar3 <= fVar2) {
    return;
  }
  fVar4 = 500.0;
  if (500.0 < fVar3) {
    fVar3 = 1.0;
    if (fVar2 == 500.0) goto LAB_004ebfeb;
  }
  else {
    fVar4 = fVar3;
    if (fVar3 <= fVar2) {
      fVar4 = fVar2;
    }
    if (fVar2 == 500.0) {
      fVar3 = (float)(-(uint)(500.0 <= fVar4) & 0x3f800000);
      goto LAB_004ebfeb;
    }
  }
  fVar2 = (fVar4 - fVar2) / (500.0 - fVar2);
  fVar3 = fVar2 * fVar2 * 3.0 - (fVar2 + fVar2) * fVar2 * fVar2;
LAB_004ebfeb:
  lVar1 = (longdouble)(**(code **)(*(int *)param_2 + 0x7c))(param_2);
  (**(code **)(*(int *)param_2 + 0x84))(&local_18,param_2);
  *(float *)(this + 0x3c) = (300.0 - *(float *)(this + 0x3c)) * fVar3 + *(float *)(this + 0x3c);
  *(float *)(this + 0x34) =
       ((0.025 / (float)lVar1) *
        SQRT(local_18 * local_18 + local_10 * local_10 + local_14 * local_14) * 21600.0 -
       *(float *)(this + 0x34)) * fVar3 + *(float *)(this + 0x34);
  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)