]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - menu.c
Fix setinfo.
[xonotic/darkplaces.git] / menu.c
diff --git a/menu.c b/menu.c
index 5ad0755ae45f138a1021e173c5a5a9afed462b57..05abaa862f882875be716803c007c33bb36b31b0 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -18,9 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 */
 #include "quakedef.h"
-#ifdef CONFIG_CD
 #include "cdaudio.h"
-#endif
 #include "image.h"
 #include "progsvm.h"
 
@@ -414,7 +412,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 +456,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 +477,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 +756,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 +769,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 +923,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 +941,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 ; i<MAX_SAVEGAMES ; i++)
                M_Print(16, 32 + 8*i, m_filenames[i]);
@@ -1052,7 +1050,7 @@ static void M_Transfusion_Episode_Draw (void)
        M_Background(640, 480);
 
        p = Draw_CachePic ("gfx/menu/tb-episodes");
-       M_DrawPic (640/2 - p->width/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 +1108,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 +1213,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 +1223,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 +1342,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 +1413,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");
@@ -1624,9 +1622,7 @@ static void M_Menu_Options_AdjustSliders (int dir)
        else if (options_cursor == optnum++) Cvar_SetValueQuick(&v_contrast, bound(1, v_contrast.value + dir * 0.0625, 4));
        else if (options_cursor == optnum++) Cvar_SetValueQuick(&v_gamma, bound(0.5, v_gamma.value + dir * 0.0625, 3));
        else if (options_cursor == optnum++) Cvar_SetValueQuick(&volume, bound(0, volume.value + dir * 0.0625, 1));
-#ifdef CONFIG_CD
        else if (options_cursor == optnum++) Cvar_SetValueQuick(&bgmvolume, bound(0, bgmvolume.value + dir * 0.0625, 1));
-#endif
 }
 
 static int m_optnum;
@@ -1680,7 +1676,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;
@@ -1703,9 +1699,7 @@ static void M_Options_Draw (void)
        M_Options_PrintSlider(  "            Brightness", true, v_contrast.value, 1, 2);
        M_Options_PrintSlider(  "                 Gamma", true, v_gamma.value, 0.5, 3);
        M_Options_PrintSlider(  "          Sound Volume", snd_initialized.integer, volume.value, 0, 1);
-#ifdef CONFIG_CD
        M_Options_PrintSlider(  "          Music Volume", cdaudioinitialized.integer, bgmvolume.value, 0, 1);
-#endif
        M_Options_PrintCommand( "     Customize Effects", true);
        M_Options_PrintCommand( "       Effects:  Quake", true);
        M_Options_PrintCommand( "       Effects: Normal", true);
@@ -1889,7 +1883,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 +2030,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;
@@ -2226,7 +2220,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;
@@ -2617,7 +2611,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 +2922,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;
 
@@ -2943,12 +2937,7 @@ static void M_Video_Draw (void)
        M_Print(96, video_cursor_table[t] + 8, va(vabuf, sizeof(vabuf), "Type: %s", menu_video_resolutions[menu_video_resolution].type));
        t++;
 
-       // Bits per pixel
-       M_Print(16, video_cursor_table[t], "        Bits per pixel");
-       M_Print(220, video_cursor_table[t], (vid_bitsperpixel.integer == 32) ? "32" : "16");
-       t++;
-
-       // Bits per pixel
+       // Antialiasing
        M_Print(16, video_cursor_table[t], "          Antialiasing");
        M_DrawSlider(220, video_cursor_table[t], vid_samples.value, 1, 32);
        t++;
@@ -2981,7 +2970,7 @@ static void M_Video_Draw (void)
        M_DrawSlider(220, video_cursor_table[t], gl_picmip.value, 3, 0);
        t++;
 
-       M_ItemPrint(16, video_cursor_table[t], "   Texture Compression", vid.support.arb_texture_compression);
+       M_ItemPrint(16, video_cursor_table[t], "   Texture Compression", true);
        M_DrawCheckbox(220, video_cursor_table[t], gl_texturecompression.integer);
        t++;
 
@@ -3016,8 +3005,6 @@ static void M_Menu_Video_AdjustSliders (int dir)
                                break;
                }
        }
-       else if (video_cursor == t++)
-               Cvar_SetValueQuick (&vid_bitsperpixel, (vid_bitsperpixel.integer == 32) ? 16 : 32);
        else if (video_cursor == t++)
                Cvar_SetValueQuick (&vid_samples, bound(1, vid_samples.value * (dir > 0 ? 2 : 0.5), 32));
        else if (video_cursor == t++)
@@ -3370,7 +3357,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 +3981,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 +4422,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 +4658,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 +4876,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);