+#define OPTIONS_GRAPHICS_ITEMS 14
+
+int options_graphics_cursor;
+
+void M_Menu_Options_Graphics_f (void)
+{
+ key_dest = key_menu;
+ m_state = m_options_graphics;
+ m_entersound = true;
+}
+
+extern cvar_t r_shadow_gloss;
+extern cvar_t r_shadow_realtime_dlight;
+extern cvar_t r_shadow_realtime_dlight_shadows;
+extern cvar_t r_shadow_realtime_world;
+extern cvar_t r_shadow_realtime_world_dlightshadows;
+extern cvar_t r_shadow_realtime_world_lightmaps;
+extern cvar_t r_shadow_realtime_world_shadows;
+extern cvar_t r_bloom;
+extern cvar_t r_bloom_intensity;
+extern cvar_t r_bloom_power;
+extern cvar_t r_bloom_blur;
+extern cvar_t r_bloom_resolution;
+extern cvar_t gl_picmip;
+
+void M_Menu_Options_Graphics_AdjustSliders (int dir)
+{
+ int optnum;
+ S_LocalSound ("sound/misc/menu3.wav");
+
+ optnum = 0;
+
+ if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_gloss, bound(0, r_shadow_gloss.integer + dir, 2));
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_dlight, !r_shadow_realtime_dlight.integer);
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_dlight_shadows, !r_shadow_realtime_dlight_shadows.integer);
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world, !r_shadow_realtime_world.integer);
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_dlightshadows, !r_shadow_realtime_world_dlightshadows.integer);
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_lightmaps, bound(0, r_shadow_realtime_world_lightmaps.value + dir * 0.1, 1));
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_shadow_realtime_world_shadows, !r_shadow_realtime_world_shadows.integer);
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_bloom, !r_bloom.integer);
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_bloom_intensity, bound(1, r_bloom_intensity.value + dir * 1, 16));
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_bloom_power, bound(1, r_bloom_power.value + dir * 1, 16));
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_bloom_blur, bound(1, r_bloom_blur.value + dir * 1, 16));
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&r_bloom_resolution, bound(64, r_bloom_resolution.value + dir * 64, 2048));
+ else if (options_graphics_cursor == optnum++) Cvar_SetValueQuick (&gl_picmip, bound(0, gl_picmip.value - dir, 3));
+ else if (options_graphics_cursor == optnum++) Cbuf_AddText ("r_restart\n");
+}
+
+
+void M_Options_Graphics_Draw (void)
+{
+ int visible;
+ cachepic_t *p;
+
+ M_Background(320, bound(200, 32 + OPTIONS_GRAPHICS_ITEMS * 8, vid_conheight.integer));
+
+ M_DrawPic(16, 4, "gfx/qplaque.lmp");
+ p = Draw_CachePic("gfx/p_option.lmp", false);
+ M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
+
+ optcursor = options_graphics_cursor;
+ optnum = 0;
+ visible = (menu_height - 32) / 8;
+ opty = 32 - bound(0, optcursor - (visible >> 1), max(0, OPTIONS_GRAPHICS_ITEMS - visible)) * 8;
+
+ M_Options_PrintSlider( " Gloss Mode", true, r_shadow_gloss.integer, 0, 2);
+ M_Options_PrintCheckbox(" RT DLights", true, r_shadow_realtime_dlight.integer);
+ M_Options_PrintCheckbox(" RT DLight Shadows", true, r_shadow_realtime_dlight_shadows.integer);
+ M_Options_PrintCheckbox(" RT World", true, r_shadow_realtime_world.integer);
+ M_Options_PrintCheckbox("RT World DLight Shadows", true, r_shadow_realtime_world_dlightshadows.integer);
+ M_Options_PrintSlider( " RT World Lightmaps", true, r_shadow_realtime_world_lightmaps.value, 0, 1);
+ M_Options_PrintCheckbox(" RT World Shadow", true, r_shadow_realtime_world_shadows.integer);
+ M_Options_PrintCheckbox(" Bloom Effect", true, r_bloom.integer);
+ M_Options_PrintSlider( " Bloom Intensity", true, r_bloom_intensity.value, 1, 16);
+ M_Options_PrintSlider( " Bloom Power", true, r_bloom_power.value, 1, 16);
+ M_Options_PrintSlider( " Bloom Blur", true, r_bloom_blur.value, 1, 16);
+ M_Options_PrintSlider( " Bloom Resolution", true, r_bloom_resolution.value, 64, 2048);
+ M_Options_PrintSlider( " Texture Quality", true, gl_picmip.value, 3, 0);
+ M_Options_PrintCommand( " Restart Renderer", true);
+}
+
+
+void M_Options_Graphics_Key (int k, char ascii)
+{
+ switch (k)
+ {
+ case K_ESCAPE:
+ M_Menu_Options_f ();
+ break;
+
+ case K_ENTER:
+ M_Menu_Options_Graphics_AdjustSliders (1);
+ break;
+
+ case K_UPARROW:
+ S_LocalSound ("sound/misc/menu1.wav");
+ options_graphics_cursor--;
+ if (options_graphics_cursor < 0)
+ options_graphics_cursor = OPTIONS_GRAPHICS_ITEMS-1;
+ break;