Problems with using TTD sprites in station sprite layouts

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
User avatar
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Problems with using TTD sprites in station sprite layouts

Post by mart3p »

While coding Industrial Stations Renewal, I have found a number of instances where it would be useful to use TTD sprites (either from trg1r.grf or loaded using Action A and GRM). I have encountered a problem each time I try this, with offsets that are added to the sprites by TTDPatch (or OpenTTD), when the selected rail type is monorail or maglev.

The offset added is 82 sprites for monorail and twice that for maglev. This offset corresponds to the number of rail sprites, for each rail type in trg1r.grf.

I was aware this happened with ground sprites, which is reasonable, as in most cases you want a ground sprite to suit the track type. It does not seem so useful that this offset is also added to other station sprites.

One example where I have the problem is the new truck parking tiles. These use TTD's truck sprites. In this case, I can work around the problem by making the tile unavailable for monorail or maglev. Players will have to switch back to normal rail to build truck parking next to their maglev stations.

There are other cases where this workaround is not possible. In the case of some of the animated stations, I would like to use sprites loaded once using Action A and GRM, rather than having to repeat them numerous times for each Action 1 sprite set. I have managed to make this work very successfully except for the problem with the sprite offset.

The only solution I can see in this case, is to use GRM to allocate enough space to have the sprites loaded 3 times, plus the required offsets between them. This works, but it means reserving 192 sprites rather than the 28 sprites that I actually need.

I have searched the NewGRF documentation for help on this, but I don't believe these sprite offsets are even mentioned.

Any suggestions would be welcome. :)
Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Problems with using TTD sprites in station sprite layouts

Post by DaleStan »

My best suggestion is multiple spritelayouts in prop 09, and then use var 42 in CB14 to get the right one.
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
mart3p
Tycoon
Tycoon
Posts: 1030
Joined: 31 Oct 2005 21:00
Location: UK

Re: Problems with using TTD sprites in station sprite layouts

Post by mart3p »

Thanks DaleStan.

Yes, I had considered doing it that way. It would mean subtracting the necessary offsets from the sprite IDs, so that when the offset is added again, the correct sprite will be used. This seemed a bit of a hack...

The main reason I'm reluctant to use this method for the animated cranes, is that the station already uses 284 sprite layouts. The Action 0 that sets prop 09 is 9700 bytes long. Each of these sprite layouts is modified by Action 6 to apply the sprite IDs returned by the GRM Action D. Multiplying all this by 3 seems like a lot of code and a lot of work, just to save on sprite usage a bit.
Image
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Problems with using TTD sprites in station sprite layouts

Post by DaleStan »

That reminds me, ... *pulls up the NFORenum sources*

Good thing I'm not teching today; I might actually manage to get something done here. Maybe. If I don't have to completely restructure NFORenum to make it happen.
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 26 guests