OPENGL: Vertical position of cursor during screen shake appears to be miscalculated
|Reported by:||AndywinXp||Owned by:||lephilousophe|
|Version:||Keywords:||cursor screen shake|
|Cc:||Game:||Day of the Tentacle|
Description (last modified by )
How to reproduce:
Start up Day Of The Tentacle, go to Green Tentacle's room and turn on the stereo. The screen should begin shaking. Or just load the savegame I attached :-)
What should happen:
The cursor should stay visible during the screen effect.
What happens instead:
During the screen shake effect, whenever the screen position is different from the origin one (0, 0), the cursor coordinates get recalculated to send the cursor texture elsewhere (out of bounds), effectively making the cursor invisible during the shake frames, producing a flicker effect.
This seems to be a regression produced by this commit and apparently it only affects the OpenGL backend: https://github.com/scummvm/scummvm/commit/87bad2cc7d602488ba3fbdf8ff067d3d74fc2b85
In particular, in the following function:
the responsible line for the offset recalculation seems to be the following:
_shakeOffsetScaled = Common::Point( _gameScreenShakeXOffset * _gameDrawRect.width() / _currentState.gameWidth, _gameScreenShakeYOffset * _gameDrawRect.height() / _currentState.gameHeight );
_shakeOffsetScaled is calculated. The result of this calculation will then be used in
OpenGLGraphicsManager::updateScreen() to calculate the position of the cursor texture:
_pipeline->drawTexture(_cursor->getGLTexture(), _cursorX - _cursorHotspotXScaled + _shakeOffsetScaled.x, _cursorY - _cursorHotspotYScaled + _shakeOffsetScaled.y, _cursorWidthScaled, _cursorHeightScaled );
When debugging the issue I noticed that (for the case at hand, DOTT, which shakes the screen vertically only), the
y component of
_shakeOffsetScaled contained garbage values (e.g. -20990) when the screen Y offset was not zero.
Just for the sake of it, when calculating
_shakeOffsetScaled I tried substituting
1, and the cursor worked properly. Of course that's not the correct solution to the issue, but I hope that this can be helpful for resolving it.
I'll attach a DOTT savegame for that particular scene, in which the screen is already shaking.