[Scummvm-git-logs] scummvm master -> 3542482bd49c13815f24d49b6711a25126935ffe

sev- noreply at scummvm.org
Wed May 28 09:13:14 UTC 2025


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

Summary:
ae69cc3fba QDENGINE: Print event, event activation types as strings in XML
3542482bd4 QDENGINE: Print state mode types as strings in XML


Commit: ae69cc3fbadd6fdd8a43452f88c4a0424c12b49a
    https://github.com/scummvm/scummvm/commit/ae69cc3fbadd6fdd8a43452f88c4a0424c12b49a
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-05-28T11:13:10+02:00

Commit Message:
QDENGINE: Print event, event activation types as strings in XML

Changed paths:
    engines/qdengine/qdcore/qd_interface_element_state.cpp
    engines/qdengine/qdcore/qd_interface_element_state.h


diff --git a/engines/qdengine/qdcore/qd_interface_element_state.cpp b/engines/qdengine/qdcore/qd_interface_element_state.cpp
index 5bf7d0c5e97..5c9b0564edf 100644
--- a/engines/qdengine/qdcore/qd_interface_element_state.cpp
+++ b/engines/qdengine/qdcore/qd_interface_element_state.cpp
@@ -73,6 +73,60 @@ qdInterfaceElementState &qdInterfaceElementState::operator = (const qdInterfaceE
 	return *this;
 }
 
+#define defEnum(x) #x
+
+static const char *eventList[] = {
+	defEnum(EVENT_NONE),
+	defEnum(EVENT_EXIT),
+	defEnum(EVENT_LOAD_SCENE),
+	defEnum(EVENT_SAVE_GAME),
+	defEnum(EVENT_NEW_GAME),
+	defEnum(EVENT_CHANGE_INTERFACE_SCREEN),
+	defEnum(EVENT_CHANGE_PERSONAGE),
+	defEnum(EVENT_TMP_HIDE_ELEMENT),
+	defEnum(EVENT_HIDE_ELEMENT),
+	defEnum(EVENT_SHOW_ELEMENT),
+	defEnum(EVENT_RESUME_GAME),
+	defEnum(EVENT_SET_SAVE_MODE),
+	defEnum(EVENT_SET_LOAD_MODE),
+	defEnum(EVENT_ACTIVATE_PERSONAGE),
+	defEnum(EVENT_PREV_ELEMENT_STATE),
+	defEnum(EVENT_NEXT_ELEMENT_STATE),
+	defEnum(EVENT_MAIN_MENU),
+	defEnum(EVENT_PLAY_VIDEO),
+	defEnum(EVENT_BUTTON_STATE),
+	defEnum(EVENT_CLEAR_MOUSE),
+	defEnum(EVENT_SCROLL_LEFT),
+	defEnum(EVENT_SCROLL_RIGHT),
+	defEnum(EVENT_SCROLL_UP),
+	defEnum(EVENT_SCROLL_DOWN),
+	defEnum(EVENT_SHOW_INTERFACE_SCREEN_AS_MODAL),
+	defEnum(EVENT_MODAL_OK),
+	defEnum(EVENT_MODAL_CANCEL),
+	defEnum(EVENT_HALL_OF_FAME_PLAYER),
+	defEnum(EVENT_HALL_OF_FAME_SCORE),
+	defEnum(EVENT_HALL_OF_FAME_CUR_SCORE),
+};
+
+static const char *eventActivationList[] = {
+	defEnum(EVENT_ACTIVATION_CLICK),
+	defEnum(EVENT_ACTIVATION_HOVER),
+};
+
+Common::String qdInterfaceElementState::event2Str(int fl, bool truncate) const {
+	if (fl >= ARRAYSIZE(eventList) || fl < 0)
+		return Common::String::format("<%d>", fl);
+
+	return Common::String(&eventList[fl][truncate ? 6 : 0]);
+}
+
+Common::String qdInterfaceElementState::eventActivation2Str(int fl, bool truncate) const {
+	if (fl >= ARRAYSIZE(eventActivationList) || fl < 0)
+		return Common::String::format("<%d>", fl);
+
+	return Common::String(&eventActivationList[fl][truncate ? 17 : 0]);
+}
+
 bool qdInterfaceElementState::save_script(Common::WriteStream &fh, int indent) const {
 	for (int i = 0; i < indent; i++) {
 		fh.writeString("\t");
@@ -90,7 +144,11 @@ bool qdInterfaceElementState::save_script(Common::WriteStream &fh, int indent) c
 		for (int i = 0; i <= indent; i++) {
 			fh.writeString("\t");
 		}
-		fh.writeString(Common::String::format("<event type=\"%d\"", int(_events[j].event())));
+		if (debugChannelSet(-1, kDebugLog)) {
+			fh.writeString(Common::String::format("<event type=\"%s\"", event2Str(_events[j].event()).c_str()));
+		} else {
+			fh.writeString(Common::String::format("<event type=\"%d\"", int(_events[j].event())));
+		}
 
 		if (_events[j].has_data()) {
 			fh.writeString(Common::String::format(" event_data=\"%s\"", qdscr_XML_string(_events[j].event_data())));
@@ -101,7 +159,11 @@ bool qdInterfaceElementState::save_script(Common::WriteStream &fh, int indent) c
 		}
 
 		if (_events[j].activation() != qdInterfaceEvent::EVENT_ACTIVATION_CLICK) {
-			fh.writeString(Common::String::format(" activation_type=\"%d\"", (int)_events[j].activation()));
+			if (debugChannelSet(-1, kDebugLog)) {
+				fh.writeString(Common::String::format(" activation_type=\"%s\"", eventActivation2Str((int)_events[j].activation()).c_str()));
+			} else {
+				fh.writeString(Common::String::format(" activation_type=\"%d\"", (int)_events[j].activation()));
+			}
 		}
 
 		fh.writeString("/>\r\n");
diff --git a/engines/qdengine/qdcore/qd_interface_element_state.h b/engines/qdengine/qdcore/qd_interface_element_state.h
index 25f87a99db6..fcfa704063c 100644
--- a/engines/qdengine/qdcore/qd_interface_element_state.h
+++ b/engines/qdengine/qdcore/qd_interface_element_state.h
@@ -235,6 +235,9 @@ public:
 	//! Высвобождает ресурсы, связанные с состоянием (анимацию и звук).
 	bool unregister_resources();
 
+	Common::String event2Str(int fl, bool truncate = false) const;
+	Common::String eventActivation2Str(int fl, bool truncate = false) const;
+
 	//! Запись данных в скрипт.
 	bool save_script(Common::WriteStream &fh, int indent = 0) const;
 	//! Загрузка данных из скрипта.


Commit: 3542482bd49c13815f24d49b6711a25126935ffe
    https://github.com/scummvm/scummvm/commit/3542482bd49c13815f24d49b6711a25126935ffe
Author: Alikhan Balpykov (luxrage1990 at gmail.com)
Date: 2025-05-28T11:13:10+02:00

Commit Message:
QDENGINE: Print state mode types as strings in XML

Changed paths:
    engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
    engines/qdengine/qdcore/qd_interface_element_state_mode.h


diff --git a/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp b/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
index 261ef6d2039..eaf3c2f46a6 100644
--- a/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
+++ b/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
@@ -70,11 +70,31 @@ void qdInterfaceElementStateMode::set_animation_file(const Common::Path &name) {
 	_animation_file = name;
 }
 
+#define defEnum(x) #x
+
+static const char *stateModeList[] = {
+	defEnum(DEFAULT_MODE),
+	defEnum(MOUSE_HOVER_MODE),
+	defEnum(EVENT_MODE),
+};
+
+Common::String qdInterfaceElementStateMode::stateMode2Str(int fl, bool truncate) const {
+	if (fl >= ARRAYSIZE(stateModeList) || fl < 0)
+		return Common::String::format("<%d>", fl);
+
+	Common::String out(stateModeList[fl]);
+	return truncate ? out.substr(0, out.size() - 5) : out;
+}
+
 bool qdInterfaceElementStateMode::save_script(Common::WriteStream &fh, int type_id, int indent) const {
 	for (int i = 0; i < indent; i++) {
 		fh.writeString("\t");
 	}
-	fh.writeString(Common::String::format("<state_mode type=\"%d\"", type_id));
+	if (debugChannelSet(-1, kDebugLog)) {
+		fh.writeString(Common::String::format("<state_mode type=\"%s\"", stateMode2Str(type_id).c_str()));
+	} else {
+		fh.writeString(Common::String::format("<state_mode type=\"%d\"", type_id));
+	}
 
 	if (has_animation()) {
 		fh.writeString(Common::String::format(" animation=\"%s\"", qdscr_XML_string(animation_file().toString('\\'))));
diff --git a/engines/qdengine/qdcore/qd_interface_element_state_mode.h b/engines/qdengine/qdcore/qd_interface_element_state_mode.h
index 36161676801..f439e4fedd9 100644
--- a/engines/qdengine/qdcore/qd_interface_element_state_mode.h
+++ b/engines/qdengine/qdcore/qd_interface_element_state_mode.h
@@ -123,6 +123,8 @@ public:
 		return true;
 	}
 
+	Common::String stateMode2Str(int fl, bool truncate = false) const;
+
 	//! Запись данных в скрипт.
 	/**
 	type_id - тип события




More information about the Scummvm-git-logs mailing list