GRIM: Treat the movie subtitle separate from the other TextObjects. Fix #571.

This commit is contained in:
Giulio Camuffo 2012-03-21 18:14:58 +01:00
parent 1f1cc712df
commit b2b809aa27
4 changed files with 22 additions and 7 deletions

View File

@ -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;

View File

@ -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();
}

View File

@ -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<Actor *> _activeActors;

View File

@ -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() {