Coding Help Please!

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

Post Reply
gmyx
Engineer
Engineer
Posts: 123
Joined: 27 Feb 2003 00:06
Location: Hammond, Ontario, Canada

Coding Help Please!

Post by gmyx »

I'm looking for a little help. I'm in the process of writing my own industries GRF and have run into a problem. The problem is that I can't seem to figure out how action 1/2/3 work -> TTDPatch does not give me an error but the industry refuses to appear. I've managed to get other industries that I'm not changing the graphics for to work, but this is a new industry.

Below is the related code -> my question for you all is -> where did I go wrong?

Code: Select all

...
  101 * 25	 0C "  Meat Processing Plant "
  102 * 17	 0C "  MPP: Graphics "
  103 * 4	 01 09 04 03
  104 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 642 24 03 32 64 -31 -1
  105 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 722 24 03 50 64 -31 -19
  106 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 2 88 09 59 64 -31 -28
  107 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 82 88 03 31 64 -31 0
  108 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 162 88 03 53 64 -31 -22
  109 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 242 88 09 64 64 -31 -33
  110 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 322 88 03 25 21 -10 -4
  111 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 354 88 03 41 23 -11 -20
  112 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 386 88 09 41 23 -11 -20
  113 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 418 88 03 31 64 -31 0
  114 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 498 88 03 31 64 -31 0
  115 c:\games\ttwin95\newgrf\occsdefs/occsdefs.pcx 578 88 09 31 64 -31 0
  116 * 14	 0C "  MPP: Tiles "
  117 * 16	 00 09 04 01 01 0A 04 08 0B 19 08 0C 00 00 0D 10
  118 * 16	 00 09 04 01 02 0A 04 08 0B 19 08 0C 00 00 0D 10
  119 * 16	 00 09 04 01 03 0A 04 08 0B 19 08 0C 00 00 0D 10
  120 * 16	 00 09 04 01 04 0A 04 08 0B 19 08 0C 00 00 0D 10
  121 * 38	 0C "  MPP: Associate Graphics with tiles "
  122 * 17	 02 09 00 00 00 00 00 00 00 80 00 80 00 00 10 10 25
  123 * 17	 02 09 01 00 00 00 00 00 01 00 00 80 00 00 10 10 1A
  124 * 17	 02 09 02 00 00 00 00 00 02 00 00 80 00 00 10 10 11
  125 * 17	 02 09 03 00 00 00 00 00 03 00 00 80 00 00 10 10 40
  126 * 7	 03 09 01 00 00 00 00
  127 * 7	 03 09 01 01 00 01 00
  128 * 7	 03 09 01 02 00 02 00
  129 * 7	 03 09 01 03 00 03 00
...
  182 * 25	 0C "  Meat Processing Plant "
  183 * 124	 00 0A 15 01 05 08 FF 06 07 0B 04 0F CF 10 16 FF 11 04 19 FF FF 12 00 13 00 14 15 15 00 17 
05 18 03 19 A2 1A 00 00 00 00 1C 02 00 00 00 1D 00 00 00 00 20 FF FF FF FF 1F 1E DC 0A 01 3E 00 00 00 00 
00 FE 00 00 01 00 FE 00 00 02 00 FE 00 00 00 01 FE 00 00 01 01 FE 00 00 02 01 FE 00 00 00 02 FE 00 00 01 
02 FE 01 00 02 02 FE 01 00 00 03 FE 02 00 01 03 FE 02 00 02 03 FE 03 00
...
Any help / comments is much appreciated! Of course, this GRF is far from complete, but once I can figure out how to properly add a new graphic, all will be better.
Attachments
occsdefs.nfo
The full source file
(14.87 KiB) Downloaded 54 times
occsdefs.grf
the compiled grf
(16.67 KiB) Downloaded 55 times
occsdefs.pcx
I know it's a pcx... the graphics file
(27.65 KiB) Downloaded 49 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Coding Help Please!

Post by DaleStan »

Have you asked NFORenum? It tells me that TTDPatch should be objecting to sprite 174. If you want to set the climate availability, use action 7, not prop 06. The latter doesn't exist.

... Interesting. TTDPatch doesn't complain. What I've seen of that code suggests to me that you're probably scribbling the vehicle availability masks there.
/me adds yet another thing to his ever-growing todo.

You should expect that TTDPatch will soon be made to agree with NFORenum on sprite 174, and all 174's relatives. In the meantime, there are some other problems too. Re-read the documentation for prop 08, and then set it before your action 3s, not after them.
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
gmyx
Engineer
Engineer
Posts: 123
Joined: 27 Feb 2003 00:06
Location: Hammond, Ontario, Canada

Re: Coding Help Please!

Post by gmyx »

DaleStan wrote:Have you asked NFORenum? It tells me that TTDPatch should be objecting to sprite 174. If you want to set the climate availability, use action 7, not prop 06. The latter doesn't exist.

... Interesting. TTDPatch doesn't complain. What I've seen of that code suggests to me that you're probably scribbling the vehicle availability masks there.
/me adds yet another thing to his ever-growing todo.

You should expect that TTDPatch will soon be made to agree with NFORenum on sprite 174, and all 174's relatives. In the meantime, there are some other problems too. Re-read the documentation for prop 08, and then set it before your action 3s, not after them.
Ok, that helps somewhat. I got confused, prop 06 only applies to vehicles - I just removed them since I want the industries to appear in all climates.

It seems NFORenum is a lot more picky than TTDPatch since it never complained on any of the errors found by NFORenum. I'm still having some problems with the actions 3s however even after setting an action 8 for the industry tiles. It tells me that there is not prop 8 for the IDs that I set in the industry tiles definitions just above the action 2? Is this the wrong spot to place it?

I thank you for all your help, I find this to be a bit confusing at first - I'm sure it will get less confusing over time.

Edit: I've included the a updated copy of the NFO file.

Edit 2: After a bit more fiddling around I seem to have gotten it right... just one more error to go! The industry layout...

Final edit: IT WORKS! I thank you so much... you pointed in the right direction and away from the brick wall! Now... back to adding more stuff. I guess I should make a new topic on what I am coding. But that is for another day, it's getting late. Again, I thank you very much for your help DaleStan.
Attachments
occsdefs.nfo
(15.1 KiB) Downloaded 53 times
occsdefs.nfo
(14.85 KiB) Downloaded 42 times
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Coding Help Please!

Post by DaleStan »

gmyx wrote:It seems NFORenum is a lot more picky than TTDPatch since it never complained on any of the errors found by NFORenum. I'm still having some problems with the actions 3s however even after setting an action 8 for the industry tiles.
Are you familiar with lint? NFORenum is to TTDPatch as lint is to the old C compilers. As with lint, NFORenum tries to find everything that could be a problem, while TTDPatch accepts anything that is strictly valid, and a few things that aren't.

To borrow some wise and ancient words concerning lint:
I. Thou shalt run lint frequently and study its pronouncements with care, for verily its perception and judgement oft exceed thine.
<snip>
"Study'' doth not mean mindless zeal to eradicate every byte of lint output--if for no other reason, because thou just canst not shut it up about some things--but that thou should know the cause of its unhappiness and understand what worrisome sign it tries to speak of.
Changing every instance of "lint" to "NFORenum" above leaves truth pretty much intact.

Some things NFORenum just does not like. But usually those are warnings, not errors.
Contrary to the message involved, either a ground sprite or a sprite with bit 30 set are acceptable to shut it up about error 84. I guess I need to look at that too.
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
gmyx
Engineer
Engineer
Posts: 123
Joined: 27 Feb 2003 00:06
Location: Hammond, Ontario, Canada

Re: Coding Help Please!

Post by gmyx »

DaleStan wrote: Are you familiar with lint? NFORenum is to TTDPatch as lint is to the old C compilers. As with lint, NFORenum tries to find everything that could be a problem, while TTDPatch accepts anything that is strictly valid, and a few things that aren't.
Nope, I guess I'm not old enough to know about lint - to used to Visual this and Visual that. Thanks you all your help.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 16 guests