MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / ramp_control_value

Function ramp_control_value

Descent3/Controls.cpp:560–569  ·  view source on GitHub ↗

ramping macros

Source from the content-addressed store, hash-verified

558
559// ramping macros
560static inline float ramp_control_value(float val, float limit, float &ramp_state, float &old_ramp_delta) {
561 float sign = val / fabs(val), old_sign = old_ramp_delta / fabs(old_ramp_delta);
562 if (sign != old_sign)
563 ramp_state = -ramp_state;
564 ramp_state = (val != 0) ? (ramp_state + val) : 0.0f;
565 ramp_state = (ramp_state > limit) ? limit : (ramp_state < -limit) ? (-limit) : ramp_state;
566 old_ramp_delta = val;
567
568 return ramp_state;
569}
570
571// INITIALIZATION FUNCTIONS
572

Callers 1

DoKeyboardMovementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected