for the GermanRV project (see sig) I'm currently implementing lots of special stuff which relies on appropriate usage of recolor tables. For example, vehicles will provide "real" liveries which are achieved by recoloring a basic wrong-colored sprite using recolor tables. Now the code for that works fine in TTDPatch, but not in OTTD, all I get to see is the sprite as it is drawn in the underlying graphics file, without any recoloring applied.
The code for it looks like this:
Code: Select all
10 * 5 0D 01 00 00 00 // set var 01 = var 00
11 * 9 0D 00 00 00 FE FF 08 00 01 // reserve 256 tables
12 * 5 0D 01 02 00 01 // set var 01 = var 00 - var 01
13 * 44 06 01 82 03 01 82 06 01 // add var 01 to the base of each table
14 * 44 0A 0E 80 00 00 80 80 00 // define 2*128 new sprites
...
here come the recolor tables, real sprites and other stuff
...
// check refit cycle to determine usage of 2CC sprites or false color sprites
1887 * 14 02 01 02 81 F2 00 FF 01 //
03 00 00 00 // 2CC case, goto 03 00 (points to 2CC sprites)
04 00 // else goto 04 00 (points to false color sprites)
// CB 2D chain, select color table (Berlin)
1889 * 17 02 01 20 85
7F 00 20 FF FF 00
1A 00 00 00 // use recolor table 0
00 00 80
// CB 2D chain, select color table (Bochum)
1890 * 17 02 01 21 85 // colour mapping select
7F 00 20 FF FF 00
1A 00 01 00 // use recolor table 1
00 00 80
// CB 2D, select color mapping
1891 * 18 02 01 12 81 F2 00 FF 02 // check var F2 (refit cycle)
20 00 01 01 // goto 20 (Berlin)
21 00 02 02 // goto 21 (Bochum)
02 00 // else fail (no recoloring shall be applied to 2CC sprites)
// standard chain, check CBs
1894 * 30 02 01 01 81 0C 00 FF 05
01 80 11 11 // CB 11, make vehicle shorter by one 1/8th
10 00 16 16 // CB 16, articulation
11 00 19 19 // CB 19, cargo subtype display
12 00 2D 2D // CB 2D, select color mapping
13 00 33 33 // CB 33, sound effects
02 00 // goto 02
// action 03
1896 * 10 03 01 01 46 01
FF 00 00 // buy menu, goto 00 00
01 00 // default, goto 01 00
... here come action 0, enabling all used CBs