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_particles.qc
1 #ifndef SLIDER_PARTICLES_H
2 #define SLIDER_PARTICLES_H
3 #include "textslider.qc"
4 CLASS(XonoticParticlesSlider, XonoticTextSlider)
5         METHOD(XonoticParticlesSlider, configureXonoticParticlesSlider, void(entity));
6         METHOD(XonoticParticlesSlider, loadCvars, void(entity));
7         METHOD(XonoticParticlesSlider, saveCvars, void(entity));
8 ENDCLASS(XonoticParticlesSlider)
9 entity makeXonoticParticlesSlider();
10 #endif
11
12 #ifdef IMPLEMENTATION
13 entity makeXonoticParticlesSlider()
14 {
15         entity me;
16         me = NEW(XonoticParticlesSlider);
17         me.configureXonoticParticlesSlider(me);
18         return me;
19 }
20 void XonoticParticlesSlider_configureXonoticParticlesSlider(entity me)
21 {
22         me.configureXonoticTextSlider(me, "cl_particles_quality");
23         if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^OMG")),      "0.4 250 0"); }
24         me.addValue(me,                         ZCTX(_("PART^Low")),      "0.4 500 0");
25         me.addValue(me,                         ZCTX(_("PART^Medium")),   "0.8 750 0");
26         me.addValue(me,                         ZCTX(_("PART^Normal")),   "1.0 1000 1");
27         me.addValue(me,                         ZCTX(_("PART^High")),     "1.0 1500 1");
28         me.addValue(me,                         ZCTX(_("PART^Ultra")),    "1.0 2000 2");
29         if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^Ultimate")), "1.0 3000 2"); }
30         me.configureXonoticTextSliderValues(me);
31 }
32 void XonoticParticlesSlider_loadCvars(entity me)
33 {
34         me.setValueFromIdentifier_noAnim(me, sprintf("%s %s %s",
35                 cvar_string("cl_particles_quality"),
36                 cvar_string("r_drawparticles_drawdistance"),
37                 cvar_string("cl_damageeffect")
38         ));
39 }
40 void XonoticParticlesSlider_saveCvars(entity me)
41 {
42         if(me.value >= 0 || me.value < me.nValues)
43         {
44                 tokenize_console(me.getIdentifier(me));
45                 cvar_set("cl_particles_quality", argv(0));
46                 cvar_set("r_drawparticles_drawdistance", argv(1));
47                 cvar_set("cl_damageeffect", argv(2));
48         }
49 }
50 #endif