]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/slider.c
Add Archer to the credits
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / slider.c
index 46a01bb5ac0e3c1c1e089a90836c4de3b851370f..aba15ecae625d244fda71f4eb60f9c623a61787b 100644 (file)
@@ -33,21 +33,24 @@ entity makeXonoticSlider(float theValueMin, float theValueMax, float theValueSte
 }
 void XonoticSlider_configureXonoticSlider(entity me, float theValueMin, float theValueMax, float theValueStep, string theCvar)
 {
-       float v, vk, vp;
-       v = theValueMin;
-       vk = theValueStep;
+       float vp;
        vp = theValueStep * 10;
        while(fabs(vp) < fabs(theValueMax - theValueMin) / 40)
                vp *= 10;
+
        me.configureSliderVisuals(me, me.fontSize, me.align, me.valueSpace, me.image);
-       me.configureSliderValues(me, theValueMin, v, theValueMax, theValueStep, vk, vp);
+
        if(theCvar)
        {
+               // Prevent flickering of the slider button by initialising the
+               // slider out of bounds to hide the button before loading the cvar
+               me.configureSliderValues(me, theValueMin, theValueMin-theValueStep, theValueMax, theValueStep, theValueStep, vp);
                me.cvarName = theCvar;
                me.loadCvars(me);
-               if(tooltipdb >= 0)
-                       me.tooltip = getZonedTooltipForIdentifier(theCvar);
+               me.tooltip = getZonedTooltipForIdentifier(theCvar);
        }
+       else
+               me.configureSliderValues(me, theValueMin, theValueMin, theValueMax, theValueStep, theValueStep, vp);
 }
 void XonoticSlider_setValue(entity me, float val)
 {
@@ -59,14 +62,14 @@ void XonoticSlider_setValue(entity me, float val)
 }
 void XonoticSlider_loadCvars(entity me)
 {
-       if not(me.cvarName)
+       if (!me.cvarName)
                return;
 
        me.setValue( me, cvar(me.cvarName) );
 }
 void XonoticSlider_saveCvars(entity me)
 {
-       if not(me.cvarName)
+       if (!me.cvarName)
                return;
 
        cvar_set(me.cvarName, ftos(me.value));