X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=menu.c;h=b4ee44b8e00d5337cd97930656e5dbaa979d794b;hb=66ae08799675241ffa3cc3bcaa211fddcd63387c;hp=879761a0b0759ed02abc41a570ec9a1b692421b7;hpb=63a4ff4563c4bbd232c265a288e9890e4015bd93;p=xonotic%2Fdarkplaces.git diff --git a/menu.c b/menu.c index 879761a0..b4ee44b8 100644 --- a/menu.c +++ b/menu.c @@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "image.h" -void (*vid_menudrawfn)(void); -void (*vid_menukeyfn)(int key); #define TYPE_DEMO 1 #define TYPE_GAME 2 @@ -174,7 +172,7 @@ void M_DrawCharacter (float cx, float cy, int num) DrawQ_String(menu_x + cx, menu_y + cy, temp, 1, 8, 8, 1, 1, 1, 1, 0); } -void M_Print (float cx, float cy, char *str) +void M_Print (float cx, float cy, const char *str) { DrawQ_String(menu_x + cx, menu_y + cy, str, 0, 8, 8, 1, 1, 1, 1, 0); } @@ -1389,7 +1387,7 @@ void M_Options_Draw (void) M_Print(16, y, " Customize controls");y += 8; M_Print(16, y, " Go to console");y += 8; M_Print(16, y, " Reset to defaults");y += 8; - M_ItemPrint(16, y, " Video Options", vid_menudrawfn != NULL);y += 8; + M_Print(16, y, " Video Options");y += 8; M_Print(16, y, " Effects Options");y += 8; M_Print(16, y, " 2D Resolution");M_DrawSlider(220, y, scr_2dresolution.value);y += 8; M_Print(16, y, " Screen size");M_DrawSlider(220, y, (scr_viewsize.value - 30) /(120 - 30));y += 8; @@ -1443,8 +1441,7 @@ void M_Options_Key (int k) Cbuf_AddText ("exec default.cfg\n"); break; case 3: - if (vid_menudrawfn) - M_Menu_Video_f (); + M_Menu_Video_f (); break; case 4: M_Menu_Options_Effects_f (); @@ -1663,6 +1660,8 @@ char *transfusionbindnames[][2] = { {"+forward", "walk forward"}, {"+back", "backpedal"}, +{"+left", "turn left"}, +{"+right", "turn right"}, {"+moveleft", "step left"}, {"+moveright", "step right"}, {"+jump", "jump / swim up"}, @@ -1954,23 +1953,165 @@ void M_Keys_Key (int k) //============================================================================= /* VIDEO MENU */ +#define VIDEO_ITEMS 5 + +int video_cursor = 0; +int video_cursor_table[] = {56, 68, 80, 92, 116}; +unsigned short video_resolutions[][2] = {{512,384}, {640,480}, {800,600}, {1024,768}, {1280,960}}; +int video_resolution; + +extern int current_vid_fullscreen; +extern int current_vid_width; +extern int current_vid_height; +extern int current_vid_bitsperpixel; +extern int current_vid_stencil; + + void M_Menu_Video_f (void) { key_dest = key_menu; m_state = m_video; m_entersound = true; + + // Look for the current resolution + for (video_resolution = 0; video_resolution < (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0])); video_resolution++) + { + if (video_resolutions[video_resolution][0] == current_vid_width && + video_resolutions[video_resolution][1] == current_vid_height) + break; + } + + // Default to 800x600 if we didn't find it + if (video_resolution == sizeof (video_resolutions) / sizeof (video_resolutions[0])) + { + video_resolution = 2; + Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]); + Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]); + } } void M_Video_Draw (void) { - (*vid_menudrawfn) (); + cachepic_t *p; + const char* string; + + M_DrawPic(16, 4, "gfx/qplaque.lmp"); + p = Draw_CachePic("gfx/vidmodes.lmp"); + M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp"); + + // Resolution + M_Print(16, video_cursor_table[0], " Resolution"); + string = va("%dx%d", video_resolutions[video_resolution][0], video_resolutions[video_resolution][1]); + M_Print (220, video_cursor_table[0], string); + + // Bits per pixel + M_Print(16, video_cursor_table[1], " Bits per pixel"); + M_Print (220, video_cursor_table[1], (vid_bitsperpixel.integer == 32) ? "32" : "16"); + + // Fullscreen + M_Print(16, video_cursor_table[2], " Fullscreen"); + M_DrawCheckbox(220, video_cursor_table[2], vid_fullscreen.integer); + + // Stencil + M_Print(16, video_cursor_table[3], " Stencil"); + M_DrawCheckbox(220, video_cursor_table[3], vid_stencil.integer); + + // "Apply" button + M_Print(220, video_cursor_table[4], "Apply"); + + // Cursor + M_DrawCharacter(200, video_cursor_table[video_cursor], 12+((int)(realtime*4)&1)); +} + + +void M_Menu_Video_AdjustSliders (int dir) +{ + S_LocalSound ("misc/menu3.wav"); + + switch (video_cursor) + { + // Resolution + case 0: + { + int new_resolution = video_resolution + dir; + if (new_resolution < 0) + video_resolution = sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1; + else if (new_resolution > (int) (sizeof (video_resolutions) / sizeof (video_resolutions[0]) - 1)) + video_resolution = 0; + else + video_resolution = new_resolution; + + Cvar_SetValueQuick (&vid_width, video_resolutions[video_resolution][0]); + Cvar_SetValueQuick (&vid_height, video_resolutions[video_resolution][1]); + break; + } + + // Bits per pixel + case 1: + Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32); + break; + case 2: + Cvar_SetValueQuick (&vid_fullscreen, !vid_fullscreen.integer); + break; + case 3: + Cvar_SetValueQuick (&vid_stencil, !vid_stencil.integer); + break; + } } void M_Video_Key (int key) { - (*vid_menukeyfn) (key); + switch (key) + { + case K_ESCAPE: + // vid_shared.c has a copy of the current video config. We restore it + Cvar_SetValueQuick(&vid_fullscreen, current_vid_fullscreen); + Cvar_SetValueQuick(&vid_width, current_vid_width); + Cvar_SetValueQuick(&vid_height, current_vid_height); + Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel); + Cvar_SetValueQuick(&vid_stencil, current_vid_stencil); + + S_LocalSound ("misc/menu1.wav"); + M_Menu_Options_f (); + break; + + case K_ENTER: + m_entersound = true; + switch (video_cursor) + { + case 4: + Cbuf_AddText ("vid_restart\n"); + M_Menu_Options_f (); + break; + default: + M_Menu_Video_AdjustSliders (1); + } + break; + + case K_UPARROW: + S_LocalSound ("misc/menu1.wav"); + video_cursor--; + if (video_cursor < 0) + video_cursor = VIDEO_ITEMS-1; + break; + + case K_DOWNARROW: + S_LocalSound ("misc/menu1.wav"); + video_cursor++; + if (video_cursor >= VIDEO_ITEMS) + video_cursor = 0; + break; + + case K_LEFTARROW: + M_Menu_Video_AdjustSliders (-1); + break; + + case K_RIGHTARROW: + M_Menu_Video_AdjustSliders (1); + break; + } } //============================================================================= @@ -2558,6 +2699,8 @@ level_t transfusionlevels[] = {"e1m1", "Cradle to Grave"}, {"e1m2", "Wrong Side of the Tracks"}, {"e1m7", "Altar of Stone"}, + {"e3m7", "The Pit of Cerberus"}, + {"e4m8", "The Hall of the Epiphany"}, {"dm1", "Monolith Building 11"}, {"dm2", "Power!"}, @@ -2582,6 +2725,7 @@ level_t transfusionlevels[] = {"dranzbb6", "Black Coffee"}, {"fragm", "Frag'M"}, + {"maim", "Maim"}, {"qe1m7", "The House of Chthon"}, {"simple", "Dead Simple"} }; @@ -2589,12 +2733,12 @@ level_t transfusionlevels[] = episode_t transfusionepisodes[] = { {"Blood", 0, 8}, - {"Blood Single Player", 8, 3}, - {"Plasma Pack", 11, 4}, - {"Cryptic Passage", 15, 2}, - {"Blood 2", 17, 5}, - {"Transfusion", 22, 6}, - {"Conversions", 28, 4} + {"Blood Single Player", 8, 5}, + {"Plasma Pack", 13, 4}, + {"Cryptic Passage", 17, 2}, + {"Blood 2", 19, 5}, + {"Transfusion", 24, 6}, + {"Conversions", 30, 5} }; gamelevels_t sharewarequakegame = {"Shareware Quake", quakelevels, quakeepisodes, 2}; @@ -2776,7 +2920,7 @@ void M_GameOptions_Draw (void) M_Print (x, 146, " More than 64 players?? "); M_Print (x, 154, " First, question your "); M_Print (x, 162, " sanity, then email "); - M_Print (x, 170, " havoc@inside3d.com "); + M_Print (x, 170, " havoc@telefragged.com "); } else {