From 4b52730be253dbfce9bea6f604c772a87da104e3 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 3 Jul 2023 18:53:55 +0200 Subject: [PATCH] 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 76ba2b12116d9cfee190c90f313633b447a6b61d --- BBGE/RenderObject.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/BBGE/RenderObject.cpp b/BBGE/RenderObject.cpp index cdf96af..aebd0d6 100644 --- a/BBGE/RenderObject.cpp +++ b/BBGE/RenderObject.cpp @@ -448,18 +448,6 @@ void RenderObject::renderCall(const RenderState& rs, const Vector& renderAt, flo Vector pos = getFollowCameraPosition(); 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 { @@ -470,13 +458,13 @@ nofollow: if (RenderObject::renderPaths) // TODO: move this to debug render 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); const Vector renderScale = scale * rs.scale; glScalef(renderScale.x, renderScale.y, 1);