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

rvanlaar roland at rolandvanlaar.nl
Mon Jul 27 10:46:53 UTC 2020


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:
edd5aab7fd DIRECTOR: LINGO: Implement RearWindowXObj as no-op


Commit: edd5aab7fd6be06d2b2357a63a92ded6c9027893
    https://github.com/scummvm/scummvm/commit/edd5aab7fd6be06d2b2357a63a92ded6c9027893
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2020-07-27T12:44:22+02:00

Commit Message:
DIRECTOR: LINGO: Implement RearWindowXObj as no-op

RearWindow is a mac only XObject that can draw on the desktop
outside the game window. This gives the user more immersion.

Implemented as a no-op since ScummVM doesn't handle the background
outside it's own window.

Changed paths:
  A engines/director/lingo/xlibs/winxobj.cpp
  A engines/director/lingo/xlibs/winxobj.h
    engines/director/lingo/lingo-object.cpp
    engines/director/lingo/tests/XObjects.lingo
    engines/director/module.mk


diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 9435fe5f65..6cf28fb5d9 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -33,6 +33,7 @@
 #include "director/lingo/xlibs/fileio.h"
 #include "director/lingo/xlibs/palxobj.h"
 #include "director/lingo/xlibs/flushxobj.h"
+#include "director/lingo/xlibs/winxobj.h"
 
 namespace Director {
 
@@ -98,9 +99,11 @@ static struct XLibProto {
 	int version;
 } xlibs[] = {
 	{ "FileIO",					FileIO::initialize,					kXObj | kFactoryObj,	2 },	// D2
-	{ "PalXObj",				PalXObj:: initialize,				kXObj,					4 }, 	// D4
 	{ "FlushXObj",				FlushXObj::initialize,				kXObj,					4 },	// D4
+	{ "PalXObj",				PalXObj:: initialize,				kXObj,					4 }, 	// D4
+	{ "winXObj",				RearWindowXObj::initialize,			kXObj,					4 },	// D4
 	{ 0, 0, 0, 0 }
+
 };
 
 void Lingo::initXLibs() {
diff --git a/engines/director/lingo/tests/XObjects.lingo b/engines/director/lingo/tests/XObjects.lingo
index 2509f8267a..c8729fd39a 100644
--- a/engines/director/lingo/tests/XObjects.lingo
+++ b/engines/director/lingo/tests/XObjects.lingo
@@ -1,11 +1,14 @@
-openXlib("FlushXObj")
+openXLib("FlushXObj")
 set flush = FlushXObj(mNew)
 flush(mClearMask)
 flush(mAddToMask, 0, 0)
 flush(mFlush)
 flush(mFlushEvents, 0, 0)
 
-openXlib("PalXObj")
+openXLib("PalXObj")
 set fixpal = FixPalette(mNew, 0, 20, 512, 20)
 fixpal(mPatchIt)
 
+openXLib("winXOBJ")
+set winxobj = RearWindow(mNew, "M")
+scummVMAssert(winxobj(mGetMemoryNeeded) = 0)
\ No newline at end of file
diff --git a/engines/director/lingo/xlibs/winxobj.cpp b/engines/director/lingo/xlibs/winxobj.cpp
new file mode 100644
index 0000000000..b93d95668f
--- /dev/null
+++ b/engines/director/lingo/xlibs/winxobj.cpp
@@ -0,0 +1,81 @@
+/* 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.
+ *
+ */
+
+/* RearWindow is a Mac only XObject. It's purpose is to cover the screen
+ * with either a 1-bit pattern, indexed color, direct(RGB) color, bitmappedCastMember
+ * or PICT file picture.
+ *
+ * It does this when the Stage size is smaller than the monitor screen.
+ *
+ * Implemented as a no-op, since ScummVM doesn't handle desktop backgrounds.
+ *
+ */
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/xlibs/winxobj.h"
+
+
+namespace Director {
+
+static const char *xlibName = "RearWindow";
+
+static MethodProto xlibMethods[] = {
+	{ "new",				RearWindowXObj::m_new,				1,	1,	4 },	// D4
+	{ "GetMemoryNeeded",	RearWindowXObj::m_getMemoryNeeded,	0,	0,	4 },	// D4
+
+	{ 0, 0, 0, 0, 0 }
+};
+
+void RearWindowXObj::initialize(int type) {
+	RearWindowXObject::initMethods(xlibMethods);
+	if (type & kXObj) {
+		if (!g_lingo->_globalvars.contains(xlibName)) {
+			RearWindowXObject *xobj = new RearWindowXObject(kXObj);
+			g_lingo->_globalvars[xlibName] = xobj;
+		} else {
+			warning("RearWindowXObject already initialized");
+		}
+	}
+}
+
+
+RearWindowXObject::RearWindowXObject(ObjectType ObjectType) :Object<RearWindowXObject>("RearWindowXObj") {
+	_objType = ObjectType;
+}
+
+void RearWindowXObj::m_new(int nargs) {
+	Datum d1 = g_lingo->pop();
+	g_lingo->push(g_lingo->_currentMe);
+}
+
+void RearWindowXObj::m_getMemoryNeeded(int nargs) {
+	// No memory is needed for a stubbed XLib.
+	g_lingo->push(Datum(0));
+}
+
+void RearWindowXObj::m_patToWindow(int nargs) {
+	g_lingo->pop();
+}
+
+} // End of namespace Director
diff --git a/engines/director/lingo/xlibs/winxobj.h b/engines/director/lingo/xlibs/winxobj.h
new file mode 100644
index 0000000000..8d70a5169f
--- /dev/null
+++ b/engines/director/lingo/xlibs/winxobj.h
@@ -0,0 +1,45 @@
+/* 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.
+ *
+ */
+
+
+#ifndef DIRECTOR_LINGO_XOBJECT_WINXOBJ_H
+#define DIRECTOR_LINGO_XOBJECT_WINXOBJ_H
+
+namespace Director {
+
+class RearWindowXObject : public Object<RearWindowXObject> {
+public:
+	RearWindowXObject(ObjectType objType);
+};
+
+namespace RearWindowXObj {
+	void initialize(int type);
+
+	void m_new(int nargs);
+	void m_getMemoryNeeded(int nargs);
+	void m_patToWindow(int nargs);
+
+} // End of namespace RearWindowXObj
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 92754c04be..bb1e6d2619 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -38,7 +38,8 @@ MODULE_OBJS = \
 	lingo/lingo-the.o \
 	lingo/xlibs/fileio.o \
 	lingo/xlibs/flushxobj.o \
-	lingo/xlibs/palxobj.o
+	lingo/xlibs/palxobj.o \
+	lingo/xlibs/winxobj.o
 
 director-grammar:
 	`brew --prefix flex`/bin/flex engines/director/lingo/lingo-lex.l




More information about the Scummvm-git-logs mailing list