[Scummvm-git-logs] scummvm master -> 45aafa1edd68497211e94e657c078aa39e1ef4e7

sev- sev at scummvm.org
Thu Jul 8 21:11:33 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:
45aafa1edd DIRECTOR: Implemented LabelDrv XObject. Now MediaBand starts again


Commit: 45aafa1edd68497211e94e657c078aa39e1ef4e7
    https://github.com/scummvm/scummvm/commit/45aafa1edd68497211e94e657c078aa39e1ef4e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-08T23:11:13+02:00

Commit Message:
DIRECTOR: Implemented LabelDrv XObject. Now MediaBand starts again

Changed paths:
  A engines/director/lingo/xlibs/labeldrvxobj.cpp
  A engines/director/lingo/xlibs/labeldrvxobj.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 7064440a18..cda164e6c9 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -22,6 +22,8 @@
 
 #include "common/endian.h"
 
+#include "graphics/macgui/mactext.h"
+
 #include "director/director.h"
 #include "director/cast.h"
 #include "director/channel.h"
@@ -32,11 +34,12 @@
 #include "director/lingo/lingo-code.h"
 #include "director/lingo/lingo-object.h"
 #include "director/lingo/lingo-the.h"
+
 #include "director/lingo/xlibs/fileio.h"
-#include "director/lingo/xlibs/palxobj.h"
 #include "director/lingo/xlibs/flushxobj.h"
+#include "director/lingo/xlibs/labeldrvxobj.h"
+#include "director/lingo/xlibs/palxobj.h"
 #include "director/lingo/xlibs/winxobj.h"
-#include "graphics/macgui/mactext.h"
 
 namespace Director {
 
@@ -109,6 +112,7 @@ static struct XLibProto {
 	{ "FileIO",					FileIO::initialize,					kXObj | kFactoryObj,	200 },	// D2
 	{ "FlushXObj",				FlushXObj::initialize,				kXObj,					400 },	// D4
 	{ "PalXObj",				PalXObj:: initialize,				kXObj,					400 }, 	// D4
+	{ "LabelDrv",				LabelDrvXObj:: initialize,			kXObj,					400 }, 	// D4
 	{ "winXObj",				RearWindowXObj::initialize,			kXObj,					400 },	// D4
 	{ 0, 0, 0, 0 }
 
diff --git a/engines/director/lingo/xlibs/labeldrvxobj.cpp b/engines/director/lingo/xlibs/labeldrvxobj.cpp
new file mode 100644
index 0000000000..08c8582be0
--- /dev/null
+++ b/engines/director/lingo/xlibs/labeldrvxobj.cpp
@@ -0,0 +1,96 @@
+/* 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.
+ *
+ */
+
+/*
+	-- LabelDrv XObject. Version 1.1 6/5/95 greg yachuk
+	LabelDrv
+	I      mNew          --Creates a new instance of the XObject
+	X      mDispose      --Disposes of XObject instance.
+	XSS    mSetRange     --Sets the drive letters to begin and end the search for the label. Default is C..Z.
+	SS     mGetDrive     --Return the drive letter where the specified label is mounted.
+ */
+
+#include "director/director.h"
+#include "director/lingo/lingo.h"
+#include "director/lingo/lingo-object.h"
+#include "director/lingo/xlibs/labeldrvxobj.h"
+
+namespace Director {
+
+// The name is different from the obj filename.
+static const char *xlibName = "LabelDrv";
+
+static MethodProto xlibMethods[] = {
+	{ "new",				LabelDrvXObj::m_new,		 0, 0,	400 },	// D4
+	{ "SetRange",			LabelDrvXObj::m_setRange,	 2, 2,  400 },	// D4
+	{ "GetDrive",			LabelDrvXObj::m_getDrive,	 1, 1,  400 },	// D4
+	{ 0, 0, 0, 0, 0 }
+};
+
+void LabelDrvXObj::initialize(int type) {
+	LabelDrvXObject::initMethods(xlibMethods);
+	if (type & kXObj) {
+		if (!g_lingo->_globalvars.contains(xlibName)) {
+			LabelDrvXObject *xobj = new LabelDrvXObject(kXObj);
+			g_lingo->_globalvars[xlibName] = xobj;
+		} else {
+			warning("PalXObject already initialized");
+		}
+	}
+}
+
+LabelDrvXObject::LabelDrvXObject(ObjectType ObjectType) :Object<LabelDrvXObject>("LabelDrvXObj") {
+	_objType = ObjectType;
+}
+
+void LabelDrvXObj::m_new(int nargs) {
+	LabelDrvXObject *me = static_cast<LabelDrvXObject *>(g_lingo->_currentMe.u.obj);
+
+	Common::Rect rect;
+	me->_range = "C";
+
+	g_lingo->push(g_lingo->_currentMe);
+}
+
+void LabelDrvXObj::m_setRange(int nargs) {
+	LabelDrvXObject *me = static_cast<LabelDrvXObject *>(g_lingo->_currentMe.u.obj);
+
+	Datum d2 = g_lingo->pop();
+	Datum d1 = g_lingo->pop();
+
+	Common::String from = d1.asString();
+	Common::String to = d2.asString();
+
+	me->_range = from;
+}
+
+void LabelDrvXObj::m_getDrive(int nargs) {
+	LabelDrvXObject *me = static_cast<LabelDrvXObject *>(g_lingo->_currentMe.u.obj);
+
+	Datum d1 = g_lingo->pop();
+
+	Common::String label = d1.asString();
+
+	g_lingo->push(Datum(me->_range));
+}
+
+} // End of namespace Director
diff --git a/engines/director/lingo/xlibs/labeldrvxobj.h b/engines/director/lingo/xlibs/labeldrvxobj.h
new file mode 100644
index 0000000000..d7a03e5963
--- /dev/null
+++ b/engines/director/lingo/xlibs/labeldrvxobj.h
@@ -0,0 +1,48 @@
+/* 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_LABELDRVXOBJ_H
+#define DIRECTOR_LINGO_XLIBS_LABELDRVXOBJ_H
+
+namespace Director {
+
+class LabelDrvXObject : public Object<LabelDrvXObject> {
+public:
+	Common::String _range;
+
+public:
+	LabelDrvXObject(ObjectType objType);
+};
+
+namespace LabelDrvXObj {
+
+void initialize(int type);
+
+void m_new(int nargs);
+void m_setRange(int nargs);
+void m_getDrive(int nargs);
+
+} // End of namespace LabelDrvXObject
+
+} // End of namespace Director
+
+#endif
diff --git a/engines/director/module.mk b/engines/director/module.mk
index 093855058c..13788a7726 100644
--- a/engines/director/module.mk
+++ b/engines/director/module.mk
@@ -38,6 +38,7 @@ MODULE_OBJS = \
 	lingo/lingo-the.o \
 	lingo/xlibs/fileio.o \
 	lingo/xlibs/flushxobj.o \
+	lingo/xlibs/labeldrvxobj.o \
 	lingo/xlibs/palxobj.o \
 	lingo/xlibs/winxobj.o
 




More information about the Scummvm-git-logs mailing list