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

[Bug]: Child sprites with zero offset and identical size to their parent can be misaligned from their parent #12289

Open
zephyris opened this issue Mar 12, 2024 · 0 comments
Labels
needs triage This issue needs further investigation before it becomes actionable

Comments

@zephyris
Copy link
Contributor

zephyris commented Mar 12, 2024

Version of OpenTTD

14.0-RC1

Expected result

A child sprite with zero offset and an identical size to the parent sprite (I'm using the example of station roofs and the transparency effect sprite) should be exactly aligned with their parent at all zoom levels.
image

Actual result

Misalignment can occur. I'm not sure what causes this issue, but I've seen it at 4x zoom.
image

For this example, the roof sprite (in nml) is:
[ 196*z+x*z, 66*z+y*z, 64*z, 64*z+z-1, -31*z, -16*z-int((z-1)/2)-1, NOCROP]
The child sprite with the darken/transparency effect recolour is:
[ 261*z+x*z, 66*z+y*z, 64*z, 64*z+z-1, 0, 0, NOCROP]

Here, x and y are the position within the sprite sheet and z is the zoom.

Both are (w, h) = (64*z, 64*z+z-1). The child sprite has offsets (xoffs, yoffs) = (0, 0).

The child sprite is drawn 2px too high.

Steps to reproduce

  1. Load the attached NewGRF (called "stationbug.grf", listed with the name "Test").
  2. Build a maglev station and look at the roof at 4x zoom.
    stationbug.zip
@2TallTyler 2TallTyler added the needs triage This issue needs further investigation before it becomes actionable label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue needs further investigation before it becomes actionable
Projects
None yet
Development

No branches or pull requests

2 participants