Question about Action-A

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
mikeel
Engineer
Engineer
Posts: 69
Joined: 03 Jun 2002 09:55

Question about Action-A

Post by mikeel »

hi to all
i'm trying to understand how grfs work, but i have a problem.
in action-a, according to the manual, the last two values represent the first-sprite:

Code: Select all

<first-sprite>	W	Number of first sprite in this set
but where i can find this number?
(for example if i want replace a building)
thanks
mikeel
User avatar
mph
Engineer
Engineer
Posts: 124
Joined: 24 Aug 2007 20:47

Re: Question about Action-A

Post by mph »

i think this is what you mean-
you decode trg1r.grf - that is the main graphics file for most of the graphics in the game-
you then get trg1r.nfo and trg1r.pcx
open the pcx file - and there will be lots of sprites- each with a number above them- and that is the sprite number.
a set of sprites is a set of consecutive sprites- if you want to replace a certain building- find the sprite or set of sprites in the pcx file, and the first sprite number is what you want.

i hope i understood correctly- i too am only learning-
previously known as daylight
mikeel
Engineer
Engineer
Posts: 69
Joined: 03 Jun 2002 09:55

Re: Question about Action-A

Post by mikeel »

well i don't think that is the little number above the sprites becouse it is a decimal value.
the action-A requires instead two hex values:
in the example of the manual
3 * 5 0A 01 0C 3A 08
where
3A 08 <first-sprite>: First Sprite of the set (3A 08 - Farms)
but in the pcx file the first sprite of the farm is 2108
User avatar
mph
Engineer
Engineer
Posts: 124
Joined: 24 Aug 2007 20:47

Re: Question about Action-A

Post by mph »

yes- the little number above the sprite is a decimal number.

the action a reqires this number in hexidecimal in little endian format i believe.

in the wiki-on the actionA page- it says in the table that the element- <first-sprite>, which is the number of the first sprite in the set, has size w.
size w means that
This parameter is a two-byte word, specified in little-endian byte order
from this page- http://wiki.ttdpatch.net/tiki-index.php ... nsDetailed

so you take the decimal sprite number from the trg1r.pcx file and convert this do hexidecimal. the windows calculator can do this.
taking an example i have done- to replace the fences on the railway tracks.
first sprite number is 1301 in decimal

convert to hexidecimal - giving 515.
make this a two byte word- 05 15
put in little endian- 15 05

and that is what you use in the actionA


i hope this is what you mean. and that im explaining it ok!

edit- you may be confused- the first sprite for the farm is 2106 not 2108. which in hexidecimal put in little endian is 3A 08
previously known as daylight
mikeel
Engineer
Engineer
Posts: 69
Joined: 03 Jun 2002 09:55

Re: Question about Action-A: Answered

Post by mikeel »

I was getting crazy becouse i didn't realize that i have to switch the two values in little endian :oops: ... thanks
User avatar
minime
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 18 Jan 2004 10:02
Skype: dan.masek
Location: Prague, Czech Republic
Contact:

Re: Question about Action-A

Post by minime »

Why not just save yourself the trouble and use those handy little escape sequences? Then you can just write the decimal number and not have to worry about endianness.
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. --Albert Einstein
Image Image Image
mikeel
Engineer
Engineer
Posts: 69
Joined: 03 Jun 2002 09:55

Re: Question about Action-A

Post by mikeel »

i haven't understand... what are the "little escape sequences"?
User avatar
minime
Transport Coordinator
Transport Coordinator
Posts: 339
Joined: 18 Jan 2004 10:02
Skype: dan.masek
Location: Prague, Czech Republic
Contact:

Re: Question about Action-A

Post by minime »

Read the documentation - in particular the part of section "Byte Order" that begins with
wiki wrote:In Info version 7 and later (supported by grfcodec version 0.9.9 and later), grfcodec can do some of this work for you...
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. --Albert Einstein
Image Image Image
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 15 guests