(svn r819) Code cleanup: colors for langfile strings are now taken from a color table instead of a sprite
authordominik
Fri, 26 Nov 2004 14:00:57 +0000
changeset 509 52dde395d888
parent 508 9f0de59088b3
child 510 01f571a4ade6
(svn r819) Code cleanup: colors for langfile strings are now taken from a color table instead of a sprite
gfx.c
table/palettes.h
--- a/gfx.c	Fri Nov 26 07:30:06 2004 +0000
+++ b/gfx.c	Fri Nov 26 14:00:57 2004 +0000
@@ -475,7 +475,7 @@
 int DoDrawString(const byte *string, int x, int y, byte color) {
 	DrawPixelInfo *dpi = _cur_dpi;
 	int base = _stringwidth_base;
-	byte c, *b;
+	byte c;
 	int xo = x, yo = y;
 
 	if (color != 0xFE) {
@@ -487,9 +487,8 @@
 
 		if (color != 0xFF) {
 switch_color:;
-			b = GetSpritePtr(674);
-			_string_colorremap[1] = b[color*2+8];
-			_string_colorremap[2] = b[color*2+9];
+			_string_colorremap[1] = StringColormap[color][0];
+			_string_colorremap[2] = StringColormap[color][1];
 			_color_remap_ptr = _string_colorremap;
 		}
 	}
--- a/table/palettes.h	Fri Nov 26 07:30:06 2004 +0000
+++ b/table/palettes.h	Fri Nov 26 14:00:57 2004 +0000
@@ -94,3 +94,25 @@
 		92,164,184, 92,164,184,116,180,196,148,200,216,180,220,232},
 };
 
+// Color table for colors in lang files (e.g. {BLACK})
+// 1st color: text
+// 2nd color: shadow
+static const byte StringColormap[17][2] = {
+	{ 150, 215 }, // BLUE
+	{  12, 215 }, // SILVER
+	{ 189, 215 }, // GOLD
+	{ 184, 215 }, // RED
+	{ 174, 215 }, // PURPLE
+	{  30, 215 }, // LTBROWN
+	{ 195, 215 }, // ORANGE
+	{ 209, 215 }, // GREEN
+	{  68, 215 }, // YELLOW
+	{  95, 215 }, // DKGREEN
+	{  79, 215 }, // CREAM
+	{ 116, 215 }, // BROWN
+	{  15, 215 }, // WHITE
+	{ 152, 215 }, // LTBLUE
+	{  32, 215 }, // GRAY
+	{ 133, 215 }, // DKBLUE
+	{ 215,   0 }, // BLACK
+};