[Scummvm-git-logs] scummvm master -> 630a6472cb5994e7ce5407531c2f800d13c8bc5a
mduggan
noreply at scummvm.org
Sat Oct 12 05:03:34 UTC 2024
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
630a6472cb DGDS: Implement horizontal scroll for Heart of China
Commit: 630a6472cb5994e7ce5407531c2f800d13c8bc5a
https://github.com/scummvm/scummvm/commit/630a6472cb5994e7ce5407531c2f800d13c8bc5a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2024-10-12T16:03:08+11:00
Commit Message:
DGDS: Implement horizontal scroll for Heart of China
Changed paths:
engines/dgds/ttm.cpp
diff --git a/engines/dgds/ttm.cpp b/engines/dgds/ttm.cpp
index 7cd928421ff..50838d01080 100644
--- a/engines/dgds/ttm.cpp
+++ b/engines/dgds/ttm.cpp
@@ -331,11 +331,12 @@ static void _doScroll(Graphics::ManagedSurface &compBuf, int16 dir, int16 steps,
const Common::Rect screenRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
for (int16 i = 1; i <= steps; i++) {
int stepval = ((int)i * offset) / steps;
- int xoff = (dir == 2 ? stepval : 0);
- int yoff = (dir == 2 ? 0 : (dir == 1 ? stepval : -stepval));
+ int xoff = (dir <= 1 ? 0 : (dir == 2 ? stepval : -stepval));
+ int yoff = (dir >= 2 ? 0 : (dir == 1 ? stepval : -stepval));
Common::Rect srcRectFromOrigScreen(Common::Point(xoff, yoff), SCREEN_WIDTH, SCREEN_HEIGHT);
srcRectFromOrigScreen.clip(screenRect);
- screen->copyRectToSurface(screenCopy, MAX(0, -xoff), MAX(0, -yoff), srcRectFromOrigScreen);
+ if (abs(xoff) < SCREEN_WIDTH && abs(yoff) < SCREEN_HEIGHT)
+ screen->copyRectToSurface(screenCopy, MAX(0, -xoff), MAX(0, -yoff), srcRectFromOrigScreen);
switch (dir) {
case 0: {
@@ -349,11 +350,17 @@ static void _doScroll(Graphics::ManagedSurface &compBuf, int16 dir, int16 steps,
break;
}
case 2: {
- // Draw composition buf to right of screen buf
+ // Draw composition buf to right of screen buf (camera moves to right)
Common::Rect rectFromCompBuf(0, 0, SCREEN_WIDTH - srcRectFromOrigScreen.width(), SCREEN_HEIGHT);
screen->copyRectToSurface(compBuf, srcRectFromOrigScreen.width(), 0, rectFromCompBuf);
break;
}
+ case 3: {
+ // Draw composition buf to left of screen buf (camera moves to left)
+ Common::Rect rectFromCompBuf(srcRectFromOrigScreen.width(), 0, SCREEN_WIDTH, SCREEN_HEIGHT);
+ screen->copyRectToSurface(compBuf, 0, 0, rectFromCompBuf);
+ break;
+ }
default:
error("TTM scroll invalid scroll direction: %d", dir);
break;
More information about the Scummvm-git-logs
mailing list