Merge pull request #172 from klusark/work

Add support for lua sending text to the background.
This commit is contained in:
Pawel Kolodziejski 2011-05-24 21:31:00 -07:00
commit 365cbbd229
3 changed files with 6 additions and 6 deletions

View File

@ -835,7 +835,7 @@ float Actor::getYawTo(Graphics::Vector3d p) const {
return atan2(-dpos.x(), dpos.y()) * (180.f / LOCAL_PI);
}
void Actor::sayLine(const char *msg, const char *msgId) {
void Actor::sayLine(const char *msg, const char *msgId, bool background) {
assert(msg);
assert(msgId);
@ -896,7 +896,7 @@ void Actor::sayLine(const char *msg, const char *msgId) {
}
GrimEngine::SpeechMode m = g_grim->getSpeechMode();
if (!g_grim->_sayLineDefaults.getFont() || m == GrimEngine::VoiceOnly)
if (!g_grim->_sayLineDefaults.getFont() || m == GrimEngine::VoiceOnly || background)
return;
_sayLineText = new TextObject(false, true);

View File

@ -95,7 +95,7 @@ public:
Graphics::Vector3d getPuckVector() const;
void turn(int dir);
void sayLine(const char *msg, const char *msgId);
void sayLine(const char *msg, const char *msgId, bool background);
// When we clean all text objects we don't want the actors to clean their
// objects again since they're already freed
void lineCleanup() { _sayLineText = NULL; }

View File

@ -433,9 +433,9 @@ void parseSayLineTable(lua_Object paramObj, bool *background, int *vol, int *pan
lua_pushobject(paramObj);
lua_pushobject(lua_getref(refTextObjectBackground));
tableObj = lua_gettable();
if (!lua_isnil(tableObj)) {
if (tableObj) {
if (*background)
*background = 0;
*background = (int)lua_getnumber(tableObj);
}
lua_pushobject(paramObj);
@ -492,7 +492,7 @@ void L1_SayLine() {
paramObj = lua_getparam(paramId++);
}
if (!msg.empty()) {
actor->sayLine(msg.c_str(), msgId); //background, vol, pan, x, y
actor->sayLine(msg.c_str(), msgId, background); //background, vol, pan, x, y
}
}
}