]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
menuqc: new width/height handling, no longer trust the vid_ cvars. Also fixes vid_res...
authorRudolf Polzer <divverent@xonotic.org>
Tue, 20 Aug 2013 08:35:29 +0000 (10:35 +0200)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 20 Aug 2013 08:35:29 +0000 (10:35 +0200)
qcsrc/common/util-pre.qh
qcsrc/menu/menu.qc
qcsrc/menu/xonotic/slider_resolution.c

index 1c2c1cc9f266fdb2fdc16ab627e95fd46ca9be18..f0f243abc999696733349004353d2d6f09351fd8 100644 (file)
@@ -12,6 +12,7 @@
 //# define COMPAT_XON050_ENGINE
 # define COMPAT_NO_MOD_IS_XONOTIC
 # define COMPAT_XON060_DONTCRASH_CHECKPVS
+# define COMPAT_XON070_OLD_M_DRAW
 #endif
 
 #ifdef FTEQCC
index a76efb8e367840cc3737734a781c104556bbe935..490a40a4d116bc497a0add07acaf6a4941490a4f 100644 (file)
@@ -93,7 +93,8 @@ void m_init()
 
 float MENU_ASPECT = 1.25; // 1280x1024
 float MENU_MINHEIGHT = 600;
-float conwidth_s, conheight_s, realconwidth, realconheight, screenconwidth, screenconheight;
+float conwidth_s, conheight_s, vidwidth_s, vidheight_s, realconwidth,
+      realconheight, screenconwidth, screenconheight;
 void draw_reset_cropped()
 {
        draw_reset(screenconwidth, screenconheight, 0.5 * (realconwidth - screenconwidth), 0.5 * (realconheight - screenconheight));
@@ -102,8 +103,16 @@ void draw_reset_full()
 {
        draw_reset(realconwidth, realconheight, 0, 0);
 }
-void UpdateConWidthHeight()
+
+void UpdateConWidthHeight(float w, float h)
 {
+       if (w != vidwidth_s || h != vidheight_s)
+       {
+               initConwidths(w, h);
+               updateConwidths();
+               vidwidth_s = w;
+               vidheight_s = h;
+       }
        conwidth_s = conwidth;
        conheight_s = conheight;
        realconwidth = cvar("vid_conwidth");
@@ -149,7 +158,7 @@ void m_init_delayed()
        string s;
 
        conwidth = conheight = -1;
-       UpdateConWidthHeight();
+       UpdateConWidthHeight(cvar("vid_width"), cvar("vid_height"));
        draw_reset_cropped();
 
        menuInitialized = 0;
@@ -658,7 +667,7 @@ void m_tooltip(vector pos)
        }
 }
 
-void m_draw()
+void m_draw(float width, float height)
 {
        float t;
        float realFrametime;
@@ -673,7 +682,13 @@ void m_draw()
                anim.tickAll(anim);
 
        if(main)
-               UpdateConWidthHeight();
+       {
+#ifdef COMPAT_XON070_OLD_M_DRAW
+               UpdateConWidthHeight(width ? width : cvar("vid_width"), height ? height : cvar("vid_height"));
+#else
+               UpdateConWidthHeight(width, height);
+#endif
+       }
 
        if(!menuInitialized)
        {
index 8bd47e799983abe4207446224c390a6441e4d1bc..1a77f2adf87272dcb29591adf23e7953304fa994 100644 (file)
@@ -11,10 +11,10 @@ void updateConwidths();
 #endif
 
 #ifdef IMPLEMENTATION
-void initConwidths()
+void initConwidths(float width, float height)
 {
-       cvar_set("_menu_vid_width", cvar_string("vid_width"));
-       cvar_set("_menu_vid_height", cvar_string("vid_height"));
+       cvar_set("_menu_vid_width", ftos(width));
+       cvar_set("_menu_vid_height", ftos(height));
        cvar_set("_menu_vid_pixelheight", cvar_string("vid_pixelheight"));
 }
 void updateConwidths()