diff --git a/Sources/Jazz2/LevelHandler.cpp b/Sources/Jazz2/LevelHandler.cpp index 8e7935b1..9d3597f1 100644 --- a/Sources/Jazz2/LevelHandler.cpp +++ b/Sources/Jazz2/LevelHandler.cpp @@ -1572,10 +1572,6 @@ namespace Jazz2 Vector2f focusPos = targetObj->_pos; Vector2f focusSpeed = targetObj->_speed; - Vector2f focusDiff = focusPos - _cameraLastPos; - _cameraDiff.X = lerpByTime(_cameraDiff.X, focusDiff.X, 0.8f, timeMult); - _cameraDiff.Y = lerpByTime(_cameraDiff.Y, focusDiff.Y, 0.8f, timeMult); - _cameraLastPos = focusPos; _cameraDistanceFactor.X = lerpByTime(_cameraDistanceFactor.X, focusSpeed.X * 8.0f, (std::abs(focusSpeed.X) < 2.0f ? SlowRatioX : FastRatioX), timeMult); @@ -1595,7 +1591,7 @@ namespace Jazz2 // Clamp camera position to level bounds if (_viewBounds.W > halfView.X * 2) { - _cameraPos.X = std::clamp(_cameraLastPos.X + _cameraDistanceFactor.X - _cameraDiff.X, _viewBounds.X + halfView.X, _viewBounds.X + _viewBounds.W - halfView.X) + _shakeOffset.X; + _cameraPos.X = std::clamp(_cameraLastPos.X + _cameraDistanceFactor.X, _viewBounds.X + halfView.X, _viewBounds.X + _viewBounds.W - halfView.X) + _shakeOffset.X; if (!PreferencesCache::UnalignedViewport || std::abs(_cameraDistanceFactor.X) < 1.0f) { _cameraPos.X = std::floor(_cameraPos.X); } @@ -1603,7 +1599,7 @@ namespace Jazz2 _cameraPos.X = std::floor(_viewBounds.X + _viewBounds.W * 0.5f + _shakeOffset.X); } if (_viewBounds.H > halfView.Y * 2) { - _cameraPos.Y = std::clamp(_cameraLastPos.Y + _cameraDistanceFactor.Y - _cameraDiff.Y, _viewBounds.Y + halfView.Y - 1.0f, _viewBounds.Y + _viewBounds.H - halfView.Y - 2.0f) + _shakeOffset.Y; + _cameraPos.Y = std::clamp(_cameraLastPos.Y + _cameraDistanceFactor.Y, _viewBounds.Y + halfView.Y - 1.0f, _viewBounds.Y + _viewBounds.H - halfView.Y - 2.0f) + _shakeOffset.Y; if (!PreferencesCache::UnalignedViewport || std::abs(_cameraDistanceFactor.Y) < 1.0f) { _cameraPos.Y = std::floor(_cameraPos.Y); } diff --git a/Sources/Jazz2/LevelHandler.h b/Sources/Jazz2/LevelHandler.h index b54fab98..c2492578 100644 --- a/Sources/Jazz2/LevelHandler.h +++ b/Sources/Jazz2/LevelHandler.h @@ -297,7 +297,6 @@ namespace Jazz2 Vector2f _cameraPos; Vector2f _cameraLastPos; Vector2f _cameraDistanceFactor; - Vector2f _cameraDiff; float _shakeDuration; Vector2f _shakeOffset; float _waterLevel;