X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fslider_resolution.c;h=66f48f9e58ef2bf26f838e6736889632fe659d1a;hb=ce4e626fe2d78ad7779e4e9ccc9cc46f850493ea;hp=0c33e345546c9db0d85636cb7e1380f775ef3430;hpb=fa4ba6cd36e500c0b6744d12bfa1e7bfa7b39ccd;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/slider_resolution.c b/qcsrc/menu/xonotic/slider_resolution.c index 0c33e3455..66f48f9e5 100644 --- a/qcsrc/menu/xonotic/slider_resolution.c +++ b/qcsrc/menu/xonotic/slider_resolution.c @@ -9,7 +9,7 @@ CLASS(XonoticResolutionSlider) EXTENDS(XonoticTextSlider) ATTRIB(XonoticResolutionSlider, vid_fullscreen, float, -1) ENDCLASS(XonoticResolutionSlider) entity makeXonoticResolutionSlider(); -void updateConwidths(float width, float height, float pixelheight); +float updateConwidths(float width, float height, float pixelheight); #endif #ifdef IMPLEMENTATION @@ -17,12 +17,16 @@ void updateConwidths(float width, float height, float pixelheight); /* private static */ float XonoticResolutionSlider_DataHasChanged; // Updates cvars (to be called by menu.qc at startup or on detected res change) -void updateConwidths(float width, float height, float pixelheight) +float updateConwidths(float width, float height, float pixelheight) { vector r, c; float minfactor, maxfactor; float sz, f; + sz = cvar("menu_vid_scale"); + if (sz < -1) + return 0; // No recalculation. + // Save off current settings. cvar_set("_menu_vid_width", ftos(width)); cvar_set("_menu_vid_height", ftos(height)); @@ -32,7 +36,6 @@ void updateConwidths(float width, float height, float pixelheight) r_x = width; r_y = height; r_z = pixelheight; - sz = cvar("menu_vid_scale"); // calculate the base resolution c_z = 0; @@ -61,9 +64,19 @@ void updateConwidths(float width, float height, float pixelheight) f = 1; c = c * f; // fteqcc fail - cvar_set("vid_conwidth", ftos(rint(c_x))); - cvar_set("vid_conheight", ftos(rint(c_y))); + c_x = rint(c_x); + c_y = rint(c_y); + + // Please reload resolutions list and such stuff. XonoticResolutionSlider_DataHasChanged = TRUE; + + if (c_x != cvar("vid_conwidth") || c_y != cvar("vid_conheight")) + { + cvar_set("vid_conwidth", ftos(c_x)); + cvar_set("vid_conheight", ftos(c_y)); + return 1; + } + return 0; } entity makeXonoticResolutionSlider() { @@ -149,10 +162,12 @@ void XonoticResolutionSlider_loadResolutions(entity me, float fullscreen) if(me.nValues == 0) { me.addResolution(me, 640, 480, 1); // pc res +#if 0 me.addResolution(me, 720, 480, 1.125); // DVD NTSC 4:3 me.addResolution(me, 720, 576, 0.9375); // DVD PAL 4:3 me.addResolution(me, 720, 480, 0.84375); // DVD NTSC 16:9 me.addResolution(me, 720, 576, 0.703125); // DVD PAL 16:9 +#endif me.addResolution(me, 800, 480, 1); // 480p at 1:1 pixel aspect me.addResolution(me, 800, 600, 1); // pc res me.addResolution(me, 1024, 600, 1); // notebook res