aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
authorPaul Gilbert2016-07-23 13:15:24 -0400
committerPaul Gilbert2016-07-23 13:15:24 -0400
commit9e02409ef4ece6b3184c1d745106e87f3169e6ca (patch)
tree4e500cf9c0823f1d6e969dc63a15cda7479521b4 /engines/titanic/support
parent382ba52e332a02a49343c1ba1c2aed80dfcd5c87 (diff)
downloadscummvm-rg350-9e02409ef4ece6b3184c1d745106e87f3169e6ca.tar.gz
scummvm-rg350-9e02409ef4ece6b3184c1d745106e87f3169e6ca.tar.bz2
scummvm-rg350-9e02409ef4ece6b3184c1d745106e87f3169e6ca.zip
TITANIC: Clarification and fixes for movie reverse and repeat flags
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/avi_surface.cpp23
-rw-r--r--engines/titanic/support/avi_surface.h9
-rw-r--r--engines/titanic/support/movie.cpp2
-rw-r--r--engines/titanic/support/movie_range_info.cpp8
-rw-r--r--engines/titanic/support/movie_range_info.h2
5 files changed, 30 insertions, 14 deletions
diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp
index c64edca7a4..c3a720154a 100644
--- a/engines/titanic/support/avi_surface.cpp
+++ b/engines/titanic/support/avi_surface.cpp
@@ -103,7 +103,7 @@ bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags
info->_startFrame = startFrame;
info->_endFrame = endFrame;
info->_isReversed = endFrame < startFrame;
- info->_isFlag1 = flags & MOVIE_1;
+ info->_isRepeat = flags & MOVIE_REPEAT;
if (obj) {
CMovieEvent *me = new CMovieEvent();
@@ -119,6 +119,8 @@ bool AVISurface::play(int startFrame, int endFrame, int initialFrame, uint flags
_movieRangeInfo.push_back(info);
if (_movieRangeInfo.size() == 1) {
+ // First play call, so start the movie playing
+ setReversed(info->_isReversed);
return startAtFrame(initialFrame);
} else {
return true;
@@ -164,6 +166,12 @@ void AVISurface::seekToFrame(uint frameNumber) {
renderFrame();
}
+void AVISurface::setReversed(bool isReversed) {
+ _decoders[0]->setReverse(isReversed);
+ if (_decoders[1])
+ _decoders[1]->setReverse(isReversed);
+}
+
bool AVISurface::handleEvents(CMovieEventList &events) {
if (!isPlaying())
return true;
@@ -173,7 +181,9 @@ bool AVISurface::handleEvents(CMovieEventList &events) {
if ((info->_isReversed && currentPos < info->_endFrame) ||
(!info->_isReversed && currentPos > info->_endFrame)) {
- if (info->_isFlag1) {
+ if (info->_isRepeat) {
+ currentPos = info->_startFrame;
+ } else {
info->getMovieEnd(events);
_movieRangeInfo.remove(info);
delete info;
@@ -186,15 +196,15 @@ bool AVISurface::handleEvents(CMovieEventList &events) {
info = _movieRangeInfo.front();
currentPos = info->_startFrame;
}
- } else {
- currentPos = info->_startFrame;
}
}
if (isPlaying()) {
- if (currentPos != getFrame())
+ if (currentPos != getFrame()) {
// The frame has been changed, so move to new position
+ setReversed(info->_isReversed);
seekToFrame(currentPos);
+ }
// Get any events for the given position
info->getMovieFrame(events, currentPos);
@@ -267,7 +277,8 @@ int AVISurface::getFrame() const {
}
bool AVISurface::isFrameReady() const {
- return _decoders[0]->needsUpdate() && (!_decoders[1] || _decoders[1]->needsUpdate());
+ return _decoders[0]->needsUpdate() &&
+ (!_decoders[1] || _decoders[1]->needsUpdate());
}
bool AVISurface::renderFrame() {
diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h
index 4372757bc6..77186edeb4 100644
--- a/engines/titanic/support/avi_surface.h
+++ b/engines/titanic/support/avi_surface.h
@@ -34,7 +34,7 @@ class CSoundManager;
class CVideoSurface;
enum MovieFlag {
- MOVIE_1 = 1, MOVIE_STOP_PREVIOUS = 2, MOVIE_NO_OBJECT = 4,
+ MOVIE_REPEAT = 1, MOVIE_STOP_PREVIOUS = 2, MOVIE_NO_OBJECT = 4,
MOVIE_REVERSE = 8, MOVIE_GAMESTATE = 0x10
};
@@ -69,7 +69,12 @@ protected:
/**
* Start playback at the specified frame
*/
- virtual bool startAtFrame(int frameNumber);
+ bool startAtFrame(int frameNumber);
+
+ /**
+ * Sets whether the movie is playing in reverse
+ */
+ void setReversed(bool isReversed);
/**
* Seeks to a given frame number in the video
diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp
index 33e7d33154..eba878e875 100644
--- a/engines/titanic/support/movie.cpp
+++ b/engines/titanic/support/movie.cpp
@@ -175,7 +175,7 @@ bool OSMovie::handleEvents(CMovieEventList &events) {
return _aviSurface.isPlaying();
// Handle updating the frame
- while (_aviSurface.isFrameReady()) {
+ while (_aviSurface.isPlaying() && _aviSurface.isFrameReady()) {
_aviSurface.handleEvents(events);
_videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface());
}
diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp
index 4c62539864..634ab1cc62 100644
--- a/engines/titanic/support/movie_range_info.cpp
+++ b/engines/titanic/support/movie_range_info.cpp
@@ -38,7 +38,7 @@ CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() {
_endFrame = src->_endFrame;
_initialFrame = src->_initialFrame;
_isReversed = src->_isReversed;
- _isFlag1 = src->_isFlag1;
+ _isRepeat = src->_isRepeat;
// Duplicate the events list
for (CMovieEventList::const_iterator i = _events.begin();
@@ -52,7 +52,7 @@ void CMovieRangeInfo::save(SimpleFile *file, int indent) {
file->writeNumberLine(_startFrame, indent + 1);
file->writeNumberLine(_endFrame, indent + 1);
file->writeNumberLine(_initialFrame, indent + 1);
- file->writeNumberLine(_isFlag1, indent + 1);
+ file->writeNumberLine(_isRepeat, indent + 1);
file->writeNumberLine(_isReversed, indent + 1);
_events.save(file, indent + 1);
}
@@ -63,7 +63,7 @@ void CMovieRangeInfo::load(SimpleFile *file) {
_startFrame = file->readNumber();
_endFrame = file->readNumber();
_initialFrame = file->readNumber();
- _isFlag1 = file->readNumber();
+ _isRepeat = file->readNumber();
_isReversed = file->readNumber();
_events.load(file);
}
@@ -88,7 +88,7 @@ void CMovieRangeInfo::getMovieFrame(CMovieEventList &list, int frameNumber) {
void CMovieRangeInfo::process(CGameObject *owner) {
int flags = 0;
if (_endFrame)
- flags |= MOVIE_1;
+ flags |= MOVIE_REPEAT;
if (_startFrame)
flags |= MOVIE_REVERSE;
diff --git a/engines/titanic/support/movie_range_info.h b/engines/titanic/support/movie_range_info.h
index b8186e6f7e..6b13fbadb5 100644
--- a/engines/titanic/support/movie_range_info.h
+++ b/engines/titanic/support/movie_range_info.h
@@ -38,7 +38,7 @@ public:
int _endFrame;
int _initialFrame;
bool _isReversed;
- bool _isFlag1;
+ bool _isRepeat;
CMovieEventList _events;
public:
CMovieRangeInfo();