[Scummvm-git-logs] scummvm master -> 9c85ad792e597e3ac95dcdd2bd40917bb06ec09e

sev- noreply at scummvm.org
Thu May 26 08:52:52 UTC 2022


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

Summary:
3727b3e16e GUI: Initial code for embedding formatting info into *ListWidget strings
637b1ebf4c CHEWY: Mark for testing
73f580cad5 CHEWY: Enable engine by default
9c932d0705 NEWS: Mention Chewy as supported
9c85ad792e DOCS: Describe Chewy GUIO


Commit: 3727b3e16ed4ac690b0f279975b1badc2da48e97
    https://github.com/scummvm/scummvm/commit/3727b3e16ed4ac690b0f279975b1badc2da48e97
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-05-26T10:31:45+02:00

Commit Message:
GUI: Initial code for embedding formatting info into *ListWidget strings

Changed paths:
    gui/launcher.cpp
    gui/widgets/groupedlist.cpp
    gui/widgets/list.cpp
    gui/widgets/list.h


diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 0c99b618d86..0e5c4532a68 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -1064,7 +1064,9 @@ void LauncherSimple::updateListing() {
 				// description += Common::String::format(" (%s)", _("Not found"));
 			}
 		}
-		l.push_back(iter->description);
+		Common::U32String gameDesc = GUI::ListWidget::getThemeColor(color) + Common::U32String(iter->description);
+
+		l.push_back(gameDesc);
 		colors.push_back(color);
 		attrs.push_back(iter->domain);
 		_domains.push_back(iter->key);
diff --git a/gui/widgets/groupedlist.cpp b/gui/widgets/groupedlist.cpp
index 2b6800aa995..02ca0e2c945 100644
--- a/gui/widgets/groupedlist.cpp
+++ b/gui/widgets/groupedlist.cpp
@@ -400,8 +400,8 @@ void GroupedListWidget::drawWidget() {
 		} else {
 			buffer = _list[pos];
 		}
-		g_gui.theme()->drawText(r1, buffer, _state,
-								_drawAlign, inverted, pad, true, bold, color);
+
+		drawFormattedText(r1, buffer, _state, _drawAlign, inverted, pad, true);
 
 		// If in numbering mode & using RTL layout in GUI, we print a number suffix after drawing the text
 		if (_numberingMode != kListNumberingOff && g_gui.useRTL()) {
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp
index 435e29cb3d0..b3b7166fc4f 100644
--- a/gui/widgets/list.cpp
+++ b/gui/widgets/list.cpp
@@ -600,8 +600,8 @@ void ListWidget::drawWidget() {
 		} else {
 			buffer = _list[pos];
 		}
-		g_gui.theme()->drawText(r1, buffer, _state,
-								_drawAlign, inverted, pad, true, ThemeEngine::kFontStyleBold, color);
+
+		drawFormattedText(r1, buffer, _state, _drawAlign, inverted, pad, true);
 
 		// If in numbering mode & using RTL layout in GUI, we print a number suffix after drawing the text
 		if (_numberingMode != kListNumberingOff && g_gui.useRTL()) {
@@ -814,4 +814,122 @@ void ListWidget::setFilter(const Common::U32String &filter, bool redraw) {
 	}
 }
 
+Common::U32String ListWidget::getThemeColor(byte r, byte g, byte b) {
+	return Common::U32String::format("\001c%02x%02x%02x", r, g, b);
+}
+
+Common::U32String ListWidget::getThemeColor(ThemeEngine::FontColor color) {
+	switch (color) {
+	case ThemeEngine::kFontColorNormal:
+		return Common::U32String("\001C{normal}");
+	case ThemeEngine::kFontColorAlternate:
+		return Common::U32String("\001C{alternate}");
+	default:
+		return Common::U32String("\001C{unknown}");
+	}
+}
+
+ThemeEngine::FontColor ListWidget::getThemeColor(Common::U32String color) {
+	if (color == "normal")
+		return ThemeEngine::kFontColorNormal;
+
+	if (color == "alternate")
+		return ThemeEngine::kFontColorAlternate;
+
+	warning("ListWidget::getThemeColor(): Malformed color (\"%s\")", color.encode().c_str());
+
+	return ThemeEngine::kFontColorNormal;
+}
+
+Common::U32String ListWidget::stripGUIformatting(const Common::U32String &str) {
+	Common::U32String stripped;
+	const uint32 *s = str.u32_str();
+
+	while (*s) {
+		if (*s != '\001') { // normal symbol
+			stripped += *s++;
+			continue;
+		}
+
+		s++; // skip \001
+		switch (*s) {
+		case '\001':  // \001\001 -> \001
+			stripped += *s++;
+			break;
+
+		case 'c': // \001cRRGGBB
+			s += 7; // check length?
+			break;
+
+		case 'C': // \001C{color-name}
+			while (*s && *s++ != '}')
+				;
+			break;
+
+		default:
+			error("Wrong string format (%c)", *s);
+		}
+	}
+
+	return stripped;
+}
+
+void ListWidget::drawFormattedText(const Common::Rect &r, const Common::U32String &str, ThemeEngine::WidgetStateInfo state,
+				Graphics::TextAlign align, ThemeEngine::TextInversionState inverted, int deltax, bool useEllipsis) {
+	Common::U32String chunk;
+	const uint32 *s = str.u32_str();
+	ThemeEngine::FontStyle font = ThemeEngine::kFontStyleBold;
+	ThemeEngine::FontColor color = ThemeEngine::kFontColorNormal;
+	Common::U32String tmp;
+
+	while (*s) {
+		if (*s != '\001') { // normal symbol
+			chunk += *s++;
+			continue;
+		}
+
+		if (chunk.size()) {
+			g_gui.theme()->drawText(r, chunk, state, align, inverted, deltax, true, font, color);
+
+			deltax += g_gui.theme()->getStringWidth(chunk, font);
+			chunk.clear();
+		}
+
+		s++; // skip \001
+		switch (*s) {
+		case '\001':  // \001\001 -> \001
+			chunk += *s++;
+			break;
+
+		case 'c': // \001cRRGGBB
+			s += 7; // check length?
+			break;
+
+		case 'C': // \001C{color-name}
+			tmp.clear();
+			s++;
+			if (*s == '{')
+				s++;
+			else
+				error("ListWidget::drawFormattedText(): Malformatted \\001C color (%c)", *s);
+
+			while (*s && *s != '}')
+				tmp += *s++;
+
+			if (*s == '}')	// skip the closing bracket
+				s++;
+
+			color = getThemeColor(tmp);
+
+			break;
+
+		default:
+			error("ListWidget::drawFormattedText(): Wrong string format (\\001%c)", *s);
+		}
+	}
+
+	if (chunk.size())
+		g_gui.theme()->drawText(r, chunk, state, align, inverted, deltax, true, font, color);
+}
+
 } // End of namespace GUI
diff --git a/gui/widgets/list.h b/gui/widgets/list.h
index 1daf912cb8e..b707a01db61 100644
--- a/gui/widgets/list.h
+++ b/gui/widgets/list.h
@@ -143,6 +143,11 @@ public:
 
 	bool wantsFocus() override { return true; }
 
+	static Common::U32String getThemeColor(byte r, byte g, byte b);
+	static Common::U32String getThemeColor(ThemeEngine::FontColor color);
+	static ThemeEngine::FontColor getThemeColor(Common::U32String color);
+	static Common::U32String stripGUIformatting(const Common::U32String &str);
+
 protected:
 	void drawWidget() override;
 
@@ -158,6 +163,10 @@ protected:
 	void lostFocusWidget() override;
 	void checkBounds();
 	void scrollToCurrent();
+
+	void drawFormattedText(const Common::Rect &r, const Common::U32String &str, ThemeEngine::WidgetStateInfo state = ThemeEngine::kStateEnabled,
+					Graphics::TextAlign align = Graphics::kTextAlignCenter,
+					ThemeEngine::TextInversionState inverted = ThemeEngine::kTextInversionNone, int deltax = 0, bool useEllipsis = true);
 };
 
 } // End of namespace GUI


Commit: 637b1ebf4c709007534aa529e02c720a9837d310
    https://github.com/scummvm/scummvm/commit/637b1ebf4c709007534aa529e02c720a9837d310
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-05-26T10:41:41+02:00

Commit Message:
CHEWY: Mark for testing

Changed paths:
    engines/chewy/detection.cpp


diff --git a/engines/chewy/detection.cpp b/engines/chewy/detection.cpp
index 15f1597f7a5..c6453497edd 100644
--- a/engines/chewy/detection.cpp
+++ b/engines/chewy/detection.cpp
@@ -44,7 +44,7 @@ static const ChewyGameDescription gameDescriptions[] = {
 			AD_ENTRY1s("txt/atds.tap", "e6050c144dd4f23d79ea4f89a8ef306e", 218857),
 			Common::EN_ANY,
 			Common::kPlatformDOS,
-			ADGF_NO_FLAGS,
+			ADGF_NO_FLAGS | ADGF_TESTING,
 			GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
 		},
 	},
@@ -57,7 +57,7 @@ static const ChewyGameDescription gameDescriptions[] = {
 			AD_ENTRY1s("txt/atds.tap", "b1210066a524fe0f88862f44671ed97d", 226988),
 			Common::ES_ESP,
 			Common::kPlatformDOS,
-			ADGF_NO_FLAGS,
+			ADGF_NO_FLAGS | ADGF_TESTING,
 			GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
 		},
 	},
@@ -69,7 +69,7 @@ static const ChewyGameDescription gameDescriptions[] = {
 			AD_ENTRY1s("txt/atds.tap", "c117e884cc5b4bbe50ae1217d13916c4", 231071),
 			Common::DE_DEU,
 			Common::kPlatformDOS,
-			ADGF_NO_FLAGS,
+			ADGF_NO_FLAGS | ADGF_TESTING,
 			GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
 		},
 	},
@@ -81,7 +81,7 @@ static const ChewyGameDescription gameDescriptions[] = {
 			AD_ENTRY1s("txt/atds.tap", "e22f97761c0e7772ec99660f2277b1a4", 231001),
 			Common::DE_DEU,
 			Common::kPlatformDOS,
-			ADGF_NO_FLAGS,
+			ADGF_NO_FLAGS | ADGF_TESTING,
 			GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
 		},
 	},
@@ -98,7 +98,7 @@ static const ChewyGameDescription gameDescriptions[] = {
 			AD_ENTRY1s("txt/atds.tap", "c3be5641e90dd01274309b778cf8146d", 230686),
 			Common::DE_DEU,
 			Common::kPlatformDOS,
-			ADGF_DEMO,
+			ADGF_DEMO | ADGF_TESTING,
 			GUIO2(GUIO_NOMIDI, GAMEOPTION_ORIGINAL_SAVELOAD)
 		},
 	},


Commit: 73f580cad5dd6ba58955196fe3297551d8765a5a
    https://github.com/scummvm/scummvm/commit/73f580cad5dd6ba58955196fe3297551d8765a5a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-05-26T10:42:11+02:00

Commit Message:
CHEWY: Enable engine by default

Changed paths:
    engines/chewy/configure.engine


diff --git a/engines/chewy/configure.engine b/engines/chewy/configure.engine
index f9f7ffd1015..336b3655825 100644
--- a/engines/chewy/configure.engine
+++ b/engines/chewy/configure.engine
@@ -1,3 +1,3 @@
 # This file is included from the main "configure" script
 # add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine chewy "Chewy: Esc from F5" no
+add_engine chewy "Chewy: Esc from F5" yes


Commit: 9c932d0705344229eddc2485234175a5bca9b7a2
    https://github.com/scummvm/scummvm/commit/9c932d0705344229eddc2485234175a5bca9b7a2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-05-26T10:44:57+02:00

Commit Message:
NEWS: Mention Chewy as supported

Changed paths:
    NEWS.md


diff --git a/NEWS.md b/NEWS.md
index a2e4b6f9866..994d24a4fe5 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -11,7 +11,8 @@ For a more comprehensive changelog of the latest experimental code, see:
    - Added support for Clandestiny.
    - Added support for Tender Loving Care (CD-ROM Editions).
    - Added support for Uncle Henry's Playhouse.
-   - Added support for Wetlands
+   - Added support for Wetlands.
+   - Added support for Chewy: Esc from F5.
 
  General:
    - The project license has been upgraded to GPLv3+.


Commit: 9c85ad792e597e3ac95dcdd2bd40917bb06ec09e
    https://github.com/scummvm/scummvm/commit/9c85ad792e597e3ac95dcdd2bd40917bb06ec09e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2022-05-26T10:47:33+02:00

Commit Message:
DOCS: Describe Chewy GUIO

Changed paths:
    doc/docportal/settings/engine.rst


diff --git a/doc/docportal/settings/engine.rst b/doc/docportal/settings/engine.rst
index 14f6809c16d..5a25a04c417 100644
--- a/doc/docportal/settings/engine.rst
+++ b/doc/docportal/settings/engine.rst
@@ -161,6 +161,14 @@ Color Blind Mode
 
 .. _CINE:
 
+CHEWY
+*********
+
+Use original save/load screen
+	Uses the original save/load screens instead of the ScummVM screens.
+
+	*original_menus*
+
 CINE
 *********
 
@@ -641,4 +649,3 @@ More durable armor
 	Armor won't break until character is at -80HP, instead of the default -10HP.
 
 	*DurableArmor*
-




More information about the Scummvm-git-logs mailing list