Level crossings - New wailtype NML

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Level crossings - New wailtype NML

Post by stefino_cz »

Hi all, can somebody help me with code and spritesheet for lever crossings what will be add into my new railtypes? I found some informations at WIKI and found Sweedish tracks, where are this level crossings too. But I still dont know how does it works. I have this code for them

Code: Select all

template road_crossing_1_empty(){
[0,   0,    256,  200,  -128, -40]
[256, 0,    256,  200,  -128, -40]
[0,   0,    1,      1,     0,   0]
[0,   0,    1,      1,     0,   0]
[0,   0,    1,      1,     0,   0]
[0,   0,    1,      1,     0,   0]
[0,   0,    1,      1,     0,   0]
[0,   0,    1,      1,     0,   0]

}

template road_crossing_1_opened(){
[0,   0,    1,      1,     0,   0]
[0,   200,  128,  100,   -64, -40]
[128, 200,  128,  100,   -64, -40]
[0,   0,    1,      1,     0,   0]
[256, 200,  128,  100,   -64, -40]
[0,   0,    1,      1,     0,   0]
[0,   0,    1,      1,     0,   0]
[384, 200,  128,  100,   -64, -40]

}

template road_crossing_1_closed(){
[0,   0,    1,      1,     0,   0]
[0,   300,  128,  100,   -64, -40]
[128, 300,  128,  100,   -64, -40]
[0,   0,    1,      1,     0,   0]
[256, 300,  128,  100,   -64, -40]
[0,   0,    1,      1,     0,   0]
[0,   0,    1,      1,     0,   0]
[384, 300,  128,  100,   -64, -40]

}

spriteset(spriteset_160_road_level_crossing_empty, 	"gfx/PLACEHOLDER.png") {PLACEHOLDER_SIGNALS()}	
alternative_sprites(spriteset_160_road_level_crossing_empty, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/PREJEZD_160_NEW.png")  { road_crossing_1_empty() }

spriteset(spriteset_160_road_crossing_opened, 	"gfx/PLACEHOLDER.png") {PLACEHOLDER_SIGNALS()}	
alternative_sprites(spriteset_160_road_crossing_opened, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/PREJEZD_160_NEW.png")  { road_crossing_1_opened() }

spriteset(spriteset_160_road_crossing_closed, 	"gfx/PLACEHOLDER.png") {PLACEHOLDER_SIGNALS()}	
alternative_sprites(spriteset_160_road_crossing_closed, ZOOM_LEVEL_IN_4X, BIT_DEPTH_32BPP, "gfx/PREJEZD_160_NEW.png")  { road_crossing_1_closed() }



switch(FEAT_RAILTYPES, SELF, road_crossing_160_switch, level_crossing_status) {
	LEVEL_CROSSING_CLOSED: spriteset_160_road_crossing_closed;
	spriteset_160_road_crossing_opened;	
}

.....

rail graphics block

graphics{
track_overlay: el_120_overlays;
underlay: el_120_underlays;
signals: signal_switch_hl;
level_crossings: road_crossing_160_switch;
}
With this spriteset
PREJEZD_160_NEW.png
PREJEZD_160_NEW.png (95.68 KiB) Viewed 2743 times
And do it this in the game.
1_prejezd.JPG
1_prejezd.JPG (56.4 KiB) Viewed 2743 times
2_prejezd.JPG
2_prejezd.JPG (61.23 KiB) Viewed 2743 times
Lights are OK. But problem is with level crossing tile itself. I know that it use rail track overlays but I need to have my own sprites (in spritsheet) like basic tile. And the second thing - how to program bacis tile for city/out of the city? Cause it looks like it use only 2 overlay sprites? Thanks a lot :)
Image
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: Level crossings - New wailtype NML

Post by stefino_cz »

EDIT: Problem solved. I had only 8 spites and need 10. But there is still problem with city tiles of level crossings.How to do it? Any switch or somethink like that?
Image
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 721
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: Level crossings - New wailtype NML

Post by Gwyd »

You'd make a switch, based on the town zone, if I remember correctly. I'll edit in a bit with the actual code.

Edit:

Code: Select all

switch(FEAT_RAILTYPES, SELF, sw_a_name, town_zone){
1: a_spriteset;
2: a_different_spriteset;
some_other_spriteset;
}
I think the higher the number, the closer to the centre it is.
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: Level crossings - New wailtype NML

Post by stefino_cz »

Gwyd wrote:You'd make a switch, based on the town zone, if I remember correctly. I'll edit in a bit with the actual code.

Edit:

Code: Select all

switch(FEAT_RAILTYPES, SELF, sw_a_name, town_zone){
1: a_spriteset;
2: a_different_spriteset;
some_other_spriteset;
}
I think the higher the number, the closer to the centre it is.
Hmm, that seems good :)Thanks I'll try it :)
Image
Transportman
Tycoon
Tycoon
Posts: 2781
Joined: 22 Feb 2011 18:34

Re: Level crossings - New wailtype NML

Post by Transportman »

Looking at your sprites: It has been some time since I did something with tracks, but IIRC you don't need to provide the road-sprites yourself, only the tracks. OpenTTD will draw the correct road beneath it.
Coder of the Dutch Trackset | Development support for the Dutch Trainset | Coder of the 2cc TrainsInNML
User avatar
stefino_cz
Transport Coordinator
Transport Coordinator
Posts: 268
Joined: 02 Jul 2015 08:05
Location: Czech Republic
Contact:

Re: Level crossings - New wailtype NML

Post by stefino_cz »

Transportman wrote:Looking at your sprites: It has been some time since I did something with tracks, but IIRC you don't need to provide the road-sprites yourself, only the tracks. OpenTTD will draw the correct road beneath it.
I know but this way is better for me :)

Gwyd: It works. Thank's a lot :)
prejezd.JPG
prejezd.JPG (97.23 KiB) Viewed 2679 times
Image
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 721
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: Level crossings - New wailtype NML

Post by Gwyd »

No problem, always happy to help where I can
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 3 guests