Help wanted: Sprite Recolor Mapping when Map is in newgrf fi

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
richk67
Tycoon
Tycoon
Posts: 2363
Joined: 05 Jun 2003 16:21
Location: Up North
Contact:

Help wanted: Sprite Recolor Mapping when Map is in newgrf fi

Post by richk67 »

Hi. I am working on some new OTTD newgrf support, and was trying to use a sprite recolour map. I think I coded it as per the newgrf, but it doesnt remap. (Its for Action0Airports, so its unsupported in TTDP, and I cant test it there.) Usually people would blame OTTD, but I think however, the question is generic as I cant find the way to do it within TTDP either.

The difficulty Ive come across is that the sprite recolor map is defined in a newgrf. I can use recolour maps when defined in the "normal" sprite range, but cant seem to get it to point to the newgrf recolor map.

eg. newgrf sprite 0445 is to be shown, colour remapped using recolour map 0490 in the newgrf.
I think the spritedata would read: 45 84 90 04 ... but this points the recolour map to real sprite 0490, not the newgrf sprite (042D+63).

Is there an easy solution? Can you give me an example to follow?

It would be most appreciated.
RichK67

Yes, Ive read and re-read the newgrf spec, including the GRF Resource Manager info (which btw, desperately needs a link off the main index, rather than hide it unannounced in Action D Special Params). The lack of relevant examples means it doesnt help me. It doesnt show how to do a colour remap where the remap sprite is in a newgrf.
OTTD NewGRF_ports. Add an airport design via newgrf.Superceded by Yexo's NewGrf Airports 2
Want to organise your trains? Try Routemarkers.
--- ==== --- === --- === ---
Firework Photography
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Help wanted: Sprite Recolor Mapping when Map is in newgrf fi

Post by DaleStan »

Unless you're coding for newsignals, recolor maps must always be installed into TTD's sprite space with an action A, and preferably with GRM too.

I'm not aware of any proper example. Something like:

Code: Select all

-1*0 0D 00 \D= \DR FE FF 08 \w1
-1*0 06 00 02 03 FF
-1*0 0A 01 01 00 00
<recolor sprite>
Then use more action 6s to write the correct value (param 0, in this case) into the high word of all the necessary sprite-number dwords, being sure to preserve bits 30 and 31 of that dword, which I might do by using four parameters, one for each of the four possible settings of those two bits.
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
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 83 guests