[Scummvm-git-logs] scummvm master -> 51bd29ca85526b069ff67dbf50eae3c9b235b180
sev-
noreply at scummvm.org
Mon May 6 17:51:44 UTC 2024
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b2d43d54d8 DIRECTOR: DEBUGGER: Placeholder for functions list
896b20e110 DIRECTOR: DEBUGGER: Made Functions list collapsable
0757c0cbae DIRECTOR: DEBUGGER: Improve functions list usability
51bd29ca85 DIRECTOR: DEBUGGER: Better handling for Script Casts
Commit: b2d43d54d8635a66439a9cefa00e7b1c0b08336b
https://github.com/scummvm/scummvm/commit/b2d43d54d8635a66439a9cefa00e7b1c0b08336b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-06T19:49:11+02:00
Commit Message:
DIRECTOR: DEBUGGER: Placeholder for functions list
Changed paths:
engines/director/debugtools.cpp
diff --git a/engines/director/debugtools.cpp b/engines/director/debugtools.cpp
index 1b3bad7964c..c7c19767ac3 100644
--- a/engines/director/debugtools.cpp
+++ b/engines/director/debugtools.cpp
@@ -65,6 +65,7 @@ typedef struct ImGuiState {
bool _showVars = false;
bool _showChannels = false;
bool _showCast = false;
+ bool _showFuncList = false;
Common::List<CastMemberID> _scripts;
Common::HashMap<Common::String, bool, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _breakpoints;
int _prevFrame = -1;
@@ -773,7 +774,10 @@ static bool showScript(CastMemberID &id) {
return true;
}
-static void showScripts() {
+/**
+ * Display all open scripts
+ */
+static void displayScripts() {
if (_state->_scripts.empty())
return;
@@ -785,6 +789,45 @@ static void showScripts() {
}
}
+static void showFuncList() {
+ if (!_state->_showFuncList)
+ return;
+
+ ImGui::SetNextWindowPos(ImVec2(20, 20), ImGuiCond_FirstUseEver);
+ ImGui::SetNextWindowSize(ImVec2(120, 120), ImGuiCond_FirstUseEver);
+ if (ImGui::Begin("Functions", &_state->_showFuncList)) {
+ Lingo *lingo = g_director->getLingo();
+ Movie *movie = g_director->getCurrentMovie();
+ Score *score = movie->getScore();
+ ScriptContext *csc = lingo->_state->context;
+ if (csc) {
+ ImGui::Text("Functions attached to frame %d:", score->getCurrentFrameNum());
+ ImGui::Text(" %d: %s", csc->_id, csc->formatFunctionList(" ").c_str());
+ } else {
+ ImGui::Text("Functions attached to frame %d:", score->getCurrentFrameNum());
+ ImGui::Text(" [empty]");
+ }
+
+ for (auto it : *movie->getCasts()) {
+ ImGui::Text("Cast %d functions:", it._key);
+ Cast *cast = it._value;
+ if (cast && cast->_lingoArchive) {
+ ImGui::Text("%s", cast->_lingoArchive->formatFunctionList(" ").c_str());
+ } else {
+ ImGui::Text(" [empty]\n");
+ }
+ }
+ ImGui::Text("Shared cast functions:\n");
+ Cast *sharedCast = movie->getSharedCast();
+ if (sharedCast && sharedCast->_lingoArchive) {
+ ImGui::Text("%s", sharedCast->_lingoArchive->formatFunctionList(" ").c_str());
+ } else {
+ ImGui::Text(" [empty]");
+ }
+ }
+ ImGui::End();
+}
+
void onImGuiInit() {
ImGuiIO &io = ImGui::GetIO();
io.Fonts->AddFontDefault();
@@ -821,17 +864,21 @@ void onImGuiRender() {
ImGui::MenuItem("Vars", NULL, &_state->_showVars);
ImGui::MenuItem("Channels", NULL, &_state->_showChannels);
ImGui::MenuItem("Cast", NULL, &_state->_showCast);
+ ImGui::MenuItem("Functions", NULL, &_state->_showFuncList);
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
}
+ displayScripts();
+
showControlPanel();
showVars();
showCallStack();
showChannels();
- showScripts();
+ displayScripts();
showCast();
+ showFuncList();
}
void onImGuiCleanup() {
Commit: 896b20e110e6ecc2ca325272e18e513ba53eae0b
https://github.com/scummvm/scummvm/commit/896b20e110e6ecc2ca325272e18e513ba53eae0b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-06T19:49:11+02:00
Commit Message:
DIRECTOR: DEBUGGER: Made Functions list collapsable
Changed paths:
engines/director/debugtools.cpp
diff --git a/engines/director/debugtools.cpp b/engines/director/debugtools.cpp
index c7c19767ac3..3574431d32d 100644
--- a/engines/director/debugtools.cpp
+++ b/engines/director/debugtools.cpp
@@ -800,29 +800,42 @@ static void showFuncList() {
Movie *movie = g_director->getCurrentMovie();
Score *score = movie->getScore();
ScriptContext *csc = lingo->_state->context;
- if (csc) {
- ImGui::Text("Functions attached to frame %d:", score->getCurrentFrameNum());
- ImGui::Text(" %d: %s", csc->_id, csc->formatFunctionList(" ").c_str());
- } else {
- ImGui::Text("Functions attached to frame %d:", score->getCurrentFrameNum());
- ImGui::Text(" [empty]");
+ if (ImGui::TreeNode("Functions attached to current frame")) {
+ ImGui::Text("Frame %d:", score->getCurrentFrameNum());
+ if (csc) {
+ ImGui::Text(" %d: %s", csc->_id, csc->formatFunctionList(" ").c_str());
+ } else {
+ ImGui::Text(" [empty]");
+ }
+ ImGui::TreePop();
}
- for (auto it : *movie->getCasts()) {
- ImGui::Text("Cast %d functions:", it._key);
- Cast *cast = it._value;
- if (cast && cast->_lingoArchive) {
- ImGui::Text("%s", cast->_lingoArchive->formatFunctionList(" ").c_str());
- } else {
- ImGui::Text(" [empty]\n");
+ if (ImGui::TreeNode("Cast functions")) {
+ for (auto it : *movie->getCasts()) {
+ Common::String header = Common::String::format("Cast %d functions", it._key);
+ if (ImGui::TreeNode(header.c_str())) {
+ Cast *cast = it._value;
+ if (cast && cast->_lingoArchive) {
+ ImGui::Text("%s", cast->_lingoArchive->formatFunctionList(" ").c_str());
+ } else {
+ ImGui::Text(" [empty]");
+ }
+
+ ImGui::TreePop();
+ }
}
+ ImGui::TreePop();
}
- ImGui::Text("Shared cast functions:\n");
- Cast *sharedCast = movie->getSharedCast();
- if (sharedCast && sharedCast->_lingoArchive) {
- ImGui::Text("%s", sharedCast->_lingoArchive->formatFunctionList(" ").c_str());
- } else {
- ImGui::Text(" [empty]");
+
+ if (ImGui::TreeNode("Shared cast functions")) {
+ Cast *sharedCast = movie->getSharedCast();
+ if (sharedCast && sharedCast->_lingoArchive) {
+ ImGui::Text("%s", sharedCast->_lingoArchive->formatFunctionList(" ").c_str());
+ } else {
+ ImGui::Text(" [empty]");
+ }
+
+ ImGui::TreePop();
}
}
ImGui::End();
Commit: 0757c0cbae1cd8bcd4c2a05dfcdf7050d02ca265
https://github.com/scummvm/scummvm/commit/0757c0cbae1cd8bcd4c2a05dfcdf7050d02ca265
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-06T19:49:12+02:00
Commit Message:
DIRECTOR: DEBUGGER: Improve functions list usability
Changed paths:
engines/director/debugtools.cpp
diff --git a/engines/director/debugtools.cpp b/engines/director/debugtools.cpp
index 3574431d32d..d1481a09072 100644
--- a/engines/director/debugtools.cpp
+++ b/engines/director/debugtools.cpp
@@ -810,6 +810,7 @@ static void showFuncList() {
ImGui::TreePop();
}
+ ImGui::SetNextItemOpen(true, ImGuiCond_Once);
if (ImGui::TreeNode("Cast functions")) {
for (auto it : *movie->getCasts()) {
Common::String header = Common::String::format("Cast %d functions", it._key);
@@ -827,6 +828,7 @@ static void showFuncList() {
ImGui::TreePop();
}
+ ImGui::SetNextItemOpen(true, ImGuiCond_Once);
if (ImGui::TreeNode("Shared cast functions")) {
Cast *sharedCast = movie->getSharedCast();
if (sharedCast && sharedCast->_lingoArchive) {
Commit: 51bd29ca85526b069ff67dbf50eae3c9b235b180
https://github.com/scummvm/scummvm/commit/51bd29ca85526b069ff67dbf50eae3c9b235b180
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-06T19:50:14+02:00
Commit Message:
DIRECTOR: DEBUGGER: Better handling for Script Casts
Changed paths:
engines/director/debugtools.cpp
engines/director/movie.cpp
engines/director/movie.h
diff --git a/engines/director/debugtools.cpp b/engines/director/debugtools.cpp
index d1481a09072..a9c2299d0fc 100644
--- a/engines/director/debugtools.cpp
+++ b/engines/director/debugtools.cpp
@@ -20,6 +20,7 @@
*/
#define IMGUI_DEFINE_MATH_OPERATORS
+
#include "backends/imgui/imgui.h"
#include "backends/imgui/imgui_fonts.h"
#include "common/config-manager.h"
@@ -66,7 +67,7 @@ typedef struct ImGuiState {
bool _showChannels = false;
bool _showCast = false;
bool _showFuncList = false;
- Common::List<CastMemberID> _scripts;
+ Common::List<CastMemberID> _scriptCasts;
Common::HashMap<Common::String, bool, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _breakpoints;
int _prevFrame = -1;
} ImGuiState;
@@ -546,9 +547,9 @@ static ImVec4 convertColor(uint32 color) {
return ImGui::ColorConvertU32ToFloat4(color);
}
-static void addScriptToDisplay(CastMemberID &id) {
- _state->_scripts.remove(id);
- _state->_scripts.push_back(id);
+static void addScriptCastToDisplay(CastMemberID &id) {
+ _state->_scriptCasts.remove(id);
+ _state->_scriptCasts.push_back(id);
}
static void showChannels() {
@@ -646,7 +647,7 @@ static void showChannels() {
ImGui::TextColored(ImVec4(0.5f, 0.5f, 1.0f, 1.0f), "%s", sprite._scriptId.asString().c_str());
if (ImGui::IsItemClicked(0))
- addScriptToDisplay(sprite._scriptId);
+ addScriptCastToDisplay(sprite._scriptId);
}
ImGui::TableNextColumn();
ImGui::Text("0x%x", sprite._colorcode);
@@ -740,7 +741,7 @@ static void renderScript(Symbol &sym) {
}
}
-static bool showScript(CastMemberID &id) {
+static bool showScriptCast(CastMemberID &id) {
Common::String wName("Script ");
wName += id.asString();
@@ -777,13 +778,13 @@ static bool showScript(CastMemberID &id) {
/**
* Display all open scripts
*/
-static void displayScripts() {
- if (_state->_scripts.empty())
+static void displayScriptCasts() {
+ if (_state->_scriptCasts.empty())
return;
- for (Common::List<CastMemberID>::iterator scr = _state->_scripts.begin(); scr != _state->_scripts.end(); ) {
- if (!showScript(*scr))
- scr = _state->_scripts.erase(scr);
+ for (Common::List<CastMemberID>::iterator scr = _state->_scriptCasts.begin(); scr != _state->_scriptCasts.end(); ) {
+ if (!showScriptCast(*scr))
+ scr = _state->_scriptCasts.erase(scr);
else
scr++;
}
@@ -885,13 +886,12 @@ void onImGuiRender() {
ImGui::EndMainMenuBar();
}
- displayScripts();
+ displayScriptCasts();
showControlPanel();
showVars();
showCallStack();
showChannels();
- displayScripts();
showCast();
showFuncList();
}
diff --git a/engines/director/movie.cpp b/engines/director/movie.cpp
index 620a788d972..dff39e6930e 100644
--- a/engines/director/movie.cpp
+++ b/engines/director/movie.cpp
@@ -416,6 +416,19 @@ CastMember *Movie::getCastMember(CastMemberID memberID) {
return result;
}
+Cast *Movie::getCast(CastMemberID memberID) {
+ if (memberID.castLib == SHARED_CAST_LIB)
+ return _sharedCast;
+
+ if (_casts.contains(memberID.castLib)) {
+ return _casts.getVal(memberID.castLib);
+ } else if (memberID.castLib != 0) {
+ warning("Movie::getCast: Unknown castLib %d", memberID.castLib);
+ return nullptr;
+ }
+ return nullptr;
+}
+
CastMember* Movie::createOrReplaceCastMember(CastMemberID memberID, CastMember* cast) {
warning("Movie::createOrReplaceCastMember: stubbed: functions only handles create");
CastMember *result = nullptr;
diff --git a/engines/director/movie.h b/engines/director/movie.h
index ffcdcb7ad61..ed63c376e98 100644
--- a/engines/director/movie.h
+++ b/engines/director/movie.h
@@ -23,6 +23,7 @@
#define DIRECTOR_MOVIE_H
#define DEFAULT_CAST_LIB 1
+#define SHARED_CAST_LIB -1337
#define CAST_LIB_OFFSET 1023
namespace Common {
@@ -99,6 +100,7 @@ public:
Window *getWindow() const { return _window; }
DirectorEngine *getVM() const { return _vm; }
Cast *getCast() const { return _casts.getValOrDefault(DEFAULT_CAST_LIB, nullptr); }
+ Cast *getCast(CastMemberID memberID);
Cast *getSharedCast() const { return _sharedCast; }
const Common::HashMap<int, Cast *> *getCasts() const { return &_casts; }
Score *getScore() const { return _score; }
More information about the Scummvm-git-logs
mailing list