X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=blobdiff_plain;f=menu.c;h=9d3a4c20f6d039307dd1709e44391377d65037e0;hp=d09872ddc493ae4f87811d230c6f71b87b3ee555;hb=46964b3848eb7471d2f0e2284ae389b4b53337c1;hpb=6fb644eee19956bee121e1f2430d2b84067dc056 diff --git a/menu.c b/menu.c index d09872dd..9d3a4c20 100644 --- a/menu.c +++ b/menu.c @@ -414,7 +414,7 @@ void M_Menu_Main_f (void) MAIN_ITEMS = 5; // check if the game data is missing and use a different main menu if so - m_missingdata = !forceqmenu.integer && Draw_CachePic (s)->tex == r_texture_notexture; + m_missingdata = !forceqmenu.integer && !Draw_IsPicLoaded(Draw_CachePic_Flags(s, CACHEPICFLAG_FAILONMISSING)); if (m_missingdata) MAIN_ITEMS = 2; @@ -458,7 +458,7 @@ static void M_Main_Draw (void) int y1, y2, y3; M_Background(640, 480); p = Draw_CachePic ("gfx/menu/tb-transfusion"); - M_DrawPic (640/2 - p->width/2, 40, "gfx/menu/tb-transfusion"); + M_DrawPic (640/2 - Draw_GetPicWidth(p)/2, 40, "gfx/menu/tb-transfusion"); y2 = 120; // 8 rather than MAIN_ITEMS to skip a number and not miss the last option for (y1 = 1; y1 <= 8; y1++) @@ -479,7 +479,7 @@ static void M_Main_Draw (void) M_Background(320, 200); M_DrawPic (16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/ttl_main"); - M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main"); + M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/ttl_main"); // Nehahra if (gamemode == GAME_NEHAHRA) { @@ -758,7 +758,7 @@ static void M_SinglePlayer_Draw (void) // Some mods don't have a single player mode if (gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH) { - M_DrawPic ((320 - p->width) / 2, 4, "gfx/ttl_sgl"); + M_DrawPic ((320 - Draw_GetPicWidth(p)) / 2, 4, "gfx/ttl_sgl"); M_DrawTextBox (60, 8 * 8, 23, 4); if (gamemode == GAME_GOODVSBAD2) @@ -771,7 +771,7 @@ static void M_SinglePlayer_Draw (void) { int f; - M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_sgl"); + M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/ttl_sgl"); M_DrawPic (72, 32, "gfx/sp_menu"); f = (int)(realtime * 10)%6; @@ -925,7 +925,7 @@ static void M_Load_Draw (void) M_Background(320, 200); p = Draw_CachePic ("gfx/p_load"); - M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load" ); + M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/p_load" ); for (i=0 ; i< MAX_SAVEGAMES; i++) M_Print(16, 32 + 8*i, m_filenames[i]); @@ -943,7 +943,7 @@ static void M_Save_Draw (void) M_Background(320, 200); p = Draw_CachePic ("gfx/p_save"); - M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save"); + M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/p_save"); for (i=0 ; iwidth/2, 40, "gfx/menu/tb-episodes"); + M_DrawPic (640/2 - Draw_GetPicWidth(p)/2, 40, "gfx/menu/tb-episodes"); for (y = 0; y < EPISODE_ITEMS; y++){ M_DrawPic (0, 160 + y * 40, va(vabuf, sizeof(vabuf), "gfx/menu/episode%i", y+1)); } @@ -1110,7 +1110,7 @@ static void M_Transfusion_Skill_Draw (void) M_Background(640, 480); p = Draw_CachePic ("gfx/menu/tb-difficulty"); - M_DrawPic(640/2 - p->width/2, 40, "gfx/menu/tb-difficulty"); + M_DrawPic(640/2 - Draw_GetPicWidth(p)/2, 40, "gfx/menu/tb-difficulty"); for (y = 0; y < SKILL_ITEMS; y++) { @@ -1215,7 +1215,7 @@ static void M_MultiPlayer_Draw (void) { M_Background(640, 480); p = Draw_CachePic ("gfx/menu/tb-online"); - M_DrawPic (640/2 - p->width/2, 140, "gfx/menu/tb-online"); + M_DrawPic (640/2 - Draw_GetPicWidth(p)/2, 140, "gfx/menu/tb-online"); for (f = 1; f <= MULTIPLAYER_ITEMS; f++) M_DrawPic (0, 180 + f*40, va(vabuf, sizeof(vabuf), "gfx/menu/online%i", f)); M_DrawPic (0, 220 + m_multiplayer_cursor * 40, va(vabuf, sizeof(vabuf), "gfx/menu/online%iselected", m_multiplayer_cursor + 1)); @@ -1225,7 +1225,7 @@ static void M_MultiPlayer_Draw (void) M_DrawPic (16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/p_multi"); - M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi"); + M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/p_multi"); M_DrawPic (72, 32, "gfx/mp_menu"); f = (int)(realtime * 10)%6; @@ -1344,7 +1344,7 @@ static void M_Setup_Draw (void) M_DrawPic (16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/p_multi"); - M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi"); + M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/p_multi"); M_Print(64, 40, "Your name"); M_DrawTextBox (160, 32, 16, 1); @@ -1415,7 +1415,7 @@ static void M_Setup_Draw (void) } menuplyr_translated[i] = palette_bgra_transparent[j]; } - Draw_NewPic("gfx/menuplyr", menuplyr_width, menuplyr_height, true, (unsigned char *)menuplyr_translated); + Draw_NewPic("gfx/menuplyr", menuplyr_width, menuplyr_height, (unsigned char *)menuplyr_translated, TEXTYPE_BGRA, TEXF_CLAMP); } M_DrawPic(160, 48, "gfx/bigbox"); M_DrawPic(172, 56, "gfx/menuplyr"); @@ -1680,7 +1680,7 @@ static void M_Options_Draw (void) M_DrawPic(16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/p_option"); - M_DrawPic((320-p->width)/2, 4, "gfx/p_option"); + M_DrawPic((320-Draw_GetPicWidth(p))/2, 4, "gfx/p_option"); m_optnum = 0; m_optcursor = options_cursor; @@ -1889,7 +1889,7 @@ static void M_Options_Effects_Draw (void) M_DrawPic(16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/p_option"); - M_DrawPic((320-p->width)/2, 4, "gfx/p_option"); + M_DrawPic((320-Draw_GetPicWidth(p))/2, 4, "gfx/p_option"); m_optcursor = options_effects_cursor; m_optnum = 0; @@ -2036,7 +2036,7 @@ static void M_Options_Graphics_Draw (void) M_DrawPic(16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/p_option"); - M_DrawPic((320-p->width)/2, 4, "gfx/p_option"); + M_DrawPic((320-Draw_GetPicWidth(p))/2, 4, "gfx/p_option"); m_optcursor = options_graphics_cursor; m_optnum = 0; @@ -2124,8 +2124,6 @@ static void M_Menu_Options_ColorControl_AdjustSliders (int dir) optnum = 1; if (options_colorcontrol_cursor == optnum++) - Cvar_SetValueQuick (&v_hwgamma, !v_hwgamma.integer); - else if (options_colorcontrol_cursor == optnum++) { Cvar_SetValueQuick (&v_color_enable, 0); Cvar_SetValueQuick (&v_gamma, bound(1, v_gamma.value + dir * 0.125, 5)); @@ -2218,7 +2216,8 @@ static void M_Menu_Options_ColorControl_AdjustSliders (int dir) static void M_Options_ColorControl_Draw (void) { int visible; - float x, c, s, t, u, v; + float x, s, t, u, v; + float c[3]; cachepic_t *p, *dither; dither = Draw_CachePic_Flags ("gfx/colorcontrol/ditherpattern", CACHEPICFLAG_NOCLAMP); @@ -2227,7 +2226,7 @@ static void M_Options_ColorControl_Draw (void) M_DrawPic(16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/p_option"); - M_DrawPic((320-p->width)/2, 4, "gfx/p_option"); + M_DrawPic((320-Draw_GetPicWidth(p))/2, 4, "gfx/p_option"); m_optcursor = options_colorcontrol_cursor; m_optnum = 0; @@ -2235,8 +2234,7 @@ static void M_Options_ColorControl_Draw (void) m_opty = 32 - bound(0, m_optcursor - (visible >> 1), max(0, OPTIONS_COLORCONTROL_ITEMS - visible)) * 8; M_Options_PrintCommand( " Reset to defaults", true); - M_Options_PrintCheckbox("Hardware Gamma Control", vid_hardwaregammasupported.integer, v_hwgamma.integer); - M_Options_PrintSlider( " Gamma", !v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_gamma.value, 1, 5); + M_Options_PrintSlider( " Gamma", !v_color_enable.integer, v_gamma.value, 1, 5); M_Options_PrintSlider( " Contrast", !v_color_enable.integer, v_contrast.value, 1, 5); M_Options_PrintSlider( " Brightness", !v_color_enable.integer, v_brightness.value, 0, 0.8); M_Options_PrintCheckbox(" Color Level Controls", true, v_color_enable.integer); @@ -2244,10 +2242,10 @@ static void M_Options_ColorControl_Draw (void) M_Options_PrintSlider( " Black: Green", v_color_enable.integer, v_color_black_g.value, 0, 0.8); M_Options_PrintSlider( " Black: Blue ", v_color_enable.integer, v_color_black_b.value, 0, 0.8); M_Options_PrintSlider( " Black: Grey ", v_color_enable.integer, (v_color_black_r.value + v_color_black_g.value + v_color_black_b.value) / 3, 0, 0.8); - M_Options_PrintSlider( " Grey: Red ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_r.value, 0, 0.95); - M_Options_PrintSlider( " Grey: Green", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_g.value, 0, 0.95); - M_Options_PrintSlider( " Grey: Blue ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, v_color_grey_b.value, 0, 0.95); - M_Options_PrintSlider( " Grey: Grey ", v_color_enable.integer && vid_hardwaregammasupported.integer && v_hwgamma.integer, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3, 0, 0.95); + M_Options_PrintSlider( " Grey: Red ", v_color_enable.integer, v_color_grey_r.value, 0, 0.95); + M_Options_PrintSlider( " Grey: Green", v_color_enable.integer, v_color_grey_g.value, 0, 0.95); + M_Options_PrintSlider( " Grey: Blue ", v_color_enable.integer, v_color_grey_b.value, 0, 0.95); + M_Options_PrintSlider( " Grey: Grey ", v_color_enable.integer, (v_color_grey_r.value + v_color_grey_g.value + v_color_grey_b.value) / 3, 0, 0.95); M_Options_PrintSlider( " White: Red ", v_color_enable.integer, v_color_white_r.value, 1, 5); M_Options_PrintSlider( " White: Green", v_color_enable.integer, v_color_white_g.value, 1, 5); M_Options_PrintSlider( " White: Blue ", v_color_enable.integer, v_color_white_b.value, 1, 5); @@ -2266,26 +2264,29 @@ static void M_Options_ColorControl_Draw (void) DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, dither, 312, 4, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0);m_opty += 4; DrawQ_SuperPic(menu_x + 4, menu_y + m_opty, NULL , 312, 4, 0,0, 0,0,0,1, 1,0, 1,1,1,1, 0,1, 0,0,0,1, 1,1, 1,1,1,1, 0);m_opty += 4; - c = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake + c[0] = menu_options_colorcontrol_correctionvalue.value; // intensity value that should be matched up to a 50% dither to 'correct' quake + c[1] = c[0]; + c[2] = c[1]; + VID_ApplyGammaToColor(c, c); s = (float) 48 / 2 * vid.width / vid_conwidth.integer; t = (float) 48 / 2 * vid.height / vid_conheight.integer; u = s * 0.5; v = t * 0.5; m_opty += 8; x = 4; - DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, c, 0, 0, 1, 0); + DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, c[0], 0, 0, 1, 0); DrawQ_SuperPic(menu_x + x + 16, menu_y + m_opty + 16, dither, 16, 16, 0,0, 1,0,0,1, s,0, 1,0,0,1, 0,t, 1,0,0,1, s,t, 1,0,0,1, 0); DrawQ_SuperPic(menu_x + x + 32, menu_y + m_opty + 16, dither, 16, 16, 0,0, 1,0,0,1, u,0, 1,0,0,1, 0,v, 1,0,0,1, u,v, 1,0,0,1, 0); x += 80; - DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, 0, c, 0, 1, 0); + DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, 0, c[1], 0, 1, 0); DrawQ_SuperPic(menu_x + x + 16, menu_y + m_opty + 16, dither, 16, 16, 0,0, 0,1,0,1, s,0, 0,1,0,1, 0,t, 0,1,0,1, s,t, 0,1,0,1, 0); DrawQ_SuperPic(menu_x + x + 32, menu_y + m_opty + 16, dither, 16, 16, 0,0, 0,1,0,1, u,0, 0,1,0,1, 0,v, 0,1,0,1, u,v, 0,1,0,1, 0); x += 80; - DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, 0, 0, c, 1, 0); + DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, 0, 0, c[2], 1, 0); DrawQ_SuperPic(menu_x + x + 16, menu_y + m_opty + 16, dither, 16, 16, 0,0, 0,0,1,1, s,0, 0,0,1,1, 0,t, 0,0,1,1, s,t, 0,0,1,1, 0); DrawQ_SuperPic(menu_x + x + 32, menu_y + m_opty + 16, dither, 16, 16, 0,0, 0,0,1,1, u,0, 0,0,1,1, 0,v, 0,0,1,1, u,v, 0,0,1,1, 0); x += 80; - DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, c, c, c, 1, 0); + DrawQ_Fill(menu_x + x, menu_y + m_opty, 64, 48, c[0], c[1], c[2], 1, 0); DrawQ_SuperPic(menu_x + x + 16, menu_y + m_opty + 16, dither, 16, 16, 0,0, 1,1,1,1, s,0, 1,1,1,1, 0,t, 1,1,1,1, s,t, 1,1,1,1, 0); DrawQ_SuperPic(menu_x + x + 32, menu_y + m_opty + 16, dither, 16, 16, 0,0, 1,1,1,1, u,0, 1,1,1,1, 0,v, 1,1,1,1, u,v, 1,1,1,1, 0); } @@ -2304,7 +2305,6 @@ static void M_Options_ColorControl_Key (int k, int ascii) switch (options_colorcontrol_cursor) { case 0: - Cvar_SetValueQuick(&v_hwgamma, 1); Cvar_SetValueQuick(&v_gamma, 1); Cvar_SetValueQuick(&v_contrast, 1); Cvar_SetValueQuick(&v_brightness, 0); @@ -2617,7 +2617,7 @@ static void M_Keys_Draw (void) M_Background(320, 48 + 8 * numcommands); p = Draw_CachePic ("gfx/ttl_cstm"); - M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm"); + M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/ttl_cstm"); if (bind_grab) M_Print(12, 32, "Press a key or button for this action"); @@ -2928,7 +2928,7 @@ static void M_Video_Draw (void) M_DrawPic(16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/vidmodes"); - M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes"); + M_DrawPic((320-Draw_GetPicWidth(p))/2, 4, "gfx/vidmodes"); t = 0; @@ -3370,7 +3370,7 @@ static void M_LanConfig_Draw (void) M_DrawPic (16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/p_multi"); - basex = (320-p->width)/2; + basex = (320-Draw_GetPicWidth(p))/2; M_DrawPic (basex, 4, "gfx/p_multi"); if (StartingGame) @@ -3994,7 +3994,7 @@ void M_GameOptions_Draw (void) M_DrawPic (16, 4, "gfx/qplaque"); p = Draw_CachePic ("gfx/p_multi"); - M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi"); + M_DrawPic ( (320-Draw_GetPicWidth(p))/2, 4, "gfx/p_multi"); M_DrawTextBox (152, 32, 10, 1); M_Print(160, 40, "begin game"); @@ -4435,7 +4435,7 @@ static void M_ServerList_Draw (void) end = min(start + visible, serverlist_viewcount); p = Draw_CachePic ("gfx/p_multi"); - M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi"); + M_DrawPic((640 - Draw_GetPicWidth(p)) / 2, 4, "gfx/p_multi"); if (end > start) { for (n = start;n < end;n++) @@ -4671,7 +4671,7 @@ static void M_ModList_Draw (void) end = min(start + visible, modlist_count); p = Draw_CachePic ("gfx/p_option"); - M_DrawPic((640 - p->width) / 2, 4, "gfx/p_option"); + M_DrawPic((640 - Draw_GetPicWidth(p)) / 2, 4, "gfx/p_option"); if (end > start) { for (n = start;n < end;n++) @@ -4889,7 +4889,7 @@ void M_Draw (void) drop1 = Draw_CachePic ("gfx/menu/blooddrop1"); drop2 = Draw_CachePic ("gfx/menu/blooddrop2"); drop3 = Draw_CachePic ("gfx/menu/blooddrop3"); - for (scale_x = 0; scale_x <= vid_conwidth.integer; scale_x += p->width) { + for (scale_x = 0; scale_x <= vid_conwidth.integer; scale_x += Draw_GetPicWidth(p)) { for (scale_y = -scale_y_repeat; scale_y <= vid_conheight.integer; scale_y += scale_y_repeat) { DrawQ_Pic (scale_x + 21, scale_y_repeat * .5 + scale_y + scale_y_rate * scale_y_repeat, drop3, 0, 0, 1, 1, 1, 1, 0); DrawQ_Pic (scale_x + 116, scale_y_repeat + scale_y + scale_y_rate * scale_y_repeat, drop1, 0, 0, 1, 1, 1, 1, 0);