GRIM: Allow SayLine messages of zero length. Fixes #199

This commit is contained in:
Joni Vähämäki 2011-06-11 18:25:25 +03:00
parent 27ec9c2920
commit 5ea33b4f7f
2 changed files with 29 additions and 28 deletions

View File

@ -888,34 +888,36 @@ void Actor::sayLine(const char *msg, const char *msgId, bool background) {
_sayLineText = 0;
}
GrimEngine::SpeechMode m = g_grim->getSpeechMode();
if (!g_grim->_sayLineDefaults.getFont() || m == GrimEngine::VoiceOnly || background)
return;
if (msg[0] != 0) {
GrimEngine::SpeechMode m = g_grim->getSpeechMode();
if (!g_grim->_sayLineDefaults.getFont() || m == GrimEngine::VoiceOnly || background)
return;
TextObject *textObject = new TextObject(false, true);
textObject->setDefaults(&g_grim->_sayLineDefaults);
textObject->setFGColor(_talkColor);
if (g_grim->getMode() == ENGINE_MODE_SMUSH)
g_grim->killTextObjects();
if (m == GrimEngine::TextOnly || g_grim->getMode() == ENGINE_MODE_SMUSH) {
textObject->setDuration(500 + strlen(msg) * 15 * (11 - g_grim->getTextSpeed()));
}
if (g_grim->getMode() == ENGINE_MODE_SMUSH) {
textObject->setX(640 / 2);
textObject->setY(456);
} else {
if (_winX1 == 1000 || _winX2 == -1000 || _winY2 == -1000) {
textObject->setX(640 / 2);
textObject->setY(463);
} else {
textObject->setX((_winX1 + _winX2) / 2);
textObject->setY(_winY1);
TextObject *textObject = new TextObject(false, true);
textObject->setDefaults(&g_grim->_sayLineDefaults);
textObject->setFGColor(_talkColor);
if (g_grim->getMode() == ENGINE_MODE_SMUSH)
g_grim->killTextObjects();
if (m == GrimEngine::TextOnly || g_grim->getMode() == ENGINE_MODE_SMUSH) {
textObject->setDuration(500 + strlen(msg) * 15 * (11 - g_grim->getTextSpeed()));
}
if (g_grim->getMode() == ENGINE_MODE_SMUSH) {
textObject->setX(640 / 2);
textObject->setY(456);
} else {
if (_winX1 == 1000 || _winX2 == -1000 || _winY2 == -1000) {
textObject->setX(640 / 2);
textObject->setY(463);
} else {
textObject->setX((_winX1 + _winX2) / 2);
textObject->setY(_winY1);
}
}
textObject->setText(msg);
g_grim->registerTextObject(textObject);
if (g_grim->getMode() != ENGINE_MODE_SMUSH)
_sayLineText = textObject->getId();
}
textObject->setText(msg);
g_grim->registerTextObject(textObject);
if (g_grim->getMode() != ENGINE_MODE_SMUSH)
_sayLineText = textObject->getId();
}
bool Actor::isTalking() {

View File

@ -498,9 +498,8 @@ void L1_SayLine() {
}
paramObj = lua_getparam(paramId++);
}
if (!msg.empty()) {
actor->sayLine(msg.c_str(), msgId, background); //background, vol, pan, x, y
}
actor->sayLine(msg.c_str(), msgId, background); //background, vol, pan, x, y
}
}
}