L L4D2node

CFuncTrackTrain::SetSpeed

0x00b106c0 · 278 bytes · __thiscall

_ZN15CFuncTrackTrain8SetSpeedEfb

Decompiled

undefined (3 params)

/* CFuncTrackTrain::SetSpeed(float, bool) */

void __thiscall CFuncTrackTrain::SetSpeed(CFuncTrackTrain *this,float param_1,bool param_2)

{
  float fVar1;
  int iVar2;
  undefined4 uVar3;
  float fVar4;
  
  this[0x500] = (CFuncTrackTrain)param_2;
  iVar2 = gpGlobals;
  fVar1 = *(float *)(this + 0x11c);
  if (param_2) {
    *(float *)(this + 0x4f0) = *(float *)(this + 0x488) * ABS(param_1);
    *(undefined4 *)(this + 0x4f4) = *(undefined4 *)(iVar2 + 0xc);
    if ((fVar1 == 0.0) && (0.0 < ABS(*(float *)(this + 0x488) * ABS(param_1)))) {
      *(undefined4 *)(this + 0x11c) = 0x3dcccccd;
    }
    Start(this);
    return;
  }
  fVar4 = ABS(param_1) * *(float *)(this + 0x488);
  *(float *)(this + 0x11c) = fVar4;
  if (fVar1 != fVar4) {
    if (fVar4 == 0.0) {
      Stop(this);
      fVar4 = *(float *)(this + 0x11c);
    }
    else if (fVar1 == 0.0) {
      Start(this);
      fVar4 = *(float *)(this + 0x11c);
    }
    else {
      Next(this);
      fVar4 = *(float *)(this + 0x11c);
    }
  }
  uVar3 = CBaseEntity::GetDebugName((CBaseEntity *)this);
  DevMsg(2,"TRAIN(%s), speed to %.2f\n",uVar3,(double)fVar4);
  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)