From b8390fa161c0c324af0e52a4f3a740cca9e9a479 Mon Sep 17 00:00:00 2001 From: sluicebox Date: Fri, 15 Nov 2019 01:38:21 -0800 Subject: GRAPHICS: Add interface for horizontal shake --- backends/platform/ds/arm9/source/dsmain.cpp | 14 ++++++++------ backends/platform/ds/arm9/source/dsmain.h | 2 +- backends/platform/ds/arm9/source/osystem_ds.cpp | 4 ++-- backends/platform/ds/arm9/source/osystem_ds.h | 2 +- 4 files changed, 12 insertions(+), 10 deletions(-) (limited to 'backends/platform/ds') 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(); -- cgit v1.2.3