ZDoom / gzdoom

GZDoom is a feature centric port for all Doom engine games, based on ZDoom, adding an OpenGL renderer and powerful scripting capabilities
http://zdoom.org
GNU General Public License v3.0
2.53k stars 550 forks source link

[BUG] The floor/ceiling texture scrolling direction is transformed erroneously when texture is rotated(angle not 0). #2284

Open aletheos opened 11 months ago

aletheos commented 11 months ago

GZDoom version

GZDoom 4.11.3

Which game are you running with GZDoom?

Doom 2

What Operating System are you using?

Windows 10

Please describe your specific OS version

No response

Relevant hardware info

No response

Have you checked that no other similar issue already exists?

A clear and concise description of what the bug is.

TL;DR Flip the sign(remove the minus) @ gzdoom/src/playsim/mapthinkers/a_scroll.cpp:129 and/or make a compat flag to preserve the old behaviour in case there are maps that rely on it.

Line action 223: Scroll floor(UDMF) seems to yield unexpected results when the floor texture rotation is non-zero. I believe this is in error because there is a mismatch between the scrolling directions of textures and the directions things are carried, when the textures are rotated. I made a test map with a ring of scrolling textures, trying to see a pattern in order to figure out exactly how far off the transformation was from what I had intended. 1 degree rotation seems to scroll almost but not quite 180 degrees backwards(179?). 90 and 270 degrees rotation scrolls in the expected directions. 180 degrees rotation scrolls backwards. And in-between angles go more or less toward being perpendicular to the expected scroll directions.

map: ale_scrolltest.zip video: https://youtu.be/iqGumI6CgWY

I looked through the code base, and believe I've found the relevant function: RotationComp (gzdoom/src/playsim/mapthinkers/a_scroll.cpp:119-134)

I then made this demonstration in desmos, and I believe it shows both the problem and a solution. https://www.desmos.com/calculator/9dja13abyz

Steps to reproduce the behaviour.

  1. Make a scrolling floor(or ceiling) using line actions 223(or 224).
  2. Rotate the floor(or ceiling) texture(s).

Your configuration

No response

Provide a Log

No response

aletheos commented 11 months ago

When looking at the code again today the line numbers are different. Apparently the line is 132, not 129, but blame doesn't show any changes. I guess I must have been looking at another branch than master?