menu overhaul (unfinished, still need more tips, tp/cheats/other entries still need readd)

fixes to menu system, removed/corrected some cvars


git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3814 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2011-06-07 23:54:58 +00:00
parent 78d4632097
commit 67139b771a
13 changed files with 1465 additions and 1593 deletions

View File

@ -343,7 +343,7 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
while (option)
{
if (mousemoved && !bindingactive)
if (mousemoved && !bindingactive && !option->common.ishidden)
{
if (omousex > xpos+option->common.posx && omousex < xpos+option->common.posx+option->common.width)
{
@ -518,7 +518,10 @@ void MenuDrawItems(int xpos, int ypos, menuoption_t *option, menu_t *menu)
else
Draw_FunString(x, y, option->edit.caption);
x+=strlen(option->edit.caption)*8+8;
Draw_TextBox(x-8, y-8, 16, 1);
if (option->edit.slim)
x += 8; // more space for cursor
else
Draw_TextBox(x-8, y-8, 16, 1);
Draw_FunString(x, y, option->edit.text);
if (menu->selecteditem == option && (int)(realtime*4) & 1)
@ -832,7 +835,7 @@ menuedit_t *MC_AddEdit(menu_t *menu, int x, int y, char *text, char *def)
return n;
}
menuedit_t *MC_AddEditCvar(menu_t *menu, int x, int y, char *text, char *name)
menuedit_t *MC_AddEditCvar_Full(menu_t *menu, int x, int y, char *text, char *name, qboolean isslim)
{
menuedit_t *n = Z_Malloc(sizeof(menuedit_t)+strlen(text)+1);
cvar_t *cvar;
@ -853,10 +856,21 @@ menuedit_t *MC_AddEditCvar(menu_t *menu, int x, int y, char *text, char *name)
Q_strncpyz(n->text, cvar->string, sizeof(n->text));
n->common.next = menu->options;
n->slim = isslim;
menu->options = (menuoption_t *)n;
return n;
}
menuedit_t *MC_AddEditCvarSlim(menu_t *menu, int x, int y, char *text, char *name)
{
return MC_AddEditCvar_Full(menu, x, y, text, name, true);
}
menuedit_t *MC_AddEditCvar(menu_t *menu, int x, int y, char *text, char *name)
{
return MC_AddEditCvar_Full(menu, x, y, text, name, false);
}
menubox_t *MC_AddBox(menu_t *menu, int x, int y, int width, int height)
{
menubox_t *n = Z_Malloc(sizeof(menubox_t));
@ -2034,3 +2048,142 @@ void M_Menu_Main_f (void)
}
}
int MC_AddBulk(struct menu_s *menu, menubulk_t *bulk, int xstart, int xtextend, int y)
{
int x;
int selectedy = y;
menuoption_t *selected = NULL;
while (bulk)
{
switch (bulk->type)
{
case mt_text:
switch (bulk->variant)
{
case -1: // end of menu
bulk = NULL;
continue;
case 0: // white text
x = xtextend - strlen(bulk->text) * 8;
MC_AddWhiteText(menu, x, y, bulk->text, bulk->rightalign);
y += 8;
break;
case 1: // red text
x = xtextend - strlen(bulk->text) * 8;
MC_AddRedText(menu, x, y, bulk->text, bulk->rightalign);
y += 8;
break;
case 2: // spacing
y += bulk->spacing;
break;
}
break;
case mt_button:
{
menubutton_t *button;
x = xtextend - strlen(bulk->text) * 8;
switch (bulk->variant)
{
default:
case 0: // console command
button = MC_AddConsoleCommand(menu, x, y, bulk->text, bulk->consolecmd);
break;
case 1: // function command
button = MC_AddCommand(menu, x, y, bulk->text, bulk->command);
break;
}
if (!selected)
selected = (union menuoption_s *)button;
if (bulk->tooltip)
button->common.tooltip = bulk->tooltip;
y += 8;
}
break;
case mt_checkbox:
x = xtextend - strlen(bulk->text) * 8;
{
menucheck_t *check = MC_AddCheckBox(menu, x, y, bulk->text, bulk->cvar, bulk->flags);
check->func = bulk->func;
if (bulk->ret)
*bulk->ret = (union menuoption_s *)check;
if (!selected)
selected = (union menuoption_s *)check;
if (bulk->tooltip)
check->common.tooltip = bulk->tooltip;
}
y += 8;
break;
case mt_slider:
x = xtextend - strlen(bulk->text) * 8;
{
menuslider_t *slider = MC_AddSlider(menu, x, y, bulk->text, bulk->cvar, bulk->min, bulk->max, bulk->delta);
if (!selected)
selected = (union menuoption_s *)slider;
if (bulk->tooltip)
slider->common.tooltip = bulk->tooltip;
}
y += 8;
break;
case mt_combo:
{
menucombo_t *combo;
x = xtextend - strlen(bulk->text) * 8;
switch (bulk->variant)
{
default:
case 0: // cvar combo
combo = MC_AddCvarCombo(menu, x, y, bulk->text, bulk->cvar, bulk->options, bulk->values);
break;
case 1: // combo with return value
combo = MC_AddCombo(menu, x, y, bulk->text, bulk->options, bulk->selectedoption);
break;
}
if (bulk->ret)
*bulk->ret = (union menuoption_s *)combo;
if (!selected)
selected = (union menuoption_s *)combo;
if (bulk->tooltip)
combo->common.tooltip = bulk->tooltip;
y += 8;
}
break;
case mt_edit:
{
menuedit_t *edit;
x = xtextend - strlen(bulk->text) * 8;
switch (bulk->variant)
{
default:
case 0:
y += 4;
edit = MC_AddEditCvar(menu, x, y, bulk->text, bulk->cvarname);
y += 4;
break;
case 1:
edit = MC_AddEditCvarSlim(menu, x, y, bulk->text, bulk->cvarname);
break;
}
if (bulk->ret)
*bulk->ret = (union menuoption_s *)edit;
if (!selected)
selected = (union menuoption_s *)edit;
if (bulk->tooltip)
edit->common.tooltip = bulk->tooltip;
y += 8;
}
break;
default:
Con_Printf(CON_ERROR "Invalid type in bulk menu!\n");
bulk = NULL;
continue;
}
bulk++;
}
menu->selecteditem = selected;
if (selected)
selectedy = selected->common.posy;
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, xtextend + 8, selectedy, NULL, false);
return y;
}

View File

@ -45,7 +45,6 @@ void M_Menu_MultiPlayer_f (void)
mgt=64;
menu->selecteditem = (menuoption_t*)
MC_AddConsoleCommandHexen2BigFont (menu, 80, mgt, "Join A Game ", "menu_slist\n");mgt+=20;
MC_AddConsoleCommandHexen2BigFont (menu, 80, mgt, "Old Browser ", "menu_serversold\n");mgt+=20;
MC_AddConsoleCommandHexen2BigFont (menu, 80, mgt, "New Server ", "menu_newmulti\n");mgt+=20;
MC_AddConsoleCommandHexen2BigFont (menu, 80, mgt, "Player Setup", "menu_setup\n");mgt+=20;
MC_AddConsoleCommandHexen2BigFont (menu, 80, mgt, "Demos ", "menu_demo\n");mgt+=20;
@ -62,7 +61,6 @@ void M_Menu_MultiPlayer_f (void)
menu->selecteditem = (menuoption_t*)
MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Join A Game ", "menu_slist\n");mgt+=20;
MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Quick Connect", "quickconnect qw\n");mgt+=20;
MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Old Browser ", "menu_serversold\n");mgt+=20;
MC_AddConsoleCommandQBigFont (menu, 72, mgt, "New Server ", "menu_newmulti\n");mgt+=20;
MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Player Setup", "menu_setup\n");mgt+=20;
MC_AddConsoleCommandQBigFont (menu, 72, mgt, "Demos ", "menu_demo\n");mgt+=20;

File diff suppressed because it is too large Load Diff

View File

@ -711,34 +711,6 @@ void M_Menu_Demos_f (void)
ShowDemoMenu(menu, "");
}
void M_Menu_ParticleSets_f (void)
{
demomenu_t *info;
menu_t *menu;
key_dest = key_menu;
m_state = m_complex;
menu = M_CreateMenu(sizeof(demomenu_t));
menu->remove = M_Demo_Remove;
info = menu->data;
info->command[0] = "r_particlesystem script; r_particlesdesc";
info->ext[0] = ".cfg";
info->numext = 1;
MC_AddWhiteText(menu, 24, 8, "Choose a Particle Set", false);
MC_AddWhiteText(menu, 16, 24, "\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37", false);
info->list = MC_AddCustom(menu, 0, 32, NULL);
info->list->draw = M_DemoDraw;
info->list->key = M_DemoKey;
menu->selecteditem = (menuoption_t*)info->list;
ShowDemoMenu(menu, "particles/");
}
void M_Menu_MediaFiles_f (void)
{
demomenu_t *info;

View File

@ -776,8 +776,8 @@ void M_QuickConnect_f(void);
void M_Menu_MediaFiles_f (void);
void M_Menu_FPS_f (void);
void M_Menu_Shadow_Lighting_f (void);
void M_Menu_3D_f (void);
void M_Menu_Lighting_f (void);
void M_Menu_Render_f (void);
void M_Menu_Textures_f (void);
void M_Menu_Teamplay_f (void);
void M_Menu_Teamplay_Locations_f (void);
@ -790,10 +790,7 @@ void M_Menu_Teamplay_Items_Ammo_Health_f (void);
void M_Menu_Teamplay_Items_Team_Fortress_f (void);
void M_Menu_Teamplay_Items_Status_Location_Misc_f (void);
void M_Menu_Singleplayer_Cheats_f (void);
void M_Menu_Singleplayer_Cheats_Quake2_f (void);
void M_Menu_Singleplayer_Cheats_Hexen2_f (void);
void M_Menu_Particles_f (void);
void M_Menu_ParticleSets_f (void);
void M_Menu_Audio_Speakers_f (void);
void Menu_DownloadStuff_f (void);
static qboolean internalmenusregistered;
@ -840,11 +837,9 @@ void M_Init_Internal (void)
Cmd_AddRemCommand ("menu_speakers", M_Menu_Audio_Speakers_f);
#endif
Cmd_AddRemCommand ("menu_spcheats", M_Menu_Singleplayer_Cheats_f);
Cmd_AddRemCommand ("menu_quake2_spcheats", M_Menu_Singleplayer_Cheats_Quake2_f);
Cmd_AddRemCommand ("menu_hexen2_spcheats", M_Menu_Singleplayer_Cheats_Hexen2_f);
Cmd_AddRemCommand ("menu_fps", M_Menu_FPS_f);
Cmd_AddRemCommand ("menu_3d" , M_Menu_3D_f);
Cmd_AddRemCommand ("menu_shadow_lighting", M_Menu_Shadow_Lighting_f);
Cmd_AddRemCommand ("menu_render" , M_Menu_Render_f);
Cmd_AddRemCommand ("menu_lighting", M_Menu_Lighting_f);
Cmd_AddRemCommand ("menu_textures", M_Menu_Textures_f);
Cmd_AddRemCommand ("menu_teamplay", M_Menu_Teamplay_f);
Cmd_AddRemCommand ("menu_teamplay_locations", M_Menu_Teamplay_Locations_f);
@ -857,7 +852,6 @@ void M_Init_Internal (void)
Cmd_AddRemCommand ("menu_teamplay_team_fortress", M_Menu_Teamplay_Items_Team_Fortress_f);
Cmd_AddRemCommand ("menu_teamplay_status_location_misc", M_Menu_Teamplay_Items_Status_Location_Misc_f);
Cmd_AddRemCommand ("menu_particles", M_Menu_Particles_f);
Cmd_AddRemCommand ("menu_particlesets", M_Menu_ParticleSets_f);
#ifdef WEBCLIENT
Cmd_AddRemCommand ("menu_download", Menu_DownloadStuff_f);
@ -912,14 +906,11 @@ void M_DeInit_Internal (void)
Cmd_RemoveCommand ("menu_teamplay_team_fortress");
Cmd_RemoveCommand ("menu_teamplay_status_location_misc");
Cmd_RemoveCommand ("menu_spcheats");
Cmd_RemoveCommand ("menu_hexen2_spcheats");
Cmd_RemoveCommand ("menu_quake2_spcheats");
Cmd_RemoveCommand ("menu_fps");
Cmd_RemoveCommand ("menu_3d");
Cmd_RemoveCommand ("menu_shadow_lighting");
Cmd_RemoveCommand ("menu_render");
Cmd_RemoveCommand ("menu_lighting");
Cmd_RemoveCommand ("menu_textures");
Cmd_RemoveCommand ("menu_particles");
Cmd_RemoveCommand ("menu_particlesets");
Cmd_RemoveCommand ("menu_download");

View File

@ -134,7 +134,7 @@ typedef enum {
mt_checkbox,
mt_picture,
mt_picturesel,
mt_menudot,
mt_menudot,
mt_custom
} menutype_t;
@ -167,6 +167,7 @@ typedef struct {
char text[MAX_EDIT_LENGTH];
int cursorpos;
qboolean modified;
qboolean slim;
} menuedit_t;
typedef struct {
menucommon_t common;
@ -302,9 +303,53 @@ menucombo_t *MC_AddCombo(menu_t *menu, int x, int y, const char *caption, const
menubutton_t *MC_AddCommand(menu_t *menu, int x, int y, char *text, qboolean (*command) (union menuoption_s *,struct menu_s *,int));
menuedit_t *MC_AddEdit(menu_t *menu, int x, int y, char *text, char *def);
menuedit_t *MC_AddEditCvar(menu_t *menu, int x, int y, char *text, char *name);
menuedit_t *MC_AddEditCvarSlim(menu_t *menu, int x, int y, char *text, char *name);
menucustom_t *MC_AddCustom(menu_t *menu, int x, int y, void *data);
menucombo_t *MC_AddCvarCombo(menu_t *menu, int x, int y, const char *caption, cvar_t *cvar, const char **ops, const char **values);
typedef struct menubulk_s {
menutype_t type;
int variant;
char *text;
char *tooltip;
char *consolecmd; // console command
cvar_t *cvar; // check box, slider
int flags; // check box
qboolean (*func) (struct menucheck_s *option, struct menu_s *menu, chk_set_t set); // check box
float min; // slider
float max; // slider
float delta; // slider
qboolean rightalign; // text
qboolean (*command) (union menuoption_s *, struct menu_s *, int); // command
char *cvarname; // edit cvar
const char **options; // combo
const char **values; // cvar combo
int selectedoption; // other combo
union menuoption_s **ret; // other combo
int spacing; // spacing
} menubulk_t;
#define MB_CONSOLECMD(text, cmd, tip) {mt_button, 0, text, tip, cmd}
#define MB_CHECKBOXCVAR(text, cvar, flags) {mt_checkbox, 0, text, NULL, NULL, &cvar, flags}
#define MB_CHECKBOXCVARRETURN(text, cvar, flags, ret) {mt_checkbox, 0, text, NULL, NULL, &cvar, flags, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, (union menuoption_s **)&ret}
#define MB_CHECKBOXFUNC(text, func, flags, tip) {mt_checkbox, 0, text, tip, NULL, NULL, flags, func}
#define MB_SLIDER(text, cvar, min, max, delta, tip) {mt_slider, 0, text, tip, NULL, &cvar, 0, NULL, min, max, delta}
#define MB_TEXT(text, align) {mt_text, 0, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, align}
#define MB_REDTEXT(text, align) {mt_text, 1, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, align}
#define MB_CMD(text, cmdfunc, tip) {mt_button, 1, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, cmdfunc}
#define MB_EDITCVAR(text, cvarname) {mt_edit, 0, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname}
#define MB_EDITCVARSLIM(text, cvarname) {mt_edit, 1, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname}
#define MB_EDITCVARSLIMRETURN(text, cvarname, ret) {mt_edit, 1, text, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, cvarname, NULL, NULL, 0, (union menuoption_s **)&ret}
#define MB_COMBOCVAR(text, cvar, options, values, tip) {mt_combo, 0, text, tip, NULL, &cvar, 0, NULL, 0, 0, 0, false, NULL, NULL, options, values}
#define MB_COMBORETURN(text, options, selected, ret, tip) {mt_combo, 1, text, tip, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, options, NULL, selected, (union menuoption_s **)&ret}
#define MB_COMBOCVARRETURN(text, cvar, options, values, ret, tip) {mt_combo, 0, text, tip, NULL, &cvar, 0, NULL, 0, 0, 0, false, NULL, NULL, options, values, 0, (union menuoption_s **)&ret}
#define MB_SPACING(space) {mt_text, 2, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, 0, false, NULL, NULL, NULL, NULL, 0, NULL, space}
#define MB_END() {mt_text, -1}
int MC_AddBulk(struct menu_s *menu, menubulk_t *bulk, int xstart, int xtextend, int y);
menu_t *M_Options_Title(int *y, int infosize); /*Create a menu with the default options titlebar*/
menu_t *M_CreateMenu (int extrasize);
void M_AddMenu (menu_t *menu);

View File

@ -128,12 +128,12 @@ extern cvar_t r_bloodstains;
extern cvar_t gl_part_flame;
cvar_t r_part_rain_quantity = CVAR("r_part_rain_quantity", "1");
cvar_t r_particle_tracelimit = CVAR("r_particle_tracelimit", "250");
cvar_t r_particle_tracelimit = CVARD("r_particle_tracelimit", "200", "Number of traces to allow per frame for particle physics.");
cvar_t r_part_sparks = CVAR("r_part_sparks", "1");
cvar_t r_part_sparks_trifan = CVAR("r_part_sparks_trifan", "1");
cvar_t r_part_sparks_textured = CVAR("r_part_sparks_textured", "1");
cvar_t r_part_beams = CVAR("r_part_beams", "1");
cvar_t r_part_contentswitch = CVAR("r_part_contentswitch", "1");
cvar_t r_part_contentswitch = CVARD("r_part_contentswitch", "1", "Enable particle effects to change based on content (ex. water).");
particleengine_t *pe;

View File

@ -50,7 +50,7 @@ cvar_t cl_cursorsize = CVAR ("cl_cursorsize", "32");
cvar_t cl_cursorbias = CVAR ("cl_cursorbias", "4");
cvar_t gl_nocolors = CVAR ("gl_nocolors", "0");
cvar_t gl_part_flame = CVAR ("gl_part_flame", "1");
cvar_t gl_part_flame = CVARD ("gl_part_flame", "1", "Enable particle emitting from models. Mainly used for torch and flame effects.");
//opengl library, blank means try default.
static cvar_t gl_driver = CVARF ("gl_driver", "",
@ -63,8 +63,9 @@ cvar_t mod_md3flags = CVAR ("mod_md3flags", "1");
cvar_t r_ambient = CVARF ("r_ambient", "0",
CVAR_CHEAT);
cvar_t r_bloodstains = CVAR ("r_bloodstains", "1");
cvar_t r_bouncysparks = CVARF ("r_bouncysparks", "0",
CVAR_ARCHIVE);
cvar_t r_bouncysparks = CVARFD ("r_bouncysparks", "0",
CVAR_ARCHIVE,
"Enables particle interaction with world surfaces, allowing for bouncy particles.");
cvar_t r_drawentities = CVAR ("r_drawentities", "1");
cvar_t r_drawflat = CVARF ("r_drawflat", "0",
CVAR_SEMICHEAT | CVAR_RENDERERCALLBACK | CVAR_SHADERSYSTEM);
@ -106,8 +107,9 @@ cvar_t r_netgraph = SCVAR ("r_netgraph", "0");
cvar_t r_nolerp = SCVAR ("r_nolerp", "0");
cvar_t r_nolightdir = SCVAR ("r_nolightdir", "0");
cvar_t r_novis = SCVAR ("r_novis", "0");
cvar_t r_part_rain = SCVARF ("r_part_rain", "0",
CVAR_ARCHIVE);
cvar_t r_part_rain = CVARFD ("r_part_rain", "0",
CVAR_ARCHIVE,
"Enable particle effects to emit off of surfaces. Mainly used for weather or lava/slime effects.");
cvar_t r_skyboxname = SCVARF ("r_skybox", "",
CVAR_RENDERERCALLBACK | CVAR_SHADERSYSTEM);
cvar_t r_speeds = SCVAR ("r_speeds", "0");
@ -162,26 +164,24 @@ cvar_t vid_conwidth = CVARF ("vid_conwidth", "0",
cvar_t vid_renderer = CVARF ("vid_renderer", "",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
static cvar_t vid_allow_modex = CVARF ("vid_allow_modex", "1",
CVAR_ARCHIVE | CVAR_RENDERERLATCH); //FIXME: remove
static cvar_t vid_bpp = CVARF ("vid_bpp", "32",
cvar_t vid_bpp = CVARF ("vid_bpp", "32",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
static cvar_t vid_desktopsettings = CVARF ("vid_desktopsettings", "0",
cvar_t vid_desktopsettings = CVARF ("vid_desktopsettings", "0",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
#ifdef NPQTV
static cvar_t vid_fullscreen_npqtv = CVARF ("vid_fullscreen", "1",
cvar_t vid_fullscreen_npqtv = CVARF ("vid_fullscreen", "1",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
cvar_t vid_fullscreen = CVARF ("vid_fullscreen_embedded", "0",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
#else
static cvar_t vid_fullscreen = CVARF ("vid_fullscreen", "1",
cvar_t vid_fullscreen = CVARF ("vid_fullscreen", "1",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
#endif
cvar_t vid_height = CVARF ("vid_height", "0",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
cvar_t vid_multisample = CVARF ("vid_multisample", "0",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
static cvar_t vid_refreshrate = CVARF ("vid_displayfrequency", "0",
cvar_t vid_refreshrate = CVARF ("vid_displayfrequency", "0",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
cvar_t vid_wndalpha = CVAR ("vid_wndalpha", "1");
//more readable defaults to match conwidth/conheight.
@ -353,7 +353,6 @@ void GLRenderer_Init(void)
Cvar_Register (&gl_affinemodels, GLRENDEREROPTIONS);
Cvar_Register (&gl_nohwblend, GLRENDEREROPTIONS);
Cvar_Register (&r_flashblend, GLRENDEREROPTIONS);
Cvar_Register (&gl_playermip, GLRENDEREROPTIONS);
Cvar_Register (&gl_nocolors, GLRENDEREROPTIONS);
Cvar_Register (&gl_finish, GLRENDEREROPTIONS);
Cvar_Register (&gl_lateswap, GLRENDEREROPTIONS);
@ -511,8 +510,6 @@ void Renderer_Init(void)
Cvar_Register (&vid_conheight, VIDCOMMANDGROUP);
Cvar_Register (&vid_conautoscale, VIDCOMMANDGROUP);
Cvar_Register (&vid_allow_modex, VIDCOMMANDGROUP);
Cvar_Register (&vid_width, VIDCOMMANDGROUP);
Cvar_Register (&vid_height, VIDCOMMANDGROUP);
Cvar_Register (&vid_refreshrate, VIDCOMMANDGROUP);
@ -791,458 +788,6 @@ rendererinfo_t *rendererinfo[] =
};
typedef struct vidmode_s
{
const char *description;
int width, height;
} vidmode_t;
vidmode_t vid_modes[] =
{
{ "320x200 (16:10)", 320, 200}, // CGA, MCGA
{ "320x240 (4:3)", 320, 240}, // QVGA
{ "400x300 (4:3)", 400, 300}, // Quarter SVGA
{ "512x384 (4:3)", 512, 384}, // Mac LC
{ "640x400 (16:10)", 640, 400}, // Atari ST mono, Amiga OCS NTSC Hires interlace
{ "640x480 (4:3)", 640, 480}, // VGA, MCGA
{ "800x600 (4:3)", 800, 600}, // SVGA
{ "856x480 (16:9)", 856, 480}, // WVGA
{ "960x720 (4:3)", 960, 720}, // unnamed
{ "1024x576 (16:9)", 1024, 576}, // WSVGA
{ "1024x640 (16:10)", 1024, 640}, // unnamed
{ "1024x768 (4:3)", 1024, 768}, // XGA
{ "1152x720 (16:10)", 1152, 720}, // XGA+
{ "1152x864 (4:3)", 1152, 864}, // XGA+
{ "1280x720 (16:9)", 1280, 720}, // WXGA min.
{ "1280x800 (16:10)", 1280, 800}, // WXGA avg (native resolution of 17" widescreen LCDs)
{ "1280x960 (4:3)", 1280, 960}, //SXGA-
{ "1280x1024 (5:4)", 1280, 1024}, // SXGA (native resolution of 17-19" LCDs)
{ "1366x768 (16:9)", 1366, 768}, // WXGA
{ "1400x1050 (4:3)", 1400, 1050}, // SXGA+
{ "1440x900 (16:10)", 1440, 900}, // WXGA+ (native resolution of 19" widescreen LCDs)
{ "1440x1080 (4:3)", 1440, 1080}, // unnamed
{ "1600x900 (16:9)", 1600, 900}, // 900p
{ "1600x1200 (4:3)", 1600, 1200}, // UXGA (native resolution of 20"+ LCDs) //sw height is bound to 200 to 1024
{ "1680x1050 (16:10)", 1680, 1050}, // WSXGA+ (native resolution of 22" widescreen LCDs)
{ "1792x1344 (4:3)", 1792, 1344}, // unnamed
{ "1800x1440 (5:4)", 1800, 1440}, // unnamed
{ "1856x1392 (4:3)", 1856, 1392}, //unnamed
{ "1920x1080 (16:9)", 1920, 1080}, // 1080p (native resolution of cheap 24" LCDs, which really are 23.6")
{ "1920x1200 (16:10)", 1920, 1200}, // WUXGA (native resolution of good 24" widescreen LCDs)
{ "1920x1440 (4:3)", 1920, 1440}, // TXGA
{ "2048x1152 (16:9)", 2048, 1152}, // QWXGA (native resolution of 23" ultra-widescreen LCDs)
{ "2048x1536 (4:3)", 2048, 1536}, // QXGA //too much width will disable water warping (>1280) (but at that resolution, it's almost unnoticable)
{ "2304x1440 (16:10)", 2304, 1440}, // (unnamed; maximum resolution of the Sony GDM-FW900 and Hewlett Packard A7217A)
{ "2560x1600 (16:10)", 2560, 1600}, // WQXGA (maximum resolution of 30" widescreen LCDs, Dell for example)
{ "2560x2048 (5:4)", 2560, 2048} // QSXGA
};
#define NUMVIDMODES sizeof(vid_modes)/sizeof(vid_modes[0])
qboolean M_Vid_GetMode(int num, int *w, int *h)
{
if ((unsigned)num >= NUMVIDMODES)
return false;
*w = vid_modes[num].width;
*h = vid_modes[num].height;
return true;
}
typedef struct {
menucombo_t *renderer;
menucombo_t *modecombo;
menucombo_t *conscalecombo;
menucombo_t *bppcombo;
menucombo_t *refreshratecombo;
menucombo_t *vsynccombo;
menuedit_t *customwidth;
menuedit_t *customheight;
} videomenuinfo_t;
menuedit_t *MC_AddEdit(menu_t *menu, int x, int y, char *text, char *def);
void CheckCustomMode(struct menu_s *menu)
{
videomenuinfo_t *info = menu->data;
if (info->modecombo->selectedoption && info->conscalecombo->selectedoption)
{ //hide the custom options
info->customwidth->common.ishidden = true;
info->customheight->common.ishidden = true;
}
else
{
info->customwidth->common.ishidden = false;
info->customheight->common.ishidden = false;
}
if (!info->bppcombo->selectedoption)
info->bppcombo->selectedoption = 1;
info->conscalecombo->common.ishidden = false;
}
qboolean M_VideoApply (union menuoption_s *op,struct menu_s *menu,int key)
{
videomenuinfo_t *info = menu->data;
int selectedbpp;
if (key != K_ENTER)
return false;
if (info->modecombo->selectedoption)
{ //set a prefab
Cbuf_AddText(va("vid_width %i\n", vid_modes[info->modecombo->selectedoption-1].width), RESTRICT_LOCAL);
Cbuf_AddText(va("vid_height %i\n", vid_modes[info->modecombo->selectedoption-1].height), RESTRICT_LOCAL);
}
else
{ //use the custom one
Cbuf_AddText(va("vid_width %s\n", info->customwidth->text), RESTRICT_LOCAL);
Cbuf_AddText(va("vid_height %s\n", info->customheight->text), RESTRICT_LOCAL);
}
if (info->conscalecombo->selectedoption) //I am aware that this handicaps the menu a bit, but it should be easier for n00bs.
{ //set a prefab
Cbuf_AddText(va("vid_conwidth %i\n", vid_modes[info->conscalecombo->selectedoption-1].width), RESTRICT_LOCAL);
Cbuf_AddText(va("vid_conheight %i\n", vid_modes[info->conscalecombo->selectedoption-1].height), RESTRICT_LOCAL);
}
else
{ //use the custom one
Cbuf_AddText(va("vid_conwidth %s\n", info->customwidth->text), RESTRICT_LOCAL);
Cbuf_AddText(va("vid_conheight %s\n", info->customheight->text), RESTRICT_LOCAL);
}
selectedbpp = 16;
switch(info->bppcombo->selectedoption)
{
case 0:
if (info->renderer->selectedoption)
selectedbpp = 16;
else
selectedbpp = 8;
break;
case 1:
selectedbpp = 16;
break;
case 2:
selectedbpp = 32;
break;
}
switch(info->vsynccombo->selectedoption)
{
case 0:
Cbuf_AddText(va("vid_wait %i\n", 0), RESTRICT_LOCAL);
break;
case 1:
Cbuf_AddText(va("vid_wait %i\n", 1), RESTRICT_LOCAL);
break;
case 2:
Cbuf_AddText(va("vid_wait %i\n", 2), RESTRICT_LOCAL);
break;
}
Cbuf_AddText(va("vid_bpp %i\n", selectedbpp), RESTRICT_LOCAL);
switch(info->refreshratecombo->selectedoption)
{
case 0:
Cbuf_AddText(va("vid_displayfrequency %i\n", 0), RESTRICT_LOCAL);
break;
case 1:
Cbuf_AddText(va("vid_displayfrequency %i\n", 59), RESTRICT_LOCAL);
break;
case 2:
Cbuf_AddText(va("vid_displayfrequency %i\n", 60), RESTRICT_LOCAL);
break;
case 3:
Cbuf_AddText(va("vid_displayfrequency %i\n", 70), RESTRICT_LOCAL);
break;
case 4:
Cbuf_AddText(va("vid_displayfrequency %i\n", 72), RESTRICT_LOCAL);
break;
case 5:
Cbuf_AddText(va("vid_displayfrequency %i\n", 75), RESTRICT_LOCAL);
break;
case 6:
Cbuf_AddText(va("vid_displayfrequency %i\n", 85), RESTRICT_LOCAL);
break;
case 7:
Cbuf_AddText(va("vid_displayfrequency %i\n", 100), RESTRICT_LOCAL);
break;
}
switch(info->renderer->selectedoption)
{
#if defined(GLQUAKE) && !defined(D3DQUAKE) // Just OpenGL client
case 0:
Cbuf_AddText("setrenderer gl\n", RESTRICT_LOCAL);
break;
#endif
#if defined(D3DQUAKE) && !defined(GLQUAKE) // Just Direct3D client
case 0:
Cbuf_AddText("setrenderer d3d\n", RESTRICT_LOCAL);
break;
#endif
#if defined(GLQUAKE) && defined(D3DQUAKE) // OpenGL + Direct3D = Merged
case 0:
Cbuf_AddText("setrenderer gl\n", RESTRICT_LOCAL);
break;
case 1:
Cbuf_AddText("setrenderer d3d\n", RESTRICT_LOCAL);
break;
#endif
}
M_RemoveMenu(menu);
Cbuf_AddText("menu_video\n", RESTRICT_LOCAL);
return true;
}
void M_Menu_Video_f (void)
{
extern cvar_t v_contrast;
#if defined(GLQUAKE)
#endif
static const char *modenames[128] = {"Custom"};
static const char *rendererops[] = {
#ifdef GLQUAKE
"OpenGL",
#endif
#ifdef D3DQUAKE
"DirectX9",
#endif
NULL
};
static const char *bppnames[] =
{
"8",
"16",
"32",
NULL
};
//unused
/*static const char *texturefilternames[] =
{
"Nearest",
"Bilinear",
"Trilinear",
NULL
};*/
static const char *refreshrates[] =
{
"0Hz (OS Driver refresh rate)",
"59Hz (NTSC is 59.94i)",
"60Hz",
"70Hz",
"72Hz", // VESA minimum setting to avoid eye damage on CRT monitors
"75Hz",
"85Hz",
"100Hz",
NULL
};
static const char *vsyncoptions[] =
{
"Off",
"Wait for Vertical Sync",
"Wait for Display Enable",
NULL
};
videomenuinfo_t *info;
int prefabmode;
int prefab2dmode;
int currentbpp;
int currentrefreshrate;
int currentvsync;
int aspectratio3d;
int aspectratio2d;
char *aspectratio23d;
char *aspectratio22d;
char *rendererstring;
static char current3dres[10]; // enough to fit 1920x1200
static char current2dres[10]; // same as above
static char currenthz[6]; // enough to fit 120hz
static char currentcolordepth[6];
extern cvar_t _vid_wait_override;
float vidwidth = vid.pixelwidth;
float vidheight = vid.pixelheight;
int i, y;
menu_t *menu = M_Options_Title(&y, sizeof(videomenuinfo_t));
info = menu->data;
prefabmode = -1;
prefab2dmode = -1;
for (i = 0; i < sizeof(vid_modes)/sizeof(vidmode_t); i++)
{
if (vid_modes[i].width == vid_width.value && vid_modes[i].height == vid_height.value)
prefabmode = i;
if (vid_modes[i].width == vid_conwidth.value && vid_modes[i].height == vid_conheight.value)
prefab2dmode = i;
modenames[i+1] = vid_modes[i].description;
}
modenames[i+1] = NULL;
#if defined(GLQUAKE) && defined(D3DQUAKE)
if (!strcmp(vid_renderer.string, "d3d9"))
i = 1;
else
#endif
i = 0;
if (vid_bpp.value >= 32)
{
currentbpp = 2;
strcpy(currentcolordepth, va("%sbit (16.7m colors)",vid_bpp.string) );
}
else if (vid_bpp.value >= 16)
{
currentbpp = 1;
strcpy(currentcolordepth, va("%sbit (65.5k colors)",vid_bpp.string) );
}
else
currentbpp = 0;
if (vid_refreshrate.value >= 100)
currentrefreshrate = 7;
else if (vid_refreshrate.value >= 85)
currentrefreshrate = 6;
else if (vid_refreshrate.value >= 75)
currentrefreshrate = 5;
else if (vid_refreshrate.value >= 72)
currentrefreshrate = 4;
else if (vid_refreshrate.value >= 70)
currentrefreshrate = 3;
else if (vid_refreshrate.value >= 60)
currentrefreshrate = 2;
else if (vid_refreshrate.value >= 59)
currentrefreshrate = 1;
else if (vid_refreshrate.value >= 0)
currentrefreshrate = 0;
else
currentrefreshrate = 0;
strcpy(currenthz, va("%sHz",vid_refreshrate.string) );
aspectratio3d = (vidwidth / vidheight * 100); // times by 100 so don't have to deal with floats
if (aspectratio3d == 125) // 1.25
aspectratio23d = "5:4";
else if (aspectratio3d == 160) // 1.6
aspectratio23d = "16:10";
else if (aspectratio3d == 133) // 1.333333
aspectratio23d = "4:3";
else if (aspectratio3d == 177) // 1.777778
aspectratio23d = "16:9";
else
{
aspectratio23d = "Non-standard Ratio";
Con_Printf("Ratio: %i, width: %i, height: %i\n", aspectratio3d, vid.pixelwidth, vid.pixelheight);
}
aspectratio2d = (vid_conwidth.value / vid_conheight.value * 100); // times by 100 so don't have to deal with floats
if (aspectratio2d == 125) // 1.25
aspectratio22d = "5:4";
else if (aspectratio2d == 160) // 1.6
aspectratio22d = "16:10";
else if (aspectratio2d == 133) // 1.333333
aspectratio22d = "4:3";
else if (aspectratio2d == 177) // 1.777778
aspectratio22d = "16:9";
else
aspectratio22d = "Non-standard Ratio";
currentvsync = _vid_wait_override.value;
if ( stricmp(vid_renderer.string,"gl" ) == 0 )
rendererstring = "OpenGL";
else if ( stricmp(vid_renderer.string,"d3d7") == 0 )
rendererstring = "DirectX 7";
else if ( stricmp(vid_renderer.string,"d3d9") == 0 )
rendererstring = "DirectX 9";
else if ( stricmp(vid_renderer.string,"d3d") == 0)
rendererstring = "DirectX";
else if ( stricmp(vid_renderer.string,"sw") == 0)
rendererstring = "Software";
else
rendererstring = "Unknown Renderer?";
strcpy(current3dres, va("%ix%i", vid.pixelwidth, vid.pixelheight) );
strcpy(current2dres, va("%sx%s", vid_conwidth.string, vid_conheight.string) );
y += 40;
MC_AddRedText(menu, 0, y, " Current Renderer", false);
MC_AddRedText(menu, 225, y, rendererstring, false); y+=8;
MC_AddRedText(menu, 0, y, " Current Color Depth", false);
MC_AddRedText(menu, 225, y, currentcolordepth, false); y+=8;
if ( ( vidwidth == 0) || ( vidheight == 0) )
y+=16;
else
{
MC_AddRedText(menu, 0, y, " Current 3D Res", false);
MC_AddRedText(menu, 225, y, current3dres, false); y+=8;
MC_AddRedText(menu, 0, y, " Current 3D A/R", false);
MC_AddRedText(menu, 225, y, aspectratio23d, false); y+=8;
}
if ( ( vid_conwidth.value == 0) || ( vid_conheight.value == 0) ) // same as 3d resolution
{
MC_AddRedText(menu, 0, y, " Current 2D Res", false);
MC_AddRedText(menu, 225, y, current3dres, false); y+=8;
MC_AddRedText(menu, 0, y, " Current 2D A/R", false);
MC_AddRedText(menu, 225, y, aspectratio23d, false); y+=8;
}
else
{
MC_AddRedText(menu, 0, y, " Current 2D Res", false);
MC_AddRedText(menu, 225, y, current2dres, false); y+=8;
MC_AddRedText(menu, 0, y, " Current 2D A/R", false);
MC_AddRedText(menu, 225, y, aspectratio22d, false); y+=8;
}
MC_AddRedText(menu, 0, y, " Current Refresh Rate", false);
MC_AddRedText(menu, 225, y, currenthz, false); y+=8;
y+=8;
MC_AddRedText(menu, 0, y, "<><E282AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ", false); y+=8;
y+=8;
info->renderer = MC_AddCombo(menu, 16, y, " Renderer", rendererops, i); y+=8;
info->bppcombo = MC_AddCombo(menu, 16, y, " Color Depth", bppnames, currentbpp); y+=8;
info->refreshratecombo = MC_AddCombo(menu, 16, y, " Refresh Rate", refreshrates, currentrefreshrate); y+=8;
info->modecombo = MC_AddCombo(menu, 16, y, " Video Size", modenames, prefabmode+1); y+=8;
MC_AddWhiteText(menu, 16, y, " 3D Aspect Ratio", false); y+=8;
info->conscalecombo = MC_AddCombo(menu, 16, y, " 2D Size", modenames, prefab2dmode+1); y+=8;
MC_AddWhiteText(menu, 16, y, " 2D Aspect Ratio", false); y+=8;
MC_AddCheckBox(menu, 16, y, " Fullscreen", &vid_fullscreen,0); y+=8;
y+=4;info->customwidth = MC_AddEdit(menu, 16, y, " Custom width", vid_width.string); y+=8;
y+=4;info->customheight = MC_AddEdit(menu, 16, y, " Custom height", vid_height.string); y+=12;
info->vsynccombo = MC_AddCombo(menu, 16, y, " VSync", vsyncoptions, currentvsync); y+=8;
//MC_AddCheckBox(menu, 16, y, " Override VSync", &_vid_wait_override,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Desktop Settings", &vid_desktopsettings,0); y+=8;
y+=8;
MC_AddCommand(menu, 16, y, "= Apply Changes =", M_VideoApply); y+=8;
y+=8;
MC_AddSlider(menu, 16, y, " Screen size", &scr_viewsize, 30, 120, 1);y+=8;
MC_AddSlider(menu, 16, y, "Console Autoscale",&vid_conautoscale, 0, 6, 0.25); y+=8;
MC_AddSlider(menu, 16, y, " Gamma", &v_gamma, 0.3, 1, 0.05); y+=8;
MC_AddCheckBox(menu, 16, y, " Desktop Gamma", &vid_desktopgamma,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Hardware Gamma", &vid_hardwaregamma,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Preserve Gamma", &vid_preservegamma,0); y+=8;
MC_AddSlider(menu, 16, y, " Contrast", &v_contrast, 1, 3, 0.05); y+=8;
y+=8;
MC_AddCheckBox(menu, 16, y, " Allow ModeX", &vid_allow_modex,0); y+=8;
MC_AddCheckBox(menu, 16, y, " Windowed Mouse", &_windowed_mouse,0); y+=8;
menu->selecteditem = (union menuoption_s *)info->renderer;
menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 152, menu->selecteditem->common.posy, NULL, false);
menu->event = CheckCustomMode;
}
void R_SetRenderer(rendererinfo_t *ri)
{
currentrendererstate.renderer = ri;

View File

@ -59,15 +59,18 @@ int desired_bits = 16;
int sound_started=0;
cvar_t bgmvolume = CVARF( "musicvolume", "0", CVAR_ARCHIVE);
cvar_t volume = CVARF( "volume", "0.7", CVAR_ARCHIVE);
cvar_t bgmvolume = CVARFD( "musicvolume", "0", CVAR_ARCHIVE,
"Volume level for background music.");
cvar_t volume = CVARFD( "volume", "0.7", CVAR_ARCHIVE,
"Main volume level for all engine sound.");
cvar_t nosound = CVAR( "nosound", "0");
cvar_t nosound = CVARD( "nosound", "0",
"Disable all sound from the engine.");
cvar_t precache = CVARAF( "s_precache", "1",
"precache", 0);
cvar_t loadas8bit = CVARAF( "s_loadas8bit", "0",
"loadas8bit", 0);
cvar_t bgmbuffer = CVAR( "bgmbuffer", "4096");
cvar_t loadas8bit = CVARAFD( "s_loadas8bit", "0",
"loadas8bit", 0,
"Downsample sounds on load as lower quality 8-bit sound.");
cvar_t ambient_level = CVARAF( "s_ambientlevel", "0.3",
"ambient_level", 0);
cvar_t ambient_fade = CVARAF( "s_ambientfade", "100",
@ -78,8 +81,10 @@ cvar_t snd_show = CVARAF( "s_show", "0",
"snd_show", 0);
cvar_t snd_khz = CVARAF( "s_khz", "44",
"snd_khz", CVAR_ARCHIVE);
cvar_t snd_inactive = CVARAF( "s_inactive", "0",
"snd_inactive", 0); //set if you want sound even when tabbed out.
cvar_t snd_inactive = CVARAFD( "s_inactive", "0",
"snd_inactive", 0,
"Play sound while application is inactive (ex. tabbed out)."
); //set if you want sound even when tabbed out.
cvar_t _snd_mixahead = CVARAF( "s_mixahead", "0.08",
"_snd_mixahead", CVAR_ARCHIVE);
cvar_t snd_leftisright = CVARAF( "s_swapstereo", "0",
@ -92,8 +97,9 @@ cvar_t snd_buffersize = CVARAF( "s_buffersize", "0",
"snd_buffersize", 0);
cvar_t snd_samplebits = CVARAF( "s_bits", "16",
"snd_samplebits", CVAR_ARCHIVE);
cvar_t snd_playersoundvolume = CVARAF( "s_localvolume", "1",
"snd_localvolume", 0); //sugested by crunch
cvar_t snd_playersoundvolume = CVARAFD( "s_localvolume", "1",
"snd_localvolume", 0,
"Sound level for sounds local or originating from the player such as firing and pain sounds."); //sugested by crunch
cvar_t snd_linearresample = CVARAF( "s_linearresample", "1",
"snd_linearresample", 0);
@ -992,7 +998,6 @@ void S_Init (void)
Cvar_Register(&precache, "Sound controls");
Cvar_Register(&loadas8bit, "Sound controls");
Cvar_Register(&bgmvolume, "Sound controls");
Cvar_Register(&bgmbuffer, "Sound controls");
Cvar_Register(&ambient_level, "Sound controls");
Cvar_Register(&ambient_fade, "Sound controls");
Cvar_Register(&snd_noextraupdate, "Sound controls");

View File

@ -147,7 +147,7 @@ void TP_SkinCvar_Callback(struct cvar_s *var, char *oldvalue);
TP_CVAR(tp_name_teammate, ""); \
TP_CVAR(tp_name_eyes, "eyes"); \
\
TP_CVAR(loc_name_seperator, "-"); \
TP_CVAR(loc_name_separator, "-"); \
TP_CVAR(loc_name_ssg, "ssg"); \
TP_CVAR(loc_name_ng, "ng"); \
TP_CVAR(loc_name_sng, "sng"); \

View File

@ -75,7 +75,6 @@ extern cvar_t gl_part_flame;
extern cvar_t r_bloom;
cvar_t gl_affinemodels = SCVAR("gl_affinemodels","0");
cvar_t gl_playermip = SCVAR("gl_playermip","0");
cvar_t gl_reporttjunctions = SCVAR("gl_reporttjunctions","0");
cvar_t gl_finish = SCVAR("gl_finish","0");
cvar_t gl_dither = SCVAR("gl_dither", "1");

View File

@ -902,7 +902,7 @@ struct sbuiltin_s
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"varying vec4 vc;\n"
"varying lowp vec4 vc;\n"
"void main (void)\n"
"{\n"
" gl_FragColor = vc;\n"

View File

@ -143,7 +143,6 @@ modestate_t modestate = MS_UNINIT;
LONG WINAPI GLMainWndProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
qboolean GLAppActivate(BOOL fActive, BOOL minimize);
char *VID_GetModeDescription (int mode);
void ClearAllStates (void);
void VID_UpdateWindowStatus (HWND hWnd);
void GL_Init(void *(*getglfunction) (char *name));