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

moralrecordings code at moral.net.au
Sat Oct 2 11:44:08 UTC 2021


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:
dbd1eeed33 DIRECTOR: LINGO: Add implementation for MoveMouseXObj


Commit: dbd1eeed3325828c56d476a99437fc94bce8954b
    https://github.com/scummvm/scummvm/commit/dbd1eeed3325828c56d476a99437fc94bce8954b
Author: Scott Percival (code at moral.net.au)
Date: 2021-10-02T19:32:38+08:00

Commit Message:
DIRECTOR: LINGO: Add implementation for MoveMouseXObj

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


diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 916bb2c7b7..93c832bf74 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -40,6 +40,7 @@
 #include "director/lingo/xlibs/flushxobj.h"
 #include "director/lingo/xlibs/fplayxobj.h"
 #include "director/lingo/xlibs/labeldrvxobj.h"
+#include "director/lingo/xlibs/movemousexobj.h"
 #include "director/lingo/xlibs/orthoplayxobj.h"
 #include "director/lingo/xlibs/palxobj.h"
 #include "director/lingo/xlibs/popupmenuxobj.h"
@@ -129,6 +130,7 @@ static struct XLibProto {
 	{ SoundJam::fileNames,			SoundJam::open,			SoundJam::close,			kXObj,					400 },	// D4
 	{ VideodiscXObj::fileNames,		VideodiscXObj::open,	VideodiscXObj::close,		kXObj,					200 }, 	// D2
 	{ RearWindowXObj::fileNames,	RearWindowXObj::open,	RearWindowXObj::close,		kXObj,					400 },	// D4
+	{ MoveMouseXObj::fileNames,		MoveMouseXObj::open,	MoveMouseXObj::close,		kXObj,					400 },	// D4
 	{ 0, 0, 0, 0, 0 }
 
 };
diff --git a/engines/director/lingo/xlibs/movemousexobj.cpp b/engines/director/lingo/xlibs/movemousexobj.cpp
new file mode 100644
index 0000000000..a8d35ed3c3
--- /dev/null
+++ b/engines/director/lingo/xlibs/movemousexobj.cpp
@@ -0,0 +1,89 @@
+/* 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.
+ *
+ */
+
+#include "common/system.h"
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/xlibs/movemousexobj.h"
+
+namespace Director {
+
+// MoveMouse 0.1 - (c) Andrew Green 1993 for Mac
+
+const char *MoveMouseXObj::xlibName = "MoveMouse";
+const char *MoveMouseXObj::fileNames[] = {
+	"MoveMouse",
+	"MOVEWIN",
+	0
+};
+
+static MethodProto xlibMethods[] = {
+	{ "new",					MoveMouseXObj::m_new,			 0, 0,	400 },	// D4
+	{ "setMouseLoc",			MoveMouseXObj::m_setMouseLoc,	 2, 2,	400 },	// D4
+	{ 0, 0, 0, 0, 0 }
+};
+
+MoveMouseXObject::MoveMouseXObject(ObjectType ObjectType) :Object<MoveMouseXObject>("MoveMouseXObj") {
+	_objType = ObjectType;
+}
+
+void MoveMouseXObj::open(int type) {
+	if (type == kXObj) {
+		MoveMouseXObject::initMethods(xlibMethods);
+		MoveMouseXObject *xobj = new MoveMouseXObject(kXObj);
+		g_lingo->_globalvars[xlibName] = xobj;
+	} else if (type == kXtraObj) {
+		// TODO - Implement Xtra
+	}
+}
+
+void MoveMouseXObj::close(int type) {
+	if (type == kXObj) {
+		MoveMouseXObject::cleanupMethods();
+		g_lingo->_globalvars[xlibName] = Datum();
+	} else if (type == kXtraObj) {
+		// TODO - Implement Xtra
+	}
+}
+
+void MoveMouseXObj::m_new(int nargs) {
+	if (nargs != 0) {
+		warning("MoveMouse::m_new: expected 0 arguments");
+		g_lingo->dropStack(nargs);
+	}
+	g_lingo->push(g_lingo->_currentMe);
+}
+
+void MoveMouseXObj::m_setMouseLoc(int nargs) {
+	if (nargs != 2) {
+		warning("MoveMouse::m_setMouseLoc: expected 2 arguments");
+		g_lingo->dropStack(nargs);
+		return;
+	}
+	int y = g_lingo->pop().asInt();
+	int x = g_lingo->pop().asInt();
+	g_system->warpMouse(x, y);
+}
+
+}
diff --git a/engines/director/lingo/xlibs/movemousexobj.h b/engines/director/lingo/xlibs/movemousexobj.h
new file mode 100644
index 0000000000..6cfdfec334
--- /dev/null
+++ b/engines/director/lingo/xlibs/movemousexobj.h
@@ -0,0 +1,49 @@
+/* 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_XLIBS_MOVEMOUSEXOBJ_H
+#define DIRECTOR_LINGO_XLIBS_MOVEMOUSEXOBJ_H
+
+namespace Director {
+
+class MoveMouseXObject : public Object<MoveMouseXObject> {
+public:
+	MoveMouseXObject(ObjectType objType);
+};
+
+namespace MoveMouseXObj {
+
+extern const char *xlibName;
+extern const char *fileNames[];
+
+void open(int type);
+void close(int type);
+
+void m_new(int nargs);
+void m_dispose(int nargs);
+void m_setMouseLoc(int nargs);
+
+} // End of namespace MoveMouse
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 460675df09..e341b2a57a 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -42,6 +42,7 @@ MODULE_OBJS = \
 	lingo/xlibs/flushxobj.o \
 	lingo/xlibs/fplayxobj.o \
 	lingo/xlibs/labeldrvxobj.o \
+	lingo/xlibs/movemousexobj.o \
 	lingo/xlibs/palxobj.o \
 	lingo/xlibs/orthoplayxobj.o \
 	lingo/xlibs/popupmenuxobj.o \




More information about the Scummvm-git-logs mailing list