aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Iskrich2016-06-13 21:30:11 +0300
committerEugene Sandulenko2016-08-03 23:40:36 +0200
commit055fb9e1bf62dd721de87d5e73ea5b351660f7f3 (patch)
treebe5eebf4675744a5c40fa630c4545ea2765b9f7f
parente51e28cf7ed0019922911140743da4c4aa0f461d (diff)
downloadscummvm-rg350-055fb9e1bf62dd721de87d5e73ea5b351660f7f3.tar.gz
scummvm-rg350-055fb9e1bf62dd721de87d5e73ea5b351660f7f3.tar.bz2
scummvm-rg350-055fb9e1bf62dd721de87d5e73ea5b351660f7f3.zip
DIRECTOR: Handle cover up/down transitions
-rw-r--r--engines/director/score.cpp39
-rw-r--r--engines/director/score.h2
2 files changed, 37 insertions, 4 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 86cd5c6127..77cf084bb0 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -729,7 +729,8 @@ void Frame::prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Gra
renderSprites(_movie, surface, movieRect, false);
renderSprites(_movie, trailSurface, movieRect, true);
if (_transType != 0)
- playTransition();
+ //TODO Handle changing area case
+ playTransition(surface, movieRect);
if (_sound1 != 0 || _sound2 != 0) {
playSoundChannel();
}
@@ -741,8 +742,40 @@ void Frame::playSoundChannel() {
debug(0, "Sound1 %d", _sound1);
}
-void Frame::playTransition() {
- warning("STUB: playTransition(%d, %d, %d)", _transType, _transDuration, _transChunkSize);
+void Frame::playTransition(Graphics::ManagedSurface &frameSurface, Common::Rect transRect) {
+ uint16 duration = _transDuration * 250; // _transDuration in 1/4 of sec
+ duration = (duration == 0 ? 250 : duration); // director support transition duration = 0, but animation play like value = 1, idk.
+ uint16 stepDuration = duration / _transChunkSize;
+ uint16 steps = duration / stepDuration;
+
+ switch (_transType) {
+ case kTransCoverDown: {
+ uint16 stepSize = transRect.height() / steps;
+ Common::Rect r = transRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setHeight(stepSize * i);
+ g_system->delayMillis(stepDuration);
+ g_system->copyRectToScreen(frameSurface.getPixels(), frameSurface.pitch, 0, 0, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
+ case kTransCoverUp: {
+ uint16 stepSize = transRect.height() / steps;
+ Common::Rect r = transRect;
+ for (uint16 i = 1; i < steps; i++) {
+ r.setHeight(stepSize*i);
+ g_system->delayMillis(stepDuration);
+ g_system->copyRectToScreen(frameSurface.getPixels(), frameSurface.pitch, 0, transRect.height() - stepSize * i, r.width(), r.height());
+ g_system->updateScreen();
+ }
+ }
+ break;
+ default:
+ warning("Unhandled transition type %d", _transType);
+ break;
+
+ }
}
void Frame::renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail) {
diff --git a/engines/director/score.h b/engines/director/score.h
index 1b64ccab39..f9293f078c 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -237,7 +237,7 @@ public:
void prepareFrame(Archive &_movie, Graphics::ManagedSurface &surface, Graphics::ManagedSurface &trailSurface, Common::Rect movieRect);
uint16 getSpriteIDFromPos(Common::Point pos);
private:
- void playTransition();
+ void playTransition(Graphics::ManagedSurface &frameSurface, Common::Rect transRect);
void playSoundChannel();
void renderSprites(Archive &_movie, Graphics::ManagedSurface &surface, Common::Rect movieRect, bool renderTrail);
void readSprite(Common::SeekableReadStream &stream, uint16 offset, uint16 size);