diff --git a/engines/twp/debugtools.cpp b/engines/twp/debugtools.cpp index 2a0355511530..ed265b2469e3 100644 --- a/engines/twp/debugtools.cpp +++ b/engines/twp/debugtools.cpp @@ -82,7 +82,6 @@ static void drawThreads() { if (g_twp->_cutscene) { Common::SharedPtr thread(g_twp->_cutscene); SQStackInfos infos; - sq_stackinfos(thread->getThread(), 0, &infos); ImGui::TableNextRow(); ImGui::TableNextColumn(); @@ -92,11 +91,16 @@ static void drawThreads() { ImGui::TableNextColumn(); ImGui::Text("%-6s", "cutscene"); ImGui::TableNextColumn(); - ImGui::Text("%-9s", infos.funcname); - ImGui::TableNextColumn(); - ImGui::Text("%-9s", infos.source); - ImGui::TableNextColumn(); - ImGui::Text("%5lld", infos.line); + if (SQ_SUCCEEDED(sq_stackinfos(thread->getThread(), 0, &infos))) { + ImGui::Text("%-9s", infos.funcname); + ImGui::TableNextColumn(); + ImGui::Text("%-9s", infos.source); + ImGui::TableNextColumn(); + ImGui::Text("%5lld", infos.line); + } else { + ImGui::TableNextColumn(); + ImGui::TableNextColumn(); + } } for (const auto &thread : threads) { @@ -111,11 +115,16 @@ static void drawThreads() { ImGui::TableNextColumn(); ImGui::Text("%-6s", thread->isGlobal() ? "global" : "local"); ImGui::TableNextColumn(); - ImGui::Text("%-9s", infos.funcname); - ImGui::TableNextColumn(); - ImGui::Text("%-9s", infos.source); - ImGui::TableNextColumn(); - ImGui::Text("%5lld", infos.line); + if (SQ_SUCCEEDED(sq_stackinfos(thread->getThread(), 0, &infos))) { + ImGui::Text("%-9s", infos.funcname); + ImGui::TableNextColumn(); + ImGui::Text("%-9s", infos.source); + ImGui::TableNextColumn(); + ImGui::Text("%5lld", infos.line); + } else { + ImGui::TableNextColumn(); + ImGui::TableNextColumn(); + } } ImGui::EndTable(); } diff --git a/engines/twp/syslib.cpp b/engines/twp/syslib.cpp index 3ef197685460..6656806ef0b3 100644 --- a/engines/twp/syslib.cpp +++ b/engines/twp/syslib.cpp @@ -378,7 +378,7 @@ struct ActorTalking { explicit ActorTalking(Common::SharedPtr obj) : _obj(obj) {} bool operator()() { - return _obj->getTalking() && _obj->getTalking()->isEnabled(); + return _obj->getTalking() && _obj->getTalking()->isEnabled() && _obj->_room == g_twp->_room; } private: diff --git a/engines/twp/thread.cpp b/engines/twp/thread.cpp index f3cc3dff6094..7b2bc9ce965e 100644 --- a/engines/twp/thread.cpp +++ b/engines/twp/thread.cpp @@ -275,4 +275,10 @@ bool Cutscene::isStopped() { return sq_getvmstate(getThread()) == 0; } +void Cutscene::cutsceneOverride() { + if (_state == csCheckEnd) { + _state = csOverride; + } +} + } // namespace Twp diff --git a/engines/twp/thread.h b/engines/twp/thread.h index 6d20cc2ff6ba..ee544e184360 100644 --- a/engines/twp/thread.h +++ b/engines/twp/thread.h @@ -114,7 +114,7 @@ class Cutscene final : public ThreadBase { void stop() override final; bool hasOverride() const; - inline void cutsceneOverride() { _state = csOverride; } + void cutsceneOverride(); bool isStopped(); void setInputState(InputStateFlag state) { _inputState = state; }