]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - menu.c
changed all Draw_CachePic calls to precache the pic except for two calls in the menu...
[xonotic/darkplaces.git] / menu.c
diff --git a/menu.c b/menu.c
index 2ae3f6374df02a97a9bfb3175ec94c5e5ae04856..4467e6666fd736ab5ef76b0be7f2e6cffae9dd35 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -209,7 +209,7 @@ static void M_ItemPrint(float cx, float cy, const char *str, int unghosted)
 
 static void M_DrawPic(float cx, float cy, const char *picname)
 {
-       DrawQ_Pic(menu_x + cx, menu_y + cy, Draw_CachePic(picname, false), 0, 0, 1, 1, 1, 1, 0);
+       DrawQ_Pic(menu_x + cx, menu_y + cy, Draw_CachePic(picname, true), 0, 0, 1, 1, 1, 1, 0);
 }
 
 static unsigned char identityTable[256];
@@ -420,7 +420,7 @@ static void M_Main_Draw (void)
        if (gamemode == GAME_TRANSFUSION) {
                int y1, y2, y3;
                M_Background(640, 480);
-               p = Draw_CachePic ("gfx/menu/tb-transfusion", false);
+               p = Draw_CachePic ("gfx/menu/tb-transfusion", true);
                M_DrawPic (640/2 - p->width/2, 40, "gfx/menu/tb-transfusion");
                y2 = 120;
                // 8 rather than MAIN_ITEMS to skip a number and not miss the last option
@@ -452,7 +452,7 @@ static void M_Main_Draw (void)
        }
        M_Background(320, 200);
        M_DrawPic (16, 4, "gfx/qplaque");
-       p = Draw_CachePic ("gfx/ttl_main", false);
+       p = Draw_CachePic ("gfx/ttl_main", true);
        M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main");
 // Nehahra
        if (gamemode == GAME_NEHAHRA)
@@ -753,7 +753,7 @@ static void M_SinglePlayer_Draw (void)
        M_Background(320, 200);
 
        M_DrawPic (16, 4, "gfx/qplaque");
-       p = Draw_CachePic ("gfx/ttl_sgl", false);
+       p = Draw_CachePic ("gfx/ttl_sgl", true);
 
        // Some mods don't have a single player mode
        if (gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
@@ -917,7 +917,7 @@ static void M_Load_Draw (void)
 
        M_Background(320, 200);
 
-       p = Draw_CachePic ("gfx/p_load", false);
+       p = Draw_CachePic ("gfx/p_load", true);
        M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load" );
 
        for (i=0 ; i< MAX_SAVEGAMES; i++)
@@ -935,7 +935,7 @@ static void M_Save_Draw (void)
 
        M_Background(320, 200);
 
-       p = Draw_CachePic ("gfx/p_save", false);
+       p = Draw_CachePic ("gfx/p_save", true);
        M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save");
 
        for (i=0 ; i<MAX_SAVEGAMES ; i++)
@@ -1041,7 +1041,7 @@ static void M_Transfusion_Episode_Draw (void)
        cachepic_t *p;
        M_Background(640, 480);
 
-       p = Draw_CachePic ("gfx/menu/tb-episodes", false);
+       p = Draw_CachePic ("gfx/menu/tb-episodes", true);
        M_DrawPic (640/2 - p->width/2, 40, "gfx/menu/tb-episodes");
        for (y = 0; y < EPISODE_ITEMS; y++){
                M_DrawPic (0, 160 + y * 40, va("gfx/menu/episode%i", y+1));
@@ -1098,7 +1098,7 @@ static void M_Transfusion_Skill_Draw (void)
        cachepic_t      *p;
        M_Background(640, 480);
 
-       p = Draw_CachePic ("gfx/menu/tb-difficulty", false);
+       p = Draw_CachePic ("gfx/menu/tb-difficulty", true);
        M_DrawPic(640/2 - p->width/2, 40, "gfx/menu/tb-difficulty");
 
        for (y = 0; y < SKILL_ITEMS; y++)
@@ -1202,7 +1202,7 @@ static void M_MultiPlayer_Draw (void)
        if (gamemode == GAME_TRANSFUSION)
        {
                M_Background(640, 480);
-               p = Draw_CachePic ("gfx/menu/tb-online", false);
+               p = Draw_CachePic ("gfx/menu/tb-online", true);
                M_DrawPic (640/2 - p->width/2, 140, "gfx/menu/tb-online");
                for (f = 1; f <= MULTIPLAYER_ITEMS; f++)
                        M_DrawPic (0, 180 + f*40, va("gfx/menu/online%i", f));
@@ -1212,7 +1212,7 @@ static void M_MultiPlayer_Draw (void)
        M_Background(320, 200);
 
        M_DrawPic (16, 4, "gfx/qplaque");
-       p = Draw_CachePic ("gfx/p_multi", false);
+       p = Draw_CachePic ("gfx/p_multi", true);
        M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi");
        M_DrawPic (72, 32, "gfx/mp_menu");
 
@@ -1330,7 +1330,7 @@ static void M_Setup_Draw (void)
        M_Background(320, 200);
 
        M_DrawPic (16, 4, "gfx/qplaque");
-       p = Draw_CachePic ("gfx/p_multi", false);
+       p = Draw_CachePic ("gfx/p_multi", true);
        M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi");
 
        M_Print(64, 40, "Your name");
@@ -1363,8 +1363,8 @@ static void M_Setup_Draw (void)
                        menuplyr_width = image_width;
                        menuplyr_height = image_height;
                        Mem_Free(f);
-                       menuplyr_pixels = (unsigned char *)Mem_Alloc(cls.mempool, menuplyr_width * menuplyr_height);
-                       menuplyr_translated = (unsigned int *)Mem_Alloc(cls.mempool, menuplyr_width * menuplyr_height * 4);
+                       menuplyr_pixels = (unsigned char *)Mem_Alloc(cls.permanentmempool, menuplyr_width * menuplyr_height);
+                       menuplyr_translated = (unsigned int *)Mem_Alloc(cls.permanentmempool, menuplyr_width * menuplyr_height * 4);
                        memcpy(menuplyr_pixels, data, menuplyr_width * menuplyr_height);
                        Mem_Free(data);
                }
@@ -1681,7 +1681,7 @@ static void M_Options_Draw (void)
        M_Background(320, bound(200, 32 + OPTIONS_ITEMS * 8, vid_conheight.integer));
 
        M_DrawPic(16, 4, "gfx/qplaque");
-       p = Draw_CachePic("gfx/p_option", false);
+       p = Draw_CachePic("gfx/p_option", true);
        M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
 
        optnum = 0;
@@ -1876,7 +1876,7 @@ static void M_Options_Effects_Draw (void)
        M_Background(320, bound(200, 32 + OPTIONS_EFFECTS_ITEMS * 8, vid_conheight.integer));
 
        M_DrawPic(16, 4, "gfx/qplaque");
-       p = Draw_CachePic("gfx/p_option", false);
+       p = Draw_CachePic("gfx/p_option", true);
        M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
 
        optcursor = options_effects_cursor;
@@ -2016,7 +2016,7 @@ static void M_Options_Graphics_Draw (void)
        M_Background(320, bound(200, 32 + OPTIONS_GRAPHICS_ITEMS * 8, vid_conheight.integer));
 
        M_DrawPic(16, 4, "gfx/qplaque");
-       p = Draw_CachePic("gfx/p_option", false);
+       p = Draw_CachePic("gfx/p_option", true);
        M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
 
        optcursor = options_graphics_cursor;
@@ -2198,12 +2198,12 @@ static void M_Options_ColorControl_Draw (void)
        float x, c, s, t, u, v;
        cachepic_t      *p, *dither;
 
-       dither = Draw_CachePic("gfx/colorcontrol/ditherpattern", false);
+       dither = Draw_CachePic("gfx/colorcontrol/ditherpattern", true);
 
        M_Background(320, 256);
 
        M_DrawPic(16, 4, "gfx/qplaque");
-       p = Draw_CachePic("gfx/p_option", false);
+       p = Draw_CachePic("gfx/p_option", true);
        M_DrawPic((320-p->width)/2, 4, "gfx/p_option");
 
        optcursor = options_colorcontrol_cursor;
@@ -2591,7 +2591,7 @@ static void M_Keys_Draw (void)
 
        M_Background(320, 48 + 8 * numcommands);
 
-       p = Draw_CachePic ("gfx/ttl_cstm", false);
+       p = Draw_CachePic ("gfx/ttl_cstm", true);
        M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm");
 
        if (bind_grab)
@@ -2877,7 +2877,7 @@ static void M_Video_Draw (void)
        M_Background(320, 200);
 
        M_DrawPic(16, 4, "gfx/qplaque");
-       p = Draw_CachePic("gfx/vidmodes", false);
+       p = Draw_CachePic("gfx/vidmodes", true);
        M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes");
 
        // Current Resolution
@@ -3282,7 +3282,7 @@ static void M_LanConfig_Draw (void)
        M_Background(320, 200);
 
        M_DrawPic (16, 4, "gfx/qplaque");
-       p = Draw_CachePic ("gfx/p_multi", false);
+       p = Draw_CachePic ("gfx/p_multi", true);
        basex = (320-p->width)/2;
        M_DrawPic (basex, 4, "gfx/p_multi");
 
@@ -3892,7 +3892,7 @@ void M_GameOptions_Draw (void)
        M_Background(320, 200);
 
        M_DrawPic (16, 4, "gfx/qplaque");
-       p = Draw_CachePic ("gfx/p_multi", false);
+       p = Draw_CachePic ("gfx/p_multi", true);
        M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi");
 
        M_DrawTextBox (152, 32, 10, 1);
@@ -4339,7 +4339,7 @@ static void M_ServerList_Draw (void)
        start = bound(0, slist_cursor - (visible >> 1), serverlist_viewcount - visible);
        end = min(start + visible, serverlist_viewcount);
 
-       p = Draw_CachePic("gfx/p_multi", false);
+       p = Draw_CachePic("gfx/p_multi", true);
        M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi");
        if (end > start)
        {
@@ -4612,10 +4612,10 @@ void M_Draw (void)
                        g = (int)(realtime * 64)%96;
                        scale_y_rate = (float)(g+1) / 96;
                        top_offset = (g+12)/12;
-                       p = Draw_CachePic (va("gfx/menu/blooddrip%i", top_offset), false);
-                       drop1 = Draw_CachePic("gfx/menu/blooddrop1", false);
-                       drop2 = Draw_CachePic("gfx/menu/blooddrop2", false);
-                       drop3 = Draw_CachePic("gfx/menu/blooddrop3", false);
+                       p = Draw_CachePic (va("gfx/menu/blooddrip%i", top_offset), true);
+                       drop1 = Draw_CachePic("gfx/menu/blooddrop1", true);
+                       drop2 = Draw_CachePic("gfx/menu/blooddrop2", true);
+                       drop3 = Draw_CachePic("gfx/menu/blooddrop3", true);
                        for (scale_x = 0; scale_x <= vid_conwidth.integer; scale_x += p->width) {
                                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);
@@ -4630,7 +4630,7 @@ void M_Draw (void)
                                        DrawQ_Pic (scale_x + 557, scale_y_repeat * .9425 + scale_y + scale_y_rate * scale_y_repeat, drop1, 0, 0, 1, 1, 1, 1, 0);
                                        DrawQ_Pic (scale_x + 606, scale_y_repeat * .5 + scale_y + scale_y_rate * scale_y_repeat, drop2, 0, 0, 1, 1, 1, 1, 0);
                                }
-                               DrawQ_Pic (scale_x, -1, Draw_CachePic(va("gfx/menu/blooddrip%i", top_offset), false), 0, 0, 1, 1, 1, 1, 0);
+                               DrawQ_Pic (scale_x, -1, Draw_CachePic(va("gfx/menu/blooddrip%i", top_offset), true), 0, 0, 1, 1, 1, 1, 0);
                        }
                }
        }