Page 1 of 1

roadtypes/tramtypes (formerly referred to as NRT)

Posted: 06 Oct 2019 20:32
by wallyweb
Roadtypes and Tramtypes have been available in OpenTTD-master for a while now, but NewGRF NFO and NML documentation are rather sparse.
There are at least two GRFs available: ratt-roads and unspooled.
They are coded in NML.
I am trying to cobble together something in NFO, so I will have an occasional question.

Considering that the NRT topic is largely out of date with the exception of the most recent posts, If others have Roadtypes or Tramtypes NewGRF coding questions (NML and/or NFO), perhaps they could post them below.

I will try to add relevant links here as they become available.

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 06 Oct 2019 21:01
by wallyweb
My first question is about NFO Action 1.

The NewGRF specifications show:
// BASIC <sprite-number> * <length> 01 <feature> <num-sets> <num-ent>
// EXTENDED <sprite-number> * <length> 01 <feature> 00 <first-set> <num-sets> <num-ent>

but roadtypes seem to be a bit different.
<sprite-number> * <length> 01 <feature> <num-sets> FF <num-ent> <first-set>

A bit self explanatory with the exception of FF.
In the EXTENDED format 00 is an indicator that the Action 1 is indeed extended.
Does the FF in the roadtype Action 1 also act as an indicator, this one for roadtypes/tramtypes, or does it refer to something else?

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 06 Oct 2019 21:49
by jfs
No, the roadtype syntax for action 1 is not any different.

The FF syntax is "extended byte". The FF indicates that instead of a single-byte value, read two more bytes that form the actual value as a word-sized value. Described here.

Extended bytes only work for values that are defined to accept them, and the num-ent value is one of those.

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 06 Oct 2019 22:47
by wallyweb
So, in

Code: Select all

6 * 6	 01 12 01 FF 13 00
13 00 (19d) would be <num-ent> and there is no <first-set>?
and in

Code: Select all

6 * 6	 01 12 02 FF 13 00
we have two <num-ent> of 19 real sprites each?

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 07 Oct 2019 00:04
by PikkaBird
That looks about right to me. Neither are the extended format action 1, but both use an extended byte for num-ent.
wallyweb wrote: 06 Oct 2019 22:47 13 00 (19d)
Wherever possible, code "19d in a word" as "\w19", not "13 00". Makes life easier for everyone.

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 07 Oct 2019 00:25
by wallyweb
Thanks. :)

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 07 Oct 2019 19:45
by andythenorth
There's now an nml nightly (2019-10-07) including NRT http://bundles.openttdcoop.org/nml/nightlies/LATEST/

Sorry, no Windows build of that yet.

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 07 Oct 2019 20:33
by wallyweb
andythenorth wrote: 07 Oct 2019 19:45 ...
Treasure trove. :bow:
Treasure map to the Windows trove would be handy when its available. :mrgreen: Thanks.

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 07 Oct 2019 21:40
by andythenorth
There are roadtypes examples included with NML also btw.

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 07 Oct 2019 22:17
by wallyweb
andythenorth wrote: 07 Oct 2019 21:40 There are roadtypes examples included with NML also btw.
So I noticed. Colourful stuff no less.

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 16 Oct 2019 07:07
by andythenorth
FYI I'm working on the nml docs and improved examples for roadtypes/tramtypes:

https://github.com/OpenTTD/nml/issues/47
https://github.com/OpenTTD/nml/issues/46

Assistance would be valuable :wink:

Re: roadtypes/tramtypes (formerly referred to as NRT)

Posted: 16 Oct 2019 10:39
by wallyweb
andythenorth wrote: 16 Oct 2019 07:07 Assistance would be valuable :wink:
Indeed. :D