From 8b0ccf6667e0ddaba0fae6ad6f2ddc5a1d6bc680 Mon Sep 17 00:00:00 2001 From: immibis Date: Sat, 5 Aug 2017 19:54:13 +1200 Subject: [PATCH] Fix horizontal scrolling of background images. --- src/graphics/engine/engine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/graphics/engine/engine.cpp b/src/graphics/engine/engine.cpp index a6d21cd2..74c6179d 100644 --- a/src/graphics/engine/engine.cpp +++ b/src/graphics/engine/engine.cpp @@ -4741,8 +4741,9 @@ void CEngine::DrawBackgroundImage() if (a > Math::PI/4.0f) a = Math::PI/4.0f; if (a < -Math::PI/4.0f) a = -Math::PI/4.0f; - u1 = -m_eyeDirH/Math::PI; - u2 = u1+1.0f/Math::PI; + // Note the background covers Math::PI radians, i.e. it repeats twice per rotation! + u1 = (-m_eyeDirH - GetHFovAngle()/2.0f) / Math::PI; + u2 = u1 + (GetHFovAngle() / Math::PI); v1 = (1.0f-h)*(0.5f+a/(2.0f*Math::PI/4.0f))+0.1f; v2 = v1+h;