Narrow Gauge Locos for Tram Ways

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

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

Re: Narrow Gauge Locos for Tram Ways

Post by FooBar »

NekoMaster wrote:all I got was confusion and a hurting head
Don't just look at it. That would give me a headache as well :wink:

Just start from the top and write the purpose down for every single byte you encounter in the code (a byte being a group of two hex numbers).

Allow me to do the first part for you. Just try and follow me and do the next line yourself. Post that here and then someone can check/correct that before you proceed to the next. Before you even know it you'll be doing it all by yourself.

--Start of explanation bit of http://www.tt-forums.net/download/file.php?id=112550 --

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
// Format: spritenum pcxfile xpos ypos compression ysize xsize xrel yrel
Each NFO file starts with these two lines. Those are mandatory otherwise it will not work, so just copy/paste them from some place else. NFORenum will add them for you if you don't supply them yourself, but you might as well add them yourself.

Code: Select all

// Initial sprite with line count. Leave it empty because NFORenum will fix it for you.
This is a comment. It's not actually doing anything, but you can use it to write reminders and such in your code. Usually comments are preceded by two slashes. They can be at the beginning of a line or somewhere halfway, but everything after the // on that line is treated as a comment. I'll be skipping the comments from now on, as there's not much more to explain about it.

Code: Select all

-1 * 0  00 00 00 00
This is the first (pseudo) sprite of the nfo code. The first number (-1) is the line number. Each line needs to be numbered consequtively. Because nforenum can do that for us, we write -1 instead at the beginning of each line. Then there's a * indicating that doesn't contain graphics but code instead. After the * there's a (decimal!) number indicating the amount of bytes in the sprites. Nforenum can fill that in for you as well, so we set this to zero.
The very first sprite of each is always a dword value representing the amount of sprites in the file. Again nforenum can fill that in for you, so we set it to 0 for now. Because it's a dword, it uses four bytes, so that's four times 00.

Code: Select all

-1 * 0 08 07 05 "NT" 01 "Narro guage/tram trains" 00 "Drawn by Nekomaster\nCoded by DJ Nekkid\nReleased under GPL v2 or later" 00
The first sprite that actually does something.
Again it starts with -1 * 0. Then theres the number 08, indicating that this sprites is an Action 08. This should tell you to open the NewGRF Specification on the Action8 page.

The action 8 specifies the NFO version used, the ID of the grf, the grfs title and its description. After the 08 there's one byte indicating the grf version. In this case that's 07. Grf version 7 is the current version. After the grf version there's four bytes indicating the GRFID. This is a somewhat unique value. It's a convention to use the first two bytes for the creator's initials in ASCII code. The last two bytes should be numbers, typically the first number identifying which of the author's sets this is, and the second number being a version number. DJNekkid didn't completely stick to that convention. You might want to replace the 05 "NT" 01 with "NM" 01 01. NM being your initials (each letter is one byte) and 01 01 being the first version of your first grf.
After that follows the grf's title. This is a zero-terminated string. I.e. you write the string between quotes and put a 00 after it so that it's known where the string ends. After the title comes the description, again zero-terminated.

-1 * 9 0D 9E 08 9E FF 08 00 00 00 // Draw all 32 px in the depot view
-1 * 9 0D 8E \D= FF 00 02 00 00 00 // Drop 2px in depot view
These two are a bit more advanced. I suggest to skip those and only try to understand them when you understand the rest of the file.

-1 * 0 04 01 7F 01 00 "Krauss Maffei ML4000" 00
This one's for you!


Note: If I break table: too bad. PHP has a wordwrap() function you know...
Last edited by FooBar on 17 Jun 2009 18:37, edited 1 time in total.
User avatar
NekoMaster
Tycoon
Tycoon
Posts: 4001
Joined: 16 Aug 2008 22:26
Skype: neko-master
Location: Oshawa, Ontario, CANADA

Re: Narrow Gauge Locos for Tram Ways

Post by NekoMaster »

OK, well that helped a bit. But theres still some other things I need to know.

I need to know to do for
VehicleID 0

Reliability

model life
climate availability
Speed in mph/3,2
Running cost factor
State that this is new graphics
Capacity
Cargo type
Purchase cost factor
power in 10hp (2000hp)
weight in 1/4th tons
speed in mph*0,8 (high byte of speed)
Refittable cargo
Callback bitmask
Torque (TE)
Drag
Refit cost
Refit vehicle early
Misc info, 1 = tram, 2 = 2cc, 3 = both
Refittable cargoclasses
Nonrefittable cargoclasses
Image Proud Canadian Image
Nekomasters Projects! (Downloads available on BaNaNaS!) \(>^w^<)/
# NARS ADD-ON SET 2CC | 2cc Rapid Transit For Me! (2ccRTFM) | 2cc Wagons In NML (2ccWIN)
# NML Category System (Organize your GRFS!) <- TT-Forums Exclusive Download!
User avatar
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Re: Narrow Gauge Locos for Tram Ways

Post by Wile E. Coyote »

NekoMaster wrote:The Serbian flag I made my self
It's not Serbian flag, coat of arms is missing :wink:
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Narrow Gauge Locos for Tram Ways

Post by DaleStan »

DJ Nekkid wrote:CC ... NA
NA? What clause is that?
FooBar wrote:

Code: Select all

// Automatically generated by GRFCODEC. Do not modify!
// (Info version 7)
Each NFO file starts with these two lines. Those are mandatory otherwise it will not work, so just copy/paste them from some place else.
The first three lines are mandatory to grfcodec. NFORenum will obey them if present and insert them if not, but they must be present or absent as a block; you can't have just the first two lines, for example.
FooBar wrote:The very first sprite of each is always a dword value representing the amount of sprites in the file. Both grfcodec and nforenum can fill that in for you,
Please don't attribute non-existent abilities to my programs. grfcodec can tell you if you specify and incorrect number of sprites, but it can not and will not fix it. This was an intentional decision. NFORenum tries to fix things. grfcodec does exactly what you tell it to do, no matter how wrong that may be.
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
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Narrow Gauge Locos for Tram Ways

Post by DJ Nekkid »

@DaleStan:
sorry, i cannot forget the entire term, but anyway... i prefer double D's anyway ;p
NekoMaster wrote:Ill draw the graphics, but I was wondering if it would be possible to use some wagon graphics from your 2cc set like the small hoper and the small oil tanker.
Not up to me. Purno and/or DanMack did draw thoose graphics afaik. So it's them you need to ask.

And for the Action0... If that isnt pretty much self explainable, then i dont know what is ...
For example: you dont know it's speed? It's Capacity, its enginepower? It's ALL explained on the grf-wiki...
Member of the
ImageImage
User avatar
FooBar
Tycoon
Tycoon
Posts: 6553
Joined: 21 May 2007 11:47
Location: The Netherlands
Contact:

Re: Narrow Gauge Locos for Tram Ways

Post by FooBar »

DaleStan wrote:
DJ Nekkid wrote:CC ... NA
NA? What clause is that?
That be the "Not Applicable" clause :lol:
DaleStan wrote:Please don't attribute non-existent abilities to my programs. grfcodec can tell you if you specify and incorrect number of sprites, but it can not and will not fix it. This was an intentional decision. NFORenum tries to fix things. grfcodec does exactly what you tell it to do, no matter how wrong that may be.
By bad. I've been using NFORenum for so long that I forgot what grfcodec can and can not do.

I'll be updating my previous post for if anyone else starts using it as a manual...
User avatar
Wile E. Coyote
Tycoon
Tycoon
Posts: 8515
Joined: 08 Jul 2004 22:14
Skype: wile.e.coyote2
Location: Belgrade, Serbia
Contact:

Re: Narrow Gauge Locos for Tram Ways

Post by Wile E. Coyote »

DJ Nekkid wrote:
NekoMaster wrote:Ill draw the graphics, but I was wondering if it would be possible to use some wagon graphics from your 2cc set like the small hoper and the small oil tanker.
Not up to me. Purno and/or DanMack did draw thoose graphics afaik. So it's them you need to ask.
Ahm... I drew wagons for 2cc set... :P
Serbian rail set with Serbian scenario (ECS, PBI, FIRS and Tourist set compatible) Website | Topic and download | Latest version: 03.06.2015.
Serbian tram set Tracking table | TTD Patch tram set Latest version: 17.06.2015. | Open TTD Remix Latest version: 11.07.2015.
WIN-DOS GRF Converter Topic and download | Version 0.2.1: 09.01.2005.


Runner-up in "Best avatar Forums award" for years 2006 and 2010!
User avatar
DJ Nekkid
Tycoon
Tycoon
Posts: 2141
Joined: 30 Nov 2006 20:33

Re: Narrow Gauge Locos for Tram Ways

Post by DJ Nekkid »

or even you :)
Member of the
ImageImage
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Bing [Bot], BW89 and 8 guests