L L4D2node

CCSGameMovement::ComputeSpeeds

0x004304b0 · 385 bytes · __thiscall

_ZN15CCSGameMovement13ComputeSpeedsEv

Decompiled

undefined (1 param)

/* CCSGameMovement::ComputeSpeeds() */

void __thiscall CCSGameMovement::ComputeSpeeds(CCSGameMovement *this)

{
  int iVar1;
  int iVar2;
  bool bVar3;
  longdouble lVar4;
  float fVar5;
  float fVar6;
  float local_14;
  
  iVar2 = *(int *)(this + 4);
  if (*(byte *)(iVar2 + 0x186) == 1) {
    return;
  }
  if ((*(byte *)(iVar2 + 0x186) & 0xfd) == 8) {
    return;
  }
  iVar1 = *(int *)(this + 8);
  fVar5 = *(float *)(iVar1 + 0x34) * *(float *)(iVar1 + 0x34) +
          *(float *)(iVar1 + 0x2c) * *(float *)(iVar1 + 0x2c) +
          *(float *)(iVar1 + 0x30) * *(float *)(iVar1 + 0x30);
  fVar6 = *(float *)(iVar1 + 0x3c);
  if (fVar6 != 0.0) {
    if (*(float *)(iVar1 + 0x38) <= fVar6) {
      fVar6 = *(float *)(iVar1 + 0x38);
    }
    *(float *)(iVar1 + 0x38) = fVar6;
    iVar2 = *(int *)(this + 4);
  }
  if (*(int *)(iVar2 + 0x217c) == 0) {
    local_14 = 1.0;
  }
  else {
    local_14 = *(float *)(*(int *)(iVar2 + 0x217c) + 0x44);
  }
  lVar4 = (longdouble)CGameMovement::ComputeConstraintSpeedFactor((CGameMovement *)this);
  fVar6 = (float)lVar4;
  if (local_14 <= (float)lVar4) {
    fVar6 = local_14;
  }
  lVar4 = (longdouble)(**(code **)(*(int *)this + 0x120))(this);
  bVar3 = g_bMovementOptimizations == '\0';
  *(float *)(*(int *)(this + 8) + 0x38) =
       (float)lVar4 * *(float *)(*(int *)(this + 8) + 0x38) * fVar6;
  if (bVar3) {
    fVar5 = SQRT(fVar5);
    if (fVar5 == 0.0) {
      return;
    }
    iVar2 = *(int *)(this + 8);
    if (fVar5 <= *(float *)(iVar2 + 0x38)) {
      return;
    }
    fVar5 = *(float *)(iVar2 + 0x38) / fVar5;
  }
  else {
    if (fVar5 == 0.0) {
      return;
    }
    iVar2 = *(int *)(this + 8);
    fVar6 = *(float *)(iVar2 + 0x38);
    if (fVar5 <= fVar6 * fVar6) {
      return;
    }
    fVar5 = fVar6 / SQRT(fVar5);
  }
  *(float *)(iVar2 + 0x2c) = *(float *)(iVar2 + 0x2c) * fVar5;
  *(float *)(*(int *)(this + 8) + 0x30) = *(float *)(*(int *)(this + 8) + 0x30) * fVar5;
  *(float *)(*(int *)(this + 8) + 0x34) = fVar5 * *(float *)(*(int *)(this + 8) + 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)