]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/menu/xonotic/slider_resolution.qc
Merge branch 'Mario/headshots' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / slider_resolution.qc
index 1e0a80b7676d91f349d21045f06167b5f9fe0b04..70b108ae339af06a97c43c62a77aed7a9d0fdbc2 100644 (file)
@@ -1,6 +1,8 @@
 #include "slider_resolution.qh"
 
 /* private static */ float XonoticResolutionSlider_DataHasChanged;
+/* attrib */ float vid_conwidth;
+/* attrib */ float vid_conheight;
 
 // Updates cvars (to be called by menu.qc at startup or on detected res change)
 float updateConwidths(float width, float height, float pixelheight)
@@ -19,6 +21,20 @@ float updateConwidths(float width, float height, float pixelheight)
        cvar_set("_menu_vid_pixelheight", ftos(pixelheight));
        cvar_set("_menu_vid_desktopfullscreen", cvar_string("vid_desktopfullscreen"));
 
+       // engine is handling conwidth calculations!
+       if((cvar_type("vid_conwidthauto") & CVAR_TYPEFLAG_ENGINE) && cvar("vid_conwidthauto"))
+       {
+               if(vid_conwidth != cvar("vid_conwidth") || vid_conheight != cvar("vid_conheight"))
+               {
+                       // Please reload resolutions list and such stuff.
+                       XonoticResolutionSlider_DataHasChanged = true;
+                       vid_conwidth = cvar("vid_conwidth");
+                       vid_conheight = cvar("vid_conheight");
+                       return 1;
+               }
+               return 0; // No recalculation
+       }
+
        r_x = width;
        r_y = height;
        r_z = pixelheight;
@@ -39,8 +55,8 @@ float updateConwidths(float width, float height, float pixelheight)
 
        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
-       LOG_TRACE("min factor: ", ftos(minfactor), "\n");
-       LOG_TRACE("max factor: ", ftos(maxfactor), "\n");
+       LOG_TRACE("min factor: ", ftos(minfactor));
+       LOG_TRACE("max factor: ", ftos(maxfactor));
 
        if(sz < 0)
                f = 1 - (maxfactor - 1) * sz;
@@ -149,7 +165,7 @@ void XonoticResolutionSlider_loadResolutions(entity me, float fullscreen)
                r = getresolution(-1);
                if(r.x != 0 || r.y != 0)
                        me.addResolution(me, r.x, r.y, r.z);
-               LOG_TRACE("Added system resolutions.\n");
+               LOG_TRACE("Added system resolutions.");
        }
 
        if(me.nValues == 0)
@@ -184,9 +200,9 @@ void XonoticResolutionSlider_loadResolutions(entity me, float fullscreen)
                me.addResolution(me, 1280, 960, 1); // pc res
                me.addResolution(me, 1280, 1024, 1); // pc res
                me.addResolution(me, 1920, 1080, 1); // 1080p
-               LOG_TRACE("Added default resolutions.\n");
+               LOG_TRACE("Added default resolutions.");
        }
-       LOG_TRACE("Total number of resolutions detected: ", ftos(me.nValues), "\n");
+       LOG_TRACE("Total number of resolutions detected: ", ftos(me.nValues));
 
        me.vid_fullscreen = fullscreen;