Some Requests (Help Needed)

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
zero.eight
Traffic Manager
Traffic Manager
Posts: 128
Joined: 15 Jun 2007 01:14

Re: Some Requests (Help Needed)

Post by zero.eight »

Your first layout is ok (you only need two layouts for the layout to be valid, but it shouldn't matter if you have two more that aren't used)

Code: Select all

// valid layout definition
    09 04
        1D 08 00 00
        00 00 00    10 05 01
        2D 04 00 00        80
        1D 08 00 00
        00 00 00    05 10 0F
        2E 04 00 00         80
        1D 08 00 00
        00 00 00    10 05 01
        2D 04 00 00        80
        1D 08 00 00
        00 00 00    05 10 0F
        2E 04 00 00        80
but the other two layouts won't work.

I'm not sure what the "<-" is for. The sprite number is there but the rest of the definition is missing. 80 00 07 FF as your sprite number is ok, but it needs to be in little endian and put in the correct place. The code above can be modified to do this.

If you want the two orientations to draw different sprites, change the sprite number in property 09. The number of layouts defined should be a multiple of 2, where the first controls the / orientation; the second controls the \ orientation. Just change the sprite numbers there.
OpenTTD: VAST - station tiles and objects | MICS - urban monorail graphical conversion | Universal Rail Type - easier train replacement
User avatar
RL Conroy
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 04 Sep 2010 12:28
Location: Nijmegen, Holland

Re: Some Requests (Help Needed)

Post by RL Conroy »

zero.eight wrote:but the other two layouts won't work
I knew i did something Wrong
zero.eight wrote:I'm not sure what the "<-" is for
Oh Sorry this means "Must i put it after here?"

So if i Understand it Right it must be like this? This Allows (I Hope) to Create 4 Tiles of the Default Coal Mine.

Code: Select all

2 * 82	 00 04 07 01 00 08 "IST1" 0C FE 0D FE 11 00 14 FF 15 FF 09 04 1D 08 00 00 00 07 DF 10 05 01
	 2D 04 00 00 80 1D 08 00 00 00 07 E2 05 10 0F 2E 04 00 00 80 1D 08 00 00 00 07 E7 10 05 01 2D 04
	 00 00 80 1D 08 00 00 00 07 E8 05 10 0F 2E 04 00 00 80 
3 * 4	 01 04 01 02
4 sprites/Station_Tiles.pcx 82 8 09 31 64 -31 0
5 sprites/Station_Tiles.pcx 162 8 09 31 64 -31 0
6 * 7	 02 04 00 00 01 00 00
7 * 7	 03 04 01 00 00 00 00
8 * 18	 04 04 9F 01 00 "ÅCoal Mine 1" 00
9 * 22	 00 04 07 01 01 08 "IST1" 0C FE 0D FE 11 00 14 FF 15 FF 0A 00
10 * 4	 01 04 01 02
11 sprites/Station_Tiles.pcx 322 8 09 31 64 -31 0
12 sprites/Station_Tiles.pcx 402 8 09 48 64 -31 0
13 * 7	 02 04 00 00 01 00 00
14 * 7	 03 04 01 01 00 00 00
15 * 18	 04 04 9F 01 01 "ÅCoal Mine 2" 00
16 * 22	 00 04 07 01 02 08 "IST1" 0C FE 0D FE 11 00 14 FF 15 FF 0A 00
17 * 4	 01 04 01 02
...
The Codes are 2013/07 DF, 2018/07 E2, 2021/07 E7 & 2023/07 E8. I hope it's not too Confusing for you... :mrgreen:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
And 2 Questions: When you use Bit 31 to use a Baseset from Lets say Industries with Animation will the Animation Code and other Codes Connected onto that Sprite be Copied too?

And how to Set Bit 31 with Vehicles? Must you Adjust the Location of that Particular Sprite with Setting Bits? Because i wanna Recreate a GRF that Allows to Build a Statue onto a Standard of the Airplane "Yate Haugan" and the Steamtrain "Chaney Jubilee" (Look at Statue Company Colours.png)

I couldn't Find it on TTDPatch Wiki, maybe Someone Knows it?
Conroy: This is Rebel Leader to base. Rebel Transport 2001 has been destroyed and parts for Teleport Device have been lost. We need those Parts! Conroy out.
Erik: What the... What was that all about?
Baleog: I don't know. But he did mention the words "Teleport Device" and "Parts". Quote from the Game "Lost Vikings 2"
4f 70 65 6e 54 54 44 20 52 6f 63 6b 73 21 Hex Code
Find out what the Hex Code means! | Dec/Hex/Oct/Bin Table | Screenshots! | Topic TrafficLight Junction | TTDPatch Wiki | My Website! |
User avatar
zero.eight
Traffic Manager
Traffic Manager
Posts: 128
Joined: 15 Jun 2007 01:14

Re: Some Requests (Help Needed)

Post by zero.eight »

Before I comment on the code, are the sprites added by Action 01 copies of coal mine sprites from the base set?


RL Conroy wrote:When you use Bit 31 to use a Baseset from Lets say Industries with Animation will the Animation Code and other Codes Connected onto that Sprite be Copied too?
There are two types of animation: palette and frame (is this a real term?). Palette animation works by changing a colour in a single sprite to another colour after some time; frame animation works by defining a number of sprites and using callbacks to change the frame after some time.

Setting bit 31 for a sprite number only allows you to tell the game to use a sprite from the base set. Since palette animation is determined by the colours in the sprite, palette animation will always be "copied" if you reference a sprite that uses colours that are part of the palette cycle (see http://wiki.ttdpatch.net/tiki-index.php?page=PalettesAndCoordinates). Frame animation cannot be copied by referencing sprites. Not sure what you mean by "codes connected onto that sprite". A sprite is just an image drawn by the game. It is the code associated with it that sets its properties. But you cannot copy these properties by referencing the sprite.
RL Conroy wrote:And how to Set Bit 31 with Vehicles? Must you Adjust the Location of that Particular Sprite with Setting Bits? Because i wanna Recreate a GRF that Allows to Build a Statue onto a Standard of the Airplane "Yate Haugan" and the Steamtrain "Chaney Jubilee" (Look at Statue Company Colours.png)
If the sprite is in the base set, it does not matter what feature (vehicle, station, building etc) it is used for. Setting bit 31 in a station's sprite number will let you use any sprite from the base set. Use the x-ofs, y-ofs and z-ofs properties to move the sprite around.
OpenTTD: VAST - station tiles and objects | MICS - urban monorail graphical conversion | Universal Rail Type - easier train replacement
User avatar
RL Conroy
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 04 Sep 2010 12:28
Location: Nijmegen, Holland

Re: Some Requests (Help Needed)

Post by RL Conroy »

zero.eight wrote:are the sprites added by Action 01 copies of coal mine sprites from the base set?
Yes look at the Attachment. It's from "trg1r" File (But this is a Test so i can Experiment with how to Set Bit 31.)
zero.eight wrote:Frame animation cannot be copied by referencing sprites
Ah. That is bad :(
zero.eight wrote:Not sure what you mean by "codes connected onto that sprite"
I mean if that Sprite is having Properties Somewhere else (I don't Really know how to say it... ?()
zero.eight wrote:Use the x-ofs, y-ofs and z-ofs properties to move the sprite around
Huh? Is there a z-ofs? I didn't Know that! How to Adjust that?

Code: Select all

...
4 sprites/Station_Tiles.pcx 82 8 09 31 64 -31 0
5 sprites/Station_Tiles.pcx 162 8 09 31 64 -31 0
...
11 sprites/Station_Tiles.pcx 322 8 09 31 64 -31 0
12 sprites/Station_Tiles.pcx 402 8 09 48 64 -31 0
...
And what must i do with this? :?:
Attachments
2013, 2018, 2021 &amp; 2023
2013, 2018, 2021 & 2023
Coal Mine Sprites.png (18.34 KiB) Viewed 1739 times
Conroy: This is Rebel Leader to base. Rebel Transport 2001 has been destroyed and parts for Teleport Device have been lost. We need those Parts! Conroy out.
Erik: What the... What was that all about?
Baleog: I don't know. But he did mention the words "Teleport Device" and "Parts". Quote from the Game "Lost Vikings 2"
4f 70 65 6e 54 54 44 20 52 6f 63 6b 73 21 Hex Code
Find out what the Hex Code means! | Dec/Hex/Oct/Bin Table | Screenshots! | Topic TrafficLight Junction | TTDPatch Wiki | My Website! |
User avatar
zero.eight
Traffic Manager
Traffic Manager
Posts: 128
Joined: 15 Jun 2007 01:14

Re: Some Requests (Help Needed)

Post by zero.eight »

Two ways to to use sprites in a base set. It looks like you are trying to use the first but are getting confused with the second. The second is easier in my opinion.

1. Extract the sprites from the base set, define them in an Action 1 and refer to them in the station layout (Act 0 Prop09).

2. Reference the sprites. This means that you don't include them in an Action 1 but instead you modify the sprite number in Property 09 so that some base set sprites are used.

Instead of the following: (fill in the stuff in <> with relevant code)

Code: Select all

<Action 0> // define properties for one station
    09 02          // layouts: draw a ground sprite and a sprite from action 1
    <groundsprite> <offsets> <sizes>
    2D 04 00 00		80      // do not set bit 31
    <groundsprite> <offsets> <sizes>
    2E 04 00 00		80      // do not set bit 31

<Action 1> // define some coal mine sprites taken from the base set
<Action 2> // define a graphics set
<Action 3> // link graphics set to station
You can use

Code: Select all

<Action 0> // define properties for one station
    09 02          // layouts: draw a ground sprite and a coal mine sprite from base set
    <groundsprite> <offsets> <sizes>
    2D 04 00 80		80
    <groundsprite> <offsets> <sizes>
    2E 04 00 80		80

<Action 1> // define an empty sprite
<Action 2> // define a graphics set
<Action 3> // link graphics set to station
You need the empty sprite in the second example because an Action 3 requires an Action 2 which requires *a sprite* of some form. Therefore draw a sprite which is just magic blue and define it in your action 1. Without an Action 3, your stations will not show up in the build menu.

The following should work. I haven't tested it.

Code: Select all

// Action 0 : define station properties
2 * 82		00 04 
			   07 01 00 
				08 "IST1"
				0C FE
				0D FE
				11 00
				14 FF
				15 FF
				   09 02  // define 2 layouts. Each layout draws a grassy ground sprite,
				// a coal mine sprite and an empty overlay sprite
				   1D 08 00 00                                        // ground sprite : draw sprite 2077 = 0x81D
				   00 00 80		00 00 00		DD 07 00 80            // draw base set sprite 2013 = 0x7DD    !important: set bit 31
				   00 00 00		0F 0F 00		2D 04 00 00		80    // draw first sprite in Action 1 = some "empty" sprite
				   1D 08 00 00                                        // ground sprite : draw base set sprite 2077 = 0x81D
				   00 00 80		00 00 00		E5 07 00 80            // draw sprite 2021 = 0x7E5    !important: set bit 31
				   00 00 00		0F 0F 00		2E 04 00 00		80    // draw second sprite in Action 1 = some "empty" sprite

// Action 1 : define some sprites
10 * 4    01 04 01 02
11 sprites/Station_Tiles.pcx 10 10  01  01 01 0 0    // this is a one pixel sprite containing "magic blue"
12 sprites/Station_Tiles.pcx 10 10  01  01 01 0 0    // this is the same sprite, 
                                                     //    but it has to be defined twice because stations need two sprites per set, 
                                                     //    one for each orientation
// Action 2 : define a graphics set
13 * 7    02 04 00 00 01 00 00
// Action 3 : link graphics to station
14 * 7    03 04 01 00 00 00 00
If you use that code, and in general, I suggest running it through NFORenum to fix line numbers and flag up broken stuff.
OpenTTD: VAST - station tiles and objects | MICS - urban monorail graphical conversion | Universal Rail Type - easier train replacement
User avatar
RL Conroy
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 04 Sep 2010 12:28
Location: Nijmegen, Holland

Re: Some Requests (Help Needed)

Post by RL Conroy »

zero.eight wrote:The following should work. I haven't tested it.
I Copied the Code you Posted and Tested it; it Works but Partially. But it is an Indication that i'm on the Right way :)

Look at the Attachments. Is this Supposed to happen? I know that i did Something Wrong. :oops: Image
Attachments
Testing it 1.png
Testing it 1.png (24.79 KiB) Viewed 1705 times
Testing it 2.png
Testing it 2.png (6.36 KiB) Viewed 1705 times
Conroy: This is Rebel Leader to base. Rebel Transport 2001 has been destroyed and parts for Teleport Device have been lost. We need those Parts! Conroy out.
Erik: What the... What was that all about?
Baleog: I don't know. But he did mention the words "Teleport Device" and "Parts". Quote from the Game "Lost Vikings 2"
4f 70 65 6e 54 54 44 20 52 6f 63 6b 73 21 Hex Code
Find out what the Hex Code means! | Dec/Hex/Oct/Bin Table | Screenshots! | Topic TrafficLight Junction | TTDPatch Wiki | My Website! |
User avatar
zero.eight
Traffic Manager
Traffic Manager
Posts: 128
Joined: 15 Jun 2007 01:14

Re: Some Requests (Help Needed)

Post by zero.eight »

Offsets and sizes need to be adjusted.

change

Code: Select all

00 00 80      00 00 00      DD 07 00 80
to

Code: Select all

<offsets>      <sizes>      DD 07 00 80
where <offsets> is 00 00 00 so that the sprite has its own bounding box. Measure the sprite and put the values into <sizes>. Keep <offsets> as 00 00 00, and if the sprite needs to be moved, just change the relevant offset.
OpenTTD: VAST - station tiles and objects | MICS - urban monorail graphical conversion | Universal Rail Type - easier train replacement
User avatar
RL Conroy
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 04 Sep 2010 12:28
Location: Nijmegen, Holland

Re: Some Requests (Help Needed)

Post by RL Conroy »

zero.eight wrote:where <offsets> is 00 00 00 so that the sprite has its own bounding box
That is Simple but...
zero.eight wrote:Measure the sprite and put the values into <sizes>
How to do that? (Not Measuring, I know how to do that :wink:) What is Which Value? I am *Confuzzled... ?(

*Confused and Puzzled Merged
Conroy: This is Rebel Leader to base. Rebel Transport 2001 has been destroyed and parts for Teleport Device have been lost. We need those Parts! Conroy out.
Erik: What the... What was that all about?
Baleog: I don't know. But he did mention the words "Teleport Device" and "Parts". Quote from the Game "Lost Vikings 2"
4f 70 65 6e 54 54 44 20 52 6f 63 6b 73 21 Hex Code
Find out what the Hex Code means! | Dec/Hex/Oct/Bin Table | Screenshots! | Topic TrafficLight Junction | TTDPatch Wiki | My Website! |
User avatar
zero.eight
Traffic Manager
Traffic Manager
Posts: 128
Joined: 15 Jun 2007 01:14

Re: Some Requests (Help Needed)

Post by zero.eight »

See The spritedata of sprites with their own bounding box has this format here.
OpenTTD: VAST - station tiles and objects | MICS - urban monorail graphical conversion | Universal Rail Type - easier train replacement
User avatar
RL Conroy
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 04 Sep 2010 12:28
Location: Nijmegen, Holland

Re: Some Requests (Help Needed)

Post by RL Conroy »

So x-ofs is Horizontal,
y-ofs is Vertical
& z-ofs is Diagonal?
Or not? ?(
Conroy: This is Rebel Leader to base. Rebel Transport 2001 has been destroyed and parts for Teleport Device have been lost. We need those Parts! Conroy out.
Erik: What the... What was that all about?
Baleog: I don't know. But he did mention the words "Teleport Device" and "Parts". Quote from the Game "Lost Vikings 2"
4f 70 65 6e 54 54 44 20 52 6f 63 6b 73 21 Hex Code
Find out what the Hex Code means! | Dec/Hex/Oct/Bin Table | Screenshots! | Topic TrafficLight Junction | TTDPatch Wiki | My Website! |
User avatar
zero.eight
Traffic Manager
Traffic Manager
Posts: 128
Joined: 15 Jun 2007 01:14

Re: Some Requests (Help Needed)

Post by zero.eight »

Like this:
Attachments
dimensions.png
dimensions.png (4.35 KiB) Viewed 1654 times
OpenTTD: VAST - station tiles and objects | MICS - urban monorail graphical conversion | Universal Rail Type - easier train replacement
User avatar
RL Conroy
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 04 Sep 2010 12:28
Location: Nijmegen, Holland

Re: Some Requests (Help Needed)

Post by RL Conroy »

Calculating the Z-ofs is not so hard to do but what about the X-ofs and Y-ofs? How to Calculate that?
I don't know how to do that with Sprites without Groundsprites. :oops:
Here is Sprite 2013 from "trg1r" for Example.
Attachments
Coal Mine Test.png
Coal Mine Test.png (1.69 KiB) Viewed 1607 times
Conroy: This is Rebel Leader to base. Rebel Transport 2001 has been destroyed and parts for Teleport Device have been lost. We need those Parts! Conroy out.
Erik: What the... What was that all about?
Baleog: I don't know. But he did mention the words "Teleport Device" and "Parts". Quote from the Game "Lost Vikings 2"
4f 70 65 6e 54 54 44 20 52 6f 63 6b 73 21 Hex Code
Find out what the Hex Code means! | Dec/Hex/Oct/Bin Table | Screenshots! | Topic TrafficLight Junction | TTDPatch Wiki | My Website! |
User avatar
zero.eight
Traffic Manager
Traffic Manager
Posts: 128
Joined: 15 Jun 2007 01:14

Re: Some Requests (Help Needed)

Post by zero.eight »

What happens if (x-ofs, y-ofs, z-0fs) = (0, 0, 0) ? In theory, those values will place the sprite on the northern corner of the tile.
OpenTTD: VAST - station tiles and objects | MICS - urban monorail graphical conversion | Universal Rail Type - easier train replacement
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Some Requests (Help Needed)

Post by planetmaker »

RL Conroy wrote:Calculating the Z-ofs is not so hard to do but what about the X-ofs and Y-ofs? How to Calculate that?
I don't know how to do that with Sprites without Groundsprites. :oops:
Here is Sprite 2013 from "trg1r" for Example.
You give it a rough guess and then take the alignment tool ingame to find out the exact offset ;-)

Assuming the sprite is as wide as a ground tile, you move it up additionally by that many pixels as it exceeds 32 pixels in height.
User avatar
RL Conroy
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 04 Sep 2010 12:28
Location: Nijmegen, Holland

Re: Some Requests (Help Needed)

Post by RL Conroy »

planetmaker wrote:alignment tool ingame
It sounds like something from TTDPatch. I use OpenTTD.
planetmaker wrote:Assuming the sprite is as wide as a ground tile, you move it up additionally by that many pixels as it exceeds 32 pixels in height
I know this Already but thanks for the Info Planetmaker :wink:
zero.eight wrote:In theory, those values will place the sprite on the northern corner of the tile
So that is how it Works!

But what about X-Extent, Y-Extent and Z-Extent? (Not Extend?)
I Readed it on TTDPatch Wiki but how to Calculate that?

And can i get to the X-ofs, Y-os and Z-ofs from Sprites from the Basesets so i can Copy them?
Conroy: This is Rebel Leader to base. Rebel Transport 2001 has been destroyed and parts for Teleport Device have been lost. We need those Parts! Conroy out.
Erik: What the... What was that all about?
Baleog: I don't know. But he did mention the words "Teleport Device" and "Parts". Quote from the Game "Lost Vikings 2"
4f 70 65 6e 54 54 44 20 52 6f 63 6b 73 21 Hex Code
Find out what the Hex Code means! | Dec/Hex/Oct/Bin Table | Screenshots! | Topic TrafficLight Junction | TTDPatch Wiki | My Website! |
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Some Requests (Help Needed)

Post by Lord Aro »

RL Conroy wrote:
planetmaker wrote:alignment tool ingame
It sounds like something from TTDPatch. I use OpenTTD.
Uh-uh.
http://wiki.openttd.org/NewGRF_Debugging
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
RL Conroy
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 04 Sep 2010 12:28
Location: Nijmegen, Holland

Re: Some Requests (Help Needed)

Post by RL Conroy »

Lord Aro wrote:Uh-uh.
Uhm... I tried typing in the Console Command and what i get is this:
Set newgrf_developer_tools 1.png
Set newgrf_developer_tools 1.png (1.42 KiB) Viewed 1558 times
And then i Readed this on that Page: It's for a Nightly. I don't have a Nightly. I have a Stable Version.

And something Off-Topic: This is my 100st Post! :mrgreen: :D
Conroy: This is Rebel Leader to base. Rebel Transport 2001 has been destroyed and parts for Teleport Device have been lost. We need those Parts! Conroy out.
Erik: What the... What was that all about?
Baleog: I don't know. But he did mention the words "Teleport Device" and "Parts". Quote from the Game "Lost Vikings 2"
4f 70 65 6e 54 54 44 20 52 6f 63 6b 73 21 Hex Code
Find out what the Hex Code means! | Dec/Hex/Oct/Bin Table | Screenshots! | Topic TrafficLight Junction | TTDPatch Wiki | My Website! |
User avatar
Lord Aro
Tycoon
Tycoon
Posts: 2369
Joined: 25 Jun 2009 16:42
Location: Location, Location
Contact:

Re: Some Requests (Help Needed)

Post by Lord Aro »

to be honest, it would be best to get a recent nightly since you're a NewGRF developer, especially with the new parameters window.
You don't even have to update it that often...
AroAI - A really feeble attempt at an AI

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration. --Edsger Dijkstra
User avatar
RL Conroy
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 04 Sep 2010 12:28
Location: Nijmegen, Holland

Re: Some Requests (Help Needed)

Post by RL Conroy »

If i Install the Latest Nightly will it not have Interference with my Stable Version?
Because i wanna have the Nightly and my Stable Version Apart. Is that Possible?
Conroy: This is Rebel Leader to base. Rebel Transport 2001 has been destroyed and parts for Teleport Device have been lost. We need those Parts! Conroy out.
Erik: What the... What was that all about?
Baleog: I don't know. But he did mention the words "Teleport Device" and "Parts". Quote from the Game "Lost Vikings 2"
4f 70 65 6e 54 54 44 20 52 6f 63 6b 73 21 Hex Code
Find out what the Hex Code means! | Dec/Hex/Oct/Bin Table | Screenshots! | Topic TrafficLight Junction | TTDPatch Wiki | My Website! |
User avatar
lawton27
Tycoon
Tycoon
Posts: 1418
Joined: 03 Aug 2009 14:29
Location: Manchester

Re: Some Requests (Help Needed)

Post by lawton27 »

You download as a zip archive so you can extract to any folder you wish and run it separately to any other version you have installed.
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 6 guests