1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-01-24 17:26:41 +00:00

Fix parallax horizontal flip rotation bug, but now maps are wrong

Unfortunatelx maps were designed with this bug present,
and now tile rotation on parallax layers is wrong for flipped tiles.
This also affected background fish swarms and anything that
was on a parallax layer and flipped horizontally.
Need to fix maps next...

See also: commit 76ba2b1211
This commit is contained in:
fgenesis 2023-07-03 18:53:55 +02:00
parent 9d7dbe5435
commit 4b52730be2

View file

@ -448,18 +448,6 @@ void RenderObject::renderCall(const RenderState& rs, const Vector& renderAt, flo
Vector pos = getFollowCameraPosition(); Vector pos = getFollowCameraPosition();
glTranslatef(pos.x, pos.y, pos.z); glTranslatef(pos.x, pos.y, pos.z);
} }
// FIXME: this is the reason why flipped tiles on parallax layers rotate in the wrong direction!
// Unfortunately the maps were built with this in mind, so before this can be taken out
// and replaced with the correct version (below), the rotation needs to be fixed up somehow.
// Not sure yet how to do this. Fix maps on load?
// Add a map flag "hasCorrectParallaxRotation" and an editor feature to rotate tiles and set this flag?
// Probably want editor compatibility with old versions so the incorrect behavior
// needs to be the default if nothing is specified.
// What a mess. Sigh. -- FG
if (isfh())
glRotatef(180, 0, 1, 0);
glRotatef(renderRotation, 0, 0, 1);
} }
else else
{ {
@ -470,13 +458,13 @@ nofollow:
if (RenderObject::renderPaths) // TODO: move this to debug render if (RenderObject::renderPaths) // TODO: move this to debug render
debugRenderPaths(); debugRenderPaths();
// This is the correct way to rotate things.
glRotatef(renderRotation, 0, 0, 1);
if (isfh())
glRotatef(180, 0, 1, 0);
} }
// Apply rotation and flip
glRotatef(renderRotation, 0, 0, 1);
if (isfh())
glRotatef(180, 0, 1, 0);
glTranslatef(beforeScaleOffset.x, beforeScaleOffset.y, beforeScaleOffset.z); glTranslatef(beforeScaleOffset.x, beforeScaleOffset.y, beforeScaleOffset.z);
const Vector renderScale = scale * rs.scale; const Vector renderScale = scale * rs.scale;
glScalef(renderScale.x, renderScale.y, 1); glScalef(renderScale.x, renderScale.y, 1);