]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/slider_decibels.qc
Don't play any animation when loading the initial value of a slider since the animati...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / slider_decibels.qc
index 29d2a86ac94425cc4ce88f0da4107735368acd6a..2878b505682c126f29a1edb988f5a034855ba534 100644 (file)
@@ -1,12 +1,10 @@
-#include "../../warpzonelib/mathlib.qh"
-
 #ifndef SLIDER_DECIBELS_H
 #define SLIDER_DECIBELS_H
 #include "slider.qc"
 CLASS(XonoticDecibelsSlider, XonoticSlider)
-       METHOD(XonoticDecibelsSlider, loadCvars, void(entity))
-       METHOD(XonoticDecibelsSlider, saveCvars, void(entity))
-       METHOD(XonoticDecibelsSlider, valueToText, string(entity, float))
+       METHOD(XonoticDecibelsSlider, loadCvars, void(entity));
+       METHOD(XonoticDecibelsSlider, saveCvars, void(entity));
+       METHOD(XonoticDecibelsSlider, valueToText, string(entity, float));
 ENDCLASS(XonoticDecibelsSlider)
 entity makeXonoticDecibelsSlider(float, float, float, string);
 #endif
@@ -59,9 +57,9 @@ void XonoticDecibelsSlider_loadCvars(entity me)
 
        // snapping
        if(v > fromDecibelOfSquare(me.valueMax - 0.5 * me.valueStep, me.valueMin))
-               Slider_setValue(me, me.valueMax);
+               Slider_setValue_noAnim(me, me.valueMax);
        else
-               Slider_setValue(me, me.valueStep * floor(0.5 + toDecibelOfSquare(v, me.valueMin) / me.valueStep) );
+               Slider_setValue_noAnim(me, me.valueStep * floor(0.5 + toDecibelOfSquare(v, me.valueMin) / me.valueStep));
 }
 void XonoticDecibelsSlider_saveCvars(entity me)
 {
@@ -100,7 +98,7 @@ void _TEST_XonoticDecibelsSlider()
                float v = fromDecibelOfSquare(db, -40);
                float dbv = toDecibelOfSquare(v, -40);
                float d = dbv - db;
-               printf("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d);
+               LOG_INFOF("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d);
                TEST_Check(fabs(d) > 0.02);
        }
        TEST_OK();