From: Mario <mario.mario@y7mail.com>
Date: Tue, 21 Jul 2020 16:55:01 +0000 (+1000)
Subject: Rough support for vid_conwidthauto
X-Git-Tag: xonotic-v0.8.5~840
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ebb31cd8b26835b9103733e0b383bce8c0e2534a;p=xonotic%2Fxonotic-data.pk3dir.git

Rough support for vid_conwidthauto
---

diff --git a/qcsrc/menu/xonotic/slider_resolution.qc b/qcsrc/menu/xonotic/slider_resolution.qc
index 9a55f8840..70b108ae3 100644
--- a/qcsrc/menu/xonotic/slider_resolution.qc
+++ b/qcsrc/menu/xonotic/slider_resolution.qc
@@ -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;