GRIM: Allow SayLine messages of zero length. Fixes #199
This commit is contained in:
parent
27ec9c2920
commit
5ea33b4f7f
2 changed files with 29 additions and 28 deletions
|
@ -888,34 +888,36 @@ void Actor::sayLine(const char *msg, const char *msgId, bool background) {
|
||||||
_sayLineText = 0;
|
_sayLineText = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GrimEngine::SpeechMode m = g_grim->getSpeechMode();
|
if (msg[0] != 0) {
|
||||||
if (!g_grim->_sayLineDefaults.getFont() || m == GrimEngine::VoiceOnly || background)
|
GrimEngine::SpeechMode m = g_grim->getSpeechMode();
|
||||||
return;
|
if (!g_grim->_sayLineDefaults.getFont() || m == GrimEngine::VoiceOnly || background)
|
||||||
|
return;
|
||||||
|
|
||||||
TextObject *textObject = new TextObject(false, true);
|
TextObject *textObject = new TextObject(false, true);
|
||||||
textObject->setDefaults(&g_grim->_sayLineDefaults);
|
textObject->setDefaults(&g_grim->_sayLineDefaults);
|
||||||
textObject->setFGColor(_talkColor);
|
textObject->setFGColor(_talkColor);
|
||||||
if (g_grim->getMode() == ENGINE_MODE_SMUSH)
|
if (g_grim->getMode() == ENGINE_MODE_SMUSH)
|
||||||
g_grim->killTextObjects();
|
g_grim->killTextObjects();
|
||||||
if (m == GrimEngine::TextOnly || g_grim->getMode() == ENGINE_MODE_SMUSH) {
|
if (m == GrimEngine::TextOnly || g_grim->getMode() == ENGINE_MODE_SMUSH) {
|
||||||
textObject->setDuration(500 + strlen(msg) * 15 * (11 - g_grim->getTextSpeed()));
|
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);
|
|
||||||
}
|
}
|
||||||
|
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() {
|
bool Actor::isTalking() {
|
||||||
|
|
|
@ -498,9 +498,8 @@ void L1_SayLine() {
|
||||||
}
|
}
|
||||||
paramObj = lua_getparam(paramId++);
|
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
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue