11 float minfactor, maxfactor;
14 sz =
cvar(
"menu_vid_scale");
45 c_y = c.x * r.y * r.z / r.x;
49 c_x = c.y * r.x / (r.y * r.z);
52 f =
min(r.x / c.x, r.y / c.y);
56 minfactor =
min(1, 640 / c.x);
57 maxfactor =
max(1, r.x / c.x, r.y / c.y);
62 f = 1 - (maxfactor - 1) * sz;
64 f = 1 + (minfactor - 1) * sz;
75 if (c.x !=
cvar(
"vid_conwidth") || c.y !=
cvar(
"vid_conheight"))
87 me.configureXonoticResolutionSlider(me);
92 if (me.maxAllowedWidth && w > me.maxAllowedWidth)
94 if (me.maxAllowedHeight && h > me.maxAllowedHeight)
97 for (i = 0; i < me.nValues; ++i)
104 if (pixelheight >
stof(
argv(2)) + 0.01)
continue;
105 if (pixelheight <
stof(
argv(2)) - 0.01)
break;
108 if (pixelheight != 1)
110 float aspect = w / (h * pixelheight);
111 float bestdenom =
rint(aspect);
114 for (denom = 2; denom < 10; ++denom) {
115 float num =
rint(aspect * denom);
116 if (
fabs(num / denom - aspect) <
fabs(bestnum / bestdenom - aspect))
122 me.insertValue(me, i,
strzone(sprintf(
"%dx%d (%d:%d)", w, h, bestnum, bestdenom)),
strzone(
strcat(
ftos(w),
" ",
ftos(h),
" ",
ftos(pixelheight))));
130 me.configureXonoticTextSlider(me,
"_menu_vid_width",
131 _(
"Screen resolution"));
132 me.loadResolutions(me,
cvar(
"vid_fullscreen"));
141 for(i = 0; i < me.nValues; ++i)
148 me.maxAllowedWidth = 0;
149 me.maxAllowedHeight = 0;
156 if(r_x == 0 && r_y == 0)
158 if(r.x < 640 || r.y < 480)
163 me.addResolution(me, r.x, r.y, r.z);
166 if(r.x != 0 || r.y != 0)
167 me.addResolution(me, r.x, r.y, r.z);
176 if(r.x == 0 && r.y == 0)
180 if(r.x != 0 || r.y != 0)
182 me.maxAllowedWidth = r.x;
183 me.maxAllowedHeight = r.y;
184 me.addResolution(me, r.x, r.y, r.z);
188 me.addResolution(me, 640, 480, 1);
190 me.addResolution(me, 720, 480, 1.125);
191 me.addResolution(me, 720, 576, 0.9375);
192 me.addResolution(me, 720, 480, 0.84375);
193 me.addResolution(me, 720, 576, 0.703125);
195 me.addResolution(me, 800, 480, 1);
196 me.addResolution(me, 800, 600, 1);
197 me.addResolution(me, 1024, 600, 1);
198 me.addResolution(me, 1024, 768, 1);
199 me.addResolution(me, 1280, 720, 1);
200 me.addResolution(me, 1280, 960, 1);
201 me.addResolution(me, 1280, 1024, 1);
202 me.addResolution(me, 1920, 1080, 1);
205 LOG_TRACE(
"Total number of resolutions detected: ",
ftos(me.nValues));
207 me.vid_fullscreen = fullscreen;
209 me.configureXonoticTextSliderValues(me);
217 if(me.value >= 0 || me.value < me.nValues)
225 cvar_set(
"_menu_vid_desktopfullscreen",
"1");
227 cvar_set(
"_menu_vid_desktopfullscreen",
"0");
232 if (
cvar(
"vid_fullscreen") != me.vid_fullscreen)
234 me.loadResolutions(me,
cvar(
"vid_fullscreen"));
void XonoticResolutionSlider_addResolution(entity me, float w, float h, float pixelheight)
void XonoticResolutionSlider_loadResolutions(entity me, float fullscreen)
void XonoticResolutionSlider_saveCvars(entity me)
spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 spree_cen s1 f1 s1 strcat(_("Level %s: "), "^BG%s\3\, _("^BGPress ^F2%s^BG to enter the game"))
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float CVAR_TYPEFLAG_ENGINE
float XonoticResolutionSlider_DataHasChanged
entity makeXonoticResolutionSlider()
float autocvar_menu_vid_allowdualscreenresolution
void XonoticResolutionSlider_configureXonoticResolutionSlider(entity me)
void XonoticResolutionSlider_draw(entity me)
float updateConwidths(float width, float height, float pixelheight)
void XonoticResolutionSlider_loadCvars(entity me)