aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorsluicebox2019-11-15 01:38:21 -0800
committerEugene Sandulenko2019-11-19 00:20:40 +0100
commitb8390fa161c0c324af0e52a4f3a740cca9e9a479 (patch)
treee88f1e7cbb2c35c1b1c3319c9481c4edafca734d /backends/platform
parent3238e523ee2ac442c7562830a85b347400b7da88 (diff)
downloadscummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.gz
scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.bz2
scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.zip
GRAPHICS: Add interface for horizontal shake
Diffstat (limited to 'backends/platform')
-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
31 files changed, 107 insertions, 83 deletions
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() {