OpenTTD

Tasklist

FS#6315 - Advanced Fences: (with patch)

Attached to Project: OpenTTD
Opened by Ivan Piskovoy (pi1985) - Monday, 08 June 2015, 15:32 GMT
Last edited by andythenorth (andythenorth) - Friday, 01 September 2017, 08:21 GMT
Type Patch
Category Core
Status New
Assigned To No-one
Operating System All
Severity Medium
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Is it a bug or a feature? In grass tiles rails drawn with fences, but in snowed or desert tiles without them.
This patch solve this. Also it add bit ADVANCED_FENCES for use for drawing 32 spritres: 16 for grass and desert tiles and 16 for snowed ones (8 tiles for front and 8 for back of the fence).
Used trunk r27261.
This task depends upon

Comment by frosch (frosch) - Monday, 08 June 2015, 17:13 GMT
Adding a flag for also drawing fences on snow is fine.
But the snowy fence should not use new offsets. The GRF can check itself for snow and various other things.
Comment by George (George) - Tuesday, 09 June 2015, 10:34 GMT
Do you mean graphics? Snowed graphics may be, for example, 1 px higher.
Or what offsets did you mean?
https://dev.openttdcoop.org/projects/sprite-tests/repository/revisions/5962aed2dc5e
Comment by George (George) - Tuesday, 09 June 2015, 10:35 GMT
How do you intend a GRF should provide different graphics it snow?
Comment by Ivan Piskovoy (pi1985) - Tuesday, 09 June 2015, 15:11 GMT
You maybe mean that this sprites should be in different sprites group (RTSG_FENCES_FRONT, RTSG_FENCES_BACK for example) with same indexes?
And GRF should detect snowed tile and return different base image (if this is possible at all)?
Comment by frosch (frosch) - Tuesday, 09 June 2015, 17:22 GMT
Railtype GRFs draw snowy tracks, underlays and depots using the "terrain_type" variable. For example swedish rails: https://dev.openttdcoop.org/projects/swedishrails/repository/entry/src/railtypes.pnml#L19

Drawing fences should be no different, so there is no need for RFO_XXX_SNOW_YYY. It only needs a flag for considering drawing them in the first place.

I notice, the patch also adds another thing, which you call XXX_TWO_YYY. This looks like you add fences for more orientations. Enabling this could also be done by extending GetCustomRailSprite to return the number of sprites in the set (group->GetNumResults). Compare it with vehicles, which can also provide either 4 or 8 sprites. It does not need a flag for enabling. (Though if it would need one, it should be separate from "draw on snow".)
Comment by George (George) - Tuesday, 09 June 2015, 19:24 GMT
I do not see tile height variable here http://newgrf-specs.tt-wiki.net/wiki/NML:Railtypes#Railtype_variables, like nearby_tile_height for houses
Comment by George (George) - Tuesday, 09 June 2015, 19:27 GMT
Also, I can't understand how can GRF recognize the railway side (XXX_TWO_YYY)
I suppose you could provide some explaining based on https://dev.openttdcoop.org/projects/sprite-tests/repository/revisions/b2a3cc8bfea7 for example
because I used townzone instead of terrain_type and I can't make it work
Comment by Ingo von Borstel (planetmaker) - Wednesday, 10 June 2015, 07:07 GMT
You don't need height information. terrain_type gives you the indication by means of TILETYPE_SNOW on when to draw snow and when not.
Comment by George (George) - Wednesday, 10 June 2015, 08:09 GMT
I need it, because I want to provide several levels of snow - "a little snow", "some snow", "much snow" and "fully snowed"
Comment by Ivan Piskovoy (pi1985) - Thursday, 11 June 2015, 18:59 GMT
Patch update.
Comment by frosch (frosch) - Sunday, 26 July 2015, 12:57 GMT
The 16 sprite version has been implemented in r27343.

The fences-on-snow needs more work:
- Currently the code to decide which fences to draw is duplicated between DrawTrackDetails and TileLoop_Track in the patch.
- Fences are placed instantly above snow, but not below snow.
- Fences do not work on half-snow tiles.

Probably this needs reshuffling of the RailGroundType enum. There are 5 different ground types, with up to 4 fence combinations. However, not all combinations are possible, so 4 bits would still suffice:
0 barren, no fence
1 grass, no fence
2 grass, fence 1
3 grass, fence 2
4 grass, fence 1 and 2
5 snow/desert, no fence
6 snow/deset, fence 1
7 snow/deset, fence 2
8 snow/deset, fence 1 and2
9 half-snow, no fence
10 half-snow, fence
11 water, no fence
12 water, fence
13-15 unused
Comment by Ivan Piskovoy (pi1985) - Tuesday, 29 September 2015, 16:46 GMT
Here is remake fences in snow patch.
Comment by Ivan Piskovoy (pi1985) - Tuesday, 29 September 2015, 18:16 GMT
Here is remake fences in snow patch.
Comment by George (George) - Sunday, 22 November 2015, 09:07 GMT
Any progress on the adding the patch to the trunk?

Loading...