roadtypes/tramtypes (formerly referred to as NRT)

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

roadtypes/tramtypes (formerly referred to as NRT)

Post 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.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

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

Post 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?
User avatar
jfs
Tycoon
Tycoon
Posts: 1758
Joined: 08 Jan 2003 23:09
Location: Denmark

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

Post 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.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

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

Post 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?
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

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

Post 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.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

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

Post by wallyweb »

Thanks. :)
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

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

Post 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.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

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

Post 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.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

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

Post by wallyweb »

andythenorth wrote: 16 Oct 2019 07:07 Assistance would be valuable :wink:
Indeed. :D
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 20 guests