[Scummvm-git-logs] scummvm master -> 704afa6d954ed3222b668c2e5e1f51120c27e800

sev- sev at scummvm.org
Wed May 26 10:04:33 UTC 2021


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

Summary:
f1f031449b GRAPHICS: MACGUI: Expose another way of setting MacWindow borders
51c83d4e50 WAGE: Build-in borders instead of relying on external files
bd8233c3a7 WAGE: Move border files to engine directory.
704afa6d95 WAGE: Add clarifying comment on border extraction


Commit: f1f031449bc65bc2be03d0a5e9b504eb0acb0ce0
    https://github.com/scummvm/scummvm/commit/f1f031449bc65bc2be03d0a5e9b504eb0acb0ce0
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-26T12:00:28+02:00

Commit Message:
GRAPHICS: MACGUI: Expose another way of setting MacWindow borders

Changed paths:
    graphics/macgui/macwindow.cpp
    graphics/macgui/macwindow.h


diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index d721544221..77221f564b 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -316,6 +316,10 @@ void MacWindow::loadBorder(Common::SeekableReadStream &file, uint32 flags, Borde
 	_macBorder.loadBorder(file, flags, offsets);
 }
 
+void MacWindow::setBorder(Graphics::TransparentSurface *surface, uint32 flags, BorderOffsets offsets) {
+	_macBorder.setBorder(surface, flags, offsets);
+}
+
 void MacWindow::resizeBorderSurface() {
 	updateOuterDims();
 	_borderSurface.free();
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index f5f0393765..92531c0399 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -307,6 +307,7 @@ public:
 	 */
 	void loadBorder(Common::SeekableReadStream &file, uint32 flags, int lo = -1, int ro = -1, int to = -1, int bo = -1);
 	void loadBorder(Common::SeekableReadStream &file, uint32 flags, BorderOffsets offsets);
+	void setBorder(Graphics::TransparentSurface *surface, uint32 flags, BorderOffsets offsets);
 	void disableBorder();
 	void loadWin95Border(const Common::String &filename, uint32 flags);
 	/**


Commit: 51c83d4e5030f5026a0e9894b4435d815dbfed0a
    https://github.com/scummvm/scummvm/commit/51c83d4e5030f5026a0e9894b4435d815dbfed0a
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-26T12:01:02+02:00

Commit Message:
WAGE: Build-in borders instead of relying on external files

Changed paths:
  A engines/wage/guiborders.cpp
    engines/wage/gui.cpp
    engines/wage/gui.h
    engines/wage/module.mk


diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 8754eefc1b..621cf1102c 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -313,44 +313,6 @@ void Gui::executeMenuCommand(int action, Common::String &text) {
 	}
 }
 
-void Gui::loadBorders() {
-	_consoleWindow->enableScrollbar(true);
-	loadBorder(_sceneWindow, "wage_border_inact-title.bmp", Graphics::kWindowBorderTitle, 22);
-	loadBorder(_sceneWindow, "wage_border_act-noscrollbar-title.bmp", Graphics::kWindowBorderActive|Graphics::kWindowBorderTitle, 22);
-	loadBorder(_consoleWindow, "wage_border_inact.bmp", Graphics::kWindowBorderScrollbar, 0);
-	loadBorder(_consoleWindow, "wage_border_act.bmp", Graphics::kWindowBorderScrollbar|Graphics::kWindowBorderActive, 0);
-}
-
-void Gui::loadBorder(Graphics::MacWindow *target, Common::String filename, uint32 flags, int titlePos) {
-	Common::File borderfile;
-
-	if (!borderfile.open(filename)) {
-		debug(1, "Cannot open border file");
-		return;
-	}
-
-	Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size());
-	if (stream) {
-
-		Graphics::BorderOffsets offsets;
-		offsets.left = 16;
-		offsets.right = 16;
-		offsets.top = 16;
-		offsets.bottom = 16;
-		offsets.titleTop = 0;
-		offsets.titleBottom = 0;
-		offsets.dark = false;
-		offsets.upperScrollHeight = 16;
-		offsets.lowerScrollHeight = 16;
-		offsets.titlePos = titlePos;
-		target->loadBorder(*stream, flags, offsets);
-
-		borderfile.close();
-
-		delete stream;
-	}
-}
-
 //////////////////
 // Console stuff
 //////////////////
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 83dc54bbb9..3bfc4d31bf 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -150,7 +150,7 @@ private:
 	const Graphics::Font *getTitleFont();
 
 	void loadBorders();
-	void loadBorder(Graphics::MacWindow *target, Common::String filename, uint32 flags, int titlePos = 0);
+	void loadBorder(Graphics::MacWindow *target, const char *border[], uint height, uint32 flags, int titlePos = 0);
 
 public:
 	Graphics::ManagedSurface _screen;
diff --git a/engines/wage/guiborders.cpp b/engines/wage/guiborders.cpp
new file mode 100644
index 0000000000..d234562e7e
--- /dev/null
+++ b/engines/wage/guiborders.cpp
@@ -0,0 +1,289 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * MIT License..
+ *
+ * Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions..
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
+#include "wage/wage.h"
+#include "wage/gui.h"
+
+namespace Wage {
+
+static const char *wage_border_inact_title[] = {
+"......................................  ..  ..  ......................................",
+"..                                    ..      ..                                    ..",
+"..  ################################  ..  ##  ..  ################################  ..",
+"..  ################################      ##      ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################      ##      ################################  ..",
+"..  ################################  ..  ##  ..  ################################    ",
+"..                                    ..      ..                                      ",
+"  ....  ########################  ..................  ########################  ....  ",
+"..                                    ..........                                      ",
+"..  ################################  ..........  ################################    ",
+"..  ################################              ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################  ..........  ################################  ..",
+"..                                    ..........                                    ..",
+"..................................                  .................................."};
+
+static const char *wage_border_act_noscrollbar_title[] = {
+"......................................  ..  ..  ......................................",
+"..                                    ..      ..                                    ..",
+"..  ################################  ..  ##  ..  ################################  ..",
+"..  ################################      ##      ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ########                ########      ##      ################################  ..",
+"..  ########  ############  ########      ##      ################################  ..",
+"..  ########  ############  ########      ##      ################################  ..",
+"..  ########  ############  ########      ##      ################################  ..",
+"..  ########  ############  ########      ##      ################################  ..",
+"..  ########  ############  ########      ##      ################################  ..",
+"..  ########  ############  ########      ##      ################################  ..",
+"..  ########                ########      ##      ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################  ##  ##  ##  ################################  ..",
+"..  ################################      ##      ################################  ..",
+"..  ################################  ..  ##  ..  ################################    ",
+"..                                    ..      ..                                      ",
+"  ....  ####                ####  ..................  ####                ####  ....  ",
+"..                                    ..........                                      ",
+"..  ################################  ..........  ################################    ",
+"..  ################################              ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################  ##########  ################################  ..",
+"..  ################################              ################################  ..",
+"..  ################################  ..........  ################################  ..",
+"..                                    ..........                                    ..",
+"..................................                  .................................."};
+
+static const char *wage_border_inact[] = {
+"......................................  ......................................",
+"..                                    ..                                    ..",
+"..  ################################  ..  ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################  ..  ################################    ",
+"..                                    ..                                      ",
+"  ....  ########################  ..........  ########################  ....  ",
+"..                                    ..                                      ",
+"..  ################################  ..  ################################    ",
+"..  ################################      ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################  ..  ################################  ..",
+"..                                    ..                                    ..",
+"..................................          .................................."};
+
+static const char *wage_border_act[] = {
+"......................................  ......................................",
+"..                                    ..                                    ..",
+"..  ################################  ..  ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ########                ########      ################################  ..",
+"..  ########  ############  ########      ################################  ..",
+"..  ########  ############  ########      ################################  ..",
+"..  ########  ############  ########      ################################  ..",
+"..  ########  ############  ########      ################################  ..",
+"..  ########  ############  ########      ################################  ..",
+"..  ########  ############  ########      ################################  ..",
+"..  ########                ########      ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################  ..  ################################    ",
+"..                                    ..                                      ",
+"......  ####                ####  ..........  ##########    ##########  ....  ",
+"......  ####                ####  ..........  ########        ########  ....  ",
+"......  ####                ####  ..........  ######            ######  ....  ",
+"......  ####                ####  ..........  ####                ####  ....  ",
+"......  ####                ####  ..........  ##                    ##  ....  ",
+"......  ####                ####  ..........                            ....  ",
+"  ....  ####                ####  ..........  ####                ####  ....  ",
+"......  ####                ####  ..........                            ....  ",
+"......  ####                ####  ..........  ##                    ##  ....  ",
+"......  ####                ####  ..........  ####                ####  ....  ",
+"......  ####                ####  ..........  ######            ######  ....  ",
+"......  ####                ####  ..........  ########        ########  ....  ",
+"......  ####                ####  ..........  ##########    ##########  ....  ",
+"..                                    ..                                      ",
+"..  ################################  ..  ################################    ",
+"..  ################################      ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################  ##  ################################  ..",
+"..  ################################      ################################  ..",
+"..  ################################  ..  ################################  ..",
+"..                                    ..                                    ..",
+"..................................          .................................."};
+
+void Gui::loadBorders() {
+	_consoleWindow->enableScrollbar(true);
+	loadBorder(_sceneWindow, wage_border_inact_title, ARRAYSIZE(wage_border_inact_title), Graphics::kWindowBorderTitle, 22);
+	loadBorder(_sceneWindow, wage_border_act_noscrollbar_title, ARRAYSIZE(wage_border_act_noscrollbar_title), Graphics::kWindowBorderActive|Graphics::kWindowBorderTitle, 22);
+	loadBorder(_consoleWindow, wage_border_inact, ARRAYSIZE(wage_border_inact), Graphics::kWindowBorderScrollbar, 0);
+	loadBorder(_consoleWindow, wage_border_act, ARRAYSIZE(wage_border_act), Graphics::kWindowBorderScrollbar|Graphics::kWindowBorderActive, 0);
+}
+
+void Gui::loadBorder(Graphics::MacWindow *target, const char *border[], uint height, uint32 flags, int titlePos) {
+	uint width = strlen(border[0]) / 2;
+
+	Graphics::Surface source;
+
+	source.create(width, height, Graphics::TransparentSurface::getSupportedPixelFormat());
+
+	for (uint y = 0; y < height; y++) {
+		uint32 *dst = (uint32 *)source.getBasePtr(0, y);
+
+		for (uint x = 0; x < width; x++) {
+			switch(border[y][x * 2]) {
+			case ' ':
+				*dst = TS_RGB(0, 0, 0);
+				break;
+
+			case '#':
+				*dst = TS_RGB(0xff, 0xff, 0xff);
+				break;
+
+			case '.':
+				*dst = TS_RGB(0xff, 0, 0xff);
+				break;
+
+			default:
+				error("Incorrect symbol in bitmap '%c'(%02x) at %d,%d", border[y][x * 2], border[y][x * 2], x, y);
+			}
+
+			dst++;
+		}
+	}
+
+	Graphics::TransparentSurface *surface = new Graphics::TransparentSurface(source, true);
+
+	source.free();
+
+	Graphics::BorderOffsets offsets;
+	offsets.left = 16;
+	offsets.right = 16;
+	offsets.top = 16;
+	offsets.bottom = 16;
+	offsets.titleTop = 0;
+	offsets.titleBottom = 0;
+	offsets.dark = false;
+	offsets.upperScrollHeight = 16;
+	offsets.lowerScrollHeight = 16;
+	offsets.titlePos = titlePos;
+	target->setBorder(surface, flags, offsets);
+}
+
+
+
+} // End of namespace Wage
diff --git a/engines/wage/module.mk b/engines/wage/module.mk
index 86b4b86c8c..8e38cbc236 100644
--- a/engines/wage/module.mk
+++ b/engines/wage/module.mk
@@ -7,6 +7,7 @@ MODULE_OBJS := \
 	dialog.o \
 	entities.o \
 	gui.o \
+	guiborders.o \
 	metaengine.o \
 	randomhat.o \
 	saveload.o \


Commit: bd8233c3a72d655044c4f5241fb4f0e409e18da9
    https://github.com/scummvm/scummvm/commit/bd8233c3a72d655044c4f5241fb4f0e409e18da9
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-26T12:01:40+02:00

Commit Message:
WAGE: Move border files to engine directory.

Since now they're built-in, there is no create_wage utility be ever needed

Changed paths:
  A engines/wage/guiborders/wage_border_act-noscrollbar-title.bmp
  A engines/wage/guiborders/wage_border_act-noscrollbar.bmp
  A engines/wage/guiborders/wage_border_act-title.bmp
  A engines/wage/guiborders/wage_border_act.bmp
  A engines/wage/guiborders/wage_border_inact-title.bmp
  A engines/wage/guiborders/wage_border_inact.bmp
  R devtools/create_wage/wage_border_act-noscrollbar-title.bmp
  R devtools/create_wage/wage_border_act-noscrollbar.bmp
  R devtools/create_wage/wage_border_act-title.bmp
  R devtools/create_wage/wage_border_act.bmp
  R devtools/create_wage/wage_border_inact-title.bmp
  R devtools/create_wage/wage_border_inact.bmp


diff --git a/devtools/create_wage/wage_border_act-noscrollbar-title.bmp b/engines/wage/guiborders/wage_border_act-noscrollbar-title.bmp
similarity index 100%
rename from devtools/create_wage/wage_border_act-noscrollbar-title.bmp
rename to engines/wage/guiborders/wage_border_act-noscrollbar-title.bmp
diff --git a/devtools/create_wage/wage_border_act-noscrollbar.bmp b/engines/wage/guiborders/wage_border_act-noscrollbar.bmp
similarity index 100%
rename from devtools/create_wage/wage_border_act-noscrollbar.bmp
rename to engines/wage/guiborders/wage_border_act-noscrollbar.bmp
diff --git a/devtools/create_wage/wage_border_act-title.bmp b/engines/wage/guiborders/wage_border_act-title.bmp
similarity index 100%
rename from devtools/create_wage/wage_border_act-title.bmp
rename to engines/wage/guiborders/wage_border_act-title.bmp
diff --git a/devtools/create_wage/wage_border_act.bmp b/engines/wage/guiborders/wage_border_act.bmp
similarity index 100%
rename from devtools/create_wage/wage_border_act.bmp
rename to engines/wage/guiborders/wage_border_act.bmp
diff --git a/devtools/create_wage/wage_border_inact-title.bmp b/engines/wage/guiborders/wage_border_inact-title.bmp
similarity index 100%
rename from devtools/create_wage/wage_border_inact-title.bmp
rename to engines/wage/guiborders/wage_border_inact-title.bmp
diff --git a/devtools/create_wage/wage_border_inact.bmp b/engines/wage/guiborders/wage_border_inact.bmp
similarity index 100%
rename from devtools/create_wage/wage_border_inact.bmp
rename to engines/wage/guiborders/wage_border_inact.bmp


Commit: 704afa6d954ed3222b668c2e5e1f51120c27e800
    https://github.com/scummvm/scummvm/commit/704afa6d954ed3222b668c2e5e1f51120c27e800
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-05-26T12:04:05+02:00

Commit Message:
WAGE: Add clarifying comment on border extraction

Changed paths:
    engines/wage/guiborders.cpp


diff --git a/engines/wage/guiborders.cpp b/engines/wage/guiborders.cpp
index d234562e7e..709bff5eba 100644
--- a/engines/wage/guiborders.cpp
+++ b/engines/wage/guiborders.cpp
@@ -50,6 +50,11 @@
 
 namespace Wage {
 
+// Original files sit in engines/wage/guiborders
+// to print out similar pictures, use
+//   bmpDecoder.getSurface()->debugPrint(0, 0, 0, 0, 0, 1);
+// in MacWindowBorder::loadBorder()
+
 static const char *wage_border_inact_title[] = {
 "......................................  ..  ..  ......................................",
 "..                                    ..      ..                                    ..",




More information about the Scummvm-git-logs mailing list