Rough support for vid_conwidthauto
authorMario <mario.mario@y7mail.com>
Tue, 21 Jul 2020 16:55:01 +0000 (02:55 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 21 Jul 2020 16:55:14 +0000 (02:55 +1000)
qcsrc/menu/xonotic/slider_resolution.qc

index 9a55f88..70b108a 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;