From 63c3df22f01d80f383ceb5376be3ffac4838d4eb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 17 Jan 2017 22:40:57 -0500 Subject: TITANIC: Handle -1 frameNumber in AVISurface::addEvent like original --- engines/titanic/npcs/parrot.cpp | 5 +++-- engines/titanic/support/avi_surface.cpp | 11 ++++++----- engines/titanic/support/avi_surface.h | 2 +- engines/titanic/support/movie.cpp | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/titanic/npcs/parrot.cpp b/engines/titanic/npcs/parrot.cpp index b89d5c7abd..becd13bf08 100644 --- a/engines/titanic/npcs/parrot.cpp +++ b/engines/titanic/npcs/parrot.cpp @@ -642,8 +642,9 @@ bool CParrot::FrameMsg(CFrameMsg *msg) { break; } - if (action < 280266) { + if (action != 280266) { if (pt.x < 75) { + warning("***********************"); _npcFlags |= NPCFLAG_1000000; playClip("Walk Left Intro", MOVIE_STOP_PREVIOUS); playClip("Walk Left Loop", MOVIE_NOTIFY_OBJECT); @@ -684,7 +685,7 @@ bool CParrot::MovieFrameMsg(CMovieFrameMsg *msg) { _npcFlags &= ~NPCFLAG_800000; } - + warning("%d", msg->_frameNumber);//***DEBUG*** switch (msg->_frameNumber) { case 244: setPosition(Point(_bounds.left + 45, _bounds.top)); diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index f8a6440be8..d5242688c4 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -406,21 +406,22 @@ bool AVISurface::renderFrame() { return false; } -bool AVISurface::addEvent(int frameNumber, CGameObject *obj) { +bool AVISurface::addEvent(int *frameNumber, CGameObject *obj) { if (!_movieRangeInfo.empty()) { CMovieRangeInfo *tail = _movieRangeInfo.back(); - if (frameNumber == -1) - frameNumber = tail->_startFrame; + assert(frameNumber); + if (*frameNumber == -1) + *frameNumber = tail->_startFrame; CMovieEvent *me = new CMovieEvent(); me->_type = MET_FRAME; me->_startFrame = 0; me->_endFrame = 0; - me->_initialFrame = frameNumber; + me->_initialFrame = *frameNumber; me->_gameObject = obj; tail->addEvent(me); - return _movieRangeInfo.size() == 1 && frameNumber == getFrame(); + return _movieRangeInfo.size() == 1 && *frameNumber == getFrame(); } return false; diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 099a257361..f45db3599e 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -181,7 +181,7 @@ public: /** * Add a movie event */ - bool addEvent(int frameNumber, CGameObject *obj); + bool addEvent(int *frameNumber, CGameObject *obj); /** * Set the frame rate diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 8863e94e14..3095715bc9 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -140,7 +140,7 @@ void OSMovie::stop() { } void OSMovie::addEvent(int frameNumber, CGameObject *obj) { - if (_aviSurface.addEvent(frameNumber, obj)) { + if (_aviSurface.addEvent(&frameNumber, obj)) { CMovieFrameMsg frameMsg(frameNumber, 0); frameMsg.execute(obj); } -- cgit v1.2.3