Page 1 of 1
graphic coding topic
Posted: 16 Nov 2004 02:01
by CyberBoy
This topic is for graphic artists who wouldn't be able to code their graphics to post them here(as well as for coders to get practice), because of the following reasons:
No set will accept it because of a) it is from a non-setted country or region
(South america, Africa, Mexico, Russia, China, etc.) b) It is a fictional graphic in which case it would not be coded otherwise or c) the person(s) running the set(s) which it would fit into have decided it is not worthy of being in the set(s), or the set(s) has run out of ID slots.
They may not be submitted if they fit under the following circumstances:
A. You have no permisssion whatsoever from the original author (for modifications).
B. It contains rude, sexual, derrogatory or offending images.
C. The purpose of the graphic is not possible under the patches limitations*
D. They are not an image, or they are but do contain, adware, spyware or malicious programs (there are viruses that pose as .jpeg's, and obviously this rule also applies for coders, who should take care when posting .exe's)
That is all.
*Such images may be posted as eyecandy, but spamming with such images or trying to change the topic to this will be dealt with by moderators
Posted: 18 Mar 2005 01:03
by Siema
Decided to post it here to not open new topic.
I have problem with coding that results TTD patch crash. I have checked everything once more but i don't see the problem. Here are crash log and my .nfo file. Please help.
Code: Select all
TTD V0019E000 Crash Log by TTDPatch 2.0.1 alpha 46 (Windows)
Exception C0000005 at 001B:0060E201
EAX EBX ECX EDX
026AF950 00000007 00000006 026AF924
ESI EDI ESP EBP
026B0F64 00457D5D 0007FED8 0007FF20
DS ES FS GS SS Flags
0023 0023 003B 0000 0023 00010207
FFFFFFFF FFFFFFFF 00000FFF ######## FFFFFFFF (Segment limits)
00CFF300 00CFF300 0040F300 ######## 00CFF300 (Access rights)
Bytes at DS:EIP
8B 44 B8 FC 2B C6 F7 D8 66 89 42 1E 58 66 50 83
Stack Dump:
0F05F836 00000002 0060E1E9 0060E416 00000024 00000000 00000001 0000002C
0269C011 0060F422 026B0F0E 026B0F64 026B0F44 0000002C 00000000 0000002C
00000000 00000000 0007FF88 0060E2CE 00000024 026B0F48 0007FF88 0007FF48
02A21014 026AF924 00000001 026AF950 0060E259 0060E331 00545E80 00600CD2
Handler Stack Dump (at 0023:0007FC88):
00003FFF 00000000 3FFF8000 00000000 00000000 0000003B 00000023 00000023
00457D5D 026B0F64 00000007 026AF924 00000006 026AF950 0007FF20 0060E201
0000001B 00010207 0007FED8 00000023 4020027F 07FF0000 773C6F17 0000001B
773C1C48 00000023 00001F80 0000FFFF 00000002 00380036 0000FA64 00000000
Patch flags:
DBFEFFFF BFBCFFDF E0EFFFED 00000FEF 00000000 00000000 0001B09F A0000000
00040000 00001000 003F01F4 009607CB 01900096 016D005A 76260280 13B14EC4
01E00280 05140258 0A28370A 19281388 5014140A 14501E14 1E14141E 003F3C1E
03200000 F0F0D0D0 EE1C6464 3264FF0A 01005A01 07800104 3F020112 1E200A22
32020501 01140A00 00000004
While processing GRF file: newgrf/pkpsetw.grf; Sprite number: 0024 (hex)
Posted: 18 Mar 2005 01:38
by Patchman
Like the crash log says, the error is in sprite 24h = 36. You specify numprops as 10h=16 properties, but then define only 0Ah = 10.
(The crash itself is due to a bug in TTDPatch that I've fixed for a47.)
Posted: 18 Mar 2005 01:53
by Siema
Thanks a lot. I forgot that num prosp must be in hex also. Just started learning slowly.
Posted: 22 Mar 2005 10:26
by Siema
Another problem that I have.....
After fixing first bugs I can run my .grf in TTD but from 5 different cargos I get one working good. Problem is in showing their graphics sets properly. First cargo - coal (default) - all sets works fine. Rest of cargos - iron ore, goods, wood and grain shows only last set (wagon is full).
Thanks in advance.
Re: graphic coding topic
Posted: 22 Mar 2005 15:05
by krtaylor
CyberBoy wrote:a) it is from a non-setted country or region
(South america, Africa, Mexico, Russia, China, etc.)
The Tropicset would accept a well-drawn African locomotive, although I think it already has all the African locos of consequence. It would probably accept Mexican trains as well, and some South American.
I've heard rumors that George is working on a Russian set.
That just leaves China, and someday maybe we'll have a Chinese set as an offshoot of the Japan set.
Posted: 22 Mar 2005 15:34
by Patchman
Siema wrote:After fixing first bugs I can run my .grf in TTD but from 5 different cargos I get one working good. Problem is in showing their graphics sets properly. First cargo - coal (default) - all sets works fine. Rest of cargos - iron ore, goods, wood and grain shows only last set (wagon is full).
The code looks right, are you sure you've been grfcodecing the right file? I'd need to look at the .grf file to see what's actually going on.
Posted: 22 Mar 2005 19:39
by Siema
First I have made .pcx file, and coordinates in .nfo from the post before are for this .pcx file. Then I encoded them to pkpsetw.grf, run TTD and saw that there are all views for coal, and for other cargos wagon is always full with adequate cargo. When I decoded pkpsetw.grf in .pxc were all 25 sets but only with full wagons graphics.
Here are all files:
pkpsetw1.nfo -> from post before
pkpsetw1.pcx -> witch I made first
pkpsetw.grf -> GRF file
pkpstw.pcx -> pcx file from decoding
pkpsetw.nfo -> nfo file from decoding
I added '1' to names for post.
Posted: 22 Mar 2005 19:48
by DaleStan
:lightbulb:
Siema, you decreased ypos without changing pcx files. That does not work. (known bug in grfcodec)
Posted: 22 Mar 2005 19:51
by Patchman
Ah, I see the problem. GRFCodec can't correctly deal with decreases in the y coordinate of the same PCX file. It can only stay the same or increase.
So here's what you have to do:
- copy pkpsetw1.pcx to pkpsetw2.pcx
- whenever the y coordinate in your nfo decrease (e.g. from sprite 24 to 25, or 44 to 45), change the filename from ..1.pcx to ..2.pcx and then back
- then run grfcodec again
This way, you force grfcodec to re-read the file, which allows it to go back in y.
Posted: 22 Mar 2005 20:21
by Siema
I didn't know about this problem. Now everything works fine. Thanks once more and probably not last one

Posted: 22 Mar 2005 22:20
by Siema
Another problem appeared quite quickly...
I'm in the same file, Action0 property 1D. As far as I know I must add bits - tried many configurations.
Want to have: Iron Ore (100), Wood (80), Grain (40), Goods (20) = 240,
but I get: Steel (200) and Grain (40) = it's also 240.
How to make them different? Isn't that in action3 when setting types of cargo?
Posted: 22 Mar 2005 22:51
by Patchman
You have to add them in hex, so that 100+80+40+20=1E0.
Action 3 only tells the patch what graphics to show if the wagon has that cargo type. Action 0 tells it what cargo types it may be refitted to. So you were doing it almost right, just not in hex.
Posted: 22 Mar 2005 23:24
by Siema
Hmmm... so this is also in hex ... I must turn my mind into hex.
One more thing before I shut up for some time... I set introducion date in action0 as 00 00 to have wagon from beggining of the game, but this don't work - it's available from 1935 with other vehicles. Why?
Posted: 22 Mar 2005 23:37
by Patchman
Did you start a new game or click the "apply" button in the grf status window? Changes to properties 00 to 06 don't get "imported" into games otherwise.
Posted: 23 Mar 2005 00:02
by Siema
I have tried with .grf file in newgrf.cfg with "!" (clicking apply in game) and without and strarting new game and in existing one. Here is current nfo:
Posted: 23 Mar 2005 01:00
by Patchman
Hmm, that looks good too. Did you remove all the other .grf files?
I think it may be possible that the wagon is available but simply not shown until the first train engine becomes available.
Posted: 23 Mar 2005 01:19
by Siema
Yes, thats good explanation, I think. It seems to be like you said. Anyway thanks for help for now and I'm going to add something new without stupid simple bugs, I hope.