From ca11c54292fa1436b93dc80bd87bb30700749264 Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 14 Sep 2005 20:56:34 +0000 Subject: [PATCH] Added preset video options, which should make things easier for new users, hopefully. Perhaps tweek these at some point. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1336 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/m_options.c | 80 +++++++++++++++++++++++++++++++++++++-- engine/client/menu.c | 3 ++ 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/engine/client/m_options.c b/engine/client/m_options.c index 7b7a2501d..f6008a42a 100644 --- a/engine/client/m_options.c +++ b/engine/client/m_options.c @@ -375,19 +375,85 @@ void M_Menu_Particles_f (void) menu->cursoritem = (menuoption_t*)MC_AddWhiteText(menu, 200, 32, NULL, false); } +enum { + PRESET_286, + PRESET_FAST, + PRESET_DEFAULT, + PRESET_NICE, + PRESET_REALTIME, + PRESET_MAX +}; +typedef struct { + char *cvarname; + char *value[PRESET_MAX]; +} presetinfo_t; +presetinfo_t preset[] = +{ + {"r_presetname", {"286", "fast", "default", "nice", "realtime"}}, + {"r_particlesdesc", {"none", "highfps", "spikeset", "spikeset", "spikeset"}}, + {"r_stains", {"0", "0", "1", "1", "1"}}, + {"r_drawflat", {"1", "0", "0", "0", "0"}}, + {"r_nolerp", {"1", "1", "0", "0", "0"}}, + {"r_nolightdir", {"1", "0", "0", "0", "0"}}, + {"r_dynamic", {"0", "0", "1", "1", "1"}}, + {"gl_flashblend", {"0", "1", "0", "1", "2"}}, + {"gl_bump", {"0", "0", "0", "1", "1"}}, + {"gl_specular", {"0", "0", "0", "1", "1"}}, + {"r_loadlit", {"0", "1", "1", "2", "2"}}, + {"r_fastsky", {"1", "1", "0", "0", "0"}}, + {"r_waterlayers", {"0", "2", "3", "4", "4"}}, + {"r_shadows", {"0", "0", "0", "1", "1"}}, + {"r_shadow_realtime_world",{"0","0", "0", "0", "1"}}, + {"gl_detail", {"0", "0", "0", "1", "1"}}, + {"gl_load24bit", {"0", "0", "1", "1", "1"}}, + {"r_waterwarp", {"0", "2", "1", "1", "1"}}, + {NULL} +}; +static void ApplyPreset (int presetnum) +{ + int i; + for (i = 1; preset[i].cvarname; i++) + { + Cbuf_AddText(preset[i].cvarname, Cmd_ExecLevel); + Cbuf_AddText(" ", Cmd_ExecLevel); + Cbuf_AddText(preset[i].value[presetnum], Cmd_ExecLevel); + Cbuf_AddText("\n", Cmd_ExecLevel); + } +} + +void FPS_Preset_f (void) +{ + char *arg = Cmd_Argv(1); + int i; + for (i = 0; i < PRESET_MAX; i++) + { + if (!strcmp(preset[0].value[i], arg)) + { + ApplyPreset(i); + return; + } + } + + Con_Printf("Preset %s not recognised\n", arg); + Con_Printf("Valid presests:\n"); + for (i = 0; i < PRESET_MAX; i++) + Con_Printf("%s\n", preset[0].value[i]); +} + void M_Menu_FPS_f (void) { int y = 32; menu_t *menu; int mgt; + int i, len; #ifdef RGLQUAKE extern cvar_t gl_compress, gl_detail, gl_bump, r_flashblend; #endif #ifdef SWQUAKE extern cvar_t d_smooth, d_mipscale, d_mipcap; #endif - extern cvar_t r_stains, r_bloodstains, r_loadlits, r_dynamic, v_contentblend, show_fps; + extern cvar_t r_stains, r_bloodstains, r_loadlits, r_dynamic, v_contentblend, show_fps, gl_skyboxname; key_dest = key_menu; m_state = m_complex; @@ -413,14 +479,20 @@ void M_Menu_FPS_f (void) menu->selecteditem = (union menuoption_s *) - MC_AddConsoleCommand(menu, 48, y, " Particle Options", "menu_particles\n"); y+=8; + MC_AddConsoleCommand(menu, 48, y, " Particle Options", "menu_particles\n"); y+=8; + for (i = 0; i < PRESET_MAX; i++) + { + len = strlen(preset[0].value[i]); + MC_AddConsoleCommand(menu, 48+8*(9-len), y, va("(preset) %s", preset[0].value[i]), va("fps_preset %s\n", preset[0].value[i])); y+=8; + } MC_AddCheckBox(menu, 48, y, " Show FPS", &show_fps,0);y+=8; MC_AddCheckBox(menu, 48, y, " Content blend", &v_contentblend,0);y+=8; MC_AddCheckBox(menu, 48, y, " Dynamic lights", &r_dynamic,0);y+=8; - MC_AddCheckBox(menu, 48, y, " Stainmaps", &r_stains,0);y+=8; + MC_AddCheckBox(menu, 48, y, " Stainmaps", &r_stains,0);y+=8; + y+=4;MC_AddEditCvar(menu, 48, y, " Skybox", &gl_skyboxname);y+=8;y+=4; switch(qrenderer) { #ifdef RGLQUAKE @@ -437,7 +509,7 @@ void M_Menu_FPS_f (void) #ifdef SWQUAKE case QR_SOFTWARE: if (r_pixbytes == 4) - {MC_AddCheckBox(menu, 48, y, " Load .lit files", &r_loadlits,0);y+=8;} + {MC_AddCheckBox(menu, 48, y, " Load .lit files", &r_loadlits,0);y+=8;} MC_AddCheckBox(menu, 48, y, " Texture Smoothing", &d_smooth,0);y+=8; MC_AddSlider(menu, 48, y, " Mipmap scale", &d_mipscale, 0.1, 3);y+=8; MC_AddSlider(menu, 48, y, " Mipmap Capping", &d_mipcap, 0, 3);y+=8; diff --git a/engine/client/menu.c b/engine/client/menu.c index fb619d350..ebcd2986a 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -898,12 +898,15 @@ void M_DeInit_Internal (void) Cmd_RemoveCommand ("menu_download"); } +void FPS_Preset_f(void); + //menu.dat is loaded later... after the video and everything is up. void M_Init (void) { M_Init_Internal(); Cmd_AddCommand("togglemenu", M_ToggleMenu_f); + Cmd_AddCommand("fps_preset", FPS_Preset_f); Cvar_Register(&m_helpismedia, "Menu thingumiebobs");