How to use recolor-table in recolor sprite

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Post Reply
mikeel
Engineer
Engineer
Posts: 69
Joined: 03 Jun 2002 09:55

How to use recolor-table in recolor sprite

Post 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
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: How to use recolor-table in recolor sprite

Post 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:

Code: Select all

05 | 16
12 | 2A
F2 | 54
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 [...]
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: How to use recolor-table in recolor sprite

Post 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?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: How to use recolor-table in recolor sprite

Post 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
Image
User avatar
XeryusTC
Tycoon
Tycoon
Posts: 15415
Joined: 02 May 2005 11:05
Skype: XeryusTC
Location: localhost

Re: How to use recolor-table in recolor sprite

Post 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?
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: How to use recolor-table in recolor sprite

Post by DaleStan »

Next time, try reading the rest of the wiki page too?

Including the parts I didn't quote?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
mikeel
Engineer
Engineer
Posts: 69
Joined: 03 Jun 2002 09:55

Re: How to use recolor-table in recolor sprite

Post 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
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: How to use recolor-table in recolor sprite

Post 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
Image
Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

Re: How to use recolor-table in recolor sprite

Post 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.
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: How to use recolor-table in recolor sprite

Post 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
Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: How to use recolor-table in recolor sprite

Post 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.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
mikeel
Engineer
Engineer
Posts: 69
Joined: 03 Jun 2002 09:55

Re: How to use recolor-table in recolor sprite

Post 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
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: How to use recolor-table in recolor sprite

Post 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.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Purno
Tycoon
Tycoon
Posts: 16659
Joined: 30 Mar 2004 12:30
Location: Almere, The Netherlands

Re: How to use recolor-table in recolor sprite

Post 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.
Contributor to the The 2cc Set and Dutch Trainset. Inventor of the Metro concept. Retired Graphics Artist.
Image Image
Download TT | Latest TTDPatch | OpenTTD | OpenTTDCoop | BaNaNaS: OpenTTD content system | 2048² OTTD scenario of the Netherlands
GRF Codec | GRF Crawler | GRF Maker | Usefull graphics & tools sites | NML Documentation Wiki | NFO Documentation Wiki
All my graphics are licensed under GPL. "Always remember you're unique, just like everyone else."
michael blunck
Tycoon
Tycoon
Posts: 5954
Joined: 27 Apr 2005 07:09
Contact:

Re: How to use recolor-table in recolor sprite

Post 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
Image
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Re: How to use recolor-table in recolor sprite

Post 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.
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 11 guests