[Scummvm-git-logs] scummvm master -> 97eddadbe8fe4c0484e71d45fce4597e7ea6b65b

sev- noreply at scummvm.org
Fri Aug 23 16:38:08 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:
97eddadbe8 QDENGINE: Added more human-readable data to XML


Commit: 97eddadbe8fe4c0484e71d45fce4597e7ea6b65b
    https://github.com/scummvm/scummvm/commit/97eddadbe8fe4c0484e71d45fce4597e7ea6b65b
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T18:37:38+02:00

Commit Message:
QDENGINE: Added more human-readable data to XML

Changed paths:
    engines/qdengine/qdcore/qd_condition.cpp
    engines/qdengine/qdcore/qd_condition.h
    engines/qdengine/qdcore/qd_named_object_reference.cpp


diff --git a/engines/qdengine/qdcore/qd_condition.cpp b/engines/qdengine/qdcore/qd_condition.cpp
index cece5b3c961..54b6884c78b 100644
--- a/engines/qdengine/qdcore/qd_condition.cpp
+++ b/engines/qdengine/qdcore/qd_condition.cpp
@@ -345,7 +345,11 @@ bool qdCondition::save_script(Common::WriteStream &fh, int indent) const {
 		fh.writeString("\t");
 	}
 
-	fh.writeString(Common::String::format("<condition type=\"%d\"", _type));
+	if (debugChannelSet(-1, kDebugLog)) {
+		fh.writeString(Common::String::format("<condition type=\"%s\"", type2str(_type)));
+	} else {
+		fh.writeString(Common::String::format("<condition type=\"%d\"", _type));
+	}
 
 	if (is_inversed()) {
 		fh.writeString(" condition_inverse=\"1\"");
@@ -481,4 +485,65 @@ bool qdCondition::init() {
 	}
 	return true;
 }
+
+const char *types[] = {
+	"CONDITION_TRUE",
+	"CONDITION_FALSE",
+	"CONDITION_MOUSE_CLICK",
+	"CONDITION_MOUSE_OBJECT_CLICK",
+	"CONDITION_OBJECT_IN_ZONE",
+	"CONDITION_PERSONAGE_WALK_DIRECTION",
+	"CONDITION_PERSONAGE_STATIC_DIRECTION",
+	"CONDITION_TIMER",
+	"CONDITION_MOUSE_DIALOG_CLICK",
+	"CONDITION_MINIGAME_STATE",
+	"CONDITION_OBJECT_STATE",
+	"CONDITION_MOUSE_ZONE_CLICK",
+	"CONDITION_MOUSE_OBJECT_ZONE_CLICK",
+	"CONDITION_OBJECT_STATE_WAS_ACTIVATED",
+	"CONDITION_OBJECT_STATE_WAS_NOT_ACTIVATED",
+	"CONDITION_OBJECT_NOT_IN_STATE",
+	"CONDITION_OBJECTS_DISTANCE",
+	"CONDITION_PERSONAGE_ACTIVE",
+	"CONDITION_OBJECT_STATE_WAITING",
+	"CONDITION_OBJECT_STATE_ANIMATION_PHASE",
+	"CONDITION_OBJECT_PREV_STATE",
+	"CONDITION_STATE_TIME_GREATER_THAN_VALUE",
+	"CONDITION_STATE_TIME_GREATER_THAN_STATE_TIME",
+	"CONDITION_STATE_TIME_IN_INTERVAL",
+	"CONDITION_COUNTER_GREATER_THAN_VALUE",
+	"CONDITION_COUNTER_LESS_THAN_VALUE",
+	"CONDITION_COUNTER_GREATER_THAN_COUNTER",
+	"CONDITION_COUNTER_IN_INTERVAL",
+	"CONDITION_OBJECT_ON_PERSONAGE_WAY",
+	"CONDITION_KEYPRESS",
+	"CONDITION_ANY_PERSONAGE_IN_ZONE",
+	"CONDITION_MOUSE_RIGHT_CLICK",
+	"CONDITION_MOUSE_RIGHT_OBJECT_CLICK",
+	"CONDITION_MOUSE_RIGHT_ZONE_CLICK",
+	"CONDITION_MOUSE_RIGHT_OBJECT_ZONE_CLICK",
+	"CONDITION_OBJECT_HIDDEN",
+	"CONDITION_MOUSE_HOVER",
+	"CONDITION_MOUSE_OBJECT_HOVER",
+	"CONDITION_MOUSE_HOVER_ZONE",
+	"CONDITION_MOUSE_OBJECT_HOVER_ZONE",
+	"CONDITION_MOUSE_CLICK_FAILED",
+	"CONDITION_MOUSE_OBJECT_CLICK_FAILED",
+	"CONDITION_MOUSE_CLICK_EVENT",
+	"CONDITION_MOUSE_OBJECT_CLICK_EVENT",
+	"CONDITION_MOUSE_RIGHT_CLICK_EVENT",
+	"CONDITION_MOUSE_RIGHT_OBJECT_CLICK_EVENT",
+	"CONDITION_MOUSE_STATE_PHRASE_CLICK",
+	"CONDITION_OBJECT_IS_CLOSER",
+	"CONDITION_ANIMATED_OBJECT_IDLE_GREATER_THAN_VALUE",
+	"CONDITION_ANIMATED_OBJECTS_INTERSECTIONAL_BOUNDS",
+};
+
+const char *qdCondition::type2str(uint type) {
+	if (type > ARRAYSIZE(types))
+		return "???";
+
+	return types[type];
+}
+
 } // namespace QDEngine
diff --git a/engines/qdengine/qdcore/qd_condition.h b/engines/qdengine/qdcore/qd_condition.h
index 1674b17e409..9623f186614 100644
--- a/engines/qdengine/qdcore/qd_condition.h
+++ b/engines/qdengine/qdcore/qd_condition.h
@@ -492,6 +492,8 @@ public:
 	}
 	void set_type(ConditionType tp);
 
+	static const char *type2str(uint type);
+
 	bool put_value(int idx, const char *str);
 
 	bool is_click_condition() const {
diff --git a/engines/qdengine/qdcore/qd_named_object_reference.cpp b/engines/qdengine/qdcore/qd_named_object_reference.cpp
index f38792bcd94..ccb330ddc68 100644
--- a/engines/qdengine/qdcore/qd_named_object_reference.cpp
+++ b/engines/qdengine/qdcore/qd_named_object_reference.cpp
@@ -132,7 +132,10 @@ bool qdNamedObjectReference::save_script(Common::WriteStream &fh, int indent) co
 
 	fh.writeString(Common::String::format(" types=\"%d", num_levels()));
 	for (int i = 0; i < num_levels(); i++) {
-		fh.writeString(Common::String::format(" %d", _object_types[i]));
+		if (debugChannelSet(-1, kDebugLog))
+			fh.writeString(Common::String::format(" %s", objectType2str(_object_types[i])));
+		else
+			fh.writeString(Common::String::format(" %d", _object_types[i]));
 	}
 	fh.writeString("\"");
 	fh.writeString(">\r\n");




More information about the Scummvm-git-logs mailing list