-static rtexturepool_t *drawtexturepool;
-
-static const unsigned char concharimage[FONT_FILESIZE] =
-{
-#include "lhfont.h"
-};
-
-static rtexture_t *draw_generateconchars(void)
-{
- int i;
- unsigned char buffer[65536][4], *data = NULL;
- double random;
-
- data = LoadTGA_BGRA (concharimage, FONT_FILESIZE);
-// Gold numbers
- for (i = 0;i < 8192;i++)
- {
- random = lhrandom (0.0,1.0);
- buffer[i][2] = 83 + (unsigned char)(random * 64);
- buffer[i][1] = 71 + (unsigned char)(random * 32);
- buffer[i][0] = 23 + (unsigned char)(random * 16);
- buffer[i][3] = data[i*4+0];
- }
-// White chars
- for (i = 8192;i < 32768;i++)
- {
- random = lhrandom (0.0,1.0);
- buffer[i][2] = 95 + (unsigned char)(random * 64);
- buffer[i][1] = 95 + (unsigned char)(random * 64);
- buffer[i][0] = 95 + (unsigned char)(random * 64);
- buffer[i][3] = data[i*4+0];
- }
-// Gold numbers
- for (i = 32768;i < 40960;i++)
- {
- random = lhrandom (0.0,1.0);
- buffer[i][2] = 83 + (unsigned char)(random * 64);
- buffer[i][1] = 71 + (unsigned char)(random * 32);
- buffer[i][0] = 23 + (unsigned char)(random * 16);
- buffer[i][3] = data[i*4+0];
- }
-// Red chars
- for (i = 40960;i < 65536;i++)
- {
- random = lhrandom (0.0,1.0);
- buffer[i][2] = 96 + (unsigned char)(random * 64);
- buffer[i][1] = 43 + (unsigned char)(random * 32);
- buffer[i][0] = 27 + (unsigned char)(random * 32);
- buffer[i][3] = data[i*4+0];
- }
-
-#if 0
- Image_WriteTGABGRA ("gfx/generated_conchars.tga", 256, 256, &buffer[0][0]);
-#endif
-
- Mem_Free(data);
- return R_LoadTexture2D(drawtexturepool, "conchars", 256, 256, &buffer[0][0], TEXTYPE_BGRA, TEXF_ALPHA | TEXF_PRECACHE, NULL);
-}
-
-static rtexture_t *draw_generateditherpattern(void)
-{
- int x, y;
- unsigned char pixels[8][8];
- for (y = 0;y < 8;y++)
- for (x = 0;x < 8;x++)
- pixels[y][x] = ((x^y) & 4) ? 254 : 0;
- return R_LoadTexture2D(drawtexturepool, "ditherpattern", 8, 8, pixels[0], TEXTYPE_PALETTE, TEXF_FORCENEAREST | TEXF_PRECACHE, palette_bgra_transparent);
-}
-
-typedef struct embeddedpic_s
-{
- const char *name;
- int width;
- int height;
- const char *pixels;
-}
-embeddedpic_t;
-
-static const embeddedpic_t embeddedpics[] =
-{
- {
- "gfx/prydoncursor001", 16, 16,
- "477777774......."
- "77.....6........"
- "7.....6........."
- "7....6.........."
- "7.....6........."
- "7..6...6........"
- "7.6.6...6......."
- "76...6...6......"
- "4.....6.6......."
- ".......6........"
- "................"
- "................"
- "................"
- "................"
- "................"
- "................"
- },
- {
- "ui/mousepointer", 16, 16,
- "477777774......."
- "77.....6........"
- "7.....6........."
- "7....6.........."
- "7.....6........."
- "7..6...6........"
- "7.6.6...6......."
- "76...6...6......"
- "4.....6.6......."
- ".......6........"
- "................"
- "................"
- "................"
- "................"
- "................"
- "................"
- },
- {
- "gfx/crosshair1", 16, 16,
- "................"
- "................"
- "................"
- "...33......33..."
- "...355....553..."
- "....577..775...."
- ".....77..77....."
- "................"
- "................"
- ".....77..77....."
- "....577..775...."
- "...355....553..."
- "...33......33..."
- "................"
- "................"
- "................"
- },
- {
- "gfx/crosshair2", 16, 16,
- "................"
- "................"
- "................"
- "...3........3..."
- "....5......5...."
- ".....7....7....."
- "......7..7......"
- "................"
- "................"
- "......7..7......"
- ".....7....7....."
- "....5......5...."
- "...3........3..."
- "................"
- "................"
- "................"
- },
- {
- "gfx/crosshair3", 16, 16,
- "................"
- ".......77......."
- ".......77......."
- "................"
- "................"
- ".......44......."
- ".......44......."
- ".77..44..44..77."
- ".77..44..44..77."
- ".......44......."
- ".......44......."
- "................"
- "................"
- ".......77......."
- ".......77......."
- "................"
- },
- {
- "gfx/crosshair4", 16, 16,
- "................"
- "................"
- "................"
- "................"
- "................"
- "................"
- "................"
- "................"
- "........7777777."
- "........752....."
- "........72......"
- "........7......."
- "........7......."
- "........7......."
- "........7......."
- "................"
- },
- {
- "gfx/crosshair5", 8, 8,
- "........"
- "........"
- "....7..."
- "........"
- "..7.7.7."
- "........"
- "....7..."
- "........"
- },
- {
- "gfx/crosshair6", 2, 2,
- "77"
- "77"
- },
- {
- "gfx/crosshair7", 16, 16,
- "................"
- ".3............3."
- "..5...2332...5.."
- "...7.3....3.7..."
- "....7......7...."
- "...3.7....7.3..."
- "..2...7..7...2.."
- "..3..........3.."
- "..3..........3.."
- "..2...7..7...2.."
- "...3.7....7.3..."
- "....7......7...."
- "...7.3....3.7..."
- "..5...2332...5.."
- ".3............3."
- "................"
- },
- {
- "gfx/editlights/cursor", 16, 16,
- "................"
- ".3............3."
- "..5...2332...5.."
- "...7.3....3.7..."
- "....7......7...."
- "...3.7....7.3..."
- "..2...7..7...2.."
- "..3..........3.."
- "..3..........3.."
- "..2...7..7...2.."
- "...3.7....7.3..."
- "....7......7...."
- "...7.3....3.7..."
- "..5...2332...5.."
- ".3............3."
- "................"
- },
- {
- "gfx/editlights/light", 16, 16,
- "................"
- "................"
- "......1111......"
- "....11233211...."
- "...1234554321..."
- "...1356776531..."
- "..124677776421.."
- "..135777777531.."
- "..135777777531.."
- "..124677776421.."
- "...1356776531..."
- "...1234554321..."
- "....11233211...."
- "......1111......"
- "................"
- "................"
- },
- {
- "gfx/editlights/noshadow", 16, 16,
- "................"
- "................"
- "......1111......"
- "....11233211...."
- "...1234554321..."
- "...1356226531..."
- "..12462..26421.."
- "..1352....2531.."
- "..1352....2531.."
- "..12462..26421.."
- "...1356226531..."
- "...1234554321..."
- "....11233211...."
- "......1111......"
- "................"
- "................"
- },
- {
- "gfx/editlights/selection", 16, 16,
- "................"
- ".777752..257777."
- ".742........247."
- ".72..........27."
- ".7............7."
- ".5............5."
- ".2............2."
- "................"
- "................"
- ".2............2."
- ".5............5."
- ".7............7."
- ".72..........27."
- ".742........247."
- ".777752..257777."
- "................"
- },
- {
- "gfx/editlights/cubemaplight", 16, 16,
- "................"
- "................"
- "......2772......"
- "....27755772...."
- "..277533335772.."
- "..753333333357.."
- "..777533335777.."
- "..735775577537.."
- "..733357753337.."
- "..733337733337.."
- "..753337733357.."
- "..277537735772.."
- "....27777772...."
- "......2772......"
- "................"
- "................"
- },
- {
- "gfx/editlights/cubemapnoshadowlight", 16, 16,
- "................"
- "................"
- "......2772......"
- "....27722772...."
- "..2772....2772.."
- "..72........27.."
- "..7772....2777.."
- "..7.27722772.7.."
- "..7...2772...7.."
- "..7....77....7.."
- "..72...77...27.."
- "..2772.77.2772.."
- "....27777772...."
- "......2772......"
- "................"
- "................"
- },
- {NULL, 0, 0, NULL}
-};
-
-static rtexture_t *draw_generatepic(const char *name, qboolean quiet)
-{
- const embeddedpic_t *p;
- for (p = embeddedpics;p->name;p++)
- if (!strcmp(name, p->name))
- return R_LoadTexture2D(drawtexturepool, p->name, p->width, p->height, (const unsigned char *)p->pixels, TEXTYPE_PALETTE, TEXF_ALPHA | TEXF_PRECACHE, palette_bgra_embeddedpic);
- if (!strcmp(name, "gfx/conchars"))
- return draw_generateconchars();
- if (!strcmp(name, "gfx/colorcontrol/ditherpattern"))
- return draw_generateditherpattern();
- if (!quiet)
- Con_Printf("Draw_CachePic: failed to load %s\n", name);
- return r_texture_notexture;
-}