[Scummvm-git-logs] scummvm master -> 3912308db94aad0f9c0333fb25c6507a73e1a585

sev- noreply at scummvm.org
Fri Nov 1 22:31:40 UTC 2024


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
f0674e1b03 QDENGINE: DT: Moved personages to a separate window and render in a table
3912308db9 QDENGINE: DT: Added more output to personages


Commit: f0674e1b034bf0c492b3bf8e53a4236aec0dc4dc
    https://github.com/scummvm/scummvm/commit/f0674e1b034bf0c492b3bf8e53a4236aec0dc4dc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-01T23:31:21+01:00

Commit Message:
QDENGINE: DT: Moved personages to a separate window and render in a table

Changed paths:
    engines/qdengine/debugger/debugtools.cpp
    engines/qdengine/debugger/dt-internal.h


diff --git a/engines/qdengine/debugger/debugtools.cpp b/engines/qdengine/debugger/debugtools.cpp
index 85ee29013e3..e084e95979d 100644
--- a/engines/qdengine/debugger/debugtools.cpp
+++ b/engines/qdengine/debugger/debugtools.cpp
@@ -419,25 +419,51 @@ void showSceneObjects() {
 		qdGameScene *scene;
 		qdGameDispatcher *dp = qdGameDispatcher::get_dispatcher();
 		if (dp && ((scene = dp->get_active_scene()))) {
-			if (!scene->getPersonages()->empty()) {
-				for (auto &it : *scene->getPersonages()) {
-					Common::String name = Common::String::format("p-%s", transCyrillic(it->name()));
-					if (ImGui::Selectable(name.c_str(), _state->_objectToDisplay == it->name())) {
+			if (!scene->object_list().empty()) {
+				for (auto &it : g_engine->_visible_objects) {
+					if (ImGui::Selectable((char *)transCyrillic(it->name()), _state->_objectToDisplay == it->name())) {
 						_state->_objectToDisplay = it->name();
 					}
-
-					ImGui::SameLine();
-
-					qdGameObjectState *st = it->get_state(it->cur_state());
-					ImGui::Text("%s", st ? qdGameObjectState::flag2str(st->flags(), true).c_str() : "<none>");
 				}
 			}
+		}
+	}
+	ImGui::End();
+}
 
-			if (!scene->object_list().empty()) {
-				for (auto &it : g_engine->_visible_objects) {
-					if (ImGui::Selectable((char *)transCyrillic(it->name()), _state->_objectToDisplay == it->name())) {
-						_state->_objectToDisplay = it->name();
+void showScenePersonages() {
+	if (!_state->_showScenePersonages)
+		return;
+
+	ImGui::SetNextWindowPos(ImVec2(20, 20), ImGuiCond_FirstUseEver);
+	ImGui::SetNextWindowSize(ImVec2(300, 250), ImGuiCond_FirstUseEver);
+
+	if (ImGui::Begin("Scene Personages", &_state->_showScenePersonages)) {
+		qdGameScene *scene;
+		qdGameDispatcher *dp = qdGameDispatcher::get_dispatcher();
+		if (dp && ((scene = dp->get_active_scene()))) {
+			if (!scene->getPersonages()->empty()) {
+				if (ImGui::BeginTable("Personages", 2, ImGuiTableFlags_Borders)) {
+					ImGuiTableFlags flags = ImGuiTableColumnFlags_WidthFixed;
+					ImGui::TableSetupColumn("Name", flags);
+					ImGui::TableSetupColumn("Flags", flags);
+
+					ImGui::TableHeadersRow();
+
+					for (auto &it : *scene->getPersonages()) {
+						ImGui::TableNextRow();
+
+						ImGui::TableNextColumn();
+
+						ImGui::Text((char *)transCyrillic(it->name()));
+
+						ImGui::TableNextColumn();
+
+						qdGameObjectState *st = it->get_state(it->cur_state());
+						ImGui::Text("%s", st ? qdGameObjectState::flag2str(st->flags(), true).c_str() : "<none>");
 					}
+
+					ImGui::EndTable();
 				}
 			}
 		}
@@ -494,6 +520,7 @@ void onImGuiRender() {
 
 			ImGui::MenuItem("Archives", NULL, &_state->_showArchives);
 			ImGui::MenuItem("Scene Objects", NULL, &_state->_showSceneObjects);
+			ImGui::MenuItem("Scene Personages", NULL, &_state->_showScenePersonages);
 			ImGui::EndMenu();
 		}
 		ImGui::EndMainMenuBar();
@@ -501,6 +528,7 @@ void onImGuiRender() {
 
 	showArchives();
 	showSceneObjects();
+	showScenePersonages();
 }
 
 void onImGuiCleanup() {
diff --git a/engines/qdengine/debugger/dt-internal.h b/engines/qdengine/debugger/dt-internal.h
index 9f8da7b7523..b4809e942c3 100644
--- a/engines/qdengine/debugger/dt-internal.h
+++ b/engines/qdengine/debugger/dt-internal.h
@@ -48,6 +48,7 @@ struct FileTree {
 typedef struct ImGuiState {
 	bool _showArchives = false;
 	bool _showSceneObjects = false;
+	bool _showScenePersonages = false;
 
 	Common::HashMap<Common::String, ImGuiImage> _frames;
 


Commit: 3912308db94aad0f9c0333fb25c6507a73e1a585
    https://github.com/scummvm/scummvm/commit/3912308db94aad0f9c0333fb25c6507a73e1a585
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-11-01T23:31:21+01:00

Commit Message:
QDENGINE: DT: Added more output to personages

Changed paths:
    engines/qdengine/debugger/debugtools.cpp
    engines/qdengine/qdcore/qd_animation.cpp
    engines/qdengine/qdcore/qd_animation.h
    engines/qdengine/qdcore/qd_game_object_moving.cpp
    engines/qdengine/qdcore/qd_game_object_moving.h


diff --git a/engines/qdengine/debugger/debugtools.cpp b/engines/qdengine/debugger/debugtools.cpp
index e084e95979d..526bfa93fc6 100644
--- a/engines/qdengine/debugger/debugtools.cpp
+++ b/engines/qdengine/debugger/debugtools.cpp
@@ -443,10 +443,14 @@ void showScenePersonages() {
 		qdGameDispatcher *dp = qdGameDispatcher::get_dispatcher();
 		if (dp && ((scene = dp->get_active_scene()))) {
 			if (!scene->getPersonages()->empty()) {
-				if (ImGui::BeginTable("Personages", 2, ImGuiTableFlags_Borders)) {
+				if (ImGui::BeginTable("Personages", 6, ImGuiTableFlags_Borders)) {
 					ImGuiTableFlags flags = ImGuiTableColumnFlags_WidthFixed;
 					ImGui::TableSetupColumn("Name", flags);
 					ImGui::TableSetupColumn("Flags", flags);
+					ImGui::TableSetupColumn("Control", flags);
+					ImGui::TableSetupColumn("Movement", flags);
+					ImGui::TableSetupColumn("Anim Flags", flags);
+					ImGui::TableSetupColumn("Anim Status", flags);
 
 					ImGui::TableHeadersRow();
 
@@ -461,6 +465,23 @@ void showScenePersonages() {
 
 						qdGameObjectState *st = it->get_state(it->cur_state());
 						ImGui::Text("%s", st ? qdGameObjectState::flag2str(st->flags(), true).c_str() : "<none>");
+
+						ImGui::TableNextColumn();
+
+						ImGui::Text(qdGameObjectMoving::control2str(it->get_control_types(), true).c_str());
+
+						ImGui::TableNextColumn();
+
+						ImGui::Text(qdGameObjectMoving::movement2str(it->get_movement_mode(), true).c_str());
+
+						qdAnimation *anim = it->get_animation();
+						ImGui::TableNextColumn();
+
+						ImGui::Text(qdAnimation::flag2str(anim->flags(), true).c_str());
+
+						ImGui::TableNextColumn();
+
+						ImGui::Text(qdAnimation::status2str(anim->status(), true).c_str());
 					}
 
 					ImGui::EndTable();
diff --git a/engines/qdengine/qdcore/qd_animation.cpp b/engines/qdengine/qdcore/qd_animation.cpp
index e7b9e24e0c4..62640637d2b 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -1200,7 +1200,7 @@ struct FlagsList {
 	defFlag(QD_ANIMATION_FLAG_TILE_COMPRESS),
 };
 
-Common::String qdAnimation::flag2str(int fl) {
+Common::String qdAnimation::flag2str(int fl, bool truncate) {
 	Common::String res;
 
 	for (int i = 0; i < ARRAYSIZE(flagList); i++) {
@@ -1208,7 +1208,7 @@ Common::String qdAnimation::flag2str(int fl) {
 			if (!res.empty())
 				res += " | ";
 
-			res += flagList[i].s;
+			res += &flagList[i].s[truncate ? 18 : 0];
 
 			fl &= ~flagList[i].f;
 		}
@@ -1220,5 +1220,22 @@ Common::String qdAnimation::flag2str(int fl) {
 	return res;
 }
 
+#define defEnum(x) #x
+
+static const char *statusList[] = {
+	defEnum(QD_ANIMATION_STOPPED),
+	defEnum(QD_ANIMATION_PLAYING),
+	defEnum(QD_ANIMATION_PAUSED),
+	defEnum(QD_ANIMATION_END_PLAYING),
+};
+
+Common::String qdAnimation::status2str(int fl, bool truncate) {
+	if (fl > ARRAYSIZE(statusList) || fl < 0)
+		return Common::String::format("<%d>", fl);
+
+	return Common::String(&statusList[fl][truncate ? 13 : 0]);
+}
+
+
 
 } // namespace QDEngine
diff --git a/engines/qdengine/qdcore/qd_animation.h b/engines/qdengine/qdcore/qd_animation.h
index 1169cc82681..7f153a1fa03 100644
--- a/engines/qdengine/qdcore/qd_animation.h
+++ b/engines/qdengine/qdcore/qd_animation.h
@@ -273,7 +273,8 @@ public:
 			return _tileAnimation;
 	}
 
-	static Common::String flag2str(int fl);
+	static Common::String flag2str(int fl, bool truncate = false);
+	static Common::String status2str(int fl, bool truncate = false);
 
 private:
 	int _sx;
diff --git a/engines/qdengine/qdcore/qd_game_object_moving.cpp b/engines/qdengine/qdcore/qd_game_object_moving.cpp
index 964c8ac11c8..e030e898e33 100644
--- a/engines/qdengine/qdcore/qd_game_object_moving.cpp
+++ b/engines/qdengine/qdcore/qd_game_object_moving.cpp
@@ -2730,7 +2730,7 @@ struct FlagsList {
 	defFlag(CONTROL_ANIMATED_ROTATION),
 };
 
-Common::String qdGameObjectMoving::control2str(int fl) const {
+Common::String qdGameObjectMoving::control2str(int fl, bool truncate) {
 	Common::String res;
 
 	for (int i = 0; i < ARRAYSIZE(controlList); i++) {
@@ -2738,7 +2738,7 @@ Common::String qdGameObjectMoving::control2str(int fl) const {
 			if (!res.empty())
 				res += " | ";
 
-			res += controlList[i].s;
+			res += &controlList[i].s[truncate ? 8 : 0];
 
 			fl &= ~controlList[i].f;
 		}
@@ -2750,4 +2750,21 @@ Common::String qdGameObjectMoving::control2str(int fl) const {
 	return res;
 }
 
+#define defEnum(x) #x
+
+static const char *movementList[] = {
+	defEnum(MOVEMENT_MODE_STOP),
+	defEnum(MOVEMENT_MODE_TURN),
+	defEnum(MOVEMENT_MODE_START),
+	defEnum(MOVEMENT_MODE_MOVE),
+	defEnum(MOVEMENT_MODE_END),
+};
+
+Common::String qdGameObjectMoving::movement2str(int fl, bool truncate) {
+	if (fl > ARRAYSIZE(movementList) || fl < 0)
+		return Common::String::format("<%d>", fl);
+
+	return Common::String(&movementList[fl][truncate ? 14 : 0]);
+}
+
 } // namespace QDEngine
diff --git a/engines/qdengine/qdcore/qd_game_object_moving.h b/engines/qdengine/qdcore/qd_game_object_moving.h
index 1070bf45c40..eb5b7ef7cff 100644
--- a/engines/qdengine/qdcore/qd_game_object_moving.h
+++ b/engines/qdengine/qdcore/qd_game_object_moving.h
@@ -108,6 +108,9 @@ public:
 		_control_types &= ~type;
 	}
 
+	int get_control_types() { return _control_types; }
+	int get_movement_mode() { return _movement_mode; }
+
 	qdGameObjectStateWalk::movement_type_t movement_type() const;
 
 	bool is_walkable(const Vect3f &pos) const;
@@ -350,7 +353,8 @@ public:
 	void set_path_attributes(int attr) const;
 	void clear_path_attributes(int attr) const;
 
-	Common::String control2str(int control) const;
+	static Common::String control2str(int control, bool truncate = false);
+	static Common::String movement2str(int movement, bool truncate = false);
 
 protected:
 




More information about the Scummvm-git-logs mailing list