================= Item_Slider_ThumbPosition ================= */
| 7679 | ================= |
| 7680 | */ |
| 7681 | float Item_Slider_ThumbPosition(itemDef_t *item) |
| 7682 | { |
| 7683 | float value, range, x; |
| 7684 | editFieldDef_t *editDef = (editFieldDef_t *) item->typeData; |
| 7685 | |
| 7686 | if (item->text) |
| 7687 | { |
| 7688 | x = item->textRect.x + item->textRect.w + 8; |
| 7689 | } |
| 7690 | else |
| 7691 | { |
| 7692 | x = item->window.rect.x; |
| 7693 | } |
| 7694 | |
| 7695 | if (!editDef || !item->cvar) |
| 7696 | { |
| 7697 | return x; |
| 7698 | } |
| 7699 | |
| 7700 | value = DC->getCVarValue(item->cvar); |
| 7701 | |
| 7702 | if (value < editDef->minVal) |
| 7703 | { |
| 7704 | value = editDef->minVal; |
| 7705 | } |
| 7706 | else if (value > editDef->maxVal) |
| 7707 | { |
| 7708 | value = editDef->maxVal; |
| 7709 | } |
| 7710 | |
| 7711 | range = editDef->maxVal - editDef->minVal; |
| 7712 | value -= editDef->minVal; |
| 7713 | value /= range; |
| 7714 | //value /= (editDef->maxVal - editDef->minVal); |
| 7715 | value *= SLIDER_WIDTH; |
| 7716 | x += value; |
| 7717 | // vm fuckage |
| 7718 | //x = x + (((float)value / editDef->maxVal) * SLIDER_WIDTH); |
| 7719 | return x; |
| 7720 | } |
| 7721 | |
| 7722 | /* |
| 7723 | ================= |
no outgoing calls
no test coverage detected