From: tomaz <tomaz@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Fri, 20 Aug 2004 20:50:39 +0000 (+0000)
Subject: embedded a fallback conchars.tga so it can load in an empty directory with a visible... 
X-Git-Tag: xonotic-v0.1.0preview~5734
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d790adf7399e5a1e9bfecfbf40fa8be2b4184e30;p=xonotic%2Fdarkplaces.git

embedded a fallback conchars.tga so it can load in an empty directory with a visible console (used to use the checkerboard texture)


git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4343 d7cf8633-e32d-0410-b094-e92efae38249
---

diff --git a/gl_draw.c b/gl_draw.c
index 3f2cddee..88f5a955 100644
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -34,6 +34,41 @@ static int numcachepics;
 
 static rtexturepool_t *drawtexturepool;
 
+static qbyte concharimage[11356] =
+{
+#include "lhfont.h"
+};
+
+extern qbyte *LoadTGA (qbyte *f, int matchwidth, int matchheight);
+
+static rtexture_t *draw_generateconchars(void)
+{
+	int i;
+	qbyte buffer[65536][4], *data = NULL;
+
+	fs_filesize = 11356;
+	data = LoadTGA (concharimage, 256, 256);
+	fs_filesize = -1;
+
+	for (i = 0;i < 32768;i++)
+	{
+		buffer[i][0] = 255;
+		buffer[i][1] = 255;
+		buffer[i][2] = 255;
+		buffer[i][3] = data[i*4+0];
+	}
+
+	for (i = 32768;i < 65536;i++)
+	{
+		buffer[i][0] = 255;
+		buffer[i][1] = 0;
+		buffer[i][2] = 0;
+		buffer[i][3] = data[i*4+0];
+	}
+	Mem_Free(data);
+	return R_LoadTexture2D(drawtexturepool, "conchars", 256, 256, &buffer[0][0], TEXTYPE_RGBA, TEXF_ALPHA | TEXF_PRECACHE, NULL);
+}
+
 static qbyte pointerimage[256] =
 {
 	"333333332......."
@@ -266,6 +301,9 @@ cachepic_t	*Draw_CachePic (char *path)
 				pic->tex = R_LoadTexture2D(drawtexturepool, path, p->width, p->height, p->data, TEXTYPE_PALETTE, TEXF_ALPHA | TEXF_PRECACHE, palette_complete);
 		}
 	}
+
+	if (pic->tex == NULL && !strcmp(path, "gfx/conchars"))
+		pic->tex = draw_generateconchars();
 	if (pic->tex == NULL && !strcmp(path, "ui/mousepointer.tga"))
 		pic->tex = draw_generatemousepointer();
 	if (pic->tex == NULL && !strcmp(path, "gfx/crosshair1.tga"))