Page 1 of 1
How to use recolor-table in recolor sprite
Posted: 18 Feb 2009 22:34
by mikeel
Hi to all,
I'm trying to understand how to use the recolour table.
I have understand the basic of the others action i used simply reading the wiki. This is not for recolor sprites, also because there are no examples.
My aim is to substitute the rail graphic and change one color with the company color.
I've used action-a to replace the sprites.
So now what i must do?
the wiki says
Code: Select all
<Sprite-number> * 257 00 <recolor-table>
but what is recolor table? how many bites i must use? and how i find it?
maybe is a stupid question, but i really don't understand.
thanks
mikeel
Re: How to use recolor-table in recolor sprite
Posted: 19 Feb 2009 00:45
by Eddi
the palette has 256 colours, a recolour table maps each colour to another colour. for example:
"colour 05 gets colour 16"
"colour 12 gets colour 2A"
"colour F2 gets colour 54"
...
if you have written down this mapping as a table on the paper:
you sort this list by the first colour, and add any missing entry in the form "colour 06 gets colour 06" [do not change]
Code: Select all
00 | 00
01 | 01
02 | 02
03 | 03
04 | 04
05 | 16 // this one is changed
06 | 06
[...]
you then leave out the left column, and the right column you enter into the newgrf, so you will have the line:
Code: Select all
-1 * 257 00 00 01 02 03 04 16 06 [...]
Re: How to use recolor-table in recolor sprite
Posted: 19 Feb 2009 03:01
by DaleStan
mikeel wrote:the wiki says
Code: Select all
<Sprite-number> * 257 00 <recolor-table>
but what is recolor table? how many bites i must use?
Let me see here:
If the sprite is to be 257 bytes long, then there must be 256 bytes after the leading null, right?
Or, if you want it spelled out for you:
<recolor-table>: 256*B, see below
And:
recolor-table
A 256-byte recolor table.
Next time, try reading the rest of the wiki page too?
Re: How to use recolor-table in recolor sprite
Posted: 19 Feb 2009 07:52
by michael blunck
mikeel wrote:
I'm trying to understand how to use the recolour table.
I have understand the basic of the others action i used simply reading the wiki. This is not for recolor sprites, also because there are no examples.
[...]
the wiki says
Code: Select all
<Sprite-number> * 257 00 <recolor-table>
but what is recolor table? how many bites i must use? and how i find it?
Did you check out
http://wiki.ttdpatch.net/tiki-index.php ... lorSprites ?
My aim is to substitute the rail graphic and change one color with the company color.
Would you care to elaborate? IMO, this task would not need using a recolour map, but should be done in an external program (paint, PSP, photoshop, gimp, ...).
regards
Michael
Re: How to use recolor-table in recolor sprite
Posted: 19 Feb 2009 11:39
by XeryusTC
DaleStan wrote:Or, if you want it spelled out for you:
<recolor-table>: 256*B, see below
And:
recolor-table
A 256-byte recolor table.
Next time, try reading the rest of the wiki page too?
May I ask how exactly that explains how to use the recolor table?
Re: How to use recolor-table in recolor sprite
Posted: 19 Feb 2009 21:03
by DaleStan
Next time, try reading the rest of the wiki page too?
Including the parts I didn't quote?
Re: How to use recolor-table in recolor sprite
Posted: 20 Feb 2009 10:46
by mikeel
thanks eddi,
with your example i have understand how it works.
But still i have some problems. I started this thread because the wiki (which i read before posting, believe or not) says
Recolor sprites are pseudosprites used to recolor other sprites, most often to apply company colors
but in the way eddi explained i can change one color with one other, but not with the company color.
At the first time, as michael blunck said, i had simply modified the graphics with the palette's company colors. But when coded as grf the game don't change with company colour, but simply leaves them blue.
For this reason i tough that i need grf-action to change the colour.
So, maybe the right question is: is it possible to have the rail tracks with company colours?
Thanks
mikeel
Re: How to use recolor-table in recolor sprite
Posted: 20 Feb 2009 12:09
by michael blunck
mikeel wrote:
[...] So, maybe the right question is: is it possible to have the rail tracks with company colours?
I don´t think so. "Company colour" as well as custom recolouring are only available with vehicle, station, building, industry and bridge sprites.
regards
Michael
Re: How to use recolor-table in recolor sprite
Posted: 20 Feb 2009 16:49
by Eddi
mikeel wrote:
but in the way eddi explained i can change one color with one other, but not with the company color.
well, there are predefined recolour tables for each company colour
[the game] simply leaves them blue.
[...]
is it possible to have the rail tracks with company colours?
the problem here is to get the game to apply a recolour sprite to the rail graphics. i believe that will require source code changes and cannot be done solely via grf.
additional to the list that michael gave, recolouring is also done for railway fences, and (at least in OpenTTD) for PBS-reservations (here the "crashed" recolouring, not company colour). it might be rather straight forward to extend that for all rail tiles and company colour.
Re: How to use recolor-table in recolor sprite
Posted: 20 Feb 2009 19:21
by michael blunck
Eddi wrote:
mikeel wrote:
[...] is it possible to have the rail tracks with company colours?
the problem here is to get the game to apply a recolour sprite to the rail graphics. i believe that will require source code changes and cannot be done solely via grf. [...]
This reminds me of a recent suggestion (although most of the follow-up discussion isn´t of much interest).
regards
Michael
Re: How to use recolor-table in recolor sprite
Posted: 20 Feb 2009 23:10
by DaleStan
mikeel wrote:But still i have some problems. I started this thread because the wiki (which i read before posting, believe or not) says
I'm going to go with not. Not when you asked a question that is answered three times on the wiki.
mikeel wrote:Recolor sprites are pseudosprites used to recolor other sprites, most often to apply company colors
but in the way eddi explained i can change one color with one other, but not with the company color.
You're misunderstanding one of two things:
1) "most often" does not mean "always".
2) The correct one of 256 different recolor sprites is automatically selected depending on which of the 256 pairs of company-colors needs to be applied.
Re: How to use recolor-table in recolor sprite
Posted: 23 Feb 2009 18:25
by mikeel
Excuse me DaleStan, but now I don't understand what you mean
2) The correct one of 256 different recolor sprites is automatically selected depending on which of the 256 pairs of company-colors needs to be applied.
I have to write 256 recolor-sprites?
In which order?
And there is a table with the byte value of every color?
I only found this:
http://wiki.ttdpatch.net/tiki-index.php ... ht=palette
But there are only the values of player colours.
In the end, I haven't yet understand if I could apply or not the company color to a rail tile, otherwise this discussion won't be very useful.
Excuse me again for my obstinacy but is difficult understand nfo coding from zero, also reading the wiki and other threads.
thanks,
mikeel
Re: How to use recolor-table in recolor sprite
Posted: 23 Feb 2009 18:34
by DaleStan
You have to write as many recolor sprites as you want recoloring options. Patchman used a perl script to generate the 2cc tables; they can be found in ttdpbase[w].grf and openttd(w|d).grf.
Usefully using the recolor sprites is a different matter entirely. In theory, all sprites can be recolored, but that ability is not always exposed to NFO.
Re: How to use recolor-table in recolor sprite
Posted: 24 Feb 2009 11:04
by Purno
mikeel wrote:In the end, I haven't yet understand if I could apply or not the company color to a rail tile, otherwise this discussion won't be very useful.
1. I don't think it's possible. Certain graphics just don't support company colors. I tried it with bridges, unsuccesfully.
2. Wouldn't adding company colors to graphics be easier by replacing the sprites with edited ones? I'm not familiar with recoloring tables, but are you sure it'll only apply to the rail graphics?
3. Making a rail tile with company colors and adding that one in a GRF could be a good way to discover if it's possible. If I remember correctly replacing a sprite is done with a simple Action A and shouldn't cost much time.
Note that I'm not an NFO expert, I'm just trying to think along.
Re: How to use recolor-table in recolor sprite
Posted: 24 Feb 2009 12:05
by michael blunck
Purno wrote:
[...] Note that I'm not an NFO expert, I'm just trying to think along.
Properly
reading would have been sufficient, as always.
mikeel wrote:In the end, I haven't yet understand if I could apply or not the company color to a rail tile, otherwise this discussion won't be very useful.
http://www.tt-forums.net/viewtopic.php?p=766145#p766145
Purno wrote:2. Wouldn't adding company colors to graphics be easier by replacing the sprites with edited ones? I'm not familiar with recoloring tables, but are you sure it'll only apply to the rail graphics?
http://www.tt-forums.net/viewtopic.php?p=765853#p765853
Purno wrote:3. Making a rail tile with company colors and adding that one in a GRF could be a good way to discover if it's possible. If I remember correctly replacing a sprite is done with a simple Action A and shouldn't cost much time.
http://www.tt-forums.net/viewtopic.php?p=766130#p766130
HTH
regards
Michael
Re: How to use recolor-table in recolor sprite
Posted: 28 Feb 2009 09:10
by eis_os
There is no one who would currently rewrite the bridge drawing nor the rail drawing code, I have started some code already but never ever released it because it simply doesn't work. I don't think I won't touch that code in the near future. So currently it's not possible to do any fancy company color stuff except the features that support them explicit.