Page 1 of 1

DOS Graphics

Posted: 08 Nov 2004 08:13
by Wizarth
Is there a particular reason why OpenTTD uses only the Windows version of the GRF files? From running the game it appears to be a palette difference, but as we know apparences can be deceptive.

If the reason it doesn't work is either A) No-one has done it yet, or B) None of the dev's have the DOS version, then I'm looking to take it on. I really love the original TTD and would love to play a version with all the features I'd wished it had.

Posted: 08 Nov 2004 08:29
by Prof. Frink
There's always TTDPatch.
That adds lots of features to both Win and Dos versions.


Or, you could download the Win version from the link in my sig

Re: DOS Graphics

Posted: 08 Nov 2004 14:04
by Darkvater
Wizarth wrote:Is there a particular reason why OpenTTD uses only the Windows version of the GRF files? From running the game it appears to be a palette difference, but as we know apparences can be deceptive.

If the reason it doesn't work is either A) No-one has done it yet, or B) None of the dev's have the DOS version, then I'm looking to take it on. I really love the original TTD and would love to play a version with all the features I'd wished it had.
A) There have been two attempts that I know of. One from Pasky and the other from Tron. If I remember correctly there were some problems with the palette animations, and thus it didn't work perfectly.

You can of course give it a try. Best thing to do though is to use grfcodec to convert the DOS graphics to WIN graphics, or obtain the windows version of ttdlx.

Posted: 08 Nov 2004 22:59
by Darkvater
I have had a look around for the DOS graphics. The best thing to would be to use a modified grfcodec ( http://www.ttdpatch.net/grfcodec/ ) to convert the DOS files to WINDOWS files. Most of the functionality is already present there. Decode the files with "grfcodec -d <file>", then encode them (and converting to windows) with "grfcodec -e -m0 <file>". The file is not yet fully working because grfcodec doesn't convert the company palettes. Thus:
  • TRG1.GRF: fails!
  • TRGC.GRF: works
  • TRGH.GRF: works
  • TRGI.GRF: works
  • TRGT.GRF: fails! (toyland crap).
You can check if it works by renaming the newly encoded file to its ...R.GRF equivalent and use that as the graphic file for running ottd. If it doesn't crash or produce weird colours, it works. If you are working on *nix, you can try these patches, which make it compatible for *nix: http://pasky.or.cz/~pasky/dev/openttd/g ... nix2.patch Good luck!

Posted: 09 Nov 2004 00:53
by SHADOW-XIII
I will give more info ....
you should decode WIN files like that:

decode it this way:
grfcodec.exe -p 2 -d win_version_of_a_file.grf

encode it this way:
grfcodec.exe -p 1 -e dos_version_of_a_file.grf

more info: grfcodec -p ?

Posted: 11 Nov 2004 12:21
by Wizarth
Thanks for the advice guys. I played with TTDPatch, but since I'm having to emulate DOS (I'm using Linux or WinXP) ttdpatch tends to crash a little too much. OpenTTD runs native to Linux, so I'm happier with that.

With grfcodec, I got it to compile (your patch file was missing a few things, want the diff's?) and it appears to sucessfully convert most of the files, except TRGI(R).GRF. Running this through the converter caused OpenTTD to crash.. Unfortauntely, my GUI text is all the same color as whatever its on (or all the text is transparent? Except for the Euro sign).

So if no-one objects I think I'll look into grfcodec and see if I can't improve it some.

Posted: 11 Nov 2004 12:43
by Darkvater
Wizarth wrote:So if no-one objects I think I'll look into grfcodec and see if I can't improve it some.
Yes, grfcodec screws up cause it was not meant for all the special stuff that's in trgr1.grf. You have to somehow fix the colour of the letters, since they are all transparent now.

Posted: 11 Nov 2004 15:51
by Mek
Wizarth wrote:Thanks for the advice guys. I played with TTDPatch, but since I'm having to emulate DOS (I'm using Linux or WinXP) ttdpatch tends to crash a little too much. OpenTTD runs native to Linux, so I'm happier with that.
With WinXP you can just run ttdpatch natively if you enable support for win2k (and use the windows version of ttd)...

Posted: 11 Nov 2004 22:27
by Wizarth
Thanks Mek, but the whole basis of this thread is that I have the DOS version, and not the Windows version.

Is there a CVS/etc for grfcodec, where I can submit patches etc?

Posted: 11 Nov 2004 23:15
by Darkvater
No, grfcodec was made for ttdpatch. So any changes you make are your own changes :). If it works perfectly it will probably be included in ottd as a seperate executable so that dos people can convert their graphics to windows format.

Posted: 13 Nov 2004 00:23
by nilsi
@Darkvater
What does the grfcodec patch change (besides \ vs. / issues and makefiles) ?
I doubt it is a good idea to have different versions floating around,
at least not at the moment.
Are your changes to the nfo format documented, or only in the patch?
(I refer to info.cc "inforeader" with "quoted byte"
and writing nfo version 5)
I fear the moment patchman uses version 5 in an incompatible way

Having a completely new grf format for OTTD in the future
a completely independent tool will of course be necessary.

When I have time I plan to take a look at reintegrating grfcodec.

Posted: 13 Nov 2004 01:16
by Wizarth
Well, I got it so that it works, it still needs work (at the moment it's a special build just for TRG1.GRF, needs to be an option). And I've changed the palette OpenTTD is using slightly (the first 15 or so colors from hot-pink to the DOS greyscale). The changed palette was to make the windows (option etc) and toolbar show up right, I couldn't find their graphics to convert/re-map them.

My alterations after the patch fixed an error with an anonymous union containing struct's (gcc didn't like that) and with a missing lib in the Makefile (stdc++). I didn't examine what the patch I was given did though, only enough to realise I had to change the line endings before it would apply.