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
|
|
|
|
* refresher this menu must be altered. A lot stuff here are preworkings
|
|
|
|
* for that and aren't needed at this time since we've only refresher.
|
|
|
|
*
|
|
|
|
* =======================================================================
|
|
|
|
*/
|
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"
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
/* this will have to be updated if ref's are added/removed from ref_t */
|
2009-03-05 15:03:56 +00:00
|
|
|
#define NUMBER_OF_REFS 1
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
/* all the refs should be initially set to 0 */
|
2012-07-22 13:34:45 +00:00
|
|
|
static char *refs[NUMBER_OF_REFS + 1] = {0};
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
/* make all these have illegal values, as they will be redefined */
|
2012-07-22 13:34:45 +00:00
|
|
|
static int REF_GL = NUMBER_OF_REFS;
|
2009-02-28 14:41:18 +00:00
|
|
|
static int GL_REF_START = NUMBER_OF_REFS;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
char menuname[32];
|
|
|
|
char realname[32];
|
|
|
|
int *pointer;
|
2009-02-28 14:41:18 +00:00
|
|
|
} ref_t;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
static const ref_t possible_refs[NUMBER_OF_REFS] = {
|
|
|
|
{"[OpenGL ]", "gl", &REF_GL},
|
2009-02-28 14:41:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern cvar_t *vid_ref;
|
|
|
|
extern cvar_t *vid_fullscreen;
|
|
|
|
extern cvar_t *vid_gamma;
|
|
|
|
extern cvar_t *scr_viewsize;
|
|
|
|
|
|
|
|
static cvar_t *gl_mode;
|
|
|
|
static cvar_t *gl_driver;
|
|
|
|
static cvar_t *gl_picmip;
|
|
|
|
static cvar_t *gl_ext_palettedtexture;
|
|
|
|
|
2010-01-08 15:47:16 +00:00
|
|
|
static cvar_t *windowed_mouse;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
extern void M_ForceMenuOff(void);
|
|
|
|
extern qboolean VID_CheckRefExists(const char *name);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
/* MENU INTERACTION */
|
2009-02-28 14:41:18 +00:00
|
|
|
#define SOFTWARE_MENU 0
|
2012-07-22 13:34:45 +00:00
|
|
|
#define OPENGL_MENU 1
|
|
|
|
#define CUSTOM_MODE 20
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
static menuframework_s s_opengl_menu;
|
2009-02-28 14:41:18 +00:00
|
|
|
static menuframework_s *s_current_menu;
|
2010-10-18 14:23:07 +00:00
|
|
|
static int s_current_menu_index;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
static menulist_s s_mode_list[2];
|
|
|
|
static menulist_s s_ref_list[2];
|
2010-10-18 14:23:07 +00:00
|
|
|
static menuslider_s s_tq_slider;
|
2012-07-22 13:34:45 +00:00
|
|
|
static menuslider_s s_screensize_slider[2];
|
|
|
|
static menuslider_s s_brightness_slider[2];
|
|
|
|
static menulist_s s_fs_box[2];
|
2010-10-18 14:23:07 +00:00
|
|
|
static menulist_s s_paletted_texture_box;
|
2012-07-22 13:34:45 +00:00
|
|
|
static menuaction_s s_apply_action[2];
|
|
|
|
static menuaction_s s_defaults_action[2];
|
2010-10-18 14:23:07 +00:00
|
|
|
|
|
|
|
static void
|
2012-07-22 13:34:45 +00:00
|
|
|
DriverCallback(void *unused)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
s_ref_list[!s_current_menu_index].curvalue =
|
|
|
|
s_ref_list[s_current_menu_index].curvalue;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
s_current_menu = &s_opengl_menu;
|
|
|
|
s_current_menu_index = 1;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
static void
|
2012-07-22 13:34:45 +00:00
|
|
|
ScreenSizeCallback(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-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Cvar_SetValue("viewsize", slider->curvalue * 10);
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
if (s_current_menu_index == 0)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
s_brightness_slider[1].curvalue = s_brightness_slider[0].curvalue;
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
else
|
2009-03-05 15:26:46 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
s_brightness_slider[0].curvalue = s_brightness_slider[1].curvalue;
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
int ref;
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
/* make values consistent */
|
2012-07-22 13:34:45 +00:00
|
|
|
s_fs_box[!s_current_menu_index].curvalue =
|
|
|
|
s_fs_box[s_current_menu_index].curvalue;
|
|
|
|
s_brightness_slider[!s_current_menu_index].curvalue =
|
|
|
|
s_brightness_slider[s_current_menu_index].curvalue;
|
|
|
|
s_ref_list[!s_current_menu_index].curvalue =
|
|
|
|
s_ref_list[s_current_menu_index].curvalue;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Cvar_SetValue("gl_picmip", 3 - s_tq_slider.curvalue);
|
|
|
|
Cvar_SetValue("vid_fullscreen", s_fs_box[s_current_menu_index].curvalue);
|
|
|
|
Cvar_SetValue("gl_ext_palettedtexture", s_paletted_texture_box.curvalue);
|
2010-01-08 15:22:49 +00:00
|
|
|
|
|
|
|
/* custom mode */
|
2012-07-22 13:34:45 +00:00
|
|
|
if (s_mode_list[OPENGL_MENU].curvalue != CUSTOM_MODE)
|
2010-01-08 15:22:49 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
printf("DEBUG: %i\n", s_mode_list[OPENGL_MENU].curvalue);
|
|
|
|
Cvar_SetValue("gl_mode", s_mode_list[OPENGL_MENU].curvalue);
|
2010-01-08 15:22:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
Cvar_SetValue("gl_mode", -1);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
|
|
|
|
2012-04-29 13:57:33 +00:00
|
|
|
/* must use an if here (instead of a switch), since the
|
2010-10-18 14:23:07 +00:00
|
|
|
REF_'s are now variables and not #DEFINE's (constants) */
|
2012-07-22 13:34:45 +00:00
|
|
|
ref = s_ref_list[s_current_menu_index].curvalue;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (ref == REF_GL)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
Cvar_Set("vid_ref", "gl");
|
2010-10-18 14:23:07 +00:00
|
|
|
|
|
|
|
/* below is wrong if we use different libs for different GL reflibs */
|
2012-08-02 12:06:32 +00:00
|
|
|
Cvar_Get("gl_driver", LIBGL, CVAR_ARCHIVE);
|
2010-10-18 14:23:07 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (gl_driver->modified)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
vid_ref->modified = true;
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
M_ForceMenuOff();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
int i, counter;
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
static const char *resolutions[] = {
|
2009-02-28 14:41:18 +00:00
|
|
|
"[320 240 ]",
|
|
|
|
"[400 300 ]",
|
|
|
|
"[512 384 ]",
|
2010-01-08 15:38:19 +00:00
|
|
|
"[640 400 ]",
|
2009-02-28 14:41:18 +00:00
|
|
|
"[640 480 ]",
|
2010-10-18 14:23:07 +00:00
|
|
|
"[800 500 ]",
|
2009-02-28 14:41:18 +00:00
|
|
|
"[800 600 ]",
|
|
|
|
"[960 720 ]",
|
2010-01-08 15:38:19 +00:00
|
|
|
"[1024 480 ]",
|
2010-10-18 14:23:07 +00:00
|
|
|
"[1024 640 ]",
|
2009-02-28 14:41:18 +00:00
|
|
|
"[1024 768 ]",
|
2010-01-08 15:38:19 +00:00
|
|
|
"[1152 768 ]",
|
2009-02-28 14:41:18 +00:00
|
|
|
"[1152 864 ]",
|
2010-10-18 14:23:07 +00:00
|
|
|
"[1280 800 ]",
|
2010-01-08 15:38:19 +00:00
|
|
|
"[1280 854 ]",
|
2011-10-15 16:27:19 +00:00
|
|
|
"[1280 960 ]",
|
2009-02-28 14:41:18 +00:00
|
|
|
"[1280 1024]",
|
2011-10-10 08:37:35 +00:00
|
|
|
"[1440 900 ]",
|
2009-02-28 14:41:18 +00:00
|
|
|
"[1600 1200]",
|
2010-10-18 14:23:07 +00:00
|
|
|
"[1680 1050]",
|
2011-10-10 08:37:35 +00:00
|
|
|
"[1920 1080]",
|
2010-10-18 14:23:07 +00:00
|
|
|
"[1920 1200]",
|
2010-01-08 15:38:19 +00:00
|
|
|
"[2048 1536]",
|
2010-01-08 15:22:49 +00:00
|
|
|
"[Custom ]",
|
2009-02-28 14:41:18 +00:00
|
|
|
0
|
|
|
|
};
|
2010-10-18 14:23:07 +00:00
|
|
|
static const char *yesno_names[] = {
|
2009-02-28 14:41:18 +00:00
|
|
|
"no",
|
|
|
|
"yes",
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
/* make sure these are invalided before showing the menu again */
|
2012-07-22 13:34:45 +00:00
|
|
|
REF_GL = NUMBER_OF_REFS;
|
2009-02-28 14:41:18 +00:00
|
|
|
GL_REF_START = NUMBER_OF_REFS;
|
|
|
|
|
|
|
|
/* now test to see which ref's are present */
|
|
|
|
i = counter = 0;
|
2010-10-18 14:23:07 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
while (i < NUMBER_OF_REFS)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
if (VID_CheckRefExists(possible_refs[i].realname))
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
*(possible_refs[i].pointer) = counter;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
/* free any previous string */
|
2012-07-22 13:34:45 +00:00
|
|
|
if (refs[i])
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
free(refs[i]);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
refs[counter] = strdup(possible_refs[i].menuname);
|
2010-10-18 14:23:07 +00:00
|
|
|
|
|
|
|
/* if we reach the 1rd item in the list, this indicates that a
|
|
|
|
GL ref has been found; this will change if more software
|
|
|
|
modes are added to the possible_ref's array */
|
2012-07-22 13:34:45 +00:00
|
|
|
if (i == 0)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2009-02-28 14:41:18 +00:00
|
|
|
GL_REF_START = counter;
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
counter++;
|
|
|
|
}
|
2010-10-18 14:23:07 +00:00
|
|
|
|
2009-02-28 14:41:18 +00:00
|
|
|
i++;
|
|
|
|
}
|
2010-10-18 14:23:07 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
refs[counter] = (char *)0;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!gl_driver)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
gl_driver = Cvar_Get("gl_driver", "libGL.so.1", 0);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!gl_picmip)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
gl_picmip = Cvar_Get("gl_picmip", "0", 0);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!gl_mode)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
gl_mode = Cvar_Get("gl_mode", "3", 0);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!gl_ext_palettedtexture)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
gl_ext_palettedtexture = Cvar_Get("gl_ext_palettedtexture",
|
|
|
|
"0", CVAR_ARCHIVE);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!windowed_mouse)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
windowed_mouse = Cvar_Get("windowed_mouse", "1",
|
|
|
|
CVAR_USERINFO | CVAR_ARCHIVE);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-01-08 15:22:49 +00:00
|
|
|
/* custom mode */
|
2012-07-22 13:34:45 +00:00
|
|
|
if (gl_mode->value >= 1.0)
|
2010-01-08 15:22:49 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
s_mode_list[OPENGL_MENU].curvalue = gl_mode->value;
|
2010-01-08 15:22:49 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
s_mode_list[OPENGL_MENU].curvalue = CUSTOM_MODE;
|
2010-01-08 15:22:49 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (!scr_viewsize)
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
scr_viewsize = Cvar_Get("viewsize", "100", CVAR_ARCHIVE);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
s_screensize_slider[OPENGL_MENU].curvalue = scr_viewsize->value / 10;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
if (strcmp(vid_ref->string, "gl") == 0)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
|
|
|
s_current_menu_index = OPENGL_MENU;
|
2012-07-22 13:34:45 +00:00
|
|
|
s_ref_list[s_current_menu_index].curvalue = REF_GL;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
s_opengl_menu.x = viddef.width * 0.50;
|
|
|
|
s_opengl_menu.nitems = 0;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < 2; i++)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
s_ref_list[i].generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_ref_list[i].generic.name = "driver";
|
|
|
|
s_ref_list[i].generic.x = 0;
|
|
|
|
s_ref_list[i].generic.y = 0;
|
|
|
|
s_ref_list[i].generic.callback = DriverCallback;
|
|
|
|
s_ref_list[i].itemnames = (const char **)refs;
|
|
|
|
|
|
|
|
s_mode_list[i].generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_mode_list[i].generic.name = "video mode";
|
|
|
|
s_mode_list[i].generic.x = 0;
|
|
|
|
s_mode_list[i].generic.y = 10;
|
|
|
|
s_mode_list[i].itemnames = resolutions;
|
|
|
|
|
|
|
|
s_screensize_slider[i].generic.type = MTYPE_SLIDER;
|
|
|
|
s_screensize_slider[i].generic.x = 0;
|
|
|
|
s_screensize_slider[i].generic.y = 20;
|
|
|
|
s_screensize_slider[i].generic.name = "screen size";
|
|
|
|
s_screensize_slider[i].minvalue = 3;
|
|
|
|
s_screensize_slider[i].maxvalue = 12;
|
|
|
|
s_screensize_slider[i].generic.callback = ScreenSizeCallback;
|
|
|
|
|
|
|
|
s_brightness_slider[i].generic.type = MTYPE_SLIDER;
|
|
|
|
s_brightness_slider[i].generic.x = 0;
|
|
|
|
s_brightness_slider[i].generic.y = 30;
|
|
|
|
s_brightness_slider[i].generic.name = "brightness";
|
|
|
|
s_brightness_slider[i].generic.callback = BrightnessCallback;
|
|
|
|
s_brightness_slider[i].minvalue = 1;
|
|
|
|
s_brightness_slider[i].maxvalue = 20;
|
|
|
|
s_brightness_slider[i].curvalue = vid_gamma->value * 10;
|
|
|
|
|
|
|
|
s_fs_box[i].generic.type = MTYPE_SPINCONTROL;
|
|
|
|
s_fs_box[i].generic.x = 0;
|
|
|
|
s_fs_box[i].generic.y = 40;
|
|
|
|
s_fs_box[i].generic.name = "fullscreen";
|
|
|
|
s_fs_box[i].itemnames = yesno_names;
|
|
|
|
s_fs_box[i].curvalue = vid_fullscreen->value;
|
|
|
|
|
|
|
|
s_defaults_action[i].generic.type = MTYPE_ACTION;
|
|
|
|
s_defaults_action[i].generic.name = "reset to default";
|
|
|
|
s_defaults_action[i].generic.x = 0;
|
|
|
|
s_defaults_action[i].generic.y = 90;
|
|
|
|
s_defaults_action[i].generic.callback = ResetDefaults;
|
|
|
|
|
|
|
|
s_apply_action[i].generic.type = MTYPE_ACTION;
|
|
|
|
s_apply_action[i].generic.name = "apply";
|
|
|
|
s_apply_action[i].generic.x = 0;
|
|
|
|
s_apply_action[i].generic.y = 100;
|
|
|
|
s_apply_action[i].generic.callback = ApplyChanges;
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
s_tq_slider.generic.type = MTYPE_SLIDER;
|
|
|
|
s_tq_slider.generic.x = 0;
|
|
|
|
s_tq_slider.generic.y = 60;
|
|
|
|
s_tq_slider.generic.name = "texture quality";
|
2009-02-28 14:41:18 +00:00
|
|
|
s_tq_slider.minvalue = 0;
|
|
|
|
s_tq_slider.maxvalue = 3;
|
2010-10-18 14:23:07 +00:00
|
|
|
s_tq_slider.curvalue = 3 - gl_picmip->value;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
|
|
|
s_paletted_texture_box.generic.type = MTYPE_SPINCONTROL;
|
2012-07-22 13:34:45 +00:00
|
|
|
s_paletted_texture_box.generic.x = 0;
|
|
|
|
s_paletted_texture_box.generic.y = 70;
|
2010-10-18 14:23:07 +00:00
|
|
|
s_paletted_texture_box.generic.name = "8-bit textures";
|
2009-02-28 14:41:18 +00:00
|
|
|
s_paletted_texture_box.itemnames = yesno_names;
|
|
|
|
s_paletted_texture_box.curvalue = gl_ext_palettedtexture->value;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_ref_list[OPENGL_MENU]);
|
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_mode_list[OPENGL_MENU]);
|
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_screensize_slider[OPENGL_MENU]);
|
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_brightness_slider[OPENGL_MENU]);
|
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_fs_box[OPENGL_MENU]);
|
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_tq_slider);
|
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_paletted_texture_box);
|
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_defaults_action[OPENGL_MENU]);
|
|
|
|
Menu_AddItem(&s_opengl_menu, (void *)&s_apply_action[OPENGL_MENU]);
|
|
|
|
|
|
|
|
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_MenuShutdown(void)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
for (i = 0; i < NUMBER_OF_REFS; i++)
|
2009-02-28 14:41:18 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
if (refs[i])
|
2010-10-18 14:23:07 +00:00
|
|
|
{
|
2012-07-22 13:34:45 +00:00
|
|
|
free(refs[i]);
|
2010-10-18 14:23:07 +00:00
|
|
|
}
|
2009-02-28 14:41:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
s_current_menu = &s_opengl_menu;
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
/* draw the banner */
|
2012-07-22 13:34:45 +00:00
|
|
|
re.DrawGetPicSize(&w, &h, "m_banner_video");
|
|
|
|
re.DrawPic(viddef.width / 2 - w / 2, viddef.height / 2 - 110,
|
|
|
|
"m_banner_video");
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
/* move cursor to a reasonable starting position */
|
2012-07-22 13:34:45 +00:00
|
|
|
Menu_AdjustCursor(s_current_menu, 1);
|
2009-02-28 14:41:18 +00:00
|
|
|
|
2010-10-18 14:23:07 +00:00
|
|
|
/* draw the menu */
|
2012-07-22 13:34:45 +00:00
|
|
|
Menu_Draw(s_current_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
|
|
|
|
|
|
|
menuframework_s *m = s_current_menu;
|
|
|
|
static const char *sound = "misc/menu1.wav";
|
|
|
|
|
2012-07-22 13:34:45 +00:00
|
|
|
switch (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
|
|
|
|