palettes.h

Go to the documentation of this file.
00001 /* $Id: palettes.h 24111 2012-04-10 20:16:51Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #include "../core/endian_type.hpp"
00013 
00014 #define M(r, g, b) Colour(r, g, b)
00015 
00017 static const Palette _palette = {
00018   {
00019     /* transparent */
00020     Colour(0, 0, 0, 0),
00021     /* grey scale */
00022                       M( 16,  16,  16), M( 32,  32,  32), M( 48,  48,  48),
00023     M( 65,  64,  65), M( 82,  80,  82), M( 98, 101,  98), M(115, 117, 115),
00024     /* regular colours */
00025     M(131, 133, 131), M(148, 149, 148), M(168, 168, 168), M(184, 184, 184),
00026     M(200, 200, 200), M(216, 216, 216), M(232, 232, 232), M(252, 252, 252),
00027     M( 52,  60,  72), M( 68,  76,  92), M( 88,  96, 112), M(108, 116, 132),
00028     M(132, 140, 152), M(156, 160, 172), M(176, 184, 196), M(204, 208, 220),
00029     M( 48,  44,   4), M( 64,  60,  12), M( 80,  76,  20), M( 96,  92,  28),
00030     M(120, 120,  64), M(148, 148, 100), M(176, 176, 132), M(204, 204, 168),
00031     M( 72,  44,   4), M( 88,  60,  20), M(104,  80,  44), M(124, 104,  72),
00032     M(152, 132,  92), M(184, 160, 120), M(212, 188, 148), M(244, 220, 176),
00033     M( 64,   0,   4), M( 88,   4,  16), M(112,  16,  32), M(136,  32,  52),
00034     M(160,  56,  76), M(188,  84, 108), M(204, 104, 124), M(220, 132, 144),
00035     M(236, 156, 164), M(252, 188, 192), M(252, 212,   0), M(252, 232,  60),
00036     M(252, 248, 128), M( 76,  40,   0), M( 96,  60,   8), M(116,  88,  28),
00037     M(136, 116,  56), M(156, 136,  80), M(176, 156, 108), M(196, 180, 136),
00038     M( 68,  24,   0), M( 96,  44,   4), M(128,  68,   8), M(156,  96,  16),
00039     M(184, 120,  24), M(212, 156,  32), M(232, 184,  16), M(252, 212,   0),
00040     M(252, 248, 128), M(252, 252, 192), M( 32,   4,   0), M( 64,  20,   8),
00041     M( 84,  28,  16), M(108,  44,  28), M(128,  56,  40), M(148,  72,  56),
00042     M(168,  92,  76), M(184, 108,  88), M(196, 128, 108), M(212, 148, 128),
00043     M(  8,  52,   0), M( 16,  64,   0), M( 32,  80,   4), M( 48,  96,   4),
00044     M( 64, 112,  12), M( 84, 132,  20), M(104, 148,  28), M(128, 168,  44),
00045     M( 28,  52,  24), M( 44,  68,  32), M( 60,  88,  48), M( 80, 104,  60),
00046     M(104, 124,  76), M(128, 148,  92), M(152, 176, 108), M(180, 204, 124),
00047     M( 16,  52,  24), M( 32,  72,  44), M( 56,  96,  72), M( 76, 116,  88),
00048     M( 96, 136, 108), M(120, 164, 136), M(152, 192, 168), M(184, 220, 200),
00049     M( 32,  24,   0), M( 56,  28,   0), M( 72,  40,   4), M( 88,  52,  12),
00050     M(104,  64,  24), M(124,  84,  44), M(140, 108,  64), M(160, 128,  88),
00051     M( 76,  40,  16), M( 96,  52,  24), M(116,  68,  40), M(136,  84,  56),
00052     M(164,  96,  64), M(184, 112,  80), M(204, 128,  96), M(212, 148, 112),
00053     M(224, 168, 128), M(236, 188, 148), M( 80,  28,   4), M(100,  40,  20),
00054     M(120,  56,  40), M(140,  76,  64), M(160, 100,  96), M(184, 136, 136),
00055     M( 36,  40,  68), M( 48,  52,  84), M( 64,  64, 100), M( 80,  80, 116),
00056     M(100, 100, 136), M(132, 132, 164), M(172, 172, 192), M(212, 212, 224),
00057     M( 40,  20, 112), M( 64,  44, 144), M( 88,  64, 172), M(104,  76, 196),
00058     M(120,  88, 224), M(140, 104, 252), M(160, 136, 252), M(188, 168, 252),
00059     M(  0,  24, 108), M(  0,  36, 132), M(  0,  52, 160), M(  0,  72, 184),
00060     M(  0,  96, 212), M( 24, 120, 220), M( 56, 144, 232), M( 88, 168, 240),
00061     M(128, 196, 252), M(188, 224, 252), M( 16,  64,  96), M( 24,  80, 108),
00062     M( 40,  96, 120), M( 52, 112, 132), M( 80, 140, 160), M(116, 172, 192),
00063     M(156, 204, 220), M(204, 240, 252), M(172,  52,  52), M(212,  52,  52),
00064     M(252,  52,  52), M(252, 100,  88), M(252, 144, 124), M(252, 184, 160),
00065     M(252, 216, 200), M(252, 244, 236), M( 72,  20, 112), M( 92,  44, 140),
00066     M(112,  68, 168), M(140, 100, 196), M(168, 136, 224), M(204, 180, 252),
00067     M(204, 180, 252), M(232, 208, 252), M( 60,   0,   0), M( 92,   0,   0),
00068     M(128,   0,   0), M(160,   0,   0), M(196,   0,   0), M(224,   0,   0),
00069     M(252,   0,   0), M(252,  80,   0), M(252, 108,   0), M(252, 136,   0),
00070     M(252, 164,   0), M(252, 192,   0), M(252, 220,   0), M(252, 252,   0),
00071     M(204, 136,   8), M(228, 144,   4), M(252, 156,   0), M(252, 176,  48),
00072     M(252, 196, 100), M(252, 216, 152), M(  8,  24,  88), M( 12,  36, 104),
00073     M( 20,  52, 124), M( 28,  68, 140), M( 40,  92, 164), M( 56, 120, 188),
00074     M( 72, 152, 216), M(100, 172, 224), M( 92, 156,  52), M(108, 176,  64),
00075     M(124, 200,  76), M(144, 224,  92), M(224, 244, 252), M(204, 240, 252),
00076     M(180, 220, 236), M(132, 188, 216), M( 88, 152, 172),
00077     /* unused pink */
00078                                                           M(212,   0, 212),
00079     M(212,   0, 212), M(212,   0, 212), M(212,   0, 212), M(212,   0, 212),
00080     M(212,   0, 212), M(212,   0, 212), M(212,   0, 212), M(212,   0, 212),
00081     M(212,   0, 212), M(212,   0, 212), M(212,   0, 212),
00082     /* Palette animated colours (filled with data from #ExtraPaletteValues) */
00083                                                           M(  0,   0,   0),
00084     M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
00085     M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
00086     M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
00087     M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
00088     M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
00089     M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
00090     M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0),
00091     /* pure white */
00092                                                           M(252, 252, 252)
00093   },
00094   0,  // First dirty
00095   256 // Dirty count
00096 };
00097 
00099 static const uint EPV_CYCLES_DARK_WATER    =  5; 
00100 static const uint EPV_CYCLES_LIGHTHOUSE    =  4; 
00101 static const uint EPV_CYCLES_OIL_REFINERY  =  7; 
00102 static const uint EPV_CYCLES_FIZZY_DRINK   =  5; 
00103 static const uint EPV_CYCLES_GLITTER_WATER = 15; 
00104 
00106 struct ExtraPaletteValues {
00107   Colour dark_water[EPV_CYCLES_DARK_WATER];               
00108   Colour dark_water_toyland[EPV_CYCLES_DARK_WATER];       
00109   Colour lighthouse[EPV_CYCLES_LIGHTHOUSE];               
00110   Colour oil_refinery[EPV_CYCLES_OIL_REFINERY];           
00111   Colour fizzy_drink[EPV_CYCLES_FIZZY_DRINK];             
00112   Colour glitter_water[EPV_CYCLES_GLITTER_WATER];         
00113   Colour glitter_water_toyland[EPV_CYCLES_GLITTER_WATER]; 
00114 };
00115 
00117 static const ExtraPaletteValues _extra_palette_values = {
00118   /* dark blue water */
00119   { M( 32,  68, 112), M( 36,  72, 116), M( 40,  76, 120), M( 44,  80, 124),
00120     M( 48,  84, 128) },
00121 
00122   /* dark blue water Toyland */
00123   { M( 28, 108, 124), M( 32, 112, 128), M( 36, 116, 132), M( 40, 120, 136),
00124     M( 44, 124, 140) },
00125 
00126   /* lighthouse & stadium */
00127   { M(240, 208,   0), M(  0,   0,   0), M(  0,   0,   0), M(  0,   0,   0) },
00128 
00129   /* oil refinery */
00130   { M(252,  60,   0), M(252,  84,   0), M(252, 108,   0), M(252, 124,   0),
00131     M(252, 148,   0), M(252, 172,   0), M(252, 196,   0) },
00132 
00133   /* fizzy drinks */
00134   { M( 76,  24,   8), M(108,  44,  24), M(144,  72,  52), M(176, 108,  84),
00135     M(212, 148, 128) },
00136 
00137   /* glittery water */
00138   { M(216, 244, 252), M(172, 208, 224), M(132, 172, 196), M(100, 132, 168),
00139     M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144),
00140     M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144), M( 72, 100, 144),
00141     M(100, 132, 168), M(132, 172, 196), M(172, 208, 224) },
00142 
00143   /* glittery water Toyland */
00144   { M(216, 244, 252), M(180, 220, 232), M(148, 200, 216), M(116, 180, 196),
00145     M( 92, 164, 184), M( 92, 164, 184), M( 92, 164, 184), M( 92, 164, 184),
00146     M( 92, 164, 184), M( 92, 164, 184), M( 92, 164, 184), M( 92, 164, 184),
00147     M(116, 180, 196), M(148, 200, 216), M(180, 220, 232) }
00148 };
00149 #undef M
00150 
00152 static const byte _string_colourmap[17] = {
00153     150, // TC_BLUE
00154      12, // TC_SILVER
00155     189, // TC_GOLD
00156     184, // TC_RED
00157     174, // TC_PURPLE
00158      30, // TC_LIGHT_BROWN
00159     195, // TC_ORANGE
00160     209, // TC_GREEN
00161      68, // TC_YELLOW
00162      95, // TC_DARK_GREEN
00163      79, // TC_CREAM
00164     116, // TC_BROWN
00165      15, // TC_WHITE
00166     152, // TC_LIGHT_BLUE
00167       6, // TC_GREY
00168     133, // TC_DARK_BLUE
00169       1, // TC_BLACK
00170 };