Garlic_Bread42 wrote: 02 Oct 2022 09:32
Thanks for your bug report - i've had a brief look into it and i'm quite sure this can't be solved. The long engines are 3-part articulated vehicles, where the sprite itself is drawn in the middle vehicle.
It's fixable for most of the cases on straight track, but the method for doing so is one of those brain-bending "you did WHAT???" hacks which you set up and then hope never to touch again. So also a call on whether fewer graphical glitches are worth the effort
When the vehicle is running "straight" it can be split into three sprites, one for the front, middle and rear of the long articulated vehicle. If the alignments are set up correctly this works, as each part of the vehicle remains in the same relative position, and now because you have three sprites corresponding to the correct size and location for their bounding box the sprite sorter can handle it.
Of course, when you go into a corner or up/down a hill the relative positions of each sub-vehicle change, so in this situation you need to detect it (using the variables for relative vehicle corner state, and z offset) and then switch to the appropriate "long" sprite. This means you can still get the graphical glitches entering and leaving corners, but as there are fewer situations where an item needs to be sorted "in front" of a corner and is in a marginal place this is far less noticeable.
If you're using GoRender there are some built-in tools to help with producing the sprites,
https://github.com/mattkimber/timberwol ... _long.tmpl may be of interest for how the switching works and
https://github.com/mattkimber/timberwol ... tions.json for the GoRender settings. (The relevant config file entry is
slice if I remember, there might be some others needed to tell it exactly where to slice sprites)