Addition of Action A features to Action 5

Got an idea for a new feature in TTDPatch? Post it here.

Moderator: TTDPatch Moderators

Post Reply
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Addition of Action A features to Action 5

Post by FooBar »

Introduction
With NewGRF Action A it's possible to replace one or more of TTD's original sprites. Action 5 enables to replace TTDP specific sprite sets, one set at a time.

Suggestion
Let Action 5 behave like an Action A. Make it possible to replace a specific range of sprites in a TTDP specific sprite set. This could be done by expanding the current Action 5.

Example:

Code: Select all

<Sprite-number> * <Length> 05 <type> <num-sprites> <num-sets> <num-sprites> <first-sprite>
This way it should be possible to replace just one or a couple of sprites in a TTDP specific sprite set.

Background
Currently I'm creating a new tram track set (see sig). Because of climate compatiblity and other issues it needs to have a lot of switches -- and a lot of Action 5s. In the end, a lot of duplicate sprites will get added to the grf. A wast of disk space (and probably memory consumption, too). If it's possible to replace the tram set graphics bit by piece, it's also possible to avoid al those duplicate sprites, thus greatly reducing filesize.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Addition of Action A features to Action 5

Post by DaleStan »

That spec won't work, I'm afraid.

First, there are no optional bytes in the NFO spec. The presence and format of any byte is determined absolutely by the preceding bytes. There are several possible solutions to this, including action 14 and adding 80+x types. The second is possibly more elegant, so I'll do that for the present

Second, Action 5 (re)allocates a sprite block every time it appears. Action A simply modifies an already-existing block. The extended-5 would probably not be able to extend the sprite block, and instead would be stuck only replacing sprites that had already been installed. We can, however, play games with useless forms to fix that problem. If action 5 were extended, I'd suggest this definition:

Code: Select all

 * <Length> 05 <type> [<num-sprites> | <num-sets> [<num-sprites | {<num-sprites> <first-sprite>}...] ]
Action 5 would be the current 3 or 5 bytes if the high bit of <type> is clear. If it is set, then the <type> is usually followed by an action-A-type "<num-sets> {<num-sprites> <first-sprite>}...". However, as a special case, if <num-sets> is 0, <num-sets> is followed by a single <num-sprites>, which specifies the size of the block to allocate. <num-sprites> is an extended byte, except in the {<num-sprites> <first-sprite>}... construct, where it is a byte.

One hazard with that definition is that it risks having sprites allocated but not defined. If this is the case, the "as a special case" clause would be removed, leaving the current format the only way to allocate a sprite block.

Does this look reasonable?
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
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Addition of Action A features to Action 5

Post by FooBar »

Thanks for your reply, DaleStan.

TBH, I was only wondering if such a feature could be created. If it gets created someday, I really don't care what it will look like eventually. That's something for you devs to figure out :mrgreen:
User avatar
minime
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 18 Jan 2004 10:02
Skype: dan.masek
Location: Prague, Czech Republic
Contact:

Re: Addition of Action A features to Action 5

Post by minime »

Dale: Your spec does seem to make sense. I don't think a special case for just allocating a block of sprites is that important - in most cases you will already have all the necessary space allocated by base graphics and only care about replacing a few of those.
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. --Albert Einstein
Image Image Image
Post Reply

Return to “Suggestions”

Who is online

Users browsing this forum: No registered users and 5 guests