Mercurial > hg > openttd
changeset 3113:500c991532b7 draft
(svn r3717) - [2cc] Add 2cc colour maps and use for newgrf engines requiring them. Currently the second colour is fixed to be the player's colour.
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Wed, 01 Mar 2006 23:14:03 +0000 |
parents | 3a5e0c62fb5e |
children | b9c92aa25fb7 |
files | data/2ccmap.grf engine.h gfxinit.c table/sprites.h vehicle.c |
diffstat | 5 files changed, 26 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
new file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..4e833c0e885423f7542f4635e75182babb137e30 GIT binary patch literal 66566 zc%0?f`L|7F9DwnALgdOAp~&nKAybA*5|U~yX{}3$GF~)@LQ0Z|P?;*tq#{F+3>lhC zDP)c!GDRpfq07B`{{g=|&+?vM&RTozefIl4=bZK3>yt>NCnY5=%91tP#o2RQk~2Bi zrMdIu&6mHxWd#deUbslnE3Pb7{HhWqOO-BDwp{s?3Kg%eRQZ}JRjXZFy++MiwXdsF zw_g40Z@96+O$~2ubW7tVO>b>>Tl3rRxO3U^6)RVLv-;cAR;}-8)3)8c?K|9ef5%Rp zyL9cA*1bp12OfOr;a-pQ?(^tlef#x)e83Y=4t#3R(}SNG^6b!I&kY~({K!$GUwHAQ zF=NM#pYZZ4uTFgJ^*7#p>+N?YO@4REd+&cRb=rs1XUv@S(Z{prd@}dbdGi-6{A|(U zB}+g5;>)kT4tM=-&DwR}uivn7)8;K(f7rJD$DelW{CU^zU-s<XxBtMe2M_&r_{h=U z|2TI1#Gilt{m;KAPo4fRJ#oP_2zQCOL0DVN4Z=ENZjgEC>}fGK2<OJ!pv7G+@6OnN z%njQAf47($gll4M5I!^J2H{g;ZV;}Hxj}<-Z{=fdP_x##RmR*PHLXO+loL6VV{VYK z|BTf;8iYN^><3H(mme?<Tz<ebaQOk#z~u)_1D78#4P1Tz%>|VoFb!OOz%+3A0n@<c z2TTK(A21DEe!w(v`2o|w<p)dymmh?)V)g^3fy)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ALHI^u_5-GY%MX|aE<a!zxcq==;PL~efy)n=1};B< z=7P!(m<BFCU>dmmfN9|J1Ezt?510lnKVTZT{D5iT@&l%U%MZe8V)g^3fy)n=1};Bf z8o2y`Y2fk$rh&^3m<BFCfaZeA510lnKVTZT{D5iT@&l%U%MX|aE<a!zxcq==;PL~e L!TI|^Qs(OnxRA^P
--- a/engine.h +++ b/engine.h @@ -98,6 +98,15 @@ byte type; // type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h } Engine; +/** + * EngineInfo.misc_flags is a bitmask, with the following values + */ +enum { + EF_RAIL_TILTS = 0, ///< Rail vehicle tilts in curves (unsupported) + EF_ROAD_TRAM = 0, ///< Road vehicle is a tram/light rail vehicle (unsup) + EF_USES_2CC = 1, ///< Vehicle uses two company colours + EF_RAIL_IS_MU = 2, ///< Rail vehicle is a multiple-unit (DMU/EMU) +}; enum { RVI_MULTIHEAD = 1,
--- a/gfxinit.c +++ b/gfxinit.c @@ -352,6 +352,9 @@ load_index = SPR_AUTORAIL_BASE; load_index += LoadGrfFile("autorail.grf", load_index, i++); + assert(load_index == SPR_2CCMAP_BASE); + load_index += LoadGrfFile("2ccmap.grf", load_index, i++); + assert(load_index == SPR_OPENTTD_BASE); LoadGrfIndexed("openttd.grf", _openttd_grf_indexes, i++); load_index = SPR_OPENTTD_BASE + OPENTTD_SPRITES_COUNT;
--- a/table/sprites.h +++ b/table/sprites.h @@ -51,7 +51,8 @@ SPR_CANALS_BASE = 5382, SPR_SLOPES_BASE = SPR_CANALS_BASE + 70, SPR_AUTORAIL_BASE = SPR_SLOPES_BASE + 78, - SPR_OPENTTD_BASE = SPR_AUTORAIL_BASE + 55, + SPR_2CCMAP_BASE = SPR_AUTORAIL_BASE + 55, + SPR_OPENTTD_BASE = SPR_2CCMAP_BASE + 256, SPR_BLOT = SPR_OPENTTD_BASE + 29, // colored circle (mainly used as vehicle profit marker and for sever compatibility) @@ -1071,7 +1072,7 @@ TRANSPARENT_BIT = 31, ///< toggles transparency in the sprite RECOLOR_BIT = 15, ///< toggles recoloring in the sprite PALETTE_SPRITE_START = 16, ///< number of the first bit of the sprite containing the recolor palette - PALETTE_SPRITE_WIDTH = 11, ///< number of bits of the sprite containing the recolor palette + PALETTE_SPRITE_WIDTH = 14, ///< number of bits of the sprite containing the recolor palette SPRITE_WIDTH = 14, ///< number of bits for the sprite number };
--- a/vehicle.c +++ b/vehicle.c @@ -2040,20 +2040,26 @@ return unit; } -// XXX Temporary stub -- will be expanded -static PalSpriteID GetEngineColourMap(PlayerID player) +static PalSpriteID GetEngineColourMap(EngineID engine_type, PlayerID player) { - return SPRITE_PALETTE(PLAYER_SPRITE_COLOR(player)); + SpriteID map; + byte colour = _player_colors[player]; + + /* XXX Magic 0x307 is the first company colour remap sprite */ + map = HASBIT(_engine_info[engine_type].misc_flags, EF_USES_2CC) ? + (SPR_2CCMAP_BASE + colour + colour * 16) : (0x307 + colour); + + return SPRITE_PALETTE(map << PALETTE_SPRITE_START); } PalSpriteID GetEnginePalette(EngineID engine_type, PlayerID player) { - return GetEngineColourMap(player); + return GetEngineColourMap(engine_type, player); } PalSpriteID GetVehiclePalette(const Vehicle *v) { - return GetEngineColourMap(v->owner); + return GetEngineColourMap(v->engine_type, v->owner); } // Save and load of vehicles