aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Bouclet2012-12-16 10:28:23 +0100
committerBastien Bouclet2012-12-16 10:28:23 +0100
commitedb8b6e236cf44154193acccee3d7840cae1f121 (patch)
tree0784ed9e54e31e364e9c557bb737d054be2df84a
parentaf64cad069071cc445ac015c87681a4f1244b413 (diff)
downloadscummvm-rg350-edb8b6e236cf44154193acccee3d7840cae1f121.tar.gz
scummvm-rg350-edb8b6e236cf44154193acccee3d7840cae1f121.tar.bz2
scummvm-rg350-edb8b6e236cf44154193acccee3d7840cae1f121.zip
MOHAWK: Add the remaining Myst transition effects
-rw-r--r--engines/mohawk/myst.h5
-rw-r--r--engines/mohawk/myst_graphics.cpp145
-rw-r--r--engines/mohawk/myst_graphics.h4
-rw-r--r--engines/mohawk/myst_stacks/mechanical.cpp2
4 files changed, 138 insertions, 18 deletions
diff --git a/engines/mohawk/myst.h b/engines/mohawk/myst.h
index 43559e2f0d..a268c19737 100644
--- a/engines/mohawk/myst.h
+++ b/engines/mohawk/myst.h
@@ -79,10 +79,13 @@ enum {
enum TransitionType {
kTransitionLeftToRight = 0,
kTransitionRightToLeft = 1,
- kTransitionUnk2 = 2,
+ kTransitionSlideToLeft = 2,
+ kTransitionSlideToRight = 3,
kTransitionDissolve = 4,
kTransitionTopToBottom = 5,
kTransitionBottomToTop = 6,
+ kTransitionSlideToTop = 7,
+ kTransitionSlideToBottom= 8,
kTransitionPartToRight = 9,
kTransitionPartToLeft = 10,
kTransitionCopy = 11,
diff --git a/engines/mohawk/myst_graphics.cpp b/engines/mohawk/myst_graphics.cpp
index 9eeb1914cd..6a292c66e2 100644
--- a/engines/mohawk/myst_graphics.cpp
+++ b/engines/mohawk/myst_graphics.cpp
@@ -217,7 +217,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
switch (type) {
case kTransitionLeftToRight: {
- debugC(kDebugScript, "Left to Right");
+ debugC(kDebugView, "Left to Right");
uint16 step = (rect.right - rect.left) / steps;
Common::Rect area = rect;
@@ -240,7 +240,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
break;
case kTransitionRightToLeft: {
- debugC(kDebugScript, "Right to Left");
+ debugC(kDebugView, "Right to Left");
uint16 step = (rect.right - rect.left) / steps;
Common::Rect area = rect;
@@ -262,8 +262,16 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
}
break;
+ case kTransitionSlideToLeft:
+ debugC(kDebugView, "Slide to left");
+ transitionSlideToLeft(rect, steps, delay);
+ break;
+ case kTransitionSlideToRight:
+ debugC(kDebugView, "Slide to right");
+ transitionSlideToRight(rect, steps, delay);
+ break;
case kTransitionDissolve: {
- debugC(kDebugScript, "Dissolve");
+ debugC(kDebugView, "Dissolve");
for (int16 step = 0; step < 8; step++) {
simulatePreviousDrawDelay(rect);
@@ -272,7 +280,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
break;
case kTransitionTopToBottom: {
- debugC(kDebugScript, "Top to Bottom");
+ debugC(kDebugView, "Top to Bottom");
uint16 step = (rect.bottom - rect.top) / steps;
Common::Rect area = rect;
@@ -295,7 +303,7 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
break;
case kTransitionBottomToTop: {
- debugC(kDebugScript, "Bottom to Top");
+ debugC(kDebugView, "Bottom to Top");
uint16 step = (rect.bottom - rect.top) / steps;
Common::Rect area = rect;
@@ -317,32 +325,37 @@ void MystGraphics::runTransition(TransitionType type, Common::Rect rect, uint16
}
}
break;
+ case kTransitionSlideToTop:
+ debugC(kDebugView, "Slide to top");
+ transitionSlideToTop(rect, steps, delay);
+ break;
+ case kTransitionSlideToBottom:
+ debugC(kDebugView, "Slide to bottom");
+ transitionSlideToBottom(rect, steps, delay);
+ break;
case kTransitionPartToRight: {
- debugC(kDebugScript, "Partial left to right");
+ debugC(kDebugView, "Partial left to right");
transitionPartialToRight(rect, 75, 3);
}
break;
case kTransitionPartToLeft: {
- debugC(kDebugScript, "Partial right to left");
+ debugC(kDebugView, "Partial right to left");
transitionPartialToLeft(rect, 75, 3);
}
break;
- default:
- //TODO: Replace minimal implementation
- warning("Unknown transition %d", type);
- // Fallthrough
case kTransitionCopy:
copyBackBufferToScreen(rect);
_vm->_system->updateScreen();
break;
+ default:
+ error("Unknown transition %d", type);
}
_enableDrawingTimeSimulation = oldEnableDrawingTimeSimulation;
}
-
void MystGraphics::transitionDissolve(Common::Rect rect, uint step) {
static const bool pattern[][4][4] = {
{
@@ -422,8 +435,109 @@ void MystGraphics::transitionDissolve(Common::Rect rect, uint step) {
_vm->_system->updateScreen();
}
-void MystGraphics::transitionPartialToRight(Common::Rect rect, uint32 width, uint32 steps)
-{
+void MystGraphics::transitionSlideToLeft(Common::Rect rect, uint16 steps, uint16 delay) {
+ rect.clip(_viewport);
+
+ uint32 stepWidth = (rect.right - rect.left) / steps;
+ Common::Rect srcRect = Common::Rect(rect.right, rect.top, rect.right, rect.bottom);
+ Common::Rect dstRect = Common::Rect(rect.left, rect.top, rect.left, rect.bottom);
+
+ for (uint step = 1; step <= steps; step++) {
+ dstRect.right = dstRect.left + step * stepWidth;
+ srcRect.left = srcRect.right - step * stepWidth;
+
+ _vm->_system->delayMillis(delay);
+
+ simulatePreviousDrawDelay(dstRect);
+ _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
+ _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->_system->updateScreen();
+ }
+
+ if (dstRect.right != rect.right) {
+ copyBackBufferToScreen(rect);
+ _vm->_system->updateScreen();
+ }
+}
+
+void MystGraphics::transitionSlideToRight(Common::Rect rect, uint16 steps, uint16 delay) {
+ rect.clip(_viewport);
+
+ uint32 stepWidth = (rect.right - rect.left) / steps;
+ Common::Rect srcRect = Common::Rect(rect.left, rect.top, rect.left, rect.bottom);
+ Common::Rect dstRect = Common::Rect(rect.right, rect.top, rect.right, rect.bottom);
+
+ for (uint step = 1; step <= steps; step++) {
+ dstRect.left = dstRect.right - step * stepWidth;
+ srcRect.right = srcRect.left + step * stepWidth;
+
+ _vm->_system->delayMillis(delay);
+
+ simulatePreviousDrawDelay(dstRect);
+ _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
+ _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->_system->updateScreen();
+ }
+
+ if (dstRect.left != rect.left) {
+ copyBackBufferToScreen(rect);
+ _vm->_system->updateScreen();
+ }
+}
+
+void MystGraphics::transitionSlideToTop(Common::Rect rect, uint16 steps, uint16 delay) {
+ rect.clip(_viewport);
+
+ uint32 stepWidth = (rect.bottom - rect.top) / steps;
+ Common::Rect srcRect = Common::Rect(rect.left, rect.bottom, rect.right, rect.bottom);
+ Common::Rect dstRect = Common::Rect(rect.left, rect.top, rect.right, rect.top);
+
+ for (uint step = 1; step <= steps; step++) {
+ dstRect.bottom = dstRect.top + step * stepWidth;
+ srcRect.top = srcRect.bottom - step * stepWidth;
+
+ _vm->_system->delayMillis(delay);
+
+ simulatePreviousDrawDelay(dstRect);
+ _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
+ _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->_system->updateScreen();
+ }
+
+
+ if (dstRect.bottom < rect.bottom) {
+ copyBackBufferToScreen(rect);
+ _vm->_system->updateScreen();
+ }
+}
+
+void MystGraphics::transitionSlideToBottom(Common::Rect rect, uint16 steps, uint16 delay) {
+ rect.clip(_viewport);
+
+ uint32 stepWidth = (rect.bottom - rect.top) / steps;
+ Common::Rect srcRect = Common::Rect(rect.left, rect.top, rect.right, rect.top);
+ Common::Rect dstRect = Common::Rect(rect.left, rect.bottom, rect.right, rect.bottom);
+
+ for (uint step = 1; step <= steps; step++) {
+ dstRect.top = dstRect.bottom - step * stepWidth;
+ srcRect.bottom = srcRect.top + step * stepWidth;
+
+ _vm->_system->delayMillis(delay);
+
+ simulatePreviousDrawDelay(dstRect);
+ _vm->_system->copyRectToScreen(_backBuffer->getBasePtr(dstRect.left, dstRect.top),
+ _backBuffer->pitch, srcRect.left, srcRect.top, srcRect.width(), srcRect.height());
+ _vm->_system->updateScreen();
+ }
+
+
+ if (dstRect.top > rect.top) {
+ copyBackBufferToScreen(rect);
+ _vm->_system->updateScreen();
+ }
+}
+
+void MystGraphics::transitionPartialToRight(Common::Rect rect, uint32 width, uint32 steps) {
rect.clip(_viewport);
uint32 stepWidth = width / steps;
@@ -444,8 +558,7 @@ void MystGraphics::transitionPartialToRight(Common::Rect rect, uint32 width, uin
_vm->_system->updateScreen();
}
-void MystGraphics::transitionPartialToLeft(Common::Rect rect, uint32 width, uint32 steps)
-{
+void MystGraphics::transitionPartialToLeft(Common::Rect rect, uint32 width, uint32 steps) {
rect.clip(_viewport);
uint32 stepWidth = width / steps;
diff --git a/engines/mohawk/myst_graphics.h b/engines/mohawk/myst_graphics.h
index 04eb1b9e9b..4bbc8d5b8c 100644
--- a/engines/mohawk/myst_graphics.h
+++ b/engines/mohawk/myst_graphics.h
@@ -61,6 +61,10 @@ protected:
void simulatePreviousDrawDelay(const Common::Rect &dest);
void copyBackBufferToScreenWithSaturation(int16 saturation);
void transitionDissolve(Common::Rect rect, uint step);
+ void transitionSlideToLeft(Common::Rect rect, uint16 steps, uint16 delay);
+ void transitionSlideToRight(Common::Rect rect, uint16 steps, uint16 delay);
+ void transitionSlideToTop(Common::Rect rect, uint16 steps, uint16 delay);
+ void transitionSlideToBottom(Common::Rect rect, uint16 steps, uint16 delay);
void transitionPartialToRight(Common::Rect rect, uint32 width, uint32 steps);
void transitionPartialToLeft(Common::Rect rect, uint32 width, uint32 steps);
private:
diff --git a/engines/mohawk/myst_stacks/mechanical.cpp b/engines/mohawk/myst_stacks/mechanical.cpp
index d6069a135c..9e688899b0 100644
--- a/engines/mohawk/myst_stacks/mechanical.cpp
+++ b/engines/mohawk/myst_stacks/mechanical.cpp
@@ -616,7 +616,7 @@ void Mechanical::elevatorGoMiddle_run() {
_vm->_sound->playSoundBlocking(11120);
_vm->_gfx->copyImageToBackBuffer(6118, Common::Rect(544, 333));
_vm->_sound->replaceSoundMyst(12120);
- _vm->_gfx->runTransition(kTransitionUnk2, Common::Rect(177, 0, 370, 333), 25, 0);
+ _vm->_gfx->runTransition(kTransitionSlideToLeft, Common::Rect(177, 0, 370, 333), 25, 0);
_vm->_sound->playSoundBlocking(13120);
_vm->_sound->replaceSoundMyst(8120);
_vm->_gfx->copyImageToBackBuffer(6327, Common::Rect(544, 333));