X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=menu.c;h=8c4b901a266a79bc54cc7daac4d3275a6c27b328;hp=8cf8ca2e5d7e2c9127b327bba6a562aa1a931bf1;hb=acb576bdab16f8244b87f7c12f85924154e83c5f;hpb=ac4ecbb937f4f082a1703e2714a35b4004545be0 diff --git a/menu.c b/menu.c index 8cf8ca2e..8c4b901a 100644 --- a/menu.c +++ b/menu.c @@ -43,6 +43,7 @@ void M_Menu_Main_f (void); void M_Menu_Options_Graphics_f (void); void M_Menu_Options_ColorControl_f (void); void M_Menu_Keys_f (void); + void M_Menu_Reset_f (void); void M_Menu_Video_f (void); void M_Menu_Help_f (void); void M_Menu_Quit_f (void); @@ -61,6 +62,7 @@ void M_Main_Draw (void); void M_Options_Graphics_Draw (void); void M_Options_ColorControl_Draw (void); void M_Keys_Draw (void); + void M_Reset_Draw (void); void M_Video_Draw (void); void M_Help_Draw (void); void M_Quit_Draw (void); @@ -79,6 +81,7 @@ void M_Main_Key (int key, char ascii); void M_Options_Graphics_Key (int key, char ascii); void M_Options_ColorControl_Key (int key, char ascii); void M_Keys_Key (int key, char ascii); + void M_Reset_Key (int key, char ascii); void M_Video_Key (int key, char ascii); void M_Help_Key (int key, char ascii); void M_Quit_Key (int key, char ascii); @@ -362,6 +365,8 @@ void M_Menu_Main_f (void) else MAIN_ITEMS = 6; } + else if (gamemode == GAME_NETHERWORLD)//VORTEX: menu restarting item + MAIN_ITEMS = 6; else MAIN_ITEMS = 5; @@ -521,6 +526,34 @@ void M_Main_Key (int key, char ascii) break; } } + else if (gamemode == GAME_NETHERWORLD)//VORTEX: menu restarting item + { + switch (m_main_cursor) + { + case 0: + M_Menu_SinglePlayer_f (); + break; + + case 1: + M_Menu_MultiPlayer_f (); + break; + + case 2: + M_Menu_Options_f (); + break; + + case 3: + M_Menu_Help_f (); + break; + + case 4: + M_Menu_Quit_f (); + break; + case 5: + MR_Restart(); + break; + } + } else { switch (m_main_cursor) @@ -1171,7 +1204,7 @@ void M_DrawCheckbox (int x, int y, int on) } -#define OPTIONS_ITEMS 38 +#define OPTIONS_ITEMS 40 int options_cursor; @@ -1183,10 +1216,10 @@ void M_Menu_Options_f (void) } extern cvar_t snd_staticvolume; -extern cvar_t gl_delayfinish; extern cvar_t slowmo; extern dllhandle_t jpeg_dll; extern cvar_t gl_texture_anisotropy; +extern cvar_t r_textshadow; void M_Menu_Options_AdjustSliders (int dir) { @@ -1204,6 +1237,10 @@ void M_Menu_Options_AdjustSliders (int dir) Cvar_SetValueQuick (&scr_conalpha, bound(0, scr_conalpha.value + dir * 0.2, 1)); else if (options_cursor == optnum++) Cvar_SetValueQuick (&scr_conbrightness, bound(0, scr_conbrightness.value + dir * 0.2, 1)); + else if (options_cursor == optnum++) + Cvar_SetValueQuick (&sbar_alpha_bg, bound(0, sbar_alpha_bg.value + dir * 0.1, 1)); + else if (options_cursor == optnum++) + Cvar_SetValueQuick (&sbar_alpha_fg, bound(0, sbar_alpha_fg.value + dir * 0.1, 1)); else if (options_cursor == optnum++) Cvar_SetValueQuick (&scr_viewsize, bound(30, scr_viewsize.value + dir * 10, 120)); else if (options_cursor == optnum++) @@ -1218,8 +1255,6 @@ void M_Menu_Options_AdjustSliders (int dir) Cvar_SetValueQuick (&gl_combine, !gl_combine.integer); else if (options_cursor == optnum++) Cvar_SetValueQuick (&gl_dither, !gl_dither.integer); - else if (options_cursor == optnum++) - Cvar_SetValueQuick (&gl_delayfinish, !gl_delayfinish.integer); else if (options_cursor == optnum++) Cvar_SetValueQuick (&gl_texture_anisotropy, bound(1, gl_texture_anisotropy.integer + dir, gl_max_anisotropy)); else if (options_cursor == optnum++) @@ -1230,6 +1265,8 @@ void M_Menu_Options_AdjustSliders (int dir) Cvar_SetValueQuick (&volume, bound(0, volume.value + dir * 0.1, 1)); else if (options_cursor == optnum++) Cvar_SetValueQuick (&snd_staticvolume, bound(0, snd_staticvolume.value + dir * 0.1, 1)); + else if (options_cursor == optnum++) + Cvar_SetValueQuick (&r_textshadow, !r_textshadow.integer); else if (options_cursor == optnum++) Cvar_SetValueQuick (&crosshair, bound(0, crosshair.integer + dir, 5)); else if (options_cursor == optnum++) @@ -1336,6 +1373,8 @@ void M_Options_Draw (void) M_Options_PrintSlider( " Console Speed", true, scr_conspeed.value, 0, 1000); M_Options_PrintSlider( " Console Alpha", true, scr_conalpha.value, 0, 1); M_Options_PrintSlider( "Conback Brightness", true, scr_conbrightness.value, 0, 1); + M_Options_PrintSlider( " Sbar Alpha BG", true, sbar_alpha_bg.value, 0, 1); + M_Options_PrintSlider( " Sbar Alpha FG", true, sbar_alpha_fg.value, 0, 1); M_Options_PrintSlider( " Screen size", true, scr_viewsize.value, 30, 120); M_Options_PrintSlider( " Field of View", true, scr_fov.integer, 1, 170); M_Options_PrintCheckbox(" JPEG screenshots", jpeg_dll != NULL, scr_screenshot_jpeg.integer); @@ -1343,12 +1382,12 @@ void M_Options_Draw (void) M_Options_PrintCheckbox(" Sky", true, r_sky.integer); M_Options_PrintCheckbox(" Texture Combine", true, gl_combine.integer); M_Options_PrintCheckbox(" Dithering", true, gl_dither.integer); - M_Options_PrintCheckbox("Delay gfx (faster)", true, gl_delayfinish.integer); M_Options_PrintSlider( "Anisotropic Filter", gl_support_anisotropy, gl_texture_anisotropy.integer, 1, gl_max_anisotropy); M_Options_PrintSlider( " Game Speed", sv.active, slowmo.value, 0, 5); M_Options_PrintSlider( " CD Music Volume", cdaudioinitialized.integer, bgmvolume.value, 0, 1); M_Options_PrintSlider( " Sound Volume", snd_initialized.integer, volume.value, 0, 1); M_Options_PrintSlider(gamemode == GAME_GOODVSBAD2 ? " Music Volume" : " Ambient Volume", snd_initialized.integer, snd_staticvolume.value, 0, 1); + M_Options_PrintCheckbox(" Text Shadow", true, r_textshadow.integer); M_Options_PrintSlider( " Crosshair", true, crosshair.value, 0, 5); M_Options_PrintSlider( " Crosshair Size", true, crosshair_size.value, 1, 5); M_Options_PrintCheckbox(" Static Crosshair", true, crosshair_static.integer); @@ -1386,7 +1425,7 @@ void M_Options_Key (int k, char ascii) Con_ToggleConsole_f (); break; case 2: - Cbuf_AddText ("exec default.cfg\n"); + M_Menu_Reset_f (); break; case 3: M_Menu_Video_f (); @@ -1430,7 +1469,7 @@ void M_Options_Key (int k, char ascii) } } -#define OPTIONS_EFFECTS_ITEMS 33 +#define OPTIONS_EFFECTS_ITEMS 34 int options_effects_cursor; @@ -1444,8 +1483,8 @@ void M_Menu_Options_Effects_f (void) extern cvar_t r_detailtextures; extern cvar_t cl_particles; -extern cvar_t cl_explosions; extern cvar_t cl_stainmaps; +extern cvar_t cl_stainmapsclearonload; extern cvar_t cl_decals; extern cvar_t r_explosionclip; extern cvar_t r_modellights; @@ -1459,6 +1498,7 @@ extern cvar_t cl_particles_bubbles; extern cvar_t cl_particles_blood; extern cvar_t cl_particles_blood_alpha; extern cvar_t cl_particles_blood_bloodhack; +extern cvar_t cl_particles_explosions_shell; extern cvar_t r_lightningbeam_thickness; extern cvar_t r_lightningbeam_scroll; extern cvar_t r_lightningbeam_repeatdistance; @@ -1478,9 +1518,10 @@ void M_Menu_Options_Effects_AdjustSliders (int dir) else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&gl_flashblend, !gl_flashblend.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles, !cl_particles.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_quality, bound(1, cl_particles_quality.value + dir * 0.5, 4)); - else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_explosions, !cl_explosions.integer); + else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_explosions_shell, !cl_particles_explosions_shell.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_explosionclip, !r_explosionclip.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmaps, !cl_stainmaps.integer); + else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_stainmapsclearonload, !cl_stainmapsclearonload.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_decals, !cl_decals.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_detailtextures, !r_detailtextures.integer); else if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&cl_particles_bulletimpacts, !cl_particles_bulletimpacts.integer); @@ -1529,9 +1570,10 @@ void M_Options_Effects_Draw (void) M_Options_PrintCheckbox(" Use Only Coronas", true, gl_flashblend.integer); M_Options_PrintCheckbox(" Particles", true, cl_particles.integer); M_Options_PrintSlider( " Particles Quality", true, cl_particles_quality.value, 1, 4); - M_Options_PrintCheckbox(" Explosions", true, cl_explosions.integer); - M_Options_PrintCheckbox(" Explosion Clipping", true, r_explosionclip.integer); + M_Options_PrintCheckbox(" Explosion Shell", true, cl_particles_explosions_shell.integer); + M_Options_PrintCheckbox(" Explosion Shell Clip", true, r_explosionclip.integer); M_Options_PrintCheckbox(" Stainmaps", true, cl_stainmaps.integer); + M_Options_PrintCheckbox("Onload Clear Stainmaps", true, cl_stainmapsclearonload.integer); M_Options_PrintCheckbox(" Decals", true, cl_decals.integer); M_Options_PrintCheckbox(" Detail Texturing", true, r_detailtextures.integer); M_Options_PrintCheckbox(" Bullet Impacts", true, cl_particles_bulletimpacts.integer); @@ -1628,7 +1670,7 @@ void M_Menu_Options_Graphics_AdjustSliders (int dir) 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, !r_shadow_realtime_world_lightmaps.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); } @@ -1654,7 +1696,7 @@ void M_Options_Graphics_Draw (void) 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_PrintCheckbox(" RT World Lightmaps", true, r_shadow_realtime_world_lightmaps.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); } @@ -2326,13 +2368,51 @@ void M_Keys_Key (int k, char ascii) } } +void M_Menu_Reset_f (void) +{ + key_dest = key_menu; + m_state = m_reset; + m_entersound = true; +} + + +void M_Reset_Key (int key, char ascii) +{ + switch (key) + { + case K_ESCAPE: + case 'n': + case 'N': + m_state = m_options; + m_entersound = true; + break; + + case 'Y': + case 'y': + Cbuf_AddText ("exec default.cfg\n"); + break; + + default: + break; + } +} + +void M_Reset_Draw (void) +{ + int lines = 2, linelength = 20; + M_Background(linelength * 8 + 16, lines * 8 + 16); + M_DrawTextBox(0, 0, linelength, lines); + M_Print(8 + 4 * (linelength - 19), 8, "Really wanna reset?"); + M_Print(8 + 4 * (linelength - 11), 16, "Press y / n"); +} + //============================================================================= /* VIDEO MENU */ -#define VIDEO_ITEMS 4 +#define VIDEO_ITEMS 5 int video_cursor = 0; -int video_cursor_table[] = {56, 68, 80, 100}; +int video_cursor_table[] = {56, 68, 80, 100, 120}; // note: if modes are added to the beginning of this list, update the // video_resolution = x; in M_Menu_Video_f below unsigned short video_resolutions[][2] = {{320,240}, {400,300}, {512,384}, {640,480}, {800,600}, {1024,768}, {1152,864}, {1280,960}, {1280,1024}, {1600,1200}, {1792,1344}, {1920,1440}, {2048,1536}, {0,0}}; @@ -2399,6 +2479,10 @@ void M_Video_Draw (void) // "Apply" button M_Print(220, video_cursor_table[3], "Apply"); + // Vertical Sync + M_ItemPrint (0, video_cursor_table[4], " Vertical Sync", gl_videosyncavailable); + M_DrawCheckbox(220, video_cursor_table[4], vid_vsync.integer); + // Cursor M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1)); } @@ -2433,6 +2517,10 @@ void M_Menu_Video_AdjustSliders (int dir) case 2: Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer); break; + + case 4: + Cvar_SetValueQuick (&vid_vsync, !vid_vsync.integer); + break; } } @@ -3232,8 +3320,6 @@ int maxplayers; qboolean m_serverInfoMessage = false; double m_serverInfoMessageTime; -extern cvar_t sv_public; - void M_Menu_GameOptions_f (void) { key_dest = key_menu; @@ -3246,8 +3332,8 @@ void M_Menu_GameOptions_f (void) } -int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 132, 152, 160}; -#define NUM_GAMEOPTIONS 11 +int gameoptions_cursor_table[] = {40, 56, 64, 72, 80, 88, 96, 104, 112, 140, 160, 168}; +#define NUM_GAMEOPTIONS 12 int gameoptions_cursor; void M_GameOptions_Draw (void) @@ -3355,24 +3441,27 @@ void M_GameOptions_Draw (void) M_Print(0, 104, " Public server"); M_Print(160, 104, (sv_public.integer == 0) ? "no" : "yes"); - M_Print(0, 120, " Server name"); - M_DrawTextBox (0, 124, 38, 1); - M_Print(8, 132, hostname.string); + M_Print(0, 112, " Server maxrate"); + M_Print(160, 112, va("%i", sv_maxrate.integer)); + + M_Print(0, 128, " Server name"); + M_DrawTextBox (0, 132, 38, 1); + M_Print(8, 140, hostname.string); g = lookupgameinfo(); if (gamemode != GAME_GOODVSBAD2) { - M_Print(0, 152, " Episode"); - M_Print(160, 152, g->episodes[startepisode].description); + M_Print(0, 160, " Episode"); + M_Print(160, 160, g->episodes[startepisode].description); } - M_Print(0, 160, " Level"); - M_Print(160, 160, g->levels[g->episodes[startepisode].firstLevel + startlevel].description); - M_Print(160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].name); + M_Print(0, 168, " Level"); + M_Print(160, 168, g->levels[g->episodes[startepisode].firstLevel + startlevel].description); + M_Print(160, 176, g->levels[g->episodes[startepisode].firstLevel + startlevel].name); // line cursor - if (gameoptions_cursor == 8) + if (gameoptions_cursor == 9) M_DrawCharacter (8 + 8 * strlen(hostname.string), gameoptions_cursor_table[gameoptions_cursor], 10+((int)(realtime*4)&1)); else M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1)); @@ -3496,9 +3585,17 @@ void M_NetStart_Change (int dir) break; case 8: + Cvar_SetValueQuick (&sv_maxrate, sv_maxrate.integer + dir*500); + if (sv_maxrate.integer > NET_MAXRATE) + Cvar_SetValueQuick (&sv_maxrate, NET_MAXRATE); + if (sv_maxrate.integer < NET_MINRATE) + Cvar_SetValueQuick (&sv_maxrate, NET_MINRATE); break; case 9: + break; + + case 10: if (gamemode == GAME_GOODVSBAD2) break; startepisode += dir; @@ -3513,7 +3610,7 @@ void M_NetStart_Change (int dir) startlevel = 0; break; - case 10: + case 11: startlevel += dir; g = lookupgameinfo(); @@ -3583,7 +3680,7 @@ void M_GameOptions_Key (int key, char ascii) break; case K_BACKSPACE: - if (gameoptions_cursor == 8) + if (gameoptions_cursor == 9) { l = strlen(hostname.string); if (l) @@ -3599,7 +3696,7 @@ void M_GameOptions_Key (int key, char ascii) default: if (ascii < 32 || ascii > 126) break; - if (gameoptions_cursor == 8) + if (gameoptions_cursor == 9) { l = strlen(hostname.string); if (l < 37) @@ -3717,7 +3814,7 @@ void M_Shutdown(void); void M_Init (void) { - menu_mempool = Mem_AllocPool("Menu"); + menu_mempool = Mem_AllocPool("Menu", 0, NULL); menuplyr_load = true; menuplyr_pixels = NULL; @@ -3734,6 +3831,7 @@ void M_Init (void) Cvar_RegisterVariable (&menu_options_colorcontrol_correctionvalue); Cmd_AddCommand ("menu_keys", M_Menu_Keys_f); Cmd_AddCommand ("menu_video", M_Menu_Video_f); + Cmd_AddCommand ("menu_reset", M_Menu_Reset_f); Cmd_AddCommand ("help", M_Menu_Help_f); Cmd_AddCommand ("menu_quit", M_Menu_Quit_f); @@ -3857,6 +3955,10 @@ void M_Draw (void) M_Keys_Draw (); break; + case m_reset: + M_Reset_Draw (); + break; + case m_video: M_Video_Draw (); break; @@ -3947,6 +4049,11 @@ void M_Keydown (int key, char ascii) M_Keys_Key (key, ascii); return; + case m_reset: + M_Reset_Key (key, ascii); + return; + + case m_video: M_Video_Key (key, ascii); return; @@ -4121,9 +4228,9 @@ void MP_Init (void) prog->error_cmd = MP_Error; // allocate the mempools - prog->edicts_mempool = Mem_AllocPool(M_NAME " edicts mempool"); - prog->edictstring_mempool = Mem_AllocPool( M_NAME " edict string mempool"); - prog->progs_mempool = Mem_AllocPool(M_PROG_FILENAME); + prog->edicts_mempool = Mem_AllocPool(M_NAME " edicts mempool", 0, NULL); + prog->edictstring_mempool = Mem_AllocPool( M_NAME " edict string mempool", 0, NULL); + prog->progs_mempool = Mem_AllocPool(M_PROG_FILENAME, 0, NULL); PRVM_LoadProgs(M_PROG_FILENAME, m_numrequiredfunc, m_required_func); @@ -4207,24 +4314,25 @@ void Call_MR_ToggleMenu_f(void) MR_ToggleMenu_f(); } -void MR_Init() +void MR_Init_Commands(void) { // set router console commands Cvar_RegisterVariable (&forceqmenu); + if (gamemode == GAME_NETHERWORLD) + Cmd_AddCommand ("menu_fallback", MP_Error); //Force to old-style menu Cmd_AddCommand ("menu_restart",MR_Restart); Cmd_AddCommand ("togglemenu", Call_MR_ToggleMenu_f); +} +void MR_Init(void) +{ // use -forceqmenu to use always the normal quake menu (it sets forceqmenu to 1) if(COM_CheckParm("-forceqmenu")) Cvar_SetValueQuick(&forceqmenu,1); // use -useqmenu for debugging proposes, cause it starts // the normal quake menu only the first time - else if(COM_CheckParm("-useqmenu")) + if(COM_CheckParm("-useqmenu")) MR_SetRouting (TRUE); - - MR_SetRouting (FALSE); + else + MR_SetRouting (FALSE); } - - - -