2009-02-28 14:41:18 +00:00
|
|
|
/*
|
2010-10-18 14:23:07 +00:00
|
|
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
*
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
* 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* =======================================================================
|
|
|
|
*
|
|
|
|
* This is the refresher dependend video menu. If you add a new
|
2012-08-02 12:39:33 +00:00
|
|
|
* refresher this menu must be altered.
|
2010-10-18 14:23:07 +00:00
|
|
|
*
|
|
|
|
* =======================================================================
|
|
|
|
*/
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
#include "../../client/header/client.h"
|
|
|
|
#include "../../client/menu/header/qmenu.h"
|
2017-04-10 19:37:08 +00:00
|
|
|
#include "header/qmenu.h"
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-08-02 12:39:33 +00:00
|
|
|
extern void M_ForceMenuOff(void);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
static cvar_t *gl_mode;
|
2017-12-09 11:30:52 +00:00
|
|
|
#ifdef REFSOFT
|
|
|
|
static cvar_t *sw_mode;
|
|
|
|
#endif
|
2015-06-06 18:45:05 +00:00
|
|
|
static cvar_t *gl_hudscale;
|
2015-11-08 11:46:38 +00:00
|
|
|
static cvar_t *gl_consolescale;
|
|
|
|
static cvar_t *gl_menuscale;
|
2015-11-09 21:09:48 +00:00
|
|
|
static cvar_t *crosshair_scale;
|
2014-05-04 18:47:52 +00:00
|
|
|
static cvar_t *fov;
|
|
|
|
extern cvar_t *scr_viewsize;
|
|
|
|
extern cvar_t *vid_gamma;
|
|
|
|
extern cvar_t *vid_fullscreen;
|
2017-04-10 19:37:08 +00:00
|
|
|
extern cvar_t *vid_renderer;
|
2014-04-12 13:03:40 +00:00
|
|
|
static cvar_t *gl_swapinterval;
|
2014-05-04 18:26:12 +00:00
|
|
|
static cvar_t *gl_anisotropic;
|
2014-05-04 18:47:52 +00:00
|
|
|
static cvar_t *gl_msaa_samples;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
static menuframework_s s_opengl_menu;
|
|
|
|
|
2017-04-10 19:37:08 +00:00
|
|
|
static menulist_s s_renderer_list;
|
2012-08-02 12:39:33 +00:00
|
|
|
static menulist_s s_mode_list;
|
2015-11-08 11:46:38 +00:00
|
|
|
static menulist_s s_uiscale_list;
|
2012-08-02 12:39:33 +00:00
|
|
|
static menuslider_s s_brightness_slider;
|
2017-08-30 13:05:02 +00:00
|
|
|
static menuslider_s s_fov_slider;
|
2012-08-02 12:39:33 +00:00
|
|
|
static menulist_s s_fs_box;
|
2014-04-12 13:03:40 +00:00
|
|
|
static menulist_s s_vsync_list;
|
2014-05-04 18:26:12 +00:00
|
|
|
static menulist_s s_af_list;
|
2014-04-16 20:47:23 +00:00
|
|
|
static menulist_s s_msaa_list;
|
2012-08-02 12:39:33 +00:00
|
|
|
static menuaction_s s_defaults_action;
|
2014-04-12 13:03:40 +00:00
|
|
|
static menuaction_s s_apply_action;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2017-04-10 19:37:08 +00:00
|
|
|
static int
|
|
|
|
GetRenderer(void)
|
|
|
|
{
|
|
|
|
/* First element in array is 'OpenGL 1.4' aka gl1.
|
|
|
|
Second element in array is 'OpenGL 3.2' aka gl3.
|
|
|
|
Third element in array is unknown renderer. */
|
|
|
|
if (Q_stricmp(vid_renderer->string, "gl1") == 0)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
else if (Q_stricmp(vid_renderer->string, "gl3") == 0)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
2017-12-09 11:30:52 +00:00
|
|
|
#ifdef REFSOFT
|
|
|
|
else if (Q_stricmp(vid_renderer->string, "soft") == 0)
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
#else
|
2017-04-10 19:37:08 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return 2;
|
|
|
|
}
|
2017-12-09 11:30:52 +00:00
|
|
|
#endif
|
2017-04-10 19:37:08 +00:00
|
|
|
}
|
|
|
|
|
2015-11-16 18:11:00 +00:00
|
|
|
static int
|
2015-11-16 21:23:15 +00:00
|
|
|
GetCustomValue(menulist_s *list)
|
2015-11-16 18:11:00 +00:00
|
|
|
{
|
2015-11-16 21:23:15 +00:00
|
|
|
static menulist_s *last;
|
|
|
|
static int i;
|
2015-11-16 18:11:00 +00:00
|
|
|
|
2015-11-16 21:23:15 +00:00
|
|
|
if (list != last)
|
2015-11-16 18:11:00 +00:00
|
|
|
{
|
2015-11-16 21:23:15 +00:00
|
|
|
last = list;
|
|
|
|
i = list->curvalue;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
while (list->itemnames[i]);
|
|
|
|
i--;
|
2015-11-16 18:11:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
static void
|
2012-07-22 13:34:45 +00:00
|
|
|
BrightnessCallback(void *s)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
menuslider_s *slider = (menuslider_s *)s;
|
2009-03-05 15:26:46 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
float gamma = slider->curvalue / 10.0;
|
|
|
|
Cvar_SetValue("vid_gamma", gamma);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2017-08-30 13:05:02 +00:00
|
|
|
static void
|
|
|
|
FOVCallback(void *s) {
|
|
|
|
menuslider_s *slider = (menuslider_s *)s;
|
|
|
|
Cvar_SetValue("fov", slider->curvalue);
|
|
|
|
}
|
|
|
|
|
2014-05-04 18:26:12 +00:00
|
|
|
static void
|
|
|
|
AnisotropicCallback(void *s)
|
|
|
|
{
|
|
|
|
menulist_s *list = (menulist_s *)s;
|
|
|
|
|
2014-05-05 16:31:08 +00:00
|
|
|
if (list->curvalue == 0)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("gl_anisotropic", 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Cvar_SetValue("gl_anisotropic", pow(2, list->curvalue));
|
|
|
|
}
|
2014-05-04 18:26:12 +00:00
|
|
|
}
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
static void
|
2012-07-22 13:34:45 +00:00
|
|
|
ResetDefaults(void *unused)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
|
|
|
VID_MenuInit();
|
|
|
|
}
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
static void
|
2012-07-22 13:34:45 +00:00
|
|
|
ApplyChanges(void *unused)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2012-08-02 12:59:51 +00:00
|
|
|
qboolean restart = false;
|
|
|
|
|
2017-04-10 19:37:08 +00:00
|
|
|
/* Renderer */
|
|
|
|
if (s_renderer_list.curvalue != GetRenderer())
|
|
|
|
{
|
|
|
|
/* First element in array is 'OpenGL 1.4' aka gl1.
|
|
|
|
Second element in array is 'OpenGL 3.2' aka gl3.
|
|
|
|
Third element in array is unknown renderer. */
|
|
|
|
if (s_renderer_list.curvalue == 0)
|
|
|
|
{
|
|
|
|
Cvar_Set("vid_renderer", "gl1");
|
|
|
|
restart = true;
|
|
|
|
}
|
|
|
|
else if (s_renderer_list.curvalue == 1)
|
|
|
|
{
|
|
|
|
Cvar_Set("vid_renderer", "gl3");
|
|
|
|
restart = true;
|
|
|
|
}
|
2017-12-09 11:30:52 +00:00
|
|
|
#ifdef REFSOFT
|
|
|
|
else if (s_renderer_list.curvalue == 2)
|
|
|
|
{
|
|
|
|
Cvar_Set("vid_renderer", "soft");
|
|
|
|
restart = true;
|
|
|
|
}
|
|
|
|
#endif
|
2017-04-10 19:37:08 +00:00
|
|
|
}
|
|
|
|
|
2017-12-09 11:30:52 +00:00
|
|
|
#ifdef REFSOFT
|
|
|
|
if (s_renderer_list.curvalue == 2) {
|
|
|
|
/* custom mode */
|
|
|
|
if (s_mode_list.curvalue != GetCustomValue(&s_mode_list))
|
|
|
|
{
|
|
|
|
/* Restarts automatically */
|
|
|
|
Cvar_SetValue("sw_mode", s_mode_list.curvalue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Restarts automatically */
|
|
|
|
Cvar_SetValue("sw_mode", -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
2010-01-08 15:22:49 +00:00
|
|
|
/* custom mode */
|
2015-11-16 21:23:15 +00:00
|
|
|
if (s_mode_list.curvalue != GetCustomValue(&s_mode_list))
|
2010-01-08 15:22:49 +00:00
|
|
|
{
|
2012-08-02 12:59:51 +00:00
|
|
|
/* Restarts automatically */
|
2012-08-02 12:39:33 +00:00
|
|
|
Cvar_SetValue("gl_mode", s_mode_list.curvalue);
|
2010-01-08 15:22:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-08-02 12:59:51 +00:00
|
|
|
/* Restarts automatically */
|
2012-07-22 13:34:45 +00:00
|
|
|
Cvar_SetValue("gl_mode", -1);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
|
|
|
|
2015-11-08 11:46:38 +00:00
|
|
|
/* UI scaling */
|
|
|
|
if (s_uiscale_list.curvalue == 0)
|
2015-06-06 18:45:05 +00:00
|
|
|
{
|
|
|
|
Cvar_SetValue("gl_hudscale", -1);
|
|
|
|
}
|
2015-11-16 21:23:15 +00:00
|
|
|
else if (s_uiscale_list.curvalue < GetCustomValue(&s_uiscale_list))
|
2015-06-06 18:45:05 +00:00
|
|
|
{
|
2015-11-08 17:20:54 +00:00
|
|
|
Cvar_SetValue("gl_hudscale", s_uiscale_list.curvalue);
|
2015-06-06 18:45:05 +00:00
|
|
|
}
|
|
|
|
|
2015-11-16 21:23:15 +00:00
|
|
|
if (s_uiscale_list.curvalue != GetCustomValue(&s_uiscale_list))
|
2015-11-08 11:46:38 +00:00
|
|
|
{
|
|
|
|
Cvar_SetValue("gl_consolescale", gl_hudscale->value);
|
|
|
|
Cvar_SetValue("gl_menuscale", gl_hudscale->value);
|
2015-11-09 21:09:48 +00:00
|
|
|
Cvar_SetValue("crosshair_scale", gl_hudscale->value);
|
2015-11-08 11:46:38 +00:00
|
|
|
}
|
|
|
|
|
2014-05-04 18:44:29 +00:00
|
|
|
/* Restarts automatically */
|
|
|
|
Cvar_SetValue("vid_fullscreen", s_fs_box.curvalue);
|
|
|
|
|
|
|
|
/* vertical sync */
|
|
|
|
if (gl_swapinterval->value != s_vsync_list.curvalue)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("gl_swapinterval", s_vsync_list.curvalue);
|
|
|
|
restart = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* multisample anti-aliasing */
|
|
|
|
if (s_msaa_list.curvalue == 0)
|
|
|
|
{
|
|
|
|
if (gl_msaa_samples->value != 0)
|
|
|
|
{
|
|
|
|
Cvar_SetValue("gl_msaa_samples", 0);
|
|
|
|
restart = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (gl_msaa_samples->value != pow(2, s_msaa_list.curvalue))
|
|
|
|
{
|
|
|
|
Cvar_SetValue("gl_msaa_samples", pow(2, s_msaa_list.curvalue));
|
|
|
|
restart = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-02 12:59:51 +00:00
|
|
|
if (restart)
|
|
|
|
{
|
|
|
|
Cbuf_AddText("vid_restart\n");
|
|
|
|
}
|
|
|
|
|
2012-08-02 13:33:42 +00:00
|
|
|
M_ForceMenuOff();
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2017-12-09 11:30:52 +00:00
|
|
|
#ifdef REFSOFT
|
|
|
|
static void DriverCallback( void *unused )
|
|
|
|
{
|
|
|
|
if (s_renderer_list.curvalue == 2)
|
|
|
|
{
|
|
|
|
s_mode_list.curvalue = sw_mode->value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
s_mode_list.curvalue = gl_mode->value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
void
|
2012-07-22 13:34:45 +00:00
|
|
|
VID_MenuInit(void)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2014-05-04 18:44:29 +00:00
|
|
|
int y = 0;
|
|
|
|
|
2017-04-10 19:37:08 +00:00
|
|
|
static const char *renderers[] = {
|
|
|
|
"[OpenGL 1.4]",
|
|
|
|
"[OpenGL 3.2]",
|
2017-12-09 11:30:52 +00:00
|
|
|
#ifdef REFSOFT
|
2017-12-17 08:59:37 +00:00
|
|
|
"[Software ]",
|
2017-12-09 11:30:52 +00:00
|
|
|
#endif
|
2017-04-10 19:37:08 +00:00
|
|
|
"[Custom ]",
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
static const char *resolutions[] = {
|
2017-04-10 19:37:08 +00:00
|
|
|
"[320 240 ]",
|
|
|
|
"[400 300 ]",
|
|
|
|
"[512 384 ]",
|
|
|
|
"[640 400 ]",
|
|
|
|
"[640 480 ]",
|
|
|
|
"[800 500 ]",
|
|
|
|
"[800 600 ]",
|
|
|
|
"[960 720 ]",
|
|
|
|
"[1024 480 ]",
|
|
|
|
"[1024 640 ]",
|
|
|
|
"[1024 768 ]",
|
|
|
|
"[1152 768 ]",
|
|
|
|
"[1152 864 ]",
|
|
|
|
"[1280 800 ]",
|
|
|
|
"[1280 720 ]",
|
|
|
|
"[1280 960 ]",
|
|
|
|
"[1280 1024 ]",
|
|
|
|
"[1366 768 ]",
|
|
|
|
"[1440 900 ]",
|
|
|
|
"[1600 1200 ]",
|
|
|
|
"[1680 1050 ]",
|
|
|
|
"[1920 1080 ]",
|
|
|
|
"[1920 1200 ]",
|
|
|
|
"[2048 1536 ]",
|
2017-12-09 11:30:52 +00:00
|
|
|
"[2560 1080 ]",
|
|
|
|
"[2560 1440 ]",
|
|
|
|
"[2560 1600 ]",
|
|
|
|
"[3440 1440 ]",
|
|
|
|
"[3840 1600 ]",
|
|
|
|
"[3840 2160 ]",
|
|
|
|
"[4096 2160 ]",
|
|
|
|
"[5120 2880 ]",
|
2017-04-10 19:37:08 +00:00
|
|
|
"[custom ]",
|
2009-02-28 14:41:18 +00:00
|
|
|
0
|
|
|
|
};
|
2012-08-02 13:18:58 +00:00
|
|
|
|
2015-11-08 11:46:38 +00:00
|
|
|
static const char *uiscale_names[] = {
|
2015-06-06 18:45:05 +00:00
|
|
|
"auto",
|
2015-11-09 21:14:45 +00:00
|
|
|
"1x",
|
2015-06-06 18:45:05 +00:00
|
|
|
"2x",
|
2015-11-08 17:20:54 +00:00
|
|
|
"3x",
|
2015-11-09 21:14:45 +00:00
|
|
|
"4x",
|
|
|
|
"5x",
|
|
|
|
"6x",
|
2015-11-08 10:15:36 +00:00
|
|
|
"custom",
|
2015-06-06 18:45:05 +00:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2014-05-04 18:44:29 +00:00
|
|
|
static const char *yesno_names[] = {
|
|
|
|
"no",
|
|
|
|
"yes",
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2017-08-01 16:32:44 +00:00
|
|
|
static const char *fullscreen_names[] = {
|
|
|
|
"no",
|
|
|
|
"keep resolution",
|
|
|
|
"switch resolution",
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2014-05-04 18:26:12 +00:00
|
|
|
static const char *pow2_names[] = {
|
2014-04-16 20:47:23 +00:00
|
|
|
"off",
|
|
|
|
"2x",
|
|
|
|
"4x",
|
|
|
|
"8x",
|
2014-05-01 18:52:25 +00:00
|
|
|
"16x",
|
2014-04-16 20:47:23 +00:00
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2014-05-04 18:44:29 +00:00
|
|
|
if (!gl_mode)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2014-05-04 18:44:29 +00:00
|
|
|
gl_mode = Cvar_Get("gl_mode", "4", 0);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
|
|
|
|
2017-12-09 11:30:52 +00:00
|
|
|
#ifdef REFSOFT
|
|
|
|
if (!sw_mode)
|
|
|
|
{
|
|
|
|
sw_mode = Cvar_Get("sw_mode", "4", 0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-06-06 18:45:05 +00:00
|
|
|
if (!gl_hudscale)
|
|
|
|
{
|
2015-06-06 18:54:10 +00:00
|
|
|
gl_hudscale = Cvar_Get("gl_hudscale", "-1", CVAR_ARCHIVE);
|
2015-06-06 18:45:05 +00:00
|
|
|
}
|
2017-04-10 19:37:08 +00:00
|
|
|
|
2015-11-08 11:46:38 +00:00
|
|
|
if (!gl_consolescale)
|
|
|
|
{
|
2015-11-08 11:48:27 +00:00
|
|
|
gl_consolescale = Cvar_Get("gl_consolescale", "-1", CVAR_ARCHIVE);
|
2015-11-08 11:46:38 +00:00
|
|
|
}
|
2017-04-10 19:37:08 +00:00
|
|
|
|
2015-11-08 11:46:38 +00:00
|
|
|
if (!gl_menuscale)
|
|
|
|
{
|
2015-11-08 11:48:27 +00:00
|
|
|
gl_menuscale = Cvar_Get("gl_menuscale", "-1", CVAR_ARCHIVE);
|
2015-11-08 11:46:38 +00:00
|
|
|
}
|
2017-04-10 19:37:08 +00:00
|
|
|
|
2015-11-09 21:09:48 +00:00
|
|
|
if (!crosshair_scale)
|
|
|
|
{
|
|
|
|
crosshair_scale = Cvar_Get("crosshair_scale", "-1", CVAR_ARCHIVE);
|
|
|
|
}
|
2015-06-06 18:45:05 +00:00
|
|
|
|
2014-05-04 18:44:29 +00:00
|
|
|
if (!fov)
|
|
|
|
{
|
|
|
|
fov = Cvar_Get("fov", "90", CVAR_USERINFO | CVAR_ARCHIVE);
|
|
|
|
}
|
|
|
|
|
2017-04-10 19:37:08 +00:00
|
|
|
if (!vid_gamma)
|
2014-05-04 18:44:29 +00:00
|
|
|
{
|
2017-04-10 19:37:08 +00:00
|
|
|
vid_gamma = Cvar_Get("vid_gamma", "1.2", CVAR_ARCHIVE);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
|
|
|
|
2017-04-10 19:37:08 +00:00
|
|
|
if (!vid_renderer)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2017-04-10 19:37:08 +00:00
|
|
|
vid_renderer = Cvar_Get("vid_renderer", "gl1", CVAR_ARCHIVE);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2014-04-12 13:03:40 +00:00
|
|
|
if (!gl_swapinterval)
|
|
|
|
{
|
|
|
|
gl_swapinterval = Cvar_Get("gl_swapinterval", "1", CVAR_ARCHIVE);
|
|
|
|
}
|
|
|
|
|
2014-05-04 18:26:12 +00:00
|
|
|
if (!gl_anisotropic)
|
|
|
|
{
|
|
|
|
gl_anisotropic = Cvar_Get("gl_anisotropic", "0", CVAR_ARCHIVE);
|
|
|
|
}
|
|
|
|
|
2014-04-16 20:47:23 +00:00
|
|
|
if (!gl_msaa_samples)
|
|
|
|
{
|
|
|
|
gl_msaa_samples = Cvar_Get("gl_msaa_samples", "0", CVAR_ARCHIVE);
|
|
|
|
}
|
|
|
|
|
2014-05-04 18:44:29 +00:00
|
|
|
s_opengl_menu.x = viddef.width * 0.50;
|
|
|
|
s_opengl_menu.nitems = 0;
|
|
|
|
|
2017-04-10 19:37:08 +00:00
|
|
|
s_renderer_list.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_renderer_list.generic.name = "renderer";
|
|
|
|
s_renderer_list.generic.x = 0;
|
|
|
|
s_renderer_list.generic.y = (y = 0);
|
|
|
|
s_renderer_list.itemnames = renderers;
|
|
|
|
s_renderer_list.curvalue = GetRenderer();
|
2017-12-09 11:30:52 +00:00
|
|
|
#ifdef REFSOFT
|
|
|
|
s_renderer_list.generic.callback = DriverCallback;
|
|
|
|
#endif
|
2017-04-10 19:37:08 +00:00
|
|
|
|
2014-05-04 18:44:29 +00:00
|
|
|
s_mode_list.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_mode_list.generic.name = "video mode";
|
|
|
|
s_mode_list.generic.x = 0;
|
2017-04-10 19:37:08 +00:00
|
|
|
s_mode_list.generic.y = (y += 10);
|
2014-05-04 18:44:29 +00:00
|
|
|
s_mode_list.itemnames = resolutions;
|
2017-12-09 11:30:52 +00:00
|
|
|
|
|
|
|
#ifdef REFSOFT
|
|
|
|
if (s_renderer_list.curvalue == 2 && sw_mode->value >= 0)
|
|
|
|
{
|
|
|
|
s_mode_list.curvalue = sw_mode->value;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
2014-05-04 18:44:29 +00:00
|
|
|
if (gl_mode->value >= 0)
|
2012-10-28 09:20:46 +00:00
|
|
|
{
|
2014-05-04 18:44:29 +00:00
|
|
|
s_mode_list.curvalue = gl_mode->value;
|
2012-10-28 09:20:46 +00:00
|
|
|
}
|
2014-05-04 18:44:29 +00:00
|
|
|
else
|
2012-08-02 13:18:58 +00:00
|
|
|
{
|
2015-11-16 21:23:15 +00:00
|
|
|
s_mode_list.curvalue = GetCustomValue(&s_mode_list);
|
2012-08-02 13:18:58 +00:00
|
|
|
}
|
|
|
|
|
2017-04-10 19:37:08 +00:00
|
|
|
s_brightness_slider.generic.type = MTYPE_SLIDER;
|
|
|
|
s_brightness_slider.generic.name = "brightness";
|
|
|
|
s_brightness_slider.generic.x = 0;
|
|
|
|
s_brightness_slider.generic.y = (y += 20);
|
|
|
|
s_brightness_slider.generic.callback = BrightnessCallback;
|
|
|
|
s_brightness_slider.minvalue = 1;
|
|
|
|
s_brightness_slider.maxvalue = 20;
|
|
|
|
s_brightness_slider.curvalue = vid_gamma->value * 10;
|
|
|
|
|
2017-08-30 13:05:02 +00:00
|
|
|
s_fov_slider.generic.type = MTYPE_SLIDER;
|
|
|
|
s_fov_slider.generic.x = 0;
|
|
|
|
s_fov_slider.generic.y = (y += 10);
|
|
|
|
s_fov_slider.generic.name = "field of view";
|
|
|
|
s_fov_slider.generic.callback = FOVCallback;
|
|
|
|
s_fov_slider.minvalue = 60;
|
|
|
|
s_fov_slider.maxvalue = 120;
|
|
|
|
s_fov_slider.curvalue = fov->value;
|
2012-08-02 13:18:58 +00:00
|
|
|
|
2015-11-08 11:46:38 +00:00
|
|
|
s_uiscale_list.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_uiscale_list.generic.name = "ui scale";
|
|
|
|
s_uiscale_list.generic.x = 0;
|
|
|
|
s_uiscale_list.generic.y = (y += 10);
|
|
|
|
s_uiscale_list.itemnames = uiscale_names;
|
|
|
|
if (gl_hudscale->value != gl_consolescale->value ||
|
2015-11-09 21:09:48 +00:00
|
|
|
gl_hudscale->value != gl_menuscale->value ||
|
|
|
|
gl_hudscale->value != crosshair_scale->value)
|
2015-11-08 11:46:38 +00:00
|
|
|
{
|
2015-11-16 21:23:15 +00:00
|
|
|
s_uiscale_list.curvalue = GetCustomValue(&s_uiscale_list);
|
2015-06-06 18:45:05 +00:00
|
|
|
}
|
|
|
|
else if (gl_hudscale->value < 0)
|
|
|
|
{
|
2015-11-08 17:20:54 +00:00
|
|
|
s_uiscale_list.curvalue = 0;
|
2015-06-06 18:45:05 +00:00
|
|
|
}
|
2015-11-16 18:26:46 +00:00
|
|
|
else if (gl_hudscale->value > 0 &&
|
2015-11-16 21:23:15 +00:00
|
|
|
gl_hudscale->value < GetCustomValue(&s_uiscale_list) &&
|
2015-11-16 18:26:46 +00:00
|
|
|
gl_hudscale->value == (int)gl_hudscale->value)
|
2015-06-06 18:45:05 +00:00
|
|
|
{
|
2015-11-08 17:20:54 +00:00
|
|
|
s_uiscale_list.curvalue = gl_hudscale->value;
|
2015-06-06 18:45:05 +00:00
|
|
|
}
|
2015-11-08 10:15:36 +00:00
|
|
|
else
|
|
|
|
{
|
2015-11-16 21:23:15 +00:00
|
|
|
s_uiscale_list.curvalue = GetCustomValue(&s_uiscale_list);
|
2015-11-08 10:15:36 +00:00
|
|
|
}
|
2015-06-06 18:45:05 +00:00
|
|
|
|
2012-08-02 12:39:33 +00:00
|
|
|
s_fs_box.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_fs_box.generic.name = "fullscreen";
|
2014-05-04 18:44:29 +00:00
|
|
|
s_fs_box.generic.x = 0;
|
|
|
|
s_fs_box.generic.y = (y += 10);
|
2017-08-01 16:32:44 +00:00
|
|
|
s_fs_box.itemnames = fullscreen_names;
|
|
|
|
s_fs_box.curvalue = (int)vid_fullscreen->value;
|
2013-04-29 21:07:55 +00:00
|
|
|
|
2014-04-12 13:03:40 +00:00
|
|
|
s_vsync_list.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_vsync_list.generic.name = "vertical sync";
|
|
|
|
s_vsync_list.generic.x = 0;
|
2014-05-04 18:44:29 +00:00
|
|
|
s_vsync_list.generic.y = (y += 10);
|
2014-04-12 13:03:40 +00:00
|
|
|
s_vsync_list.itemnames = yesno_names;
|
|
|
|
s_vsync_list.curvalue = (gl_swapinterval->value != 0);
|
|
|
|
|
2014-05-04 18:26:12 +00:00
|
|
|
s_af_list.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_af_list.generic.name = "aniso filtering";
|
|
|
|
s_af_list.generic.x = 0;
|
2017-04-10 19:37:08 +00:00
|
|
|
s_af_list.generic.y = (y += 10);
|
2014-05-04 18:26:12 +00:00
|
|
|
s_af_list.generic.callback = AnisotropicCallback;
|
|
|
|
s_af_list.itemnames = pow2_names;
|
|
|
|
s_af_list.curvalue = 0;
|
|
|
|
if (gl_anisotropic->value)
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
s_af_list.curvalue++;
|
|
|
|
} while (pow2_names[s_af_list.curvalue] &&
|
|
|
|
pow(2, s_af_list.curvalue) <= gl_anisotropic->value);
|
|
|
|
s_af_list.curvalue--;
|
|
|
|
}
|
|
|
|
|
2014-04-16 20:47:23 +00:00
|
|
|
s_msaa_list.generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_msaa_list.generic.name = "multisampling";
|
|
|
|
s_msaa_list.generic.x = 0;
|
2014-05-04 18:44:29 +00:00
|
|
|
s_msaa_list.generic.y = (y += 10);
|
2014-05-04 18:26:12 +00:00
|
|
|
s_msaa_list.itemnames = pow2_names;
|
2014-04-16 20:47:23 +00:00
|
|
|
s_msaa_list.curvalue = 0;
|
2014-04-19 11:00:12 +00:00
|
|
|
if (gl_msaa_samples->value)
|
2014-04-16 20:47:23 +00:00
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
s_msaa_list.curvalue++;
|
2014-05-04 18:26:12 +00:00
|
|
|
} while (pow2_names[s_msaa_list.curvalue] &&
|
|
|
|
pow(2, s_msaa_list.curvalue) <= gl_msaa_samples->value);
|
|
|
|
s_msaa_list.curvalue--;
|
2014-04-16 20:47:23 +00:00
|
|
|
}
|
|
|
|
|
2012-08-02 12:39:33 +00:00
|
|
|
s_defaults_action.generic.type = MTYPE_ACTION;
|
|
|
|
s_defaults_action.generic.name = "reset to default";
|
|
|
|
s_defaults_action.generic.x = 0;
|
2014-05-04 18:44:29 +00:00
|
|
|
s_defaults_action.generic.y = (y += 20);
|
2012-08-02 12:39:33 +00:00
|
|
|
s_defaults_action.generic.callback = ResetDefaults;
|
|
|
|
|
|
|
|
s_apply_action.generic.type = MTYPE_ACTION;
|
|
|
|
s_apply_action.generic.name = "apply";
|
|
|
|
s_apply_action.generic.x = 0;
|
2014-05-04 18:44:29 +00:00
|
|
|
s_apply_action.generic.y = (y += 10);
|
2012-08-02 12:39:33 +00:00
|
|
|
s_apply_action.generic.callback = ApplyChanges;
|
|
|
|
|
2017-04-10 19:37:08 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_renderer_list);
|
2012-08-02 12:39:33 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_mode_list);
|
2017-04-11 06:57:16 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_brightness_slider);
|
2017-08-30 13:05:02 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_fov_slider);
|
2015-11-08 11:46:38 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_uiscale_list);
|
2012-08-02 12:39:33 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_fs_box);
|
2014-04-12 13:03:40 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_vsync_list);
|
2014-05-04 18:26:12 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_af_list);
|
2014-04-16 20:47:23 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_msaa_list);
|
2012-08-02 12:39:33 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_defaults_action);
|
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_apply_action);
|
2012-07-22 13:34:45 +00:00
|
|
|
|
|
|
|
Menu_Center(&s_opengl_menu);
|
2009-02-28 14:41:18 +00:00
|
|
|
s_opengl_menu.x -= 8;
|
|
|
|
}
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
void
|
2012-07-22 13:34:45 +00:00
|
|
|
VID_MenuDraw(void)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
|
|
|
int w, h;
|
2014-06-24 17:12:48 +00:00
|
|
|
float scale = SCR_GetMenuScale();
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
/* draw the banner */
|
2013-05-01 19:12:38 +00:00
|
|
|
Draw_GetPicSize(&w, &h, "m_banner_video");
|
2014-06-24 17:12:48 +00:00
|
|
|
Draw_PicScaled(viddef.width / 2 - (w * scale) / 2, viddef.height / 2 - (110 * scale),
|
|
|
|
"m_banner_video", scale);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
/* move cursor to a reasonable starting position */
|
2012-08-02 12:39:33 +00:00
|
|
|
Menu_AdjustCursor(&s_opengl_menu, 1);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
/* draw the menu */
|
2012-08-02 12:39:33 +00:00
|
|
|
Menu_Draw(&s_opengl_menu);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
const char *
|
2012-07-22 13:34:45 +00:00
|
|
|
VID_MenuKey(int key)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
extern void M_PopMenu(void);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-08-02 12:39:33 +00:00
|
|
|
menuframework_s *m = &s_opengl_menu;
|
2009-02-28 14:41:18 +00:00
|
|
|
static const char *sound = "misc/menu1.wav";
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
int menu_key = Key_GetMenuKey(key);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
Add support for joystick/gamecontroller(axis/buttons/hats)/haptic.
By default joystick "in_joystick" and haptic feedback haptic ("joy_haptic_magnitude")
are disabled. And can be anabled by menu in options section. Joystick/Haptic
options are showed only if have found any.
By default axis is mapped in such way:
* Left X(joy_axis_leftx): sidemove
* Left Y(joy_axis_lefty): forwardmove
* Right X(joy_axis_rightx): yaw
* Right Y(joy_axis_righty): pitch
* Trigger Left(joy_axis_triggerleft): triggerleft
* Trigger Right(joy_axis_triggerright): triggerright
Joystick sensitivity varibales:
* joy_yawsensitivity,
* joy_pitchsensitivity,
* joy_forwardsensitivity,
* joy_sidesensitivity,
* joy_upsensitivity.
For change joystick axis mapping to gamecontoller axis export SDL_GAMECONTROLLERCONFIG before run,
e.g.: SDL_GAMECONTROLLERCONFIG='<joystick guid>,<joystick name>,leftx:a0,lefty:a1,rightx:a2,righty:a3,'
Add menu navigation by dpad and thresholds:
* Add threshold for axis (based on ioquake3), 0.15 by defaults.
* Navigate in menus by dpad (up/down, left/right, any joystick button for enter).
Defaults:
* in_joystick "0.0"
* joy_haptic_magnitude "0.0"
* joy_axis_leftx "sidemove"
* joy_axis_leftx_threshold "0.15"
* joy_axis_lefty "forwardmove"
* joy_axis_lefty_threshold "0.15"
* joy_axis_rightx "yaw"
* joy_axis_rightx_threshold "0.15"
* joy_axis_righty "pitch"
* joy_axis_righty_threshold "0.15"
* joy_axis_triggerleft "triggerleft"
* joy_axis_triggerleft_threshold "0.15"
* joy_axis_triggerright "triggerright"
* joy_axis_triggerright_threshold "0.15"
* joy_forwardsensitivity "1.0"
* joy_pitchsensitivity "1.0"
* joy_sidesensitivity "1.0"
* joy_upsensitivity "1.0"
* joy_yawsensitivity "1.0"
2017-09-16 11:23:12 +00:00
|
|
|
switch (menu_key)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2010-10-18 14:23:07 +00:00
|
|
|
case K_ESCAPE:
|
|
|
|
M_PopMenu();
|
2012-07-22 13:34:45 +00:00
|
|
|
return NULL;
|
2010-10-18 14:23:07 +00:00
|
|
|
case K_UPARROW:
|
|
|
|
m->cursor--;
|
2012-07-22 13:34:45 +00:00
|
|
|
Menu_AdjustCursor(m, -1);
|
2010-10-18 14:23:07 +00:00
|
|
|
break;
|
|
|
|
case K_DOWNARROW:
|
|
|
|
m->cursor++;
|
2012-07-22 13:34:45 +00:00
|
|
|
Menu_AdjustCursor(m, 1);
|
2010-10-18 14:23:07 +00:00
|
|
|
break;
|
|
|
|
case K_LEFTARROW:
|
2012-07-22 13:34:45 +00:00
|
|
|
Menu_SlideItem(m, -1);
|
2010-10-18 14:23:07 +00:00
|
|
|
break;
|
|
|
|
case K_RIGHTARROW:
|
2012-07-22 13:34:45 +00:00
|
|
|
Menu_SlideItem(m, 1);
|
2010-10-18 14:23:07 +00:00
|
|
|
break;
|
|
|
|
case K_ENTER:
|
2012-07-22 13:34:45 +00:00
|
|
|
Menu_SelectItem(m);
|
2010-10-18 14:23:07 +00:00
|
|
|
break;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
return sound;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
2012-07-22 13:34:45 +00:00
|
|
|
|