GRIM: Better implementation of IsMessageGoing() when no actor is passed.

This commit is contained in:
Giulio Camuffo 2011-05-19 17:55:40 +02:00
parent 310262066b
commit 65b074987e
4 changed files with 21 additions and 10 deletions

View File

@ -930,6 +930,7 @@ void Actor::sayLine(const char *msg, const char *msgId) {
}
_sayLineText->createBitmap();
g_grim->registerTextObject(_sayLineText);
g_grim->setCurrentTextObject(_sayLineText);
}
bool Actor::isTalking() {

View File

@ -356,6 +356,7 @@ GrimEngine::GrimEngine(OSystem *syst, uint32 gameFlags, GrimGameType gameType, C
_currScene = NULL;
_selectedActor = NULL;
_currTextObject = NULL;
_controlsEnabled = new bool[KEYCODE_EXTRA_LAST];
_controlsState = new bool[KEYCODE_EXTRA_LAST];
for (int i = 0; i < KEYCODE_EXTRA_LAST; i++) {
@ -1719,6 +1720,9 @@ void GrimEngine::registerTextObject(TextObject *t) {
void GrimEngine::killTextObject(TextObject *t) {
_textObjects.erase(t->getId());
if (t == _currTextObject) {
_currTextObject = NULL;
}
delete t;
}
@ -1732,6 +1736,14 @@ TextObject *GrimEngine::getTextObject(int id) const {
return _textObjects[id];
}
TextObject *GrimEngine::getCurrentTextObject() const {
return _currTextObject;
}
void GrimEngine::setCurrentTextObject(TextObject *text) {
_currTextObject = text;
}
void GrimEngine::registerActor(Actor *a) {
_actors[a->getId()] = a;
}

View File

@ -179,6 +179,9 @@ public:
void killTextObject(TextObject *a);
void killTextObjects();
TextObject *getTextObject(int id) const;
TextObject *getCurrentTextObject() const;
void setCurrentTextObject(TextObject *text);
// Primitives Object Registration
PrimitiveListType::const_iterator primitivesBegin() const { return _primitiveObjects.begin(); }
@ -274,6 +277,7 @@ private:
bool *_controlsState;
Actor *_selectedActor;
TextObject *_currTextObject;
SceneListType _scenes;
ActorListType _actors;

View File

@ -494,13 +494,6 @@ void L1_SayLine() {
}
if (!msg.empty()) {
actor->sayLine(msg.c_str(), msgId); //background, vol, pan, x, y
// Set the value of "system.lastActortalking".
// Necessary for wait_for_message() (_system.LUA, line 1319)
lua_pushobject(lua_getref(refSystemTable));
lua_pushstring("lastActorTalking");
lua_pushusertag(actor->getId(), MKTAG('A','C','T','R'));
lua_settable();
}
}
}
@ -567,9 +560,10 @@ void L1_IsMessageGoing() {
pushbool(actor->isTalking());
}
} else {
// TODO
// this part code check something more
pushbool(g_imuse->isVoicePlaying());
// NOTE: i'm not sure this currentTextObject stuff is totally right.
// if you do changes test them against the crying angelitos in the fo set.
// the dialog menu should appear few secods after they start crying.
pushbool(g_grim->getCurrentTextObject() != NULL);
}
} else
lua_pushnil();