aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD G Turner2019-11-24 01:41:14 +0000
committerD G Turner2019-11-24 01:41:14 +0000
commit8014fe06fcf9386d98daa49418e3596bd2baa5a6 (patch)
tree5430118fb56e3b71729195f8251123ed64da58de
parent735db39ad93b9865c0c4486299c2fd50022344f7 (diff)
downloadscummvm-rg350-8014fe06fcf9386d98daa49418e3596bd2baa5a6.tar.gz
scummvm-rg350-8014fe06fcf9386d98daa49418e3596bd2baa5a6.tar.bz2
scummvm-rg350-8014fe06fcf9386d98daa49418e3596bd2baa5a6.zip
LINUXMOTO: Implement horizontal shake
-rw-r--r--backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp30
1 files changed, 25 insertions, 5 deletions
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
index 4e64060992..b0837db2c6 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
@@ -196,6 +196,7 @@ void LinuxmotoSdlGraphicsManager::drawMouse() {
// scaling, shake position and aspect ratio correction manually.
if (!_overlayVisible) {
+ dst.x += _currentShakeXOffset;
dst.y += _currentShakeYOffset;
}
@@ -248,6 +249,19 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() {
#endif
// If the shake position changed, fill the dirty area with blackness
+ if (_currentShakeXOffset != _gameScreenShakeXOffset ||
+ (_cursorNeedsRedraw && _mouseBackup.x <= _currentShakeXOffset)) {
+ SDL_Rect blackrect = {0, 0, (Uint16)(_gameScreenShakeXOffset * _videoMode.scaleFactor), (Uint16)(_videoMode.screenHeight * _videoMode.scaleFactor)};
+
+ if (_videoMode.aspectRatioCorrection && !_overlayVisible)
+ blackrect.h = real2Aspect(blackrect.h - 1) + 1;
+
+ SDL_FillRect(_hwScreen, &blackrect, 0);
+
+ _currentShakeXOffset = _gameScreenShakeXOffset;
+
+ _forceFull = true;
+ }
if (_currentShakeYOffset != _gameScreenShakeYOffset ||
(_cursorNeedsRedraw && _mouseBackup.y <= _currentShakeYOffset)) {
SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_gameScreenShakeYOffset * _videoMode.scaleFactor)};
@@ -333,13 +347,17 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() {
for (r = _dirtyRectList; r != lastRect; ++r) {
int dst_y = r->y + _currentShakeYOffset;
int dst_h = 0;
- int dst_w = r->w;
+ int dst_w = 0;
int orig_dst_y = 0;
- int dst_x = r->x;
+ int dst_x = r->x + _currentShakeXOffset;
int src_y;
int src_x;
- if (dst_y < height) {
+ if (dst_x < width && dst_y < height) {
+ dst_w = r->w;
+ if (dst_w > width - dst_x)
+ dst_w = width - dst_x;
+
dst_h = r->h;
if (dst_h > height - dst_y)
dst_h = height - dst_y;
@@ -378,10 +396,10 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() {
}
if (_videoMode.mode == GFX_HALF && scalerProc == DownscaleAllByHalf) {
- r->w = r->w / 2;
+ r->w = dst_w / 2;
r->h = dst_h / 2;
} else {
- r->w = r->w;
+ r->w = dst_w;
r->h = dst_h;
}
@@ -399,7 +417,9 @@ void LinuxmotoSdlGraphicsManager::internUpdateScreen() {
// Readjust the dirty rect list in case we are doing a full update.
// This is necessary if shaking is active.
if (_forceRedraw) {
+ _dirtyRectList[0].x = 0;
_dirtyRectList[0].y = 0;
+ _dirtyRectList[0].w = (_videoMode.mode == GFX_HALF) ? _videoMode.hardwareWidth / 2 : _videoMode.hardwareWidth;
_dirtyRectList[0].h = (_videoMode.mode == GFX_HALF) ? _videoMode.hardwareHeight / 2 : _videoMode.hardwareHeight;
}