Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Road and Tramway Catenary Drawn Incorrectly / Unsorted #8647

Closed
supermop opened this issue Feb 5, 2021 · 3 comments
Closed

Road and Tramway Catenary Drawn Incorrectly / Unsorted #8647

supermop opened this issue Feb 5, 2021 · 3 comments
Labels
bug Something isn't working component: NewGRF This issue is related to NewGRFs

Comments

@supermop
Copy link

supermop commented Feb 5, 2021

Version of OpenTTD

1.10.3

Expected result

"Rear" Catenary sprites are drawn behind other items, such as vehicles.

Actual result

The rear sprites are drawn over any vehicle on the tile, leading to poles, etc. appearing over the vehicle. As Road/tram catenary has no means of defining a bounding box size or position, there is no means the draw the sprites in the correct order.

pole
pole boxes

Providing for bounding boxes, or forcing the "rear" sprite to always be under all others would fix this.

Steps to reproduce

  1. Build a default tramway, or use an NRT NewGRF to build a road or tramway that has overhead catenary.
  2. Run any road vehicle along the far lane of the road.
  3. When the vehicle passes in front of part of the catenary (pole etc), the catenary sprite is visible over the vehicle sprite.
@LordAro LordAro added bug Something isn't working component: NewGRF This issue is related to NewGRFs labels Feb 13, 2021
@supermop
Copy link
Author

Maybe it would be most expedient to just ignore bounding boxes and force all catenary_back sprites to be drawn under any vehicles?

@LordAro LordAro added this to the 1.11.0 milestone Feb 28, 2021
@TrueBrain
Copy link
Member

As a reminder to who-ever picks this up: some GRFs, like CZTR TRAM SET draw the catenary from both sides.

@TrueBrain
Copy link
Member

TrueBrain commented Mar 10, 2021

I gave it a spin to fix, as can been seen by the above PR, but .. I found out that there are some .. special choices made for trams :) Basically, some sprites in OpenGFX have pylons on both sides of the track. In general, for isometric games, if you have a single sprite that has to go both over and under another sprite, there is no correct way of sorting that. Unless OpenTTD has tricks up its sleeve to deal with these situations (my knowledge about this is severely lacking, so I hope someone else can fill in that gap), there is no answer to this problem.

So I am afraid you will have to deal with this problem a bit longer ... sorry :(

Edit: okay, gathered more information. Turns out the idea is that the back sprite draws the pylons, but the front sprite does this again for the pylons in the front. This is currently not done in OpenGFX, which was confusing me. It is fine that the back sprite has the pylon too, of course, but the front sprite should at least have it. Otherwise it is indeed an impossible situation for sorting .. but if the idea is that both have them, nothing is wrong here. It is just that OpenGFX got it wrong.
The tramtracks.png in our source tree does seem to get it right, so there is that.

@TrueBrain TrueBrain removed this from the 1.11.0 milestone Mar 10, 2021
frosch123 added a commit to frosch123/OpenTTD that referenced this issue Mar 10, 2021
The back sprite is now supposed to contain west, north and east pillars.
The front sprite is supposed to contain the south pillar and the wires.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working component: NewGRF This issue is related to NewGRFs
Projects
None yet
3 participants