================
*/
// FIXME: move this to client somehow
-cachepic_t *Draw_CachePic (char *path)
+cachepic_t *Draw_CachePic (char *path, qboolean persistent)
{
int i, crc, hashkey;
cachepic_t *pic;
qpic_t *p;
+ int persistentflag;
- if (!strncmp(CLVIDEOPREFIX, path, sizeof(CLVIDEOPREFIX) - 1)) {
+ if (!strncmp(CLVIDEOPREFIX, path, sizeof(CLVIDEOPREFIX) - 1)) {
clvideo_t *video;
video = CL_GetVideo(path);
return &video->cpif;
}
+ if (persistent) {
+ persistentflag = TEXF_PRECACHE;
+ } else {
+ persistentflag = 0;
+ }
+
crc = CRC_Block(path, strlen(path));
hashkey = ((crc >> 8) ^ crc) % CACHEPICHASHSIZE;
for (pic = cachepichash[hashkey];pic;pic = pic->chain)
cachepichash[hashkey] = pic;
// load the pic from disk
- pic->tex = loadtextureimage(drawtexturepool, path, 0, 0, false, TEXF_ALPHA | TEXF_PRECACHE);
+ pic->tex = loadtextureimage(drawtexturepool, path, 0, 0, false, TEXF_ALPHA | persistentflag);
if (pic->tex == NULL && !strncmp(path, "gfx/", 4))
{
// compatibility with older versions
- pic->tex = loadtextureimage(drawtexturepool, path + 4, 0, 0, false, TEXF_ALPHA | TEXF_PRECACHE);
+ pic->tex = loadtextureimage(drawtexturepool, path + 4, 0, 0, false, TEXF_ALPHA | persistentflag);
// failed to find gfx/whatever.tga or similar, try the wad
if (pic->tex == NULL && (p = W_GetLumpName (path + 4)))
{
for (i = 0;i < 128 * 128;i++)
if (pix[i] == 0)
pix[i] = 255;
- pic->tex = R_LoadTexture2D(drawtexturepool, path, 128, 128, pix, TEXTYPE_PALETTE, TEXF_ALPHA | TEXF_PRECACHE, palette_complete);
+ pic->tex = R_LoadTexture2D(drawtexturepool, path, 128, 128, pix, TEXTYPE_PALETTE, TEXF_ALPHA | persistentflag, palette_complete);
}
else
- pic->tex = R_LoadTexture2D(drawtexturepool, path, p->width, p->height, p->data, TEXTYPE_PALETTE, TEXF_ALPHA | TEXF_PRECACHE, palette_complete);
+ pic->tex = R_LoadTexture2D(drawtexturepool, path, p->width, p->height, p->data, TEXTYPE_PALETTE, TEXF_ALPHA | persistentflag, palette_complete);
}
}
numcachepics = 0;
memset(cachepichash, 0, sizeof(cachepichash));
- char_texture = Draw_CachePic("gfx/conchars")->tex;
+ char_texture = Draw_CachePic("gfx/conchars", true)->tex;
}
static void gl_draw_shutdown(void)
if (gamemode == GAME_TRANSFUSION) {
int y1, y2, y3;
M_Background(640, 480);
- p = Draw_CachePic ("gfx/tb-transfusion");
+ p = Draw_CachePic ("gfx/tb-transfusion", false);
M_DrawPic (640/2 - p->width/2, 40, "gfx/tb-transfusion");
y2 = 120;
// 8 rather than MAIN_ITEMS to skip a number and not miss the last option
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic ("gfx/ttl_main.lmp");
+ p = Draw_CachePic ("gfx/ttl_main.lmp", false);
M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_main.lmp");
// Nehahra
if (gamemode == GAME_NEHAHRA)
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic ("gfx/ttl_sgl.lmp");
+ p = Draw_CachePic ("gfx/ttl_sgl.lmp", false);
// Some mods don't have a single player mode
if (gamemode == GAME_NEXUIZ || gamemode == GAME_GOODVSBAD2 || gamemode == GAME_BATTLEMECH)
M_Background(320, 200);
- p = Draw_CachePic ("gfx/p_load.lmp");
- M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp");
+ p = Draw_CachePic ("gfx/p_load.lmp", false);
+ M_DrawPic ( (320-p->width)/2, 4, "gfx/p_load.lmp" );
for (i=0 ; i< MAX_SAVEGAMES; i++)
M_Print(16, 32 + 8*i, m_filenames[i]);
M_Background(320, 200);
- p = Draw_CachePic ("gfx/p_save.lmp");
+ p = Draw_CachePic ("gfx/p_save.lmp", false);
M_DrawPic ( (320-p->width)/2, 4, "gfx/p_save.lmp");
for (i=0 ; i<MAX_SAVEGAMES ; i++)
cachepic_t *p;
M_Background(640, 480);
- p = Draw_CachePic ("gfx/tb-episodes");
+ p = Draw_CachePic ("gfx/tb-episodes", false);
M_DrawPic (640/2 - p->width/2, 40, "gfx/tb-episodes");
for (y = 0; y < EPISODE_ITEMS; y++){
M_DrawPic (0, 160 + y * 40, va("gfx/episode%i", y+1));
cachepic_t *p;
M_Background(640, 480);
- p = Draw_CachePic ("gfx/tb-difficulty");
+ p = Draw_CachePic ("gfx/tb-difficulty", false);
M_DrawPic(640/2 - p->width/2, 40, "gfx/tb-difficulty");
for (y = 0; y < SKILL_ITEMS; y++)
if (gamemode == GAME_TRANSFUSION)
{
M_Background(640, 480);
- p = Draw_CachePic ("gfx/tb-online");
+ p = Draw_CachePic ("gfx/tb-online", false);
M_DrawPic (640/2 - p->width/2, 140, "gfx/tb-online");
for (f = 1; f <= MULTIPLAYER_ITEMS; f++)
M_DrawPic (0, 180 + f*40, va("gfx/online%i", f));
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic ("gfx/p_multi.lmp");
+ p = Draw_CachePic ("gfx/p_multi.lmp", false);
M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
M_DrawPic (72, 32, "gfx/mp_menu.lmp");
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic ("gfx/p_multi.lmp");
+ p = Draw_CachePic ("gfx/p_multi.lmp", false);
M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
M_Print(64, 40, "Your name");
M_Background(320, bound(200, 32 + OPTIONS_ITEMS * 8, vid.conheight));
M_DrawPic(16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic("gfx/p_option.lmp");
+ p = Draw_CachePic("gfx/p_option.lmp", false);
M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
optnum = 0;
M_Background(320, bound(200, 32 + OPTIONS_EFFECTS_ITEMS * 8, vid.conheight));
M_DrawPic(16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic("gfx/p_option.lmp");
+ p = Draw_CachePic("gfx/p_option.lmp", false);
M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
optcursor = options_effects_cursor;
M_Background(320, bound(200, 32 + OPTIONS_GRAPHICS_ITEMS * 8, vid.conheight));
M_DrawPic(16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic("gfx/p_option.lmp");
+ p = Draw_CachePic("gfx/p_option.lmp", false);
M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
optcursor = options_graphics_cursor;
M_Background(320, 256);
M_DrawPic(16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic("gfx/p_option.lmp");
+ p = Draw_CachePic("gfx/p_option.lmp", false);
M_DrawPic((320-p->width)/2, 4, "gfx/p_option.lmp");
optcursor = options_colorcontrol_cursor;
M_Background(320, 48 + 8 * numcommands);
- p = Draw_CachePic ("gfx/ttl_cstm.lmp");
+ p = Draw_CachePic ("gfx/ttl_cstm.lmp", false);
M_DrawPic ( (320-p->width)/2, 4, "gfx/ttl_cstm.lmp");
if (bind_grab)
M_Background(320, 200);
M_DrawPic(16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic("gfx/vidmodes.lmp");
+ p = Draw_CachePic("gfx/vidmodes.lmp", false);
M_DrawPic((320-p->width)/2, 4, "gfx/vidmodes.lmp");
// Resolution
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic ("gfx/p_multi.lmp");
+ p = Draw_CachePic ("gfx/p_multi.lmp", false);
basex = (320-p->width)/2;
M_DrawPic (basex, 4, "gfx/p_multi.lmp");
M_Background(320, 200);
M_DrawPic (16, 4, "gfx/qplaque.lmp");
- p = Draw_CachePic ("gfx/p_multi.lmp");
+ p = Draw_CachePic ("gfx/p_multi.lmp", false);
M_DrawPic ( (320-p->width)/2, 4, "gfx/p_multi.lmp");
M_DrawTextBox (152, 32, 10, 1);
start = bound(0, slist_cursor - (visible >> 1), serverlist_viewcount - visible);
end = min(start + visible, serverlist_viewcount);
- p = Draw_CachePic("gfx/p_multi.lmp");
+ p = Draw_CachePic("gfx/p_multi.lmp", false);
M_DrawPic((640 - p->width) / 2, 4, "gfx/p_multi.lmp");
if (end > start)
{
g = (int)(realtime * 64)%96;
scale_y_rate = (float)(g+1) / 96;
top_offset = (g+12)/12;
- p = Draw_CachePic (va("gfx/blooddrip%i", top_offset));
+ p = Draw_CachePic (va("gfx/blooddrip%i", top_offset), false);
for (scale_x = 0; scale_x <= vid.conwidth; scale_x += p->width) {
for (scale_y = -scale_y_repeat; scale_y <= vid.conheight; scale_y += scale_y_repeat) {
DrawQ_Pic (scale_x + 21, scale_y_repeat * .5 + scale_y + scale_y_rate * scale_y_repeat, "gfx/blooddrop3", 0, 0, 1, 1, 1, 1, 0);