]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/slider_particles.qc
Merge branch 'master' into terencehill/tooltips_cleanup
[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                 _("Multiplier for amount of particles. Less means less particles, which in turn gives for better performance (default: 1)"));
24         if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^OMG")),      "0.4 250 0"); }
25         me.addValue(me,                         ZCTX(_("PART^Low")),      "0.4 500 0");
26         me.addValue(me,                         ZCTX(_("PART^Medium")),   "0.8 750 0");
27         me.addValue(me,                         ZCTX(_("PART^Normal")),   "1.0 1000 1");
28         me.addValue(me,                         ZCTX(_("PART^High")),     "1.0 1500 1");
29         me.addValue(me,                         ZCTX(_("PART^Ultra")),    "1.0 2000 2");
30         if(cvar("developer")) { me.addValue(me, ZCTX(_("PART^Ultimate")), "1.0 3000 2"); }
31         me.configureXonoticTextSliderValues(me);
32 }
33 void XonoticParticlesSlider_loadCvars(entity me)
34 {
35         me.setValueFromIdentifier_noAnim(me, sprintf("%s %s %s",
36                 cvar_string("cl_particles_quality"),
37                 cvar_string("r_drawparticles_drawdistance"),
38                 cvar_string("cl_damageeffect")
39         ));
40 }
41 void XonoticParticlesSlider_saveCvars(entity me)
42 {
43         if(me.value >= 0 || me.value < me.nValues)
44         {
45                 tokenize_console(me.getIdentifier(me));
46                 cvar_set("cl_particles_quality", argv(0));
47                 cvar_set("r_drawparticles_drawdistance", argv(1));
48                 cvar_set("cl_damageeffect", argv(2));
49         }
50 }
51 #endif