diff options
Diffstat (limited to 'engines/titanic/support/avi_surface.cpp')
-rw-r--r-- | engines/titanic/support/avi_surface.cpp | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index c37bd83616..d4ebd5cef1 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -20,19 +20,20 @@ * */ -#include "titanic/support/avi_surface.h" -#include "titanic/support/screen_manager.h" -#include "titanic/support/video_surface.h" #include "common/system.h" #include "graphics/pixelformat.h" #include "video/avi_decoder.h" +#include "titanic/support/avi_surface.h" +#include "titanic/support/screen_manager.h" +#include "titanic/support/video_surface.h" +#include "titanic/titanic.h" namespace Titanic { Video::AVIDecoder::AVIVideoTrack &AVIDecoder::getVideoTrack() { for (TrackListIterator it = getTrackListBegin(); it != getTrackListEnd(); it++) if ((*it)->getTrackType() == Track::kTrackTypeVideo) - return *static_cast<AVIVideoTrack *>(*it); + return *dynamic_cast<AVIVideoTrack *>(*it); error("Could not find video track"); } @@ -338,9 +339,9 @@ bool AVISurface::addEvent(int frameNumber, CGameObject *obj) { } void AVISurface::setFrameRate(double rate) { - _decoders[0]->setRate(Common::Rational(rate)); + _decoders[0]->setRate(Common::Rational((int)rate)); if (_decoders[1]) - _decoders[1]->setRate(Common::Rational(rate)); + _decoders[1]->setRate(Common::Rational((int)rate)); } Graphics::ManagedSurface *AVISurface::getSecondarySurface() { @@ -358,4 +359,36 @@ Graphics::ManagedSurface *AVISurface::duplicateSecondaryFrame() const { } } +void AVISurface::playCutscene(const Rect &r, uint startFrame, uint endFrame) { + bool isDifferent = _movieFrameSurface[0]->w != r.width() || + _movieFrameSurface[0]->h != r.height(); + + startAtFrame(startFrame); + while (_currentFrame < (int)endFrame && !g_vm->shouldQuit()) { + if (isNextFrame()) { + renderFrame(); + _currentFrame = _decoders[0]->getCurFrame(); + + if (isDifferent) { + // Clear the destination area, and use the transBlitFrom method, + // which supports arbitrary scaling, to reduce to the desired size + g_vm->_screen->fillRect(r, 0); + g_vm->_screen->transBlitFrom(*_movieFrameSurface[0], + Common::Rect(0, 0, _movieFrameSurface[0]->w, _movieFrameSurface[0]->h), r); + } else { + g_vm->_screen->blitFrom(*_movieFrameSurface[0], Common::Point(r.left, r.top)); + } + + g_vm->_screen->update(); + g_vm->_events->pollEvents(); + } + + // Brief wait, and check at the same time for clicks to abort the clip + if (g_vm->_events->waitForPress(10)) + break; + } + + stop(); +} + } // End of namespace Titanic |