Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Nov 12, 2018 7:04 pm

All times are UTC




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sat Nov 18, 2017 10:01 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
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:
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
Attachment:
PREJEZD_160_NEW.png
PREJEZD_160_NEW.png [ 95.68 KiB | Viewed 727 times ]


And do it this in the game.
Attachment:
1_prejezd.JPG
1_prejezd.JPG [ 56.4 KiB | Viewed 727 times ]

Attachment:
2_prejezd.JPG
2_prejezd.JPG [ 61.23 KiB | Viewed 727 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


Top
   
PostPosted: Sat Nov 18, 2017 10:15 am 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
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


Top
   
PostPosted: Sat Nov 18, 2017 4:06 pm 
Offline
Director
Director
User avatar

Joined: Mon Apr 17, 2017 4:52 pm
Posts: 627
Location: Western Ile-de-France Region
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:
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.


Top
   
PostPosted: Sat Nov 18, 2017 4:42 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
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:
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


Top
   
PostPosted: Sun Nov 19, 2017 10:21 am 
Offline
Tycoon
Tycoon

Joined: Tue Feb 22, 2011 6:34 pm
Posts: 2654
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


Top
   
PostPosted: Sun Nov 19, 2017 1:54 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Thu Jul 02, 2015 8:05 am
Posts: 145
Location: Czech Republic
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 :)
Attachment:
prejezd.JPG
prejezd.JPG [ 97.23 KiB | Viewed 663 times ]

_________________
Image


Top
   
PostPosted: Sun Nov 19, 2017 4:48 pm 
Offline
Director
Director
User avatar

Joined: Mon Apr 17, 2017 4:52 pm
Posts: 627
Location: Western Ile-de-France Region
No problem, always happy to help where I can


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2018 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2018.
Hosted by Zernebok Hosting.