[Scummvm-git-logs] scummvm master -> ec8ee5d1661e0feca8d7ab4786ef7dde699b75c6

sev- noreply at scummvm.org
Mon Sep 9 17:36:19 UTC 2024


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

Summary:
ec8ee5d166 QDENGINE: Dump animation flags in human-readable format in XML


Commit: ec8ee5d1661e0feca8d7ab4786ef7dde699b75c6
    https://github.com/scummvm/scummvm/commit/ec8ee5d1661e0feca8d7ab4786ef7dde699b75c6
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-09T19:35:47+02:00

Commit Message:
QDENGINE: Dump animation flags in human-readable format in XML

Changed paths:
    engines/qdengine/qdcore/qd_animation.cpp
    engines/qdengine/qdcore/qd_animation.h
    engines/qdengine/qdcore/qd_animation_info.cpp


diff --git a/engines/qdengine/qdcore/qd_animation.cpp b/engines/qdengine/qdcore/qd_animation.cpp
index e3d345295fd..6a731df78b0 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -1170,4 +1170,44 @@ uint32 qdAnimation::resource_data_size() const {
 	return size;
 }
 #endif
+
+#define defFlag(x) { x, #x }
+
+struct FlagsList {
+	int f;
+	const char *s;
+} static flagList[] = {
+	defFlag(QD_ANIMATION_FLAG_REFERENCE),
+	defFlag(QD_ANIMATION_FLAG_REFERENCE),
+	defFlag(QD_ANIMATION_FLAG_LOOP),
+	defFlag(QD_ANIMATION_FLAG_FLIP_HORIZONTAL),
+	defFlag(QD_ANIMATION_FLAG_FLIP_VERTICAL),
+	defFlag(QD_ANIMATION_FLAG_BLACK_FON),
+	defFlag(QD_ANIMATION_FLAG_SUPPRESS_ALPHA),
+	defFlag(QD_ANIMATION_FLAG_CROP),
+	defFlag(QD_ANIMATION_FLAG_COMPRESS),
+	defFlag(QD_ANIMATION_FLAG_TILE_COMPRESS),
+};
+
+Common::String qdAnimation::flag2str(int fl) {
+	Common::String res;
+
+	for (int i = 0; i < ARRAYSIZE(flagList); i++) {
+		if (fl & flagList[i].f) {
+			if (!res.empty())
+				res += " | ";
+
+			res += flagList[i].s;
+
+			fl &= ~flagList[i].f;
+		}
+	}
+
+	if (fl)
+		res += Common::String::format(" | %x", fl);
+
+	return res;
+}
+
+
 } // namespace QDEngine
diff --git a/engines/qdengine/qdcore/qd_animation.h b/engines/qdengine/qdcore/qd_animation.h
index 265d22c1cc8..1169cc82681 100644
--- a/engines/qdengine/qdcore/qd_animation.h
+++ b/engines/qdengine/qdcore/qd_animation.h
@@ -273,6 +273,8 @@ public:
 			return _tileAnimation;
 	}
 
+	static Common::String flag2str(int fl);
+
 private:
 	int _sx;
 	int _sy;
diff --git a/engines/qdengine/qdcore/qd_animation_info.cpp b/engines/qdengine/qdcore/qd_animation_info.cpp
index 1360ffcf13e..133761a5bcf 100644
--- a/engines/qdengine/qdcore/qd_animation_info.cpp
+++ b/engines/qdengine/qdcore/qd_animation_info.cpp
@@ -19,6 +19,8 @@
  *
  */
 
+#include "common/debug.h"
+
 #include "qdengine/qd_fwd.h"
 #include "qdengine/xmath.h"
 
@@ -70,8 +72,12 @@ void qdAnimationInfo::load_script(const xml::tag *p) {
 bool qdAnimationInfo::save_script(Common::WriteStream &fh, int indent) const {
 	Common::String res;
 
-	if (flags())
-		res += Common::String::format(" flags=\"%d\"", flags());
+	if (flags()) {
+		if (debugChannelSet(-1, kDebugLog))
+			res += Common::String::format(" flags=\"%s\"", qdAnimation::flag2str(flags()).c_str());
+		else
+			res += Common::String::format(" flags=\"%d\"", flags());
+	}
 
 	if (_speed > 0.01f)
 		res += Common::String::format(" speed=\"%f\"", _speed);




More information about the Scummvm-git-logs mailing list