diff options
author | sluicebox | 2019-11-15 01:38:21 -0800 |
---|---|---|
committer | Eugene Sandulenko | 2019-11-19 00:20:40 +0100 |
commit | b8390fa161c0c324af0e52a4f3a740cca9e9a479 (patch) | |
tree | e88f1e7cbb2c35c1b1c3319c9481c4edafca734d /backends/platform/n64 | |
parent | 3238e523ee2ac442c7562830a85b347400b7da88 (diff) | |
download | scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.gz scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.tar.bz2 scummvm-rg350-b8390fa161c0c324af0e52a4f3a740cca9e9a479.zip |
GRAPHICS: Add interface for horizontal shake
Diffstat (limited to 'backends/platform/n64')
-rw-r--r-- | backends/platform/n64/osys_n64.h | 5 | ||||
-rw-r--r-- | backends/platform/n64/osys_n64_base.cpp | 22 |
2 files changed, 15 insertions, 12 deletions
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; |