Skip to content

Commit

Permalink
TWP: cutsceneOverride should not be callable several times
Browse files Browse the repository at this point in the history
  • Loading branch information
scemino committed Mar 9, 2024
1 parent f0c5479 commit 62009e0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
31 changes: 20 additions & 11 deletions engines/twp/debugtools.cpp
Expand Up @@ -82,7 +82,6 @@ static void drawThreads() {
if (g_twp->_cutscene) {
Common::SharedPtr<ThreadBase> thread(g_twp->_cutscene);
SQStackInfos infos;
sq_stackinfos(thread->getThread(), 0, &infos);

ImGui::TableNextRow();
ImGui::TableNextColumn();
Expand All @@ -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) {
Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion engines/twp/syslib.cpp
Expand Up @@ -378,7 +378,7 @@ struct ActorTalking {
explicit ActorTalking(Common::SharedPtr<Object> obj) : _obj(obj) {}

bool operator()() {
return _obj->getTalking() && _obj->getTalking()->isEnabled();
return _obj->getTalking() && _obj->getTalking()->isEnabled() && _obj->_room == g_twp->_room;
}

private:
Expand Down
6 changes: 6 additions & 0 deletions engines/twp/thread.cpp
Expand Up @@ -275,4 +275,10 @@ bool Cutscene::isStopped() {
return sq_getvmstate(getThread()) == 0;
}

void Cutscene::cutsceneOverride() {
if (_state == csCheckEnd) {
_state = csOverride;
}
}

} // namespace Twp
2 changes: 1 addition & 1 deletion engines/twp/thread.h
Expand Up @@ -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; }
Expand Down

0 comments on commit 62009e0

Please sign in to comment.