# Clamp (Real)
Grammar — Clamp value between min and max
Flags —Function
Adjust the value to make sure it stays within the provided bounds.
# Arguments
fixed
— Valuefixed
— Minfixed
— Max
Returns — fixed
fixed libNtve_gf_ArithmeticRealClamp(
fixed lp_value,
fixed lp_min,
fixed lp_max,
);
# Related
Category: Math / Arithmetic
- Absolute Value (Integer) —
int
— AbsI - Absolute Value (Real) —
fixed
— AbsF - Arithmetic (Integer)
- Bitwise Arithmetic (Integer)
- Arithmetic (Real)
- Arithmetic Multiple (Integer)
- Bitwise Arithmetic Multiple (Integer)
- Arithmetic Multiple (Real)
- Ceiling (Integer) —
int
— CeilingI - Ceiling (Real) —
fixed
— Ceiling - Clamp (Integer) —
int
— libNtve_gf_ArithmeticIntClamp - Clamp (Real) —
fixed
— libNtve_gf_ArithmeticRealClamp - Cycle
- Floor (Integer) —
int
— FloorI - Floor (Real) —
fixed
— Floor - Log2 (Integer) —
int
— Log2I - Log2 (Real) —
fixed
— Log2 - Log (Real) —
fixed
— libNtve_gf_Log - Modulo (Integer) —
int
— ModI - Modulo (Real) —
fixed
— ModF - Power (Integer) —
int
— PowI - Power (Real) —
fixed
— Pow - Round (Integer) —
int
— RoundI - Round (Real) —
fixed
— Round - Pow2 (Integer) —
int
— Pow2I - Pow2 (Real) —
fixed
— Pow2 - Square Root (Integer) —
int
— SquareRootI - Square Root (Real) —
fixed
— SquareRoot - Trunc (Integer) —
int
— TruncI - Trunc (Real) —
fixed
— Trunc
# Examples
mods/heroesmapmods/battlegroundmapmods/volskayamechanics.stormmod — base.stormdata/LibVLSK.galaxy:311
}
else {
libVLSK_gv_capturePoints[lp_capturePointIndex].lv_contestTimes[lp_contestingTeam] = libNtve_gf_ArithmeticRealClamp(lv_newProgress, 0.0, libVLSK_gv_capturePointContestTimeGoal_C);
}
if ((libVLSK_gv_capturePoints[lp_capturePointIndex].lv_contestTimes[lp_contestingTeam] == libVLSK_gv_capturePointContestTimeGoal_C) && (libVLSK_gv_capturePoints[lp_capturePointIndex].lv_owningTeam != lp_contestingTeam)) {
mods/heroesmapmods/battlegroundmapmods/volskayamechanics.stormmod — base.stormdata/LibVLSK.galaxy:390
// Implementation
libVLSK_gv_capturePoints[lp_capturePointIndex].lv_contestTimes[lp_team] = libNtve_gf_ArithmeticRealClamp(lv_newProgressValue, 0.0, libVLSK_gv_capturePointContestTimeGoal_C);
if ((libVLSK_gv_capturePoints[lp_capturePointIndex].lv_contestTimes[lp_team] == 0.0)) {
if ((libVLSK_gv_capturePoints[lp_capturePointIndex].lv_wasDecaying[lp_team] == true)) {
mods/heroesmapmods/battlegroundmapmods/volskayamechanics.stormmod — base.stormdata/LibVLSK.galaxy:438
lv_team = 1;
for ( ; ( (auto8A7EDE45_ai >= 0 && lv_team <= auto8A7EDE45_ae) || (auto8A7EDE45_ai < 0 && lv_team >= auto8A7EDE45_ae) ) ; lv_team += auto8A7EDE45_ai ) {
libVLSK_gv_capturePoints[lp_capturePointIndex].lv_victoryTimes[lv_team] = libNtve_gf_ArithmeticRealClamp(libVLSK_gv_capturePoints[lp_capturePointIndex].lv_victoryTimes[lv_team], 0.0, (libVLSK_gv_capturePointVictoryTimeGoal_C * 0.999));
}
}
mods/heromods/hanzo.stormmod — base.stormdata/LibHHAN.galaxy:230
lv_currentSearchStartDistance = lv_currentEstimatedMissileDistance;
lv_currentSearchEndDistance = (lv_currentSearchStartDistance - lv_searchLength);
lv_currentSearchStartDistance = libNtve_gf_ArithmeticRealClamp(lv_currentSearchStartDistance, lv_searchStartDistance, lv_searchEndDistance);
lv_currentSearchEndDistance = libNtve_gf_ArithmeticRealClamp(lv_currentSearchEndDistance, lv_searchStartDistance, lv_searchEndDistance);
lv_currentSearchLength = (lv_currentSearchStartDistance - lv_currentSearchEndDistance);
mods/heromods/hanzo.stormmod — base.stormdata/LibHHAN.galaxy:231
lv_currentSearchEndDistance = (lv_currentSearchStartDistance - lv_searchLength);
lv_currentSearchStartDistance = libNtve_gf_ArithmeticRealClamp(lv_currentSearchStartDistance, lv_searchStartDistance, lv_searchEndDistance);
lv_currentSearchEndDistance = libNtve_gf_ArithmeticRealClamp(lv_currentSearchEndDistance, lv_searchStartDistance, lv_searchEndDistance);
lv_currentSearchLength = (lv_currentSearchStartDistance - lv_currentSearchEndDistance);
CatalogFieldValueSetFixed(c_gameCatalogEffect, "HanzoDragonstrikeSearchArea", "AreaArray[" + IntToString(0) + "].RectangleHeight", lv_playerNumber, lv_currentSearchLength);