Changeset - r9989:3df1ea4f0982
[Not reviewed]
master
0 8 0
rubidium - 16 years ago 2008-08-23 20:16:54
rubidium@openttd.org
(svn r14146) -Codechange: allow palette override in both ways and remove some unneeded '(x == 0) ? 0 : 1' constructs.
8 files changed with 118 insertions and 111 deletions:
0 comments (0 inline, 0 general)
src/blitter/32bpp_anim.cpp
Show inline comments
 
@@ -324,13 +324,13 @@ void Blitter_32bppAnim::CopyFromBuffer(v
 
		memcpy(anim_line, usrc, width * sizeof(uint8));
 
		usrc = (uint32 *)((uint8 *)usrc + width);
 
		anim_line += this->anim_buf_width;
 
	}
 

	
 
	/* We update the palette (or the pixels that do animation) immediatly, to avoid graphical glitches */
 
	this->PaletteAnimate(PALETTE_ANIM_SIZE_START, _use_dos_palette ? PALETTE_ANIM_SIZE_DOS : PALETTE_ANIM_SIZE_WIN);
 
	this->PaletteAnimate(PALETTE_ANIM_SIZE_START, (_use_palette == PAL_DOS) ? PALETTE_ANIM_SIZE_DOS : PALETTE_ANIM_SIZE_WIN);
 
}
 

	
 
void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, int height)
 
{
 
	assert(!_screen_disable_anim);
 
	assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
src/gfx.cpp
Show inline comments
 
@@ -46,13 +46,12 @@ int _pal_first_dirty;
 
int _pal_count_dirty;
 

	
 
Colour _cur_palette[256];
 
byte _stringwidth_table[FS_END][224]; ///< Cache containing width of often used characters. @see GetCharacterWidth()
 
DrawPixelInfo *_cur_dpi;
 
byte _colour_gradient[COLOUR_END][8];
 
bool _use_dos_palette;
 

	
 
static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub = NULL);
 

	
 
FontSize _cur_fontsize;
 
static FontSize _last_fontsize;
 
static uint8 _cursor_backup[64 * 64 * 4];
 
@@ -753,17 +752,16 @@ Dimension GetStringBoundingBox(const cha
 
 * @param real_color  Colour to use, see DoDrawString() for details
 
 */
 
void DrawCharCentered(WChar c, int x, int y, uint16 real_color)
 
{
 
	FontSize size = FS_NORMAL;
 
	byte color = real_color & 0xFF;
 
	uint palette = _use_dos_palette ? 1 : 0;
 
	int w = GetCharacterWidth(size, c);
 

	
 
	_string_colorremap[1] = _string_colormap[palette][color].text;
 
	_string_colorremap[2] = _string_colormap[palette][color].shadow;
 
	_string_colorremap[1] = _string_colormap[_use_palette][color].text;
 
	_string_colorremap[2] = _string_colormap[_use_palette][color].shadow;
 
	_color_remap_ptr = _string_colorremap;
 

	
 
	GfxMainBlitter(GetGlyph(size, c), x - w / 2, y, BM_COLOUR_REMAP);
 
}
 

	
 
/** Draw a string at the given coordinates with the given colour.
 
@@ -799,17 +797,16 @@ int DoDrawString(const char *string, int
 
		if (x >= dpi->left + dpi->width || y >= dpi->top + dpi->height) return x;
 

	
 
		if (colour != TC_INVALID) { // the invalid colour flag test should not  really occur.  But better be safe
 
switch_colour:;
 
			if (real_colour & IS_PALETTE_COLOR) {
 
				_string_colorremap[1] = colour;
 
				_string_colorremap[2] = _use_dos_palette ? 1 : 215;
 
				_string_colorremap[2] = (_use_palette == PAL_DOS) ? 1 : 215;
 
			} else {
 
				uint palette = _use_dos_palette ? 1 : 0;
 
				_string_colorremap[1] = _string_colormap[palette][colour].text;
 
				_string_colorremap[2] = _string_colormap[palette][colour].shadow;
 
				_string_colorremap[1] = _string_colormap[_use_palette][colour].text;
 
				_string_colorremap[2] = _string_colormap[_use_palette][colour].shadow;
 
			}
 
			_color_remap_ptr = _string_colorremap;
 
		}
 
	}
 

	
 
check_bounds:
 
@@ -986,13 +983,13 @@ static void GfxMainBlitter(const Sprite 
 
}
 

	
 
void DoPaletteAnimations();
 

	
 
void GfxInitPalettes()
 
{
 
	memcpy(_cur_palette, _palettes[_use_dos_palette ? 1 : 0], sizeof(_cur_palette));
 
	memcpy(_cur_palette, _palettes[_use_palette], sizeof(_cur_palette));
 

	
 
	DoPaletteAnimations();
 
	_pal_first_dirty = 0;
 
	_pal_count_dirty = 256;
 
}
 

	
 
@@ -1004,13 +1001,13 @@ void DoPaletteAnimations()
 
	Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
 
	const Colour *s;
 
	const ExtraPaletteValues *ev = &_extra_palette_values;
 
	/* Amount of colors to be rotated.
 
	 * A few more for the DOS palette, because the water colors are
 
	 * 245-254 for DOS and 217-226 for Windows.  */
 
	const int colour_rotation_amount = _use_dos_palette ? PALETTE_ANIM_SIZE_DOS : PALETTE_ANIM_SIZE_WIN;
 
	const int colour_rotation_amount = (_use_palette == PAL_DOS) ? PALETTE_ANIM_SIZE_DOS : PALETTE_ANIM_SIZE_WIN;
 
	Colour old_val[PALETTE_ANIM_SIZE_DOS];
 
	const int oldval_size = colour_rotation_amount * sizeof(*old_val);
 
	const uint old_tc = _palette_animation_counter;
 
	uint i;
 
	uint j;
 

	
 
@@ -1089,13 +1086,13 @@ void DoPaletteAnimations()
 
		*palette_pos++ = s[j];
 
		j++;
 
		if (j == 4) j = 0;
 
	}
 

	
 
	/* Animate water for old DOS graphics */
 
	if (_use_dos_palette) {
 
	if (_use_palette == PAL_DOS) {
 
		/* Dark blue water DOS */
 
		s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->dark_water_TOY : ev->dark_water;
 
		j = EXTR(320, 5);
 
		for (i = 0; i != 5; i++) {
 
			*palette_pos++ = s[j];
 
			j++;
src/gfx_func.h
Show inline comments
 
@@ -176,9 +176,9 @@ extern DrawPixelInfo *_cur_dpi;
 
/**
 
 * All 16 colour gradients
 
 * 8 colours per gradient from darkest (0) to lightest (7)
 
 */
 
extern byte _colour_gradient[COLOUR_END][8];
 

	
 
extern bool _use_dos_palette;
 
extern Palette _use_palette;
 

	
 
#endif /* GFX_FUNC_H */
src/gfx_type.h
Show inline comments
 
@@ -232,7 +232,15 @@ enum StringColorFlags {
 
enum FillRectMode {
 
	FILLRECT_OPAQUE,  ///< Fill rectangle with a single color
 
	FILLRECT_CHECKER, ///< Draw only every second pixel, used for greying-out
 
	FILLRECT_RECOLOR, ///< Apply a recolor sprite to the screen content
 
};
 

	
 
/** Palettes OpenTTD supports. */
 
enum Palette {
 
	PAL_DOS,        ///< Use the DOS palette.
 
	PAL_WINDOWS,    ///< Use the Windows palette.
 
	PAL_AUTODETECT, ///< Automatically detect the palette based on the graphics pack.
 
	MAX_PAL = 2,    ///< The number of palettes.
 
};
 

	
 
#endif /* GFX_TYPE_H */
src/gfxinit.cpp
Show inline comments
 
@@ -18,12 +18,14 @@
 
#include "core/bitmath_func.hpp"
 
#include <string.h>
 
#include "settings_type.h"
 

	
 
#include "table/sprites.h"
 

	
 
Palette _use_palette = PAL_AUTODETECT;
 

	
 
struct MD5File {
 
	const char * filename;     ///< filename
 
	uint8 hash[16];            ///< md5 sum of the file
 
};
 

	
 
struct FileList {
 
@@ -127,30 +129,30 @@ static bool FileMD5(const MD5File file)
 
 *  - all DOS files present -> DOS palette
 
 *  - no Windows files present and any DOS file present -> DOS palette
 
 *  - otherwise -> Windows palette
 
 */
 
static void DeterminePalette()
 
{
 
	if (_use_dos_palette) return;
 
	if (_use_palette < MAX_PAL) return;
 

	
 
	/* Count of files from the different versions. */
 
	uint dos = 0;
 
	uint win = 0;
 

	
 
	for (uint i = 0; i < lengthof(files_dos.basic); i++) if (FioCheckFileExists(files_dos.basic[i].filename)) dos++;
 
	for (uint i = 0; i < lengthof(files_dos.landscape); i++) if (FioCheckFileExists(files_dos.landscape[i].filename)) dos++;
 

	
 
	for (uint i = 0; i < lengthof(files_win.basic); i++) if (FioCheckFileExists(files_win.basic[i].filename)) win++;
 
	for (uint i = 0; i < lengthof(files_win.landscape); i++) if (FioCheckFileExists(files_win.landscape[i].filename)) win++;
 

	
 
	if (win == 5) {
 
		_use_dos_palette = false;
 
		_use_palette = PAL_WINDOWS;
 
	} else if (dos == 5 || (win == 0 && dos > 0)) {
 
		_use_dos_palette = true;
 
		_use_palette = PAL_DOS;
 
	} else {
 
		_use_dos_palette = false;
 
		_use_palette = PAL_WINDOWS;
 
	}
 
}
 

	
 
/**
 
 * Checks whether the MD5 checksums of the files are correct.
 
 *
 
@@ -158,13 +160,13 @@ static void DeterminePalette()
 
 */
 
void CheckExternalFiles()
 
{
 
	DeterminePalette();
 

	
 
	static const size_t ERROR_MESSAGE_LENGTH = 128;
 
	const FileList *files = _use_dos_palette ? &files_dos : &files_win;
 
	const FileList *files = (_use_palette == PAL_DOS) ? &files_dos : &files_win;
 
	char error_msg[ERROR_MESSAGE_LENGTH * (lengthof(files->basic) + lengthof(files->landscape) + 3)];
 
	error_msg[0] = '\0';
 
	char *add_pos = error_msg;
 

	
 
	for (uint i = 0; i < lengthof(files->basic); i++) {
 
		if (!FileMD5(files->basic[i])) {
 
@@ -189,13 +191,13 @@ void CheckExternalFiles()
 
	if (add_pos != error_msg) ShowInfoF(error_msg);
 
}
 

	
 

	
 
static void LoadSpriteTables()
 
{
 
	const FileList *files = _use_dos_palette ? &files_dos : &files_win;
 
	const FileList *files = (_use_palette == PAL_DOS) ? &files_dos : &files_win;
 
	uint i = FIRST_GRF_SLOT;
 

	
 
	LoadGrfFile(files->basic[0].filename, 0, i++);
 

	
 
	/*
 
	 * The second basic file always starts at the given location and does
src/newgrf.cpp
Show inline comments
 
@@ -320,13 +320,13 @@ StringID MapGRFStringID(uint32 grfid, St
 

	
 
	return str;
 
}
 

	
 
static uint8 MapDOSColour(uint8 colour)
 
{
 
	if (_use_dos_palette) return colour;
 
	if (_use_palette == PAL_DOS) return colour;
 

	
 
	if (colour < 10) {
 
		static uint8 dos_to_win_colour_map[] = { 0, 215, 216, 136, 88, 106, 32, 33, 40, 245 };
 
		return dos_to_win_colour_map[colour];
 
	}
 

	
 
@@ -3631,13 +3631,13 @@ bool GetGlobalVariable(byte param, uint3
 
			uint build    = 1382;
 
			*value = (major << 24) | (minor << 20) | (revision << 16) | build;
 
			return true;
 
		}
 

	
 
		case 0x0D: // TTD Version, 00=DOS, 01=Windows
 
			*value = !_use_dos_palette;
 
			*value = _use_palette;
 
			return true;
 

	
 
		case 0x0E: // Y-offset for train sprites
 
			*value = _traininfo_vehicle_pitch;
 
			return true;
 

	
src/openttd.cpp
Show inline comments
 
@@ -186,13 +186,13 @@ static void ShowHelp()
 
		"  -D [ip][:port]      = Start dedicated server\n"
 
		"  -l ip[:port]        = Redirect DEBUG()\n"
 
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
 
		"  -f                  = Fork into the background (dedicated only)\n"
 
#endif
 
#endif /* ENABLE_NETWORK */
 
		"  -i                  = Force to use the DOS palette\n"
 
		"  -i                  = Force to use the DOS (0) or Windows (1) palette\n"
 
		"                          (use this if you see a lot of pink)\n"
 
		"  -c config_file      = Use 'config_file' instead of 'openttd.cfg'\n"
 
		"  -x                  = Do not automatically save to config file on exit\n",
 
		lastof(buf)
 
	);
 

	
 
@@ -403,13 +403,13 @@ int ttd_main(int argc, char *argv[])
 
	_config_file = NULL;
 

	
 
	/* The last param of the following function means this:
 
	 *   a letter means: it accepts that param (e.g.: -h)
 
	 *   a ':' behind it means: it need a param (e.g.: -m<driver>)
 
	 *   a '::' behind it means: it can optional have a param (e.g.: -d<debug>) */
 
	optformat = "m:s:v:b:hD::n::eit:d::r:g::G:c:xl:"
 
	optformat = "m:s:v:b:hD::n::ei::t:d::r:g::G:c:xl:"
 
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && !defined(WIN32)
 
		"f"
 
#endif
 
	;
 

	
 
	MyGetOptData mgo(argc - 1, argv + 1, optformat);
 
@@ -452,13 +452,13 @@ int ttd_main(int argc, char *argv[])
 
#if defined(WIN32)
 
				CreateConsole();
 
#endif
 
				if (mgo.opt != NULL) SetDebugString(mgo.opt);
 
			} break;
 
		case 'e': _switch_mode = SM_EDITOR; break;
 
		case 'i': _use_dos_palette = true; break;
 
		case 'i': _use_palette = (mgo.opt == NULL || atoi(mgo.opt) == 0) ? PAL_DOS : PAL_WINDOWS; break;
 
		case 'g':
 
			if (mgo.opt != NULL) {
 
				ttd_strlcpy(_file_to_saveload.name, mgo.opt, sizeof(_file_to_saveload.name));
 
				_switch_mode = SM_LOAD;
 
				_file_to_saveload.mode = SL_LOAD;
 

	
src/table/palettes.h
Show inline comments
 
@@ -8,12 +8,80 @@
 
	#define M(r, g, b) { 0xff, r, g, b }
 
#else
 
	#define M(r, g, b) { b, g, r, 0xff }
 
#endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
 

	
 
static const Colour _palettes[][256] = {
 
	/* palette 0 (mixed TTD DOS + TTD Windows palette */
 
	{
 
		{  0, 0, 0, 0  }, M( 16,  16,  16), M( 32,  32,  32), M( 48,  48,  48),
 
		M( 65,  64,  65), M( 82,  80,  82), M( 98, 101,  98), M(115, 117, 115),
 
		M(131, 133, 131), M(148, 149, 148), M(168, 168, 168), M(184, 184, 184),
 
		M(200, 200, 200), M(216, 216, 216), M(232, 232, 232), M(252, 252, 252),
 
		M( 52,  60,  72), M( 68,  76,  92), M( 88,  96, 112), M(108, 116, 132),
 
		M(132, 140, 152), M(156, 160, 172), M(176, 184, 196), M(204, 208, 220),
 
		M( 48,  44,   4), M( 64,  60,  12), M( 80,  76,  20), M( 96,  92,  28),
 
		M(120, 120,  64), M(148, 148, 100), M(176, 176, 132), M(204, 204, 168),
 
		M( 72,  44,   4), M( 88,  60,  20), M(104,  80,  44), M(124, 104,  72),
 
		M(152, 132,  92), M(184, 160, 120), M(212, 188, 148), M(244, 220, 176),
 
		M( 64,   0,   4), M( 88,   4,  16), M(112,  16,  32), M(136,  32,  52),
 
		M(160,  56,  76), M(188,  84, 108), M(204, 104, 124), M(220, 132, 144),
 
		M(236, 156, 164), M(252, 188, 192), M(252, 212,   0), M(252, 232,  60),
 
		M(252, 248, 128), M( 76,  40,   0), M( 96,  60,   8), M(116,  88,  28),
 
		M(136, 116,  56), M(156, 136,  80), M(176, 156, 108), M(196, 180, 136),
 
		M( 68,  24,   0), M( 96,  44,   4), M(128,  68,   8), M(156,  96,  16),
 
		M(184, 120,  24), M(212, 156,  32), M(232, 184,  16), M(252, 212,   0),
 
		M(252, 248, 128), M(252, 252, 192), M( 32,   4,   0), M( 64,  20,   8),
 
		M( 84,  28,  16), M(108,  44,  28), M(128,  56,  40), M(148,  72,  56),
 
		M(168,  92,  76), M(184, 108,  88), M(196, 128, 108), M(212, 148, 128),
 
		M(  8,  52,   0), M( 16,  64,   0), M( 32,  80,   4), M( 48,  96,   4),
 
		M( 64, 112,  12), M( 84, 132,  20), M(104, 148,  28), M(128, 168,  44),
 
		M( 28,  52,  24), M( 44,  68,  32), M( 60,  88,  48), M( 80, 104,  60),
 
		M(104, 124,  76), M(128, 148,  92), M(152, 176, 108), M(180, 204, 124),
 
		M( 16,  52,  24), M( 32,  72,  44), M( 56,  96,  72), M( 76, 116,  88),
 
		M( 96, 136, 108), M(120, 164, 136), M(152, 192, 168), M(184, 220, 200),
 
		M( 32,  24,   0), M( 56,  28,   0), M( 72,  40,   0), M( 88,  52,  12),
 
		M(104,  64,  24), M(124,  84,  44), M(140, 108,  64), M(160, 128,  88),
 
		M( 76,  40,  16), M( 96,  52,  24), M(116,  68,  40), M(136,  84,  56),
 
		M(164,  96,  64), M(184, 112,  80), M(204, 128,  96), M(212, 148, 112),
 
		M(224, 168, 128), M(236, 188, 148), M( 80,  28,   4), M(100,  40,  20),
 
		M(120,  56,  40), M(140,  76,  64), M(160, 100,  96), M(184, 136, 136),
 
		M( 36,  40,  68), M( 48,  52,  84), M( 64,  64, 100), M( 80,  80, 116),
 
		M(100, 100, 136), M(132, 132, 164), M(172, 172, 192), M(212, 212, 224),
 
		M( 40,  20, 112), M( 64,  44, 144), M( 88,  64, 172), M(104,  76, 196),
 
		M(120,  88, 224), M(140, 104, 252), M(160, 136, 252), M(188, 168, 252),
 
		M(  0,  24, 108), M(  0,  36, 132), M(  0,  52, 160), M(  0,  72, 184),
 
		M(  0,  96, 212), M( 24, 120, 220), M( 56, 144, 232), M( 88, 168, 240),
 
		M(128, 196, 252), M(188, 224, 252), M( 16,  64,  96), M( 24,  80, 108),
 
		M( 40,  96, 120), M( 52, 112, 132), M( 80, 140, 160), M(116, 172, 192),
 
		M(156, 204, 220), M(204, 240, 252), M(172,  52,  52), M(212,  52,  52),
 
		M(252,  52,  52), M(252, 100,  88), M(252, 144, 124), M(252, 184, 160),
 
		M(252, 216, 200), M(252, 244, 236), M( 72,  20, 112), M( 92,  44, 140),
 
		M(112,  68, 168), M(140, 100, 196), M(168, 136, 224), M(204, 180, 252),
 
		M(204, 180, 252), M(232, 208, 252), M( 60,   0,   0), M( 92,   0,   0),
 
		M(128,   0,   0), M(160,   0,   0), M(196,   0,   0), M(224,   0,   0),
 
		M(252,   0,   0), M(252,  80,   0), M(252, 108,   0), M(252, 136,   0),
 
		M(252, 164,   0), M(252, 192,   0), M(252, 220,   0), M(252, 252,   0),
 
		M(204, 136,   8), M(228, 144,   4), M(252, 156,   0), M(252, 176,  48),
 
		M(252, 196, 100), M(252, 216, 152), M(  8,  24,  88), M( 12,  36, 104),
 
		M( 20,  52, 124), M( 28,  68, 140), M( 40,  92, 164), M( 56, 120, 188),
 
		M( 72, 152, 216), M(100, 172, 224), M( 92, 156,  52), M(108, 176,  64),
 
		M(124, 200,  76), M(144, 224,  92), M(224, 244, 252), M(204, 240, 252),
 
		M(180, 220, 236), M(132, 188, 216), M( 88, 152, 172), M( 16,  16,  16),
 
		M( 32,  32,  32), M(  8,  92, 104), M( 16, 100, 112), M( 24, 108, 120),
 
		M( 32, 116, 128), M( 44, 124, 140), M( 92, 164, 184), M(116, 180, 196),
 
		M(148, 200, 216), M(180, 220, 232), M(216, 244, 252), M(  0,   0,   0),
 
		M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
 
		M(252,  60,   0), M(252,  80,   0), M(252, 104,   0), M(252, 128,   0),
 
		M(252, 148,   0), M(252, 172,   0), M(252, 196,   0), M(252,   0,   0),
 
		M(252,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
 
		M(252, 228,   0), M(148, 148, 148), M( 16, 101, 115), M( 24, 109, 123),
 
		M( 32, 117, 131), M( 41, 125, 139), M( 90, 165, 189), M(115, 182, 197),
 
		M(148, 202, 222), M(180, 222, 238), M(222, 246, 255), M(252, 252, 252)
 
	},
 

	
 
	/* palette 1 (TTD Windows) */
 
	{
 
		{  0, 0, 0, 0  }, M(212,   0, 212), M(212,   0, 212), M(212,   0, 212),
 
		M(212,   0, 212), M(212,   0, 212), M(212,   0, 212), M(212,   0, 212),
 
		M(212,   0, 212), M(212,   0, 212), M(168, 168, 168), M(184, 184, 184),
 
		M(200, 200, 200), M(216, 216, 216), M(232, 232, 232), M(252, 252, 252),
 
@@ -74,80 +142,12 @@ static const Colour _palettes[][256] = {
 
		M(252,  60,   0), M(252,  80,   0), M(252, 104,   0), M(252, 128,   0),
 
		M(252, 148,   0), M(252, 172,   0), M(252, 196,   0), M(252,   0,   0),
 
		M(252,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
 
		M(252, 228,   0), M(148, 148, 148), M(212,   0, 212), M(212,   0, 212),
 
		M(212,   0, 212), M(212,   0, 212), M(212,   0, 212), M(212,   0, 212),
 
		M(212,   0, 212), M(212,   0, 212), M(212,   0, 212), M(252, 252, 252)
 
	},
 

	
 
	/* palette 2 (mixed TTD DOS + TTD Windows palette */
 
	{
 
		{  0, 0, 0, 0  }, M( 16,  16,  16), M( 32,  32,  32), M( 48,  48,  48),
 
		M( 65,  64,  65), M( 82,  80,  82), M( 98, 101,  98), M(115, 117, 115),
 
		M(131, 133, 131), M(148, 149, 148), M(168, 168, 168), M(184, 184, 184),
 
		M(200, 200, 200), M(216, 216, 216), M(232, 232, 232), M(252, 252, 252),
 
		M( 52,  60,  72), M( 68,  76,  92), M( 88,  96, 112), M(108, 116, 132),
 
		M(132, 140, 152), M(156, 160, 172), M(176, 184, 196), M(204, 208, 220),
 
		M( 48,  44,   4), M( 64,  60,  12), M( 80,  76,  20), M( 96,  92,  28),
 
		M(120, 120,  64), M(148, 148, 100), M(176, 176, 132), M(204, 204, 168),
 
		M( 72,  44,   4), M( 88,  60,  20), M(104,  80,  44), M(124, 104,  72),
 
		M(152, 132,  92), M(184, 160, 120), M(212, 188, 148), M(244, 220, 176),
 
		M( 64,   0,   4), M( 88,   4,  16), M(112,  16,  32), M(136,  32,  52),
 
		M(160,  56,  76), M(188,  84, 108), M(204, 104, 124), M(220, 132, 144),
 
		M(236, 156, 164), M(252, 188, 192), M(252, 212,   0), M(252, 232,  60),
 
		M(252, 248, 128), M( 76,  40,   0), M( 96,  60,   8), M(116,  88,  28),
 
		M(136, 116,  56), M(156, 136,  80), M(176, 156, 108), M(196, 180, 136),
 
		M( 68,  24,   0), M( 96,  44,   4), M(128,  68,   8), M(156,  96,  16),
 
		M(184, 120,  24), M(212, 156,  32), M(232, 184,  16), M(252, 212,   0),
 
		M(252, 248, 128), M(252, 252, 192), M( 32,   4,   0), M( 64,  20,   8),
 
		M( 84,  28,  16), M(108,  44,  28), M(128,  56,  40), M(148,  72,  56),
 
		M(168,  92,  76), M(184, 108,  88), M(196, 128, 108), M(212, 148, 128),
 
		M(  8,  52,   0), M( 16,  64,   0), M( 32,  80,   4), M( 48,  96,   4),
 
		M( 64, 112,  12), M( 84, 132,  20), M(104, 148,  28), M(128, 168,  44),
 
		M( 28,  52,  24), M( 44,  68,  32), M( 60,  88,  48), M( 80, 104,  60),
 
		M(104, 124,  76), M(128, 148,  92), M(152, 176, 108), M(180, 204, 124),
 
		M( 16,  52,  24), M( 32,  72,  44), M( 56,  96,  72), M( 76, 116,  88),
 
		M( 96, 136, 108), M(120, 164, 136), M(152, 192, 168), M(184, 220, 200),
 
		M( 32,  24,   0), M( 56,  28,   0), M( 72,  40,   0), M( 88,  52,  12),
 
		M(104,  64,  24), M(124,  84,  44), M(140, 108,  64), M(160, 128,  88),
 
		M( 76,  40,  16), M( 96,  52,  24), M(116,  68,  40), M(136,  84,  56),
 
		M(164,  96,  64), M(184, 112,  80), M(204, 128,  96), M(212, 148, 112),
 
		M(224, 168, 128), M(236, 188, 148), M( 80,  28,   4), M(100,  40,  20),
 
		M(120,  56,  40), M(140,  76,  64), M(160, 100,  96), M(184, 136, 136),
 
		M( 36,  40,  68), M( 48,  52,  84), M( 64,  64, 100), M( 80,  80, 116),
 
		M(100, 100, 136), M(132, 132, 164), M(172, 172, 192), M(212, 212, 224),
 
		M( 40,  20, 112), M( 64,  44, 144), M( 88,  64, 172), M(104,  76, 196),
 
		M(120,  88, 224), M(140, 104, 252), M(160, 136, 252), M(188, 168, 252),
 
		M(  0,  24, 108), M(  0,  36, 132), M(  0,  52, 160), M(  0,  72, 184),
 
		M(  0,  96, 212), M( 24, 120, 220), M( 56, 144, 232), M( 88, 168, 240),
 
		M(128, 196, 252), M(188, 224, 252), M( 16,  64,  96), M( 24,  80, 108),
 
		M( 40,  96, 120), M( 52, 112, 132), M( 80, 140, 160), M(116, 172, 192),
 
		M(156, 204, 220), M(204, 240, 252), M(172,  52,  52), M(212,  52,  52),
 
		M(252,  52,  52), M(252, 100,  88), M(252, 144, 124), M(252, 184, 160),
 
		M(252, 216, 200), M(252, 244, 236), M( 72,  20, 112), M( 92,  44, 140),
 
		M(112,  68, 168), M(140, 100, 196), M(168, 136, 224), M(204, 180, 252),
 
		M(204, 180, 252), M(232, 208, 252), M( 60,   0,   0), M( 92,   0,   0),
 
		M(128,   0,   0), M(160,   0,   0), M(196,   0,   0), M(224,   0,   0),
 
		M(252,   0,   0), M(252,  80,   0), M(252, 108,   0), M(252, 136,   0),
 
		M(252, 164,   0), M(252, 192,   0), M(252, 220,   0), M(252, 252,   0),
 
		M(204, 136,   8), M(228, 144,   4), M(252, 156,   0), M(252, 176,  48),
 
		M(252, 196, 100), M(252, 216, 152), M(  8,  24,  88), M( 12,  36, 104),
 
		M( 20,  52, 124), M( 28,  68, 140), M( 40,  92, 164), M( 56, 120, 188),
 
		M( 72, 152, 216), M(100, 172, 224), M( 92, 156,  52), M(108, 176,  64),
 
		M(124, 200,  76), M(144, 224,  92), M(224, 244, 252), M(204, 240, 252),
 
		M(180, 220, 236), M(132, 188, 216), M( 88, 152, 172), M( 16,  16,  16),
 
		M( 32,  32,  32), M(  8,  92, 104), M( 16, 100, 112), M( 24, 108, 120),
 
		M( 32, 116, 128), M( 44, 124, 140), M( 92, 164, 184), M(116, 180, 196),
 
		M(148, 200, 216), M(180, 220, 232), M(216, 244, 252), M(  0,   0,   0),
 
		M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
 
		M(252,  60,   0), M(252,  80,   0), M(252, 104,   0), M(252, 128,   0),
 
		M(252, 148,   0), M(252, 172,   0), M(252, 196,   0), M(252,   0,   0),
 
		M(252,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
 
		M(252, 228,   0), M(148, 148, 148), M( 16, 101, 115), M( 24, 109, 123),
 
		M( 32, 117, 131), M( 41, 125, 139), M( 90, 165, 189), M(115, 182, 197),
 
		M(148, 202, 222), M(180, 222, 238), M(222, 246, 255), M(252, 252, 252)
 
	}
 
};
 

	
 
#define GET_PALETTE(x) _palettes[x]
 

	
 
struct ExtraPaletteValues {
 
@@ -198,12 +198,31 @@ static const ExtraPaletteValues _extra_p
 
struct StringColor {
 
	byte text;
 
	byte shadow;
 
};
 

	
 
static const StringColor _string_colormap[][17] = {
 
	{ /* DOS palette. */
 
		{ 150,   1 }, // TC_BLUE
 
		{  12,   1 }, // TC_SILVER
 
		{ 189,   1 }, // TC_GOLD
 
		{ 184,   1 }, // TC_RED
 
		{ 174,   1 }, // TC_PURPLE
 
		{  30,   1 }, // TC_LIGHT_BROWN
 
		{ 195,   1 }, // TC_ORANGE
 
		{ 209,   1 }, // TC_GREEN
 
		{  68,   1 }, // TC_YELLOW
 
		{  95,   1 }, // TC_DARK_GREEN
 
		{  79,   1 }, // TC_CREAM
 
		{ 116,   1 }, // TC_BROWN
 
		{  15,   1 }, // TC_WHITE
 
		{ 152,   1 }, // TC_LIGHT_BLUE
 
		{   6,   1 }, // TC_GREY
 
		{ 133,   1 }, // TC_DARK_BLUE
 
		{   1,   0 }, // TC_BLACK
 
	},
 
	{ /* Windows palette. */
 
		{ 150, 215 }, // TC_BLUE
 
		{  12, 215 }, // TC_SILVER
 
		{ 189, 215 }, // TC_GOLD
 
		{ 184, 215 }, // TC_RED
 
		{ 174, 215 }, // TC_PURPLE
 
@@ -216,27 +235,8 @@ static const StringColor _string_colorma
 
		{ 116, 215 }, // TC_BROWN
 
		{  15, 215 }, // TC_WHITE
 
		{ 152, 215 }, // TC_LIGHT_BLUE
 
		{  32, 215 }, // TC_GREY
 
		{ 133, 215 }, // TC_DARK_BLUE
 
		{ 215,   0 }, // TC_BLACK
 
	},
 
	{ /* DOS palette. */
 
		{ 150,   1 }, // TC_BLUE
 
		{  12,   1 }, // TC_SILVER
 
		{ 189,   1 }, // TC_GOLD
 
		{ 184,   1 }, // TC_RED
 
		{ 174,   1 }, // TC_PURPLE
 
		{  30,   1 }, // TC_LIGHT_BROWN
 
		{ 195,   1 }, // TC_ORANGE
 
		{ 209,   1 }, // TC_GREEN
 
		{  68,   1 }, // TC_YELLOW
 
		{  95,   1 }, // TC_DARK_GREEN
 
		{  79,   1 }, // TC_CREAM
 
		{ 116,   1 }, // TC_BROWN
 
		{  15,   1 }, // TC_WHITE
 
		{ 152,   1 }, // TC_LIGHT_BLUE
 
		{   6,   1 }, // TC_GREY
 
		{ 133,   1 }, // TC_DARK_BLUE
 
		{   1,   0 }, // TC_BLACK
 
	}
 
};
0 comments (0 inline, 0 general)