aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsluicebox2019-11-15 01:38:21 -0800
committerEugene Sandulenko2019-11-19 00:20:40 +0100
commitb8390fa161c0c324af0e52a4f3a740cca9e9a479 (patch)
treee88f1e7cbb2c35c1b1c3319c9481c4edafca734d
parent3238e523ee2ac442c7562830a85b347400b7da88 (diff)
downloadscummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.gz
scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.bz2
scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.zip
GRAPHICS: Add interface for horizontal shake
-rw-r--r--backends/graphics/graphics.h2
-rw-r--r--backends/graphics/null/null-graphics.h2
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp3
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp19
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.h3
-rw-r--r--backends/graphics/windowed.h21
-rw-r--r--backends/modular-backend.cpp4
-rw-r--r--backends/modular-backend.h2
-rw-r--r--backends/platform/3ds/osystem-graphics.cpp9
-rw-r--r--backends/platform/3ds/osystem.h5
-rw-r--r--backends/platform/dc/dc.h4
-rw-r--r--backends/platform/dc/dcmain.cpp2
-rw-r--r--backends/platform/dc/display.cpp7
-rw-r--r--backends/platform/ds/arm9/source/dsmain.cpp14
-rw-r--r--backends/platform/ds/arm9/source/dsmain.h2
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.cpp4
-rw-r--r--backends/platform/ds/arm9/source/osystem_ds.h2
-rw-r--r--backends/platform/ios7/ios7_common.h6
-rw-r--r--backends/platform/ios7/ios7_osys_main.h2
-rw-r--r--backends/platform/ios7/ios7_osys_video.mm10
-rw-r--r--backends/platform/ios7/ios7_video.h3
-rw-r--r--backends/platform/ios7/ios7_video.mm11
-rw-r--r--backends/platform/iphone/iphone_common.h6
-rw-r--r--backends/platform/iphone/iphone_video.h3
-rw-r--r--backends/platform/iphone/iphone_video.mm13
-rw-r--r--backends/platform/iphone/osys_main.h2
-rw-r--r--backends/platform/iphone/osys_video.mm10
-rw-r--r--backends/platform/n64/osys_n64.h5
-rw-r--r--backends/platform/n64/osys_n64_base.cpp22
-rw-r--r--backends/platform/ps2/Gs2dScreen.cpp11
-rw-r--r--backends/platform/ps2/Gs2dScreen.h5
-rw-r--r--backends/platform/ps2/systemps2.cpp4
-rw-r--r--backends/platform/ps2/systemps2.h2
-rw-r--r--backends/platform/psp/default_display_client.cpp7
-rw-r--r--backends/platform/psp/default_display_client.h7
-rw-r--r--backends/platform/psp/osys_psp.cpp4
-rw-r--r--backends/platform/psp/osys_psp.h2
-rw-r--r--backends/platform/wii/osystem.h2
-rw-r--r--backends/platform/wii/osystem_gfx.cpp4
-rw-r--r--common/system.h8
-rw-r--r--engines/dreamweb/dreamweb.h2
-rw-r--r--engines/kyra/graphics/screen.cpp4
-rw-r--r--engines/queen/display.cpp2
-rw-r--r--engines/sci/graphics/frameout.cpp4
-rw-r--r--engines/sci/graphics/screen.cpp10
-rw-r--r--engines/sci/graphics/screen.h2
-rw-r--r--engines/scumm/gfx.cpp6
-rw-r--r--engines/scumm/saveload.cpp2
-rw-r--r--engines/supernova/game-manager.cpp4
-rw-r--r--engines/teenagent/scene.cpp8
-rw-r--r--engines/testbed/graphics.cpp8
-rw-r--r--engines/toltecs/screen.cpp4
52 files changed, 173 insertions, 137 deletions
diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index e7be2369ed..df4fb6a9e2 100644
--- a/backends/graphics/graphics.h
+++ b/backends/graphics/graphics.h
@@ -81,7 +81,7 @@ public:
virtual void unlockScreen() = 0;
virtual void fillScreen(uint32 col) = 0;
virtual void updateScreen() = 0;
- virtual void setShakePos(int shakeOffset) = 0;
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset) = 0;
virtual void setFocusRectangle(const Common::Rect& rect) = 0;
virtual void clearFocusRectangle() = 0;
diff --git a/backends/graphics/null/null-graphics.h b/backends/graphics/null/null-graphics.h
index 4c628568ff..3972904578 100644
--- a/backends/graphics/null/null-graphics.h
+++ b/backends/graphics/null/null-graphics.h
@@ -63,7 +63,7 @@ public:
void unlockScreen() override {}
void fillScreen(uint32 col) override {}
void updateScreen() override {}
- void setShakePos(int shakeOffset) override {}
+ void setShakePos(int shakeXOffset, int shakeYOffset) override {}
void setFocusRectangle(const Common::Rect& rect) override {}
void clearFocusRectangle() override {}
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index f40b84c2bf..a01047e268 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -436,7 +436,8 @@ void OpenGLGraphicsManager::initSize(uint width, uint height, const Graphics::Pi
_currentState.gameWidth = width;
_currentState.gameHeight = height;
- _gameScreenShakeOffset = 0;
+ _gameScreenShakeXOffset = 0;
+ _gameScreenShakeYOffset = 0;
}
int16 OpenGLGraphicsManager::getWidth() const {
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 92540d93f7..95c7ddc918 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -158,7 +158,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou
_scalerProc(0), _screenChangeCount(0),
_mouseData(nullptr), _mouseSurface(nullptr),
_mouseOrigSurface(nullptr), _cursorDontScale(false), _cursorPaletteDisabled(true),
- _currentShakePos(0),
+ _currentShakeXOffset(0), _currentShakeYOffset(0),
_paletteDirtyStart(0), _paletteDirtyEnd(0),
_screenIsLocked(false),
_graphicsMutex(0),
@@ -822,7 +822,8 @@ int SurfaceSdlGraphicsManager::getStretchMode() const {
void SurfaceSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
assert(_transactionMode == kTransactionActive);
- _gameScreenShakeOffset = 0;
+ _gameScreenShakeXOffset = 0;
+ _gameScreenShakeYOffset = 0;
#ifdef USE_RGB_COLOR
//avoid redundant format changes
@@ -1206,16 +1207,16 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
// If the shake position changed, fill the dirty area with blackness
// When building with SDL2, the shake offset is added to the active rect instead,
// so this isn't needed there.
- if (_currentShakePos != _gameScreenShakeOffset ||
- (_cursorNeedsRedraw && _mouseBackup.y <= _currentShakePos)) {
- SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_gameScreenShakeOffset * _videoMode.scaleFactor)};
+ if (_currentShakeYOffset != _gameScreenShakeYOffset ||
+ (_cursorNeedsRedraw && _mouseBackup.y <= _currentShakeYOffset)) {
+ SDL_Rect blackrect = {0, 0, (Uint16)(_videoMode.screenWidth * _videoMode.scaleFactor), (Uint16)(_gameScreenShakeYOffset * _videoMode.scaleFactor)};
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
blackrect.h = real2Aspect(blackrect.h - 1) + 1;
SDL_FillRect(_hwScreen, &blackrect, 0);
- _currentShakePos = _gameScreenShakeOffset;
+ _currentShakeYOffset = _gameScreenShakeYOffset;
_forceRedraw = true;
}
@@ -1293,7 +1294,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
dstPitch = _hwScreen->pitch;
for (r = _dirtyRectList; r != lastRect; ++r) {
- int dst_y = r->y + _currentShakePos;
+ int dst_y = r->y + _currentShakeYOffset;
int dst_h = 0;
#ifdef USE_SCALERS
int orig_dst_y = 0;
@@ -1349,7 +1350,7 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() {
// Of course when the overlay is visible we do not show it, since it is only for game
// specific focus.
if (_enableFocusRect && !_overlayVisible) {
- int y = _focusRect.top + _currentShakePos;
+ int y = _focusRect.top + _currentShakeYOffset;
int h = 0;
int x = _focusRect.left * scale1;
int w = _focusRect.width() * scale1;
@@ -2276,7 +2277,7 @@ void SurfaceSdlGraphicsManager::drawMouse() {
// We draw the pre-scaled cursor image, so now we need to adjust for
// scaling, shake position and aspect ratio correction manually.
- dst.y += _currentShakePos;
+ dst.y += _currentShakeYOffset;
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
dst.y = real2Aspect(dst.y);
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index a51aa22e9b..6b8ae36b87 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -387,7 +387,8 @@ protected:
// Shake mode
// This is always set to 0 when building with SDL2.
- int _currentShakePos;
+ int _currentShakeXOffset;
+ int _currentShakeYOffset;
// Palette data
SDL_Color *_currentPalette;
diff --git a/backends/graphics/windowed.h b/backends/graphics/windowed.h
index 549739d987..7d9198d6b8 100644
--- a/backends/graphics/windowed.h
+++ b/backends/graphics/windowed.h
@@ -44,7 +44,8 @@ public:
_windowWidth(0),
_windowHeight(0),
_overlayVisible(false),
- _gameScreenShakeOffset(0),
+ _gameScreenShakeXOffset(0),
+ _gameScreenShakeYOffset(0),
_forceRedraw(false),
_cursorVisible(false),
_cursorX(0),
@@ -76,9 +77,10 @@ public:
_forceRedraw = true;
}
- virtual void setShakePos(int shakeOffset) override {
- if (_gameScreenShakeOffset != shakeOffset) {
- _gameScreenShakeOffset = shakeOffset;
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset) override {
+ if (_gameScreenShakeXOffset != shakeXOffset || _gameScreenShakeYOffset != shakeYOffset) {
+ _gameScreenShakeXOffset = shakeXOffset;
+ _gameScreenShakeYOffset = shakeYOffset;
recalculateDisplayAreas();
_cursorNeedsRedraw = true;
}
@@ -291,9 +293,14 @@ protected:
bool _overlayVisible;
/**
- * The offset by which the screen is moved vertically.
+ * The offset by which the screen is moved horizontally.
*/
- int _gameScreenShakeOffset;
+ int _gameScreenShakeXOffset;
+
+ /**
+ * The offset by which the screen is moved vertically.
+ */
+ int _gameScreenShakeYOffset;
/**
* The scaled draw rectangle for the game surface within the window.
@@ -400,7 +407,7 @@ private:
}
drawRect.left = ((_windowWidth - width) / 2);
- drawRect.top = ((_windowHeight - height) / 2) + _gameScreenShakeOffset;
+ drawRect.top = ((_windowHeight - height) / 2) + _gameScreenShakeYOffset;
drawRect.setWidth(width);
drawRect.setHeight(height);
}
diff --git a/backends/modular-backend.cpp b/backends/modular-backend.cpp
index 2c6aaba5a8..a06448d4d2 100644
--- a/backends/modular-backend.cpp
+++ b/backends/modular-backend.cpp
@@ -185,8 +185,8 @@ void ModularBackend::updateScreen() {
#endif
}
-void ModularBackend::setShakePos(int shakeOffset) {
- _graphicsManager->setShakePos(shakeOffset);
+void ModularBackend::setShakePos(int shakeXOffset, int shakeYOffset) {
+ _graphicsManager->setShakePos(shakeXOffset, shakeYOffset);
}
void ModularBackend::setFocusRectangle(const Common::Rect& rect) {
_graphicsManager->setFocusRectangle(rect);
diff --git a/backends/modular-backend.h b/backends/modular-backend.h
index ead559cd8b..580e992fce 100644
--- a/backends/modular-backend.h
+++ b/backends/modular-backend.h
@@ -93,7 +93,7 @@ public:
virtual void unlockScreen() override;
virtual void fillScreen(uint32 col) override;
virtual void updateScreen() override;
- virtual void setShakePos(int shakeOffset) override;
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset) override;
virtual void setFocusRectangle(const Common::Rect& rect) override;
virtual void clearFocusRectangle() override;
diff --git a/backends/platform/3ds/osystem-graphics.cpp b/backends/platform/3ds/osystem-graphics.cpp
index c3864c143f..1ea70053fb 100644
--- a/backends/platform/3ds/osystem-graphics.cpp
+++ b/backends/platform/3ds/osystem-graphics.cpp
@@ -366,11 +366,12 @@ void OSystem_3DS::updateScreen() {
C3D_FrameEnd(0);
}
-void OSystem_3DS::setShakePos(int shakeOffset) {
+void OSystem_3DS::setShakePos(int shakeXOffset, int shakeYOffset) {
// TODO: implement this in overlay, top screen, and mouse too
- _screenShakeOffset = shakeOffset;
- _gameTopTexture.setPosition(_gameTopX, _gameTopY + _gameTopTexture.getScaleY() * shakeOffset);
- _gameBottomTexture.setPosition(_gameBottomX, _gameBottomY + _gameBottomTexture.getScaleY() * shakeOffset);
+ _screenShakeXOffset = shakeXOffset;
+ _screenShakeYOffset = shakeYOffset;
+ _gameTopTexture.setPosition(_gameTopX, _gameTopY + _gameTopTexture.getScaleY() * shakeYOffset);
+ _gameBottomTexture.setPosition(_gameBottomX, _gameBottomY + _gameBottomTexture.getScaleY() * shakeYOffset);
}
void OSystem_3DS::setFocusRectangle(const Common::Rect &rect) {
diff --git a/backends/platform/3ds/osystem.h b/backends/platform/3ds/osystem.h
index c15c353c24..a0f78fdce2 100644
--- a/backends/platform/3ds/osystem.h
+++ b/backends/platform/3ds/osystem.h
@@ -119,7 +119,7 @@ public:
Graphics::Surface *lockScreen();
void unlockScreen();
void updateScreen();
- void setShakePos(int shakeOffset);
+ void setShakePos(int shakeXOffset, int shakeYOffset);
void setFocusRectangle(const Common::Rect &rect);
void clearFocusRectangle();
void showOverlay();
@@ -200,7 +200,8 @@ private:
};
uint32 _osdMessageEndTime;
- int _screenShakeOffset;
+ int _screenShakeXOffset;
+ int _screenShakeYOffset;
bool _overlayVisible;
int _screenChangeId;
diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h
index cdea88e6b3..20098a5e2e 100644
--- a/backends/platform/dc/dc.h
+++ b/backends/platform/dc/dc.h
@@ -145,7 +145,7 @@ public:
void setCursorPalette(const byte *colors, uint start, uint num);
// Shaking is used in SCUMM. Set current shake position.
- void setShakePos(int shake_pos);
+ void setShakePos(int shake_x_pos, int shake_y_pos);
// Get the number of milliseconds since the program was started.
uint32 getMillis(bool skipRecord = false);
@@ -201,7 +201,7 @@ public:
int _ms_cur_x, _ms_cur_y, _ms_cur_w, _ms_cur_h, _ms_old_x, _ms_old_y;
int _ms_hotspot_x, _ms_hotspot_y, _ms_visible, _devpoll, _last_screen_refresh;
- int _current_shake_pos, _screen_w, _screen_h;
+ int _current_shake_x_pos, _current_shake_y_pos, _screen_w, _screen_h;
int _overlay_x, _overlay_y;
unsigned char *_ms_buf;
uint32 _ms_keycolor;
diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp
index 26cf9de5b4..31fd883cd6 100644
--- a/backends/platform/dc/dcmain.cpp
+++ b/backends/platform/dc/dcmain.cpp
@@ -42,7 +42,7 @@ const char *gGameName;
OSystem_Dreamcast::OSystem_Dreamcast()
: _devpoll(0), screen(NULL), mouse(NULL), overlay(NULL), _softkbd(this),
_ms_buf(NULL), _mixer(NULL),
- _current_shake_pos(0), _aspect_stretch(false), _softkbd_on(false),
+ _current_shake_x_pos(0), _current_shake_y_pos(0), _aspect_stretch(false), _softkbd_on(false),
_softkbd_motion(0), _enable_cursor_palette(false), _screenFormat(0)
{
memset(screen_tx, 0, sizeof(screen_tx));
diff --git a/backends/platform/dc/display.cpp b/backends/platform/dc/display.cpp
index 2547605398..447f671059 100644
--- a/backends/platform/dc/display.cpp
+++ b/backends/platform/dc/display.cpp
@@ -35,7 +35,7 @@
#define OVL_H 200
#define OVL_TXSTRIDE 512
-#define TOP_OFFSET (_top_offset+_yscale*_current_shake_pos)
+#define TOP_OFFSET (_top_offset+_yscale*_current_shake_y_pos)
static const struct {
Graphics::PixelFormat pixelFormat;
@@ -320,9 +320,10 @@ void OSystem_Dreamcast::setMouseCursor(const void *buf, uint w, uint h,
memcpy(_ms_buf, buf, w * h);
}
-void OSystem_Dreamcast::setShakePos(int shake_pos)
+void OSystem_Dreamcast::setShakePos(int shake_x_pos, int shake_y_pos)
{
- _current_shake_pos = shake_pos;
+ _current_shake_x_pos = shake_x_pos;
+ _current_shake_y_pos = shake_y_pos;
}
void OSystem_Dreamcast::updateScreenTextures(void)
diff --git a/backends/platform/ds/arm9/source/dsmain.cpp b/backends/platform/ds/arm9/source/dsmain.cpp
index 041892aed6..b0f61322d5 100644
--- a/backends/platform/ds/arm9/source/dsmain.cpp
+++ b/backends/platform/ds/arm9/source/dsmain.cpp
@@ -260,7 +260,8 @@ static SpriteEntry spritesMain[128];
static int tweak;
// Shake
-static int s_shakePos = 0;
+static int s_shakeXOffset = 0;
+static int s_shakeYOffset = 0;
// Keyboard
static bool keyboardEnable = false;
@@ -1016,8 +1017,9 @@ void displayMode16BitFlipBuffer() {
#endif
}
-void setShakePos(int shakePos) {
- s_shakePos = shakePos;
+void setShakePos(int shakeXOffset, int shakeYOffset) {
+ s_shakeXOffset = shakeXOffset;
+ s_shakeYOffset = shakeYOffset;
}
@@ -2096,7 +2098,7 @@ void VBlankHandler(void) {
SUB_BG3_CX = subScX + 64;
}
- SUB_BG3_CY = subScY + (s_shakePos << 8);*/
+ SUB_BG3_CY = subScY + (s_shakeYOffset << 8);*/
/*SUB_BG3_XDX = (int) (subScreenWidth / 256.0f * 256);
SUB_BG3_XDY = 0;
@@ -2228,7 +2230,7 @@ void VBlankHandler(void) {
setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
- setMainScreenScroll(scX << 8, (scY << 8) + (s_shakePos << 8));
+ setMainScreenScroll(scX << 8, (scY << 8) + (s_shakeYOffset << 8));
setMainScreenScale(256, 256); // 1:1 scale
} else {
@@ -2244,7 +2246,7 @@ void VBlankHandler(void) {
setZoomedScreenScroll(subScX, subScY, (subScreenWidth != 256) && (subScreenWidth != 128));
setZoomedScreenScale(subScreenWidth, ((subScreenHeight * (256 << 8)) / 192) >> 8);
- setMainScreenScroll(64, (scY << 8) + (s_shakePos << 8));
+ setMainScreenScroll(64, (scY << 8) + (s_shakeYOffset << 8));
setMainScreenScale(320, 256); // 1:1 scale
}
diff --git a/backends/platform/ds/arm9/source/dsmain.h b/backends/platform/ds/arm9/source/dsmain.h
index 7345fc2ceb..b413c70763 100644
--- a/backends/platform/ds/arm9/source/dsmain.h
+++ b/backends/platform/ds/arm9/source/dsmain.h
@@ -112,7 +112,7 @@ void setShowCursor(bool enable);
void setMouseCursorVisible(bool visible);
// Shake
-void setShakePos(int shakePos);
+void setShakePos(int shakeXOffset, int shakeYOffset);
// Reports
void memoryReport();
diff --git a/backends/platform/ds/arm9/source/osystem_ds.cpp b/backends/platform/ds/arm9/source/osystem_ds.cpp
index 9abeb59474..c9a1f08758 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.cpp
+++ b/backends/platform/ds/arm9/source/osystem_ds.cpp
@@ -490,8 +490,8 @@ void OSystem_DS::updateScreen() {
}
}
-void OSystem_DS::setShakePos(int shakeOffset) {
- DS::setShakePos(shakeOffset);
+void OSystem_DS::setShakePos(int shakeXOffset, int shakeYOffset) {
+ DS::setShakePos(shakeXOffset, shakeYOffset);
}
void OSystem_DS::showOverlay() {
diff --git a/backends/platform/ds/arm9/source/osystem_ds.h b/backends/platform/ds/arm9/source/osystem_ds.h
index c2813d11e4..5db644bed5 100644
--- a/backends/platform/ds/arm9/source/osystem_ds.h
+++ b/backends/platform/ds/arm9/source/osystem_ds.h
@@ -103,7 +103,7 @@ public:
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
virtual void updateScreen();
- virtual void setShakePos(int shakeOffset);
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset);
virtual void showOverlay();
virtual void hideOverlay();
diff --git a/backends/platform/ios7/ios7_common.h b/backends/platform/ios7/ios7_common.h
index aa5134335e..dd1e85a884 100644
--- a/backends/platform/ios7/ios7_common.h
+++ b/backends/platform/ios7/ios7_common.h
@@ -80,7 +80,8 @@ struct VideoContext {
VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
overlayWidth(), overlayHeight(), mouseX(), mouseY(),
mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
- mouseIsVisible(), graphicsMode(kGraphicsModeNone), filtering(false), shakeOffsetY() {
+ mouseIsVisible(), graphicsMode(kGraphicsModeNone), filtering(false),
+ shakeXOffset(), shakeYOffset() {
}
// Game screen state
@@ -103,7 +104,8 @@ struct VideoContext {
// Misc state
GraphicsModes graphicsMode;
bool filtering;
- int shakeOffsetY;
+ int shakeXOffset;
+ int shakeYOffset;
};
struct InternalEvent {
diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h
index 994a67dddb..f70e48e7de 100644
--- a/backends/platform/ios7/ios7_osys_main.h
+++ b/backends/platform/ios7/ios7_osys_main.h
@@ -161,7 +161,7 @@ public:
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
- virtual void setShakePos(int shakeOffset);
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset);
virtual void showOverlay();
virtual void hideOverlay();
diff --git a/backends/platform/ios7/ios7_osys_video.mm b/backends/platform/ios7/ios7_osys_video.mm
index 20cf687709..d31ca10ea3 100644
--- a/backends/platform/ios7/ios7_osys_video.mm
+++ b/backends/platform/ios7/ios7_osys_video.mm
@@ -138,7 +138,8 @@ void OSystem_iOS7::initSize(uint width, uint height, const Graphics::PixelFormat
_videoContext->screenWidth = width;
_videoContext->screenHeight = height;
- _videoContext->shakeOffsetY = 0;
+ _videoContext->shakeXOffset = 0;
+ _videoContext->shakeYOffset = 0;
// In case we use the screen texture as frame buffer we reset the pixels
// pointer here to avoid freeing the screen texture.
@@ -354,9 +355,10 @@ void OSystem_iOS7::unlockScreen() {
dirtyFullScreen();
}
-void OSystem_iOS7::setShakePos(int shakeOffset) {
- //printf("setShakePos(%i)\n", shakeOffset);
- _videoContext->shakeOffsetY = shakeOffset;
+void OSystem_iOS7::setShakePos(int shakeXOffset, int shakeYOffset) {
+ //printf("setShakePos(%i, %i)\n", shakeXOffset, shakeYOffset);
+ _videoContext->shakeXOffset = shakeXOffset;
+ _videoContext->shakeYOffset = shakeYOffset;
execute_on_main_thread(^ {
[[iOS7AppDelegate iPhoneView] setViewTransformation];
});
diff --git a/backends/platform/ios7/ios7_video.h b/backends/platform/ios7/ios7_video.h
index a26213f28e..030d81cd9f 100644
--- a/backends/platform/ios7/ios7_video.h
+++ b/backends/platform/ios7/ios7_video.h
@@ -84,7 +84,8 @@ typedef struct {
GLint _mouseWidth, _mouseHeight;
GLfloat _mouseScaleX, _mouseScaleY;
- int _scaledShakeOffsetY;
+ int _scaledShakeXOffset;
+ int _scaledShakeYOffset;
UITouch *_firstTouch;
UITouch *_secondTouch;
diff --git a/backends/platform/ios7/ios7_video.mm b/backends/platform/ios7/ios7_video.mm
index 321ccdb63d..914dc6ded1 100644
--- a/backends/platform/ios7/ios7_video.mm
+++ b/backends/platform/ios7/ios7_video.mm
@@ -454,7 +454,8 @@ uint getSizeNextPOT(uint size) {
_overlayTexture = 0;
_mouseCursorTexture = 0;
- _scaledShakeOffsetY = 0;
+ _scaledShakeXOffset = 0;
+ _scaledShakeYOffset = 0;
_firstTouch = NULL;
_secondTouch = NULL;
@@ -868,9 +869,9 @@ uint getSizeNextPOT(uint size) {
- (void)setViewTransformation {
// Scale the shake offset according to the overlay size. We need this to
// adjust the overlay mouse click coordinates when an offset is set.
- _scaledShakeOffsetY = (int)(_videoContext.shakeOffsetY / (GLfloat)_videoContext.screenHeight * CGRectGetHeight(_overlayRect));
+ _scaledShakeYOffset = (int)(_videoContext.shakeYOffset / (GLfloat)_videoContext.screenHeight * CGRectGetHeight(_overlayRect));
- glUniform1f(_shakeSlot, _scaledShakeOffsetY);
+ glUniform1f(_shakeSlot, _scaledShakeYOffset);
}
- (void)clearColorBuffer {
@@ -914,12 +915,12 @@ uint getSizeNextPOT(uint size) {
area = &_overlayRect;
width = _videoContext.overlayWidth;
height = _videoContext.overlayHeight;
- offsetY = _scaledShakeOffsetY;
+ offsetY = _scaledShakeYOffset;
} else {
area = &_gameScreenRect;
width = _videoContext.screenWidth;
height = _videoContext.screenHeight;
- offsetY = _videoContext.shakeOffsetY;
+ offsetY = _videoContext.shakeYOffset;
}
point.x = (point.x - CGRectGetMinX(*area)) / CGRectGetWidth(*area);
diff --git a/backends/platform/iphone/iphone_common.h b/backends/platform/iphone/iphone_common.h
index 59dca84b85..a09ddd462c 100644
--- a/backends/platform/iphone/iphone_common.h
+++ b/backends/platform/iphone/iphone_common.h
@@ -61,7 +61,8 @@ struct VideoContext {
VideoContext() : asprectRatioCorrection(), screenWidth(), screenHeight(), overlayVisible(false),
overlayWidth(), overlayHeight(), mouseX(), mouseY(),
mouseHotspotX(), mouseHotspotY(), mouseWidth(), mouseHeight(),
- mouseIsVisible(), graphicsMode(kGraphicsModeLinear), shakeOffsetY() {
+ mouseIsVisible(), graphicsMode(kGraphicsModeLinear),
+ shakeXOffset(), shakeYOffset() {
}
// Game screen state
@@ -83,7 +84,8 @@ struct VideoContext {
// Misc state
GraphicsModes graphicsMode;
- int shakeOffsetY;
+ int shakeXOffset;
+ int shakeYOffset;
};
struct InternalEvent {
diff --git a/backends/platform/iphone/iphone_video.h b/backends/platform/iphone/iphone_video.h
index 26c32183ce..8cba07c409 100644
--- a/backends/platform/iphone/iphone_video.h
+++ b/backends/platform/iphone/iphone_video.h
@@ -69,7 +69,8 @@
GLint _mouseWidth, _mouseHeight;
GLfloat _mouseScaleX, _mouseScaleY;
- int _scaledShakeOffsetY;
+ int _scaledShakeXOffset;
+ int _scaledShakeYOffset;
CGFloat _contentScaleFactor;
UITouch *_firstTouch;
diff --git a/backends/platform/iphone/iphone_video.mm b/backends/platform/iphone/iphone_video.mm
index 9e521de179..1866bf5f96 100644
--- a/backends/platform/iphone/iphone_video.mm
+++ b/backends/platform/iphone/iphone_video.mm
@@ -191,7 +191,8 @@ const char *iPhone_getDocumentsDir() {
_overlayTexture = 0;
_mouseCursorTexture = 0;
- _scaledShakeOffsetY = 0;
+ _scaledShakeXOffset = 0;
+ _scaledShakeYOffset = 0;
_firstTouch = NULL;
_secondTouch = NULL;
@@ -567,10 +568,10 @@ const char *iPhone_getDocumentsDir() {
// Scale the shake offset according to the overlay size. We need this to
// adjust the overlay mouse click coordinates when an offset is set.
- _scaledShakeOffsetY = (int)(_videoContext.shakeOffsetY / (GLfloat)_videoContext.screenHeight * CGRectGetHeight(_overlayRect));
+ _scaledShakeYOffset = (int)(_videoContext.shakeYOffset / (GLfloat)_videoContext.screenHeight * CGRectGetHeight(_overlayRect));
- // Apply the shakeing to the output screen.
- glTranslatef(0, -_scaledShakeOffsetY, 0);
+ // Apply the shaking to the output screen.
+ glTranslatef(0, -_scaledShakeYOffset, 0);
}
- (void)clearColorBuffer {
@@ -641,12 +642,12 @@ const char *iPhone_getDocumentsDir() {
area = &_overlayRect;
width = _videoContext.overlayWidth;
height = _videoContext.overlayHeight;
- offsetY = _scaledShakeOffsetY;
+ offsetY = _scaledShakeYOffset;
} else {
area = &_gameScreenRect;
width = _videoContext.screenWidth;
height = _videoContext.screenHeight;
- offsetY = _videoContext.shakeOffsetY;
+ offsetY = _videoContext.shakeYOffset;
}
point.x = (point.x - CGRectGetMinX(*area)) / CGRectGetWidth(*area);
diff --git a/backends/platform/iphone/osys_main.h b/backends/platform/iphone/osys_main.h
index 6aa77e291d..427d8063e4 100644
--- a/backends/platform/iphone/osys_main.h
+++ b/backends/platform/iphone/osys_main.h
@@ -147,7 +147,7 @@ public:
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
- virtual void setShakePos(int shakeOffset);
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset);
virtual void showOverlay();
virtual void hideOverlay();
diff --git a/backends/platform/iphone/osys_video.mm b/backends/platform/iphone/osys_video.mm
index f07160d350..a5dca7ffb7 100644
--- a/backends/platform/iphone/osys_video.mm
+++ b/backends/platform/iphone/osys_video.mm
@@ -72,7 +72,8 @@ void OSystem_IPHONE::initSize(uint width, uint height, const Graphics::PixelForm
_videoContext->screenWidth = width;
_videoContext->screenHeight = height;
- _videoContext->shakeOffsetY = 0;
+ _videoContext->shakeXOffset = 0;
+ _videoContext->shakeYOffset = 0;
// In case we use the screen texture as frame buffer we reset the pixels
// pointer here to avoid freeing the screen texture.
@@ -282,9 +283,10 @@ void OSystem_IPHONE::unlockScreen() {
dirtyFullScreen();
}
-void OSystem_IPHONE::setShakePos(int shakeOffset) {
- //printf("setShakePos(%i)\n", shakeOffset);
- _videoContext->shakeOffsetY = shakeOffset;
+void OSystem_IPHONE::setShakePos(int shakeXOffset, int shakeYOffset) {
+ //printf("setShakePos(%i, %i)\n", shakeXOffset, shakeYOffset);
+ _videoContext->shakeXOffset = shakeXOffset;
+ _videoContext->shakeYOffset = shakeYOffset;
[g_iPhoneViewInstance performSelectorOnMainThread:@selector(setViewTransformation) withObject:nil waitUntilDone: YES];
// HACK: We use this to force a redraw.
_mouseDirty = true;
diff --git a/backends/platform/n64/osys_n64.h b/backends/platform/n64/osys_n64.h
index 75a15b4d17..5ad4e00b28 100644
--- a/backends/platform/n64/osys_n64.h
+++ b/backends/platform/n64/osys_n64.h
@@ -97,7 +97,8 @@ protected:
uint8 _offscrPixels; // Pixels to skip on each line before start drawing, used to center image
uint8 _maxFps; // Max frames-per-second which can be shown on screen
- int _shakeOffset;
+ int _shakeXOffset;
+ int _shakeYOffset;
uint8 *_cursor_pal; // Cursor buffer, palettized
uint16 *_cursor_hic; // Cursor buffer, 16bit
@@ -163,7 +164,7 @@ public:
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
- virtual void setShakePos(int shakeOffset);
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset);
virtual void showOverlay();
virtual void hideOverlay();
diff --git a/backends/platform/n64/osys_n64_base.cpp b/backends/platform/n64/osys_n64_base.cpp
index 1ad90cb014..357bdf2584 100644
--- a/backends/platform/n64/osys_n64_base.cpp
+++ b/backends/platform/n64/osys_n64_base.cpp
@@ -90,7 +90,8 @@ OSystem_N64::OSystem_N64() {
_overlayVisible = false;
- _shakeOffset = 0;
+ _shakeXOffset = 0;
+ _shakeYOffset = 0;
// Allocate memory for offscreen buffers
_offscreen_hic = (uint16 *)memalign(8, _screenWidth * _screenHeight * 2);
@@ -512,8 +513,8 @@ void OSystem_N64::updateScreen() {
// Copy the game buffer to screen
if (!_overlayVisible) {
tmpDst = game_framebuffer;
- tmpSrc = _offscreen_hic + (_shakeOffset * _screenWidth);
- for (currentHeight = _shakeOffset; currentHeight < _gameHeight; currentHeight++) {
+ tmpSrc = _offscreen_hic + (_shakeYOffset * _screenWidth);
+ for (currentHeight = _shakeYOffset; currentHeight < _gameHeight; currentHeight++) {
uint64 *game_dest = (uint64 *)(tmpDst + skip_pixels + _offscrPixels);
uint64 *game_src = (uint64 *)tmpSrc;
@@ -525,7 +526,7 @@ void OSystem_N64::updateScreen() {
tmpSrc += _screenWidth;
}
- uint16 _clearLines = _shakeOffset; // When shaking we must take care of remaining lines to clear
+ uint16 _clearLines = _shakeYOffset; // When shaking we must take care of remaining lines to clear
while (_clearLines--) {
memset(tmpDst + skip_pixels + _offscrPixels, 0, _screenWidth * 2);
tmpDst += _frameBufferWidth;
@@ -599,13 +600,14 @@ void OSystem_N64::unlockScreen() {
_dirtyOffscreen = true;
}
-void OSystem_N64::setShakePos(int shakeOffset) {
+void OSystem_N64::setShakePos(int shakeXOffset, int shakeYOffset) {
// If a rumble pak is plugged in and screen shakes, rumble!
- if (shakeOffset && _controllerHasRumble) rumblePakEnable(1, _controllerPort);
- else if (!shakeOffset && _controllerHasRumble) rumblePakEnable(0, _controllerPort);
+ if (shakeYOffset && _controllerHasRumble) rumblePakEnable(1, _controllerPort);
+ else if (!shakeYOffset && _controllerHasRumble) rumblePakEnable(0, _controllerPort);
- _shakeOffset = shakeOffset;
+ _shakeXOffset = shakeXOffset;
+ _shakeYOffset = shakeYOffset;
_dirtyOffscreen = true;
return;
@@ -654,8 +656,8 @@ void OSystem_N64::clearOverlay() {
uint8 skip_pixels = (_screenWidth - _gameWidth) / 2; // Center horizontally the image
uint16 *tmpDst = _overlayBuffer + (_overlayWidth * skip_lines * 2);
- uint16 *tmpSrc = _offscreen_hic + (_shakeOffset * _screenWidth);
- for (uint16 currentHeight = _shakeOffset; currentHeight < _gameHeight; currentHeight++) {
+ uint16 *tmpSrc = _offscreen_hic + (_shakeYOffset * _screenWidth);
+ for (uint16 currentHeight = _shakeYOffset; currentHeight < _gameHeight; currentHeight++) {
memcpy((tmpDst + skip_pixels), tmpSrc, _gameWidth * 2);
tmpDst += _overlayWidth;
tmpSrc += _screenWidth;
diff --git a/backends/platform/ps2/Gs2dScreen.cpp b/backends/platform/ps2/Gs2dScreen.cpp
index a11d70162e..da7d6aadfa 100644
--- a/backends/platform/ps2/Gs2dScreen.cpp
+++ b/backends/platform/ps2/Gs2dScreen.cpp
@@ -309,7 +309,8 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height) {
_mouseScaleY = (_tvHeight << 8) / _height;
setMouseXy(_width / 2, _height / 2);
_mTraCol = 255;
- _shakePos = 0;
+ _shakeXOffset = 0;
+ _shakeYOffset = 0;
_overlayFormat.bytesPerPixel = 2;
@@ -678,10 +679,10 @@ int16 Gs2dScreen::getOverlayHeight(void) {
return _height; // _videoMode.overlayHeight;
}
-void Gs2dScreen::setShakePos(int shake) {
- _shakePos = (shake * _mouseScaleY) >> 8;
- _blitCoords[0].y = SCALE(_shakePos) + ORIGIN_Y;
- _blitCoords[1].y = SCALE(_tvHeight + _shakePos) + ORIGIN_Y;
+void Gs2dScreen::setShakePos(int shakeXOffset, int shakeYOffset) {
+ _shakeYOffset = (shakeYOffset * _mouseScaleY) >> 8;
+ _blitCoords[0].y = SCALE(_shakeYOffset) + ORIGIN_Y;
+ _blitCoords[1].y = SCALE(_tvHeight + _shakeYOffset) + ORIGIN_Y;
}
void Gs2dScreen::copyPrintfOverlay(const uint8 *buf) {
diff --git a/backends/platform/ps2/Gs2dScreen.h b/backends/platform/ps2/Gs2dScreen.h
index 9ed62da2d0..d8ad25e058 100644
--- a/backends/platform/ps2/Gs2dScreen.h
+++ b/backends/platform/ps2/Gs2dScreen.h
@@ -76,7 +76,7 @@ public:
void setMouseOverlay(const uint8 *buf, uint16 width, uint16 height, uint16 hotSpotX, uint16 hotSpotY, uint8 transpCol);
void showMouse(bool show);
void setMouseXy(int16 x, int16 y);
- void setShakePos(int shake);
+ void setShakePos(int shakeXOffset, int shakeYOffset);
void playAnim(void);
void wantAnim(bool runIt);
@@ -123,7 +123,8 @@ private:
uint32 _mouseScaleX, _mouseScaleY;
uint8 _mTraCol;
- int _shakePos;
+ int _shakeXOffset;
+ int _shakeYOffset;
bool _showMouse, _showOverlay, _screenChanged, _overlayChanged, _clutChanged;
uint16 *_overlayBuf;
diff --git a/backends/platform/ps2/systemps2.cpp b/backends/platform/ps2/systemps2.cpp
index a20ac6ada9..2a8f2d65d0 100644
--- a/backends/platform/ps2/systemps2.cpp
+++ b/backends/platform/ps2/systemps2.cpp
@@ -731,8 +731,8 @@ FilesystemFactory *OSystem_PS2::getFilesystemFactory() {
return &Ps2FilesystemFactory::instance();
}
-void OSystem_PS2::setShakePos(int shakeOffset) {
- _screen->setShakePos(shakeOffset);
+void OSystem_PS2::setShakePos(int shakeXOffset, int shakeYOffset) {
+ _screen->setShakePos(shakeXOffset, shakeYOffset);
}
bool OSystem_PS2::showMouse(bool visible) {
diff --git a/backends/platform/ps2/systemps2.h b/backends/platform/ps2/systemps2.h
index 019c3634a0..e11d320d78 100644
--- a/backends/platform/ps2/systemps2.h
+++ b/backends/platform/ps2/systemps2.h
@@ -65,7 +65,7 @@ protected:
public:
virtual void copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h);
- virtual void setShakePos(int shakeOffset);
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset);
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
virtual void updateScreen();
diff --git a/backends/platform/psp/default_display_client.cpp b/backends/platform/psp/default_display_client.cpp
index 1f0cef2e6c..91183a2238 100644
--- a/backends/platform/psp/default_display_client.cpp
+++ b/backends/platform/psp/default_display_client.cpp
@@ -157,9 +157,10 @@ void Screen::init() {
_renderer.setFullScreen(true);
}
-void Screen::setShakePos(int pos) {
- _shakePos = pos;
- _renderer.setOffsetOnScreen(0, pos);
+void Screen::setShakePos(int shakeXOffset, int shakeYOffset) {
+ _shakeXOffset = shakeXOffset;
+ _shakeYOffset = shakeYOffset;
+ _renderer.setOffsetOnScreen(0, shakeYOffset);
setDirty();
}
diff --git a/backends/platform/psp/default_display_client.h b/backends/platform/psp/default_display_client.h
index f2972e0b49..ed7239720e 100644
--- a/backends/platform/psp/default_display_client.h
+++ b/backends/platform/psp/default_display_client.h
@@ -78,14 +78,14 @@ public:
*/
class Screen : public DefaultDisplayClient {
public:
- Screen() : _shakePos(0) {
+ Screen() : _shakeXOffset(0), _shakeYOffset(0) {
memset(&_pixelFormat, 0, sizeof(_pixelFormat));
memset(&_frameBuffer, 0, sizeof(_frameBuffer));
}
void init();
bool allocate();
- void setShakePos(int pos);
+ void setShakePos(int shakeXOffset, int shakeYOffset);
void setScummvmPixelFormat(const Graphics::PixelFormat *format);
const Graphics::PixelFormat &getScummvmPixelFormat() const { return _pixelFormat; }
Graphics::Surface *lockAndGetForEditing();
@@ -93,7 +93,8 @@ public:
void setSize(uint32 width, uint32 height);
private:
- uint32 _shakePos;
+ uint32 _shakeXOffset;
+ uint32 _shakeYOffset;
Graphics::PixelFormat _pixelFormat;
Graphics::Surface _frameBuffer;
};
diff --git a/backends/platform/psp/osys_psp.cpp b/backends/platform/psp/osys_psp.cpp
index 006305c6fd..a65840669b 100644
--- a/backends/platform/psp/osys_psp.cpp
+++ b/backends/platform/psp/osys_psp.cpp
@@ -231,11 +231,11 @@ void OSystem_PSP::updateScreen() {
_pendingUpdate = !_displayManager.renderAll(); // if we didn't update, we have a pending update
}
-void OSystem_PSP::setShakePos(int shakeOffset) {
+void OSystem_PSP::setShakePos(int shakeXOffset, int shakeYOffset) {
DEBUG_ENTER_FUNC();
_displayManager.waitUntilRenderFinished();
_pendingUpdate = false;
- _screen.setShakePos(shakeOffset);
+ _screen.setShakePos(shakeXOffset, shakeYOffset);
}
void OSystem_PSP::showOverlay() {
diff --git a/backends/platform/psp/osys_psp.h b/backends/platform/psp/osys_psp.h
index 58354bfbce..ff9dd101d2 100644
--- a/backends/platform/psp/osys_psp.h
+++ b/backends/platform/psp/osys_psp.h
@@ -102,7 +102,7 @@ public:
Graphics::Surface *lockScreen();
void unlockScreen();
void updateScreen();
- void setShakePos(int shakeOffset);
+ void setShakePos(int shakeXOffset, int shakeYOffset);
// Overlay related
void showOverlay();
diff --git a/backends/platform/wii/osystem.h b/backends/platform/wii/osystem.h
index 5482eb7d49..6481d61d15 100644
--- a/backends/platform/wii/osystem.h
+++ b/backends/platform/wii/osystem.h
@@ -173,7 +173,7 @@ public:
virtual void updateScreen();
virtual Graphics::Surface *lockScreen();
virtual void unlockScreen();
- virtual void setShakePos(int shakeOffset);
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset);
virtual void showOverlay();
virtual void hideOverlay();
diff --git a/backends/platform/wii/osystem_gfx.cpp b/backends/platform/wii/osystem_gfx.cpp
index 932ca3814c..8c104fb075 100644
--- a/backends/platform/wii/osystem_gfx.cpp
+++ b/backends/platform/wii/osystem_gfx.cpp
@@ -544,9 +544,9 @@ void OSystem_Wii::unlockScreen() {
_gameDirty = true;
}
-void OSystem_Wii::setShakePos(int shakeOffset) {
+void OSystem_Wii::setShakePos(int shakeXOffset, int shakeYOffset) {
gfx_coords(&_coordsGame, &_texGame, GFX_COORD_FULLSCREEN);
- _coordsGame.y -= f32(shakeOffset) * _currentYScale;
+ _coordsGame.y -= f32(shakeYOffset) * _currentYScale;
}
void OSystem_Wii::showOverlay() {
diff --git a/common/system.h b/common/system.h
index 0ea925352e..ca3f269d9c 100644
--- a/common/system.h
+++ b/common/system.h
@@ -922,11 +922,13 @@ public:
* not cause any graphic data to be lost - that is, to restore the original
* view, the game engine only has to call this method again with offset
* equal to zero. No calls to copyRectToScreen are necessary.
- * @param shakeOffset the shake offset
+ * @param shakeXOffset the shake x offset
+ * @param shakeYOffset the shake y offset
*
- * @note This is currently used in the SCUMM, QUEEN and KYRA engines.
+ * @note This is currently used in the SCUMM, QUEEN, KYRA, SCI, DREAMWEB,
+ * SUPERNOVA, TEENAGENT, and TOLTECS engines.
*/
- virtual void setShakePos(int shakeOffset) = 0;
+ virtual void setShakePos(int shakeXOffset, int shakeYOffset) = 0;
/**
* Sets the area of the screen that has the focus. For example, when a character
diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h
index d34af40a05..d770c20bae 100644
--- a/engines/dreamweb/dreamweb.h
+++ b/engines/dreamweb/dreamweb.h
@@ -138,7 +138,7 @@ public:
Common::String getSavegameFilename(int slot) const;
- void setShakePos(int pos) { _system->setShakePos(pos); }
+ void setShakePos(int pos) { _system->setShakePos(0, pos); }
void printUnderMonitor();
void quit();
diff --git a/engines/kyra/graphics/screen.cpp b/engines/kyra/graphics/screen.cpp
index b20fa46c48..f53400a22c 100644
--- a/engines/kyra/graphics/screen.cpp
+++ b/engines/kyra/graphics/screen.cpp
@@ -3223,9 +3223,9 @@ void Screen::shakeScreen(int times) {
while (times--) {
// seems to be 1 line (320 pixels) offset in the original
// 4 looks more like dosbox though, maybe check this again
- _system->setShakePos(4);
+ _system->setShakePos(0, 4);
_system->updateScreen();
- _system->setShakePos(0);
+ _system->setShakePos(0, 0);
_system->updateScreen();
}
}
diff --git a/engines/queen/display.cpp b/engines/queen/display.cpp
index d92afc04c7..b3763ac83a 100644
--- a/engines/queen/display.cpp
+++ b/engines/queen/display.cpp
@@ -1082,7 +1082,7 @@ void Display::drawBox(int16 x1, int16 y1, int16 x2, int16 y2, uint8 col) {
}
void Display::shake(bool reset) {
- _system->setShakePos(reset ? 0 : 3);
+ _system->setShakePos(0, reset ? 0 : 3);
}
void Display::blankScreen() {
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp
index d299f8ea73..f7464d460c 100644
--- a/engines/sci/graphics/frameout.cpp
+++ b/engines/sci/graphics/frameout.cpp
@@ -1201,14 +1201,14 @@ void GfxFrameout::shakeScreen(int16 numShakes, const ShakeDirection direction) {
}
if (direction & kShakeVertical) {
- g_system->setShakePos(_isHiRes ? 8 : 4);
+ g_system->setShakePos(0, _isHiRes ? 8 : 4);
}
updateScreen();
g_sci->getEngineState()->sleep(3);
if (direction & kShakeVertical) {
- g_system->setShakePos(0);
+ g_system->setShakePos(0, 0);
}
updateScreen();
diff --git a/engines/sci/graphics/screen.cpp b/engines/sci/graphics/screen.cpp
index c6f6c4043d..cd81fdf36f 100644
--- a/engines/sci/graphics/screen.cpp
+++ b/engines/sci/graphics/screen.cpp
@@ -595,23 +595,23 @@ void GfxScreen::bitsRestoreDisplayScreen(Common::Rect rect, byte *&memoryPtr) {
}
}
-void GfxScreen::setVerticalShakePos(uint16 shakePos) {
+void GfxScreen::setShakePos(uint16 shakeXOffset, uint16 shakeYOffset) {
if (!_upscaledHires)
- g_system->setShakePos(shakePos);
+ g_system->setShakePos(shakeXOffset, shakeYOffset);
else
- g_system->setShakePos(_upscaledHeightMapping[shakePos]);
+ g_system->setShakePos(_upscaledWidthMapping[shakeXOffset], _upscaledHeightMapping[shakeYOffset]);
}
void GfxScreen::kernelShakeScreen(uint16 shakeCount, uint16 directions) {
while (shakeCount--) {
if (directions & kShakeVertical)
- setVerticalShakePos(10);
+ setShakePos(0, 10);
// TODO: horizontal shakes
g_system->updateScreen();
g_sci->getEngineState()->sleep(3);
if (directions & kShakeVertical)
- setVerticalShakePos(0);
+ setShakePos(0, 0);
g_system->updateScreen();
g_sci->getEngineState()->sleep(3);
diff --git a/engines/sci/graphics/screen.h b/engines/sci/graphics/screen.h
index 8bdf64719c..a9baf2bc10 100644
--- a/engines/sci/graphics/screen.h
+++ b/engines/sci/graphics/screen.h
@@ -157,7 +157,7 @@ private:
void bitsSaveScreen(Common::Rect rect, byte *screen, uint16 screenWidth, byte *&memoryPtr);
void bitsSaveDisplayScreen(Common::Rect rect, byte *&memoryPtr);
- void setVerticalShakePos(uint16 shakePos);
+ void setShakePos(uint16 shakeXOffset, uint16 shakeYOffset);
/**
* If this flag is true, undithering is enabled, otherwise disabled.
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index 9bf5133c82..3fb93afcd5 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -523,10 +523,10 @@ void ScummEngine::drawDirtyScreenParts() {
// Handle shaking
if (_shakeEnabled) {
_shakeFrame = (_shakeFrame + 1) % NUM_SHAKE_POSITIONS;
- _system->setShakePos(shake_positions[_shakeFrame]);
+ _system->setShakePos(0, shake_positions[_shakeFrame]);
} else if (!_shakeEnabled &&_shakeFrame != 0) {
_shakeFrame = 0;
- _system->setShakePos(0);
+ _system->setShakePos(0, 0);
}
}
@@ -1519,7 +1519,7 @@ void ScummEngine::setShake(int mode) {
_shakeEnabled = mode != 0;
_shakeFrame = 0;
- _system->setShakePos(0);
+ _system->setShakePos(0, 0);
}
#pragma mark -
diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 0997fd0a55..e3557ee233 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1147,7 +1147,7 @@ void ScummEngine::saveLoadWithSerializer(Common::Serializer &s) {
// When loading, reset the ShakePos. Fixes one part of bug #7141
if (s.isLoading() && s.getVersion() >= VER(10))
- _system->setShakePos(0);
+ _system->setShakePos(0, 0);
// When loading, move the mouse to the saved mouse position.
if (s.isLoading() && s.getVersion() >= VER(20)) {
diff --git a/engines/supernova/game-manager.cpp b/engines/supernova/game-manager.cpp
index 66fb013f86..1af355b4d9 100644
--- a/engines/supernova/game-manager.cpp
+++ b/engines/supernova/game-manager.cpp
@@ -804,9 +804,9 @@ void GameManager::saveTime() {
void GameManager::screenShake() {
for (int i = 0; i < 12; ++i) {
- _vm->_system->setShakePos(8);
+ _vm->_system->setShakePos(0, 8);
wait(1);
- _vm->_system->setShakePos(0);
+ _vm->_system->setShakePos(0, 0);
wait(1);
}
}
diff --git a/engines/teenagent/scene.cpp b/engines/teenagent/scene.cpp
index 5a8589a7cd..689fe1f55b 100644
--- a/engines/teenagent/scene.cpp
+++ b/engines/teenagent/scene.cpp
@@ -1111,19 +1111,19 @@ bool Scene::processEventQueue() {
case SceneEvent::kEffect:
_vm->_system->delayMillis(80); // 2 vsyncs
- _vm->_system->setShakePos(8);
+ _vm->_system->setShakePos(0, 8);
_vm->_system->updateScreen();
_vm->_system->delayMillis(80); // 2 vsyncs
- _vm->_system->setShakePos(0);
+ _vm->_system->setShakePos(0, 0);
_vm->_system->updateScreen();
_vm->_system->delayMillis(80); // 2 vsyncs
- _vm->_system->setShakePos(4);
+ _vm->_system->setShakePos(0, 4);
_vm->_system->updateScreen();
_vm->_system->delayMillis(80); // 2 vsyncs
- _vm->_system->setShakePos(0);
+ _vm->_system->setShakePos(0, 0);
_vm->_system->updateScreen();
currentEvent.clear();
diff --git a/engines/testbed/graphics.cpp b/engines/testbed/graphics.cpp
index 65833d1de8..1eac3a8ffb 100644
--- a/engines/testbed/graphics.cpp
+++ b/engines/testbed/graphics.cpp
@@ -981,10 +981,10 @@ TestExitStatus GFXtests::shakingEffect() {
Testsuite::writeOnScreen("If Shaking Effect works, this should shake!", pt);
int times = 15;
while (times--) {
- g_system->setShakePos(25);
+ g_system->setShakePos(25, 25);
g_system->delayMillis(50);
g_system->updateScreen();
- g_system->setShakePos(0);
+ g_system->setShakePos(0, 0);
g_system->delayMillis(50);
g_system->updateScreen();
}
@@ -1187,12 +1187,12 @@ TestExitStatus GFXtests::cursorTrails() {
return kTestSkipped;
}
TestExitStatus passed = kTestFailed;
- g_system->setShakePos(25);
+ g_system->setShakePos(25, 25);
g_system->updateScreen();
if (Testsuite::handleInteractiveInput("Does the cursor leaves trails while moving?", "Yes", "No", kOptionRight)) {
passed = kTestPassed;
}
- g_system->setShakePos(0);
+ g_system->setShakePos(0, 0);
g_system->updateScreen();
return passed;
}
diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp
index 6bacc5dff7..efce0bc389 100644
--- a/engines/toltecs/screen.cpp
+++ b/engines/toltecs/screen.cpp
@@ -159,7 +159,7 @@ void Screen::startShakeScreen(int16 shakeCounter) {
void Screen::stopShakeScreen() {
_shakeActive = false;
- _vm->_system->setShakePos(0);
+ _vm->_system->setShakePos(0, 0);
}
bool Screen::updateShakeScreen() {
@@ -170,7 +170,7 @@ bool Screen::updateShakeScreen() {
if (_shakeCounter == 0) {
_shakeCounter = _shakeCounterInit;
_shakePos ^= 8;
- _vm->_system->setShakePos(_shakePos);
+ _vm->_system->setShakePos(0, _shakePos);
return true;
}
}