L L4D2node

CFuncElevator::GetHeightForTime

0x0044dd00 · 528 bytes · __thiscall

_ZNK13CFuncElevator16GetHeightForTimeEPKcfRf

Decompiled

undefined (4 params)

/* CFuncElevator::GetHeightForTime(char const*, float, float&) const */

longdouble __thiscall
CFuncElevator::GetHeightForTime(CFuncElevator *this,char *param_1,float param_2,float *param_3)

{
  float fVar1;
  float fVar2;
  float fVar3;
  float fVar4;
  float fVar5;
  float fVar6;
  float fVar7;
  
  *param_3 = 0.0;
  if ((this[0x4fc] == (CFuncElevator)0x0) ||
     (fVar7 = *(float *)(this + 0x4ec),
     *(float *)(gpGlobals + 0xc) <= fVar7 && fVar7 != *(float *)(gpGlobals + 0xc))) {
    if (((byte)this[0x14d] & 8) != 0) {
      CBaseEntity::CalcAbsolutePosition((CBaseEntity *)this);
    }
    fVar1 = *(float *)(this + 0x2e8);
  }
  else {
    fVar7 = param_2 - fVar7;
    if (fVar7 <= 0.0) {
      fVar1 = *(float *)(this + 0x4f4);
    }
    else {
      fVar1 = *(float *)(this + 0x4f8);
      if (*(float *)(this + 0x4f4) <= fVar1) {
        fVar2 = *(float *)(this + 0x4e4);
        fVar3 = fVar2 / *(float *)(this + 0x4e8);
      }
      else {
        fVar2 = -*(float *)(this + 0x4e4);
        fVar3 = *(float *)(this + 0x4e4) / *(float *)(this + 0x4e8);
      }
      if (fVar7 < fVar3) {
        fVar1 = *(float *)(this + 0x4f0);
        fVar2 = (fVar7 / fVar3) * fVar2;
        *param_3 = fVar2;
        return (longdouble)(fVar7 * 0.5 * (fVar1 + fVar2) + *(float *)(this + 0x4f4));
      }
      fVar4 = (*(float *)(this + 0x4f0) + fVar2) * fVar3 * 0.5 + *(float *)(this + 0x4f4);
      fVar5 = (fVar7 - fVar3) * fVar2 + fVar4;
      if (fVar2 <= 0.0) {
        if ((fVar2 < 0.0) && (fVar5 <= fVar1)) goto LAB_0044dde9;
      }
      else if ((fVar1 <= fVar5) || (fVar2 < 0.0)) goto LAB_0044dde9;
      fVar6 = fVar3 * 0.5 * fVar2;
      if (ABS(fVar6) <= ABS(fVar1 - fVar5)) {
        *param_3 = fVar2;
        fVar1 = fVar5;
      }
      else {
        fVar6 = fVar1 - fVar6;
        fVar7 = (fVar7 - fVar3) - (fVar6 - fVar4) / fVar2;
        if (fVar7 < fVar3) {
          fVar1 = (1.0 - fVar7 / fVar3) * fVar2;
          *param_3 = fVar1;
          fVar1 = fVar7 * 0.5 * (fVar2 + fVar1) + fVar6;
        }
      }
    }
  }
LAB_0044dde9:
  return (longdouble)fVar1;
}

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)