From b2b809aa27066d0cf40f6a8d042e660d93656848 Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Wed, 21 Mar 2012 18:14:58 +0100 Subject: [PATCH] GRIM: Treat the movie subtitle separate from the other TextObjects. Fix #571. --- engines/grim/actor.cpp | 6 ++---- engines/grim/grim.cpp | 18 ++++++++++++++++-- engines/grim/grim.h | 3 +++ engines/grim/lua_v1_graphics.cpp | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/engines/grim/actor.cpp b/engines/grim/actor.cpp index c20f03ea536..3649c6d8ee6 100644 --- a/engines/grim/actor.cpp +++ b/engines/grim/actor.cpp @@ -867,7 +867,7 @@ void Actor::sayLine(const char *msgId, bool background) { if (background) _isTalkingBackground = true; - if (_sayLineText) { + if (_sayLineText && g_grim->getMode() != GrimEngine::SmushMode) { delete TextObject::getPool().getObject(_sayLineText); _sayLineText = 0; } @@ -877,9 +877,6 @@ void Actor::sayLine(const char *msgId, bool background) { if (!g_grim->_sayLineDefaults.getFont() || m == GrimEngine::VoiceOnly) return; - if (g_grim->getMode() == GrimEngine::SmushMode) - TextObject::getPool().deleteObjects(); - TextObject *textObject = new TextObject(false, true); textObject->setDefaults(&g_grim->_sayLineDefaults); textObject->setFGColor(_talkColor); @@ -889,6 +886,7 @@ void Actor::sayLine(const char *msgId, bool background) { if (g_grim->getMode() == GrimEngine::SmushMode) { textObject->setX(640 / 2); textObject->setY(456); + g_grim->setMovieSubtitle(textObject); } else { if (_visible && isInSet(g_grim->getCurrSet()->getName())) { _mustPlaceText = true; diff --git a/engines/grim/grim.cpp b/engines/grim/grim.cpp index 895f6e57f7a..ac09d69f5b1 100644 --- a/engines/grim/grim.cpp +++ b/engines/grim/grim.cpp @@ -408,8 +408,14 @@ void GrimEngine::drawPrimitives() { _iris->draw(); // Draw text - foreach (TextObject *t, TextObject::getPool()) { - t->draw(); + if (_mode == SmushMode) { + if (_movieSubtitle) { + _movieSubtitle->draw(); + } + } else { + foreach (TextObject *t, TextObject::getPool()) { + t->draw(); + } } } @@ -1098,6 +1104,14 @@ bool GrimEngine::areActorsTalking() const { return !_talkingActors.empty(); } +void GrimEngine::setMovieSubtitle(TextObject *to) +{ + if (_movieSubtitle != to) { + delete _movieSubtitle; + _movieSubtitle = to; + } +} + const Common::String &GrimEngine::getSetName() const { return _currSet->getName(); } diff --git a/engines/grim/grim.h b/engines/grim/grim.h index c4f3a983bf8..4f69d528461 100644 --- a/engines/grim/grim.h +++ b/engines/grim/grim.h @@ -162,6 +162,8 @@ public: void addTalkingActor(Actor *actor); bool areActorsTalking() const; + void setMovieSubtitle(TextObject *to); + void saveGame(const Common::String &file); void loadGame(const Common::String &file); @@ -227,6 +229,7 @@ private: Actor *_selectedActor; Iris *_iris; + TextObject::Ptr _movieSubtitle; bool _buildActiveActorsList; Common::List _activeActors; diff --git a/engines/grim/lua_v1_graphics.cpp b/engines/grim/lua_v1_graphics.cpp index 660ffd156a9..494c95bedd6 100644 --- a/engines/grim/lua_v1_graphics.cpp +++ b/engines/grim/lua_v1_graphics.cpp @@ -149,7 +149,7 @@ void Lua_V1::IsMoviePlaying() { void Lua_V1::StopMovie() { g_movie->stop(); // Delete subtitles that may have not expired. - TextObject::getPool().deleteObjects(); + g_grim->setMovieSubtitle(NULL); } void Lua_V1::PauseMovie() {