From 5c855a0a5a71ca17dae6015ea0676fc2e2c4f249 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Fri, 1 Dec 2017 11:41:49 -0600 Subject: BACKENDS: Fix shake position getting stuck If a game is doing a screen shake (for example, DOTT when the stereo is on), and the user does an RTL, the screen shake offset may get stuck if the engine does not reset it on shutdown. To avoid this in all cases, just always reset the screen shake whenever the graphics manager is told to switch to a new graphics mode. --- backends/graphics/opengl/opengl-graphics.cpp | 1 + backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 2 ++ 2 files changed, 3 insertions(+) (limited to 'backends') diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 7bac4c85cb..7d29a81f12 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -342,6 +342,7 @@ void OpenGLGraphicsManager::initSize(uint width, uint height, const Graphics::Pi _currentState.gameWidth = width; _currentState.gameHeight = height; + _gameScreenShakeOffset = 0; } int16 OpenGLGraphicsManager::getWidth() const { diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index c2e0fd20e4..6e8561321b 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -748,6 +748,8 @@ bool SurfaceSdlGraphicsManager::setShader(int id) { void SurfaceSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) { assert(_transactionMode == kTransactionActive); + _newShakePos = 0; + #ifdef USE_RGB_COLOR //avoid redundant format changes Graphics::PixelFormat newFormat; -- cgit v1.2.3