SpriteAligner - Tool for aligning sprites directly in NFO

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
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by AndersI »

Bilbo wrote:Is there planned support for aligning also other graphics? Like houses, signals, bridges... - you'll just need different "synchronization" background.
Nothing is planned at all :-) I just threw this together when I read a post in the OTTD section about "...someone should..." :-)

If you think it can be used for other things, please indicate what changes are needed. I have only coded trains so far, and have only very sketchy ideas about the needs for the rest.

I suppose the following changes are needed, though:

- larger graphic window, zoomable?
- user selectable background 'template', adjustable position?
- what else?
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by AndersI »

Ammler wrote:But I guess, the more important fact is that the nfo files can be on very different locations, maybe it would be helpful to have the possibilty to change your path? I.e. if you click on the link you see where it is, and you can also see, where the pcx is saved.
?? I don't get what you're trying to say. The only important point for SpriteAligner is: "where are the PCX files in relation to the NFO?". As you (the user) have already pointed to the NFO, the only problem is finding the PCX if your NFO contains relative file paths - what are the relative paths relative to?
Something else, (not essential either) the pcx looks like you assume DOS? (pinky)
SA makes no assumptions at all - it reads a text file, tries to locate lines that look like NFO real sprites, tries to locate the referenced PCX and loads it (if it can be found). The PCX loader comes from a free Delphi library (Jedi) and it certainly doesn't know anything about DOS or Windows palettes. The palette for a PCX file is (should be) included in the PCX file if it is in 8bit format. I have no idea what would happen if you threw a 24bit PCX at it...
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by Ammler »

AndersI wrote:
Ammler wrote:what are the relative paths relative to?
Those aren't relative to the NFO, as someone might think. ;-)

instead to the place, where the grf will be created. (assumption)

I guess, you assume, that all nfos are in ./sprites?

example from above:
./2cc.grf
./sprites/nfo/01wagons.pnfo

Code: Select all

-1 sprites/mus/pcx/muwag.pcx  	1 	1 	01 	12	63	-25 -5

Greets
Ammler
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by AndersI »

As I said before, SA doesn't assume anything - it expects relative paths to be relative to something which is known when SA runs. What is this *something*? The folder where the NFO was opened? The current directory?

If reality doesn't look like that, it's more or less impossible to solve. If the full information cannot be found from the (full) path of the opened NFO and the relative path of the PCX, there's not much I can do. Is the folder name 'sprites' guaranteed? Are both the NFO and the PCX always somewhere under 'sprites'? How does grfcodec know where to look?
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by Ammler »

AndersI wrote:How does grfcodec know where to look?
it looks into sprites for the nfo with the same name, afaik. (there is a option to define an other location.)

You could check the path, which you called, and truncate the path until sprites and use that as "project root" where the paths are relative to...

Example:
/home/ammler/grfdev/2cc/sprites/nfo/01wagons.pnfo -> /home/ammler/grfdev/2cc

How do you do it now?

Greets
Ammler
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by AndersI »

I'm following DaleStan's advice
I think it's a safe assumption that if you strip the first directory of relative paths, then you'll have a path relative to the NFO. Or maybe prepending "../" would be safer/better/easier.
but that doesn't work for your layout.

Now, if 'sprites' is universal, and both the NFO and PCX are found somewhere in the folder tree under 'sprites', I could try to match the two strings (full path name for NFO, relative path for PCX) and build a full path for the PCX. But is that a safe bet?

Let's test and see - new version (1.04) in first post.
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by Ammler »

:bow: Work nice with 2cc now!

You made a very good job. I should keep my mouth. ;-)

(But)

No, I won't tell you from projects where the nfo is on same level as the grf. ;-)

Greets
Ammler
Attachments
Glitch, or is it just wine?
Glitch, or is it just wine?
sa-gltich.png (1.6 KiB) Viewed 2454 times
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by AndersI »

Ammler wrote:Glitch, or is it just wine?
Let's assume it is a wine problem until anyone has seen it on plain Windows :-)
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by Ammler »

Another Bugreport: (Am I the only one using it?)
sprtiealigner0.png
sprtiealigner0.png (11.69 KiB) Viewed 2320 times
if x or y position is zero, something goes wrong.

Greets
Ammler
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by Ammler »

AndersI wrote:Example files?
http://trac.openttdcoop.org/browser/grfdev/opengfx <-- makemonolevba

Greets
Ammler
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by AndersI »

OK, I've now spent more than fifteen minutes trying to get that pcx of yours, but it doesn't work how I try (the 'nfo' was no problems). If I click on the link, or right click and select Save As.. all I get is a file with the correct name, containing the link text - no pcx file. Perhaps the real file can only be fetched through svn (or whatever).

And yes, I tried the link: http://trac.openttdcoop.org/browser/grf ... lev-ba.pcx - this gives me a .pcx named file containing the text "link /home/marcel/hg/opengfx/sprites/pcx/monolev-ba.pcx" which I doubt I have the possibility to fetch.

Please attach the nfo and pcx files here if you want me to investigate further.
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by Ammler »

I am so sorry. :oops: It was just a symlink from the opengfx project, didn't realize that on commit to our svn server. Now I need to see, if I can get pcx back with coordinates 0, I changed it. If I can't revert it, I will make a scenario for you.

Edit: attached the pcx where a sprite beginns directly at boarder (pixel 0)
Greets
Ammler
Attachments
monolev-ba0.pcx
(20.04 KiB) Downloaded 97 times
User avatar
Ammler
President
President
Posts: 953
Joined: 18 Jun 2006 18:18
Location: Switzerland
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by Ammler »

I have to call back my bug report. At least partially. I need to make the pcx dimensions a factor of 4, grfcodec can handle that, but your SpriteAligner can't. I can life with that since I know it now. ;-)

Greets and still, VERY NICE tool. :-)

-Ammler
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by wallyweb »

AndersI wrote:I suppose the following changes are needed, though:

- larger graphic window, zoomable?
- user selectable background 'template', adjustable position?
- what else?
A couple of suggestions ...
- A line at the top that displays the tree and file being worked on
- A "You've made changes! Do want to save your mess?" prompt when exiting the program.
- The grid is excellent, however it appears to be standard gauge track width. An option to select for narrow gauge and the TTDX road width (center line to curb) would be useful,

I have just started using this for some RV coding and it's saving me a ton of time. 8)
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by AndersI »

wallyweb wrote: - A line at the top that displays the tree and file being worked on
- A "You've made changes! Do want to save your mess?" prompt when exiting the program.
- The grid is excellent, however it appears to be standard gauge track width. An option to select for narrow gauge and the TTDX road width (center line to curb) would be useful,
Good suggestions! As for number three, if you draw the templates, I'll get them into the program (I have no experience of my own with narrow gauge or road vehicles).
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by wallyweb »

AndersI wrote:if you draw the templates, I'll get them into the program (I have no experience of my own with narrow gauge or road vehicles).
The view yo currently have is obviously magnified ... by how much?
User avatar
AndersI
Tycoon
Tycoon
Posts: 1732
Joined: 19 Apr 2004 20:09
Location: Sweden
Contact:

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by AndersI »

@Ammler: I believe I have fixed your problem with PCX sizes - please test.

@Wallyweb: It's scaled by four (4:1). BTW, I've added display of the file name, as you wished.

I've also fixed a problem which occurred when the file names in the NFO had irregular case ("xyz.PCX" for example).
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by wallyweb »

AndersI wrote:It's scaled by four (4:1). BTW, I've added display of the file name, as you wished.
I should have asked before ... Do you have a graphic of your grid that I can use as a guide?
yorick
Engineer
Engineer
Posts: 80
Joined: 23 Mar 2008 08:53

Re: SpriteAligner - Tool for aligning sprites directly in NFO

Post by yorick »

AndersI wrote:@Ammler: I believe I have fixed your problem with PCX sizes - please test.
Yes, it's fixed, thank you :)
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: BW89 and 13 guests