]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/slider_resolution.c
Merge remote branch 'origin/master' into samual/updatecommands
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / slider_resolution.c
index ed6db5b69eaef49cd3c4ce2c64147660ba81c619..2e3ea4ce4c4d255166b123e5062b6d8fff345df3 100644 (file)
@@ -34,8 +34,8 @@ void updateConwidths()
        if(f < 1)
                c = c * f; // ensures that c_x <= r_x and c_y <= r_y
 
-       minfactor = min(1, 640 / c_x);             // can be > 1 only if c_x is <640
-       maxfactor = max3(1, r_x / c_x, r_y / c_y); // can be < 1 only if r_x < c_x and r_y < c_y
+       minfactor = min(1, 640 / c_x);            // can be > 1 only if c_x is <640
+       maxfactor = max(1, r_x / c_x, r_y / c_y); // can be < 1 only if r_x < c_x and r_y < c_y
        dprint("min factor: ", ftos(minfactor), "\n");
        dprint("max factor: ", ftos(maxfactor), "\n");
 
@@ -60,12 +60,12 @@ entity makeXonoticResolutionSlider()
        me.configureXonoticResolutionSlider(me);
        return me;
 }
-void addResolutionXonoticResolutionSlider(entity me, float w, float h, float pixelheight)
+void XonoticResolutionSlider_addResolution(entity me, float w, float h, float pixelheight)
 {
-       me.addValue(me, strzone(strcat(ftos(w), "x", ftos(h))), strzone(strcat(ftos(w), " ", ftos(h), " ", ftos(pixelheight))));
+       me.addValue(me, strzone(sprintf(_("%dx%d"), w, h)), strzone(strcat(ftos(w), " ", ftos(h), " ", ftos(pixelheight))));
        // FIXME (in case you ever want to dynamically instantiate this): THIS IS NEVER FREED
 }
-void configureXonoticResolutionSliderXonoticResolutionSlider(entity me)
+void XonoticResolutionSlider_configureXonoticResolutionSlider(entity me)
 {
        float i;
        vector r0, r;
@@ -83,18 +83,31 @@ void configureXonoticResolutionSliderXonoticResolutionSlider(entity me)
                if(r == r0)
                        continue;
                r0 = r;
-               if(r_x < 640 || r_y < 400)
+               if(r_x < 640 || r_y < 480)
+                       continue;
+               if(r_x > 2 * r_y) // likely dualscreen resolution, skip this one
                        continue;
                me.addResolution(me, r_x, r_y, r_z);
        }
 
+       if(me.nValues == 0)
+       {
+               me.addResolution(me, 640, 480, 1);
+               me.addResolution(me, 800, 600, 1);
+               me.addResolution(me, 1024, 768, 1);
+               me.addResolution(me, 1280, 960, 1);
+               me.addResolution(me, 1280, 1024, 1);
+               me.addResolution(me, 1650, 1080, 1);
+               me.addResolution(me, 1920, 1080, 1);
+       }
+
        me.configureXonoticTextSliderValues(me);
 }
-void loadCvarsXonoticResolutionSlider(entity me)
+void XonoticResolutionSlider_loadCvars(entity me)
 {
        me.setValueFromIdentifier(me, strcat(cvar_string("menu_vid_width"), " ", cvar_string("menu_vid_height"), " ", cvar_string("menu_vid_pixelheight")));
 }
-void saveCvarsXonoticResolutionSlider(entity me)
+void XonoticResolutionSlider_saveCvars(entity me)
 {
        if(me.value >= 0 || me.value < me.nValues)
        {