Initial commit
This commit is contained in:
95
engines/director/lingo/xlibs/m/maniacbg.cpp
Normal file
95
engines/director/lingo/xlibs/m/maniacbg.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-builtins.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/maniacbg.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Maniac Sports
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- ForeMost XObject. 6/23/94 greg yachuk
|
||||
ForeMost
|
||||
I mNew --Creates a new instance of the XObject
|
||||
X mDispose --Disposes of XObject instance.
|
||||
I mIsForeMost --Is this Application foremost. 1=Yes, 0=No.
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const ManiacBgXObj::xlibName = "ForeMost";
|
||||
const XlibFileDesc ManiacBgXObj::fileNames[] = {
|
||||
{ "maniacbg", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", ManiacBgXObj::m_new, 0, 0, 300 },
|
||||
{ "dispose", ManiacBgXObj::m_dispose, 0, 0, 300 },
|
||||
{ "isForeMost", ManiacBgXObj::m_isForeMost, 0, 0, 300 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
ManiacBgXObject::ManiacBgXObject(ObjectType ObjectType) :Object<ManiacBgXObject>("ForeMost") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void ManiacBgXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
ManiacBgXObject::initMethods(xlibMethods);
|
||||
ManiacBgXObject *xobj = new ManiacBgXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void ManiacBgXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
ManiacBgXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
void ManiacBgXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("ManiacBgXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUBNR(ManiacBgXObj::m_dispose)
|
||||
|
||||
void ManiacBgXObj::m_isForeMost(int nargs) {
|
||||
// process events
|
||||
LB::b_updateStage(0);
|
||||
g_lingo->push(Datum(1));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
48
engines/director/lingo/xlibs/m/maniacbg.h
Normal file
48
engines/director/lingo/xlibs/m/maniacbg.h
Normal file
@@ -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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MANIACBG_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MANIACBG_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class ManiacBgXObject : public Object<ManiacBgXObject> {
|
||||
public:
|
||||
ManiacBgXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace ManiacBgXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_isForeMost(int nargs);
|
||||
|
||||
} // End of namespace ManiacBgXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
155
engines/director/lingo/xlibs/m/mapnavigatorxobj.cpp
Normal file
155
engines/director/lingo/xlibs/m/mapnavigatorxobj.cpp
Normal file
@@ -0,0 +1,155 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/mapnavigatorxobj.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Jewels of the Oracle - Win
|
||||
* Jewels of the Oracle - Mac
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- MapNav External Factory. 16/03/95 - AAF - New
|
||||
MapNav
|
||||
IS mNew, fileName -- read map given file name
|
||||
X mDispose -- dispose of map
|
||||
I mGetFirstNode -- return index of first node
|
||||
X mResetHidden -- reset hidden flags to initial values
|
||||
SI mGetNodeName, node -- given index, return node name
|
||||
IS mGetNodeIndex, name -- given name, return node index
|
||||
II mGetBackgroundPicture, node -- return picture number for node
|
||||
II mGetHotSpotCount, node -- return no. of hot spots for node
|
||||
XIII mSetHidden, node, hotspot, flag -- set/clear hidden flag
|
||||
III mGetHidden, node, hotspot -- set/clear hidden flag
|
||||
IIIII mPointInside, node, hotspot, x, y -- return true if x,y inside hot spot
|
||||
SII mGetHotSpotRect, node, hotspot -- return list of l,t,r,b for hot spot
|
||||
III mGetHotSpotCursor, node, hotspot -- return cursor number for node
|
||||
SII mGetEvaluationFcn, node, hotspot -- return function name to call to get condition number
|
||||
IIII mGetDestinationNode, node, hotspot, condition -- return destination node for hot spot
|
||||
IIII mGetInstructionCount, node, hotspot, condition -- return number of instructions
|
||||
IIIII mGetInstructionType, node, hotspot, condition, index -- return type of instruction 'Q' or 'L'
|
||||
SIIII mGetInstruction, node, hotspot, condition, index -- return ith instruction
|
||||
|
||||
-- Navigator, Navigation XObject - aep 95.03.28
|
||||
IS mNew, fileName -- read map given file name
|
||||
X mDispose -- dispose of map
|
||||
I mGetFirstNode -- return index of first node
|
||||
X mResetHidden -- reset hidden flags to initial values
|
||||
SI mGetNodeName, node -- given index, return node name
|
||||
IS mGetNodeIndex, name -- given name, return node index
|
||||
II mGetBackgroundPicture, node -- return picture number for node
|
||||
II mGetHotSpotCount, node -- return no. of hot spots for node
|
||||
XIII mSetHidden, node, hotspot, flag -- set/clear hidden flag
|
||||
III mGetHidden, node, hotspot -- set/clear hidden flag
|
||||
IIIII mPointInside, node, hotspot, h, v -- return true if h,v inside hot spot
|
||||
SII mGetHotSpotRect, node, hotspot -- return list of l,t,r,b for hot spot
|
||||
III mGetHotSpotCursor, node, hotspot -- return cursor number for node
|
||||
SII mGetEvaluationFcn, node, hotspot -- return function name to call to get condition no.
|
||||
IIII mGetDestinationNode, node, hotspot, condition -- return destination node for hot spot
|
||||
IIII mGetInstructionCount, node, hotspot, condition -- return number of instructions
|
||||
IIIII mGetInstructionType, node, hotspot, condition, i -- return type of instruction 'Q' or 'L'
|
||||
SIIII mGetInstruction, node, hotspot, condition, i -- return ith instruction
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MapNavigatorXObj::xlibName = "MapNav";
|
||||
const XlibFileDesc MapNavigatorXObj::fileNames[] = {
|
||||
{ "MAPNAV", nullptr }, // Jewels of the Oracle - Win
|
||||
{ "MapNavigator.XObj", nullptr }, // Jewels of the Oracle - Mac
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MapNavigatorXObj::m_new, 1, 1, 400 },
|
||||
{ "dispose", MapNavigatorXObj::m_dispose, 0, 0, 400 },
|
||||
{ "getFirstNode", MapNavigatorXObj::m_getFirstNode, 0, 0, 400 },
|
||||
{ "resetHidden", MapNavigatorXObj::m_resetHidden, 0, 0, 400 },
|
||||
{ "getNodeName", MapNavigatorXObj::m_getNodeName, 1, 1, 400 },
|
||||
{ "getNodeIndex", MapNavigatorXObj::m_getNodeIndex, 1, 1, 400 },
|
||||
{ "getBackgroundPicture", MapNavigatorXObj::m_getBackgroundPicture,1, 1, 400 },
|
||||
{ "getHotSpotCount", MapNavigatorXObj::m_getHotSpotCount, 1, 1, 400 },
|
||||
{ "setHidden", MapNavigatorXObj::m_setHidden, 3, 3, 400 },
|
||||
{ "getHidden", MapNavigatorXObj::m_getHidden, 2, 2, 400 },
|
||||
{ "pointInside", MapNavigatorXObj::m_pointInside, 4, 4, 400 },
|
||||
{ "getHotSpotRect", MapNavigatorXObj::m_getHotSpotRect, 2, 2, 400 },
|
||||
{ "getHotSpotCursor", MapNavigatorXObj::m_getHotSpotCursor, 2, 2, 400 },
|
||||
{ "getEvaluationFcn", MapNavigatorXObj::m_getEvaluationFcn, 2, 2, 400 },
|
||||
{ "getDestinationNode", MapNavigatorXObj::m_getDestinationNode, 3, 3, 400 },
|
||||
{ "getInstructionCount", MapNavigatorXObj::m_getInstructionCount, 3, 3, 400 },
|
||||
{ "getInstructionType", MapNavigatorXObj::m_getInstructionType, 4, 4, 400 },
|
||||
{ "getInstruction", MapNavigatorXObj::m_getInstruction, 4, 4, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
MapNavigatorXObject::MapNavigatorXObject(ObjectType ObjectType) :Object<MapNavigatorXObject>("MapNav") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MapNavigatorXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
MapNavigatorXObject::initMethods(xlibMethods);
|
||||
MapNavigatorXObject *xobj = new MapNavigatorXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void MapNavigatorXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
MapNavigatorXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
void MapNavigatorXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("MapNavigatorXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUBNR(MapNavigatorXObj::m_dispose)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getFirstNode, 0)
|
||||
XOBJSTUBNR(MapNavigatorXObj::m_resetHidden)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getNodeName, "")
|
||||
XOBJSTUB(MapNavigatorXObj::m_getNodeIndex, 0)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getBackgroundPicture, 0)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getHotSpotCount, 0)
|
||||
XOBJSTUBNR(MapNavigatorXObj::m_setHidden)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getHidden, 0)
|
||||
XOBJSTUB(MapNavigatorXObj::m_pointInside, 0)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getHotSpotRect, "")
|
||||
XOBJSTUB(MapNavigatorXObj::m_getHotSpotCursor, 0)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getEvaluationFcn, "")
|
||||
XOBJSTUB(MapNavigatorXObj::m_getDestinationNode, 0)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getInstructionCount, 0)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getInstructionType, 0)
|
||||
XOBJSTUB(MapNavigatorXObj::m_getInstruction, "")
|
||||
|
||||
}
|
||||
63
engines/director/lingo/xlibs/m/mapnavigatorxobj.h
Normal file
63
engines/director/lingo/xlibs/m/mapnavigatorxobj.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MAPNAVIGATORXOBJ_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MAPNAVIGATORXOBJ_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MapNavigatorXObject : public Object<MapNavigatorXObject> {
|
||||
public:
|
||||
MapNavigatorXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MapNavigatorXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_getFirstNode(int nargs);
|
||||
void m_resetHidden(int nargs);
|
||||
void m_getNodeName(int nargs);
|
||||
void m_getNodeIndex(int nargs);
|
||||
void m_getBackgroundPicture(int nargs);
|
||||
void m_getHotSpotCount(int nargs);
|
||||
void m_setHidden(int nargs);
|
||||
void m_getHidden(int nargs);
|
||||
void m_pointInside(int nargs);
|
||||
void m_getHotSpotRect(int nargs);
|
||||
void m_getHotSpotCursor(int nargs);
|
||||
void m_getEvaluationFcn(int nargs);
|
||||
void m_getDestinationNode(int nargs);
|
||||
void m_getInstructionCount(int nargs);
|
||||
void m_getInstructionType(int nargs);
|
||||
void m_getInstruction(int nargs);
|
||||
|
||||
} // End of namespace MapNavigatorXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
144
engines/director/lingo/xlibs/m/mazexobj.cpp
Normal file
144
engines/director/lingo/xlibs/m/mazexobj.cpp
Normal file
@@ -0,0 +1,144 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/mazexobj.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* wttf
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- Maze XObj v 1.09F (c) 1995 Samizdat Productions. All Rights Reserved.
|
||||
-- written by Christopher P. Kelly
|
||||
I mNew
|
||||
II mUserClicked where
|
||||
II mCheckClick where
|
||||
S mGetKeySettings
|
||||
IS mSetKeySettings string
|
||||
S mGetLocSettings
|
||||
IS mSetLocSettings string
|
||||
I mGetTemplate
|
||||
I mGetKeyAdded
|
||||
IS mSetCDPath fullpath
|
||||
IS mSetHDPath fullpath
|
||||
IIIII mSetMovieBox t,l,b,r
|
||||
II mUpdateScreen moveFlag
|
||||
I mFixScreen
|
||||
I mGetLevel
|
||||
II mGetKeyState keyNum
|
||||
III mSetKeyState keyNum, state
|
||||
II mSetPreclickOption onOrOff
|
||||
I mDisposeMem
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *MazeXObj::xlibName = "MazeObj";
|
||||
const XlibFileDesc MazeXObj::fileNames[] = {
|
||||
{ "MazeObj", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static MethodProto xlibMethods[] = {
|
||||
{ "new", MazeXObj::m_new, 0, 0, 400 },
|
||||
{ "userClicked", MazeXObj::m_userClicked, 1, 1, 400 },
|
||||
{ "checkClick", MazeXObj::m_checkClick, 1, 1, 400 },
|
||||
{ "getKeySettings", MazeXObj::m_getKeySettings, 0, 0, 400 },
|
||||
{ "setKeySettings", MazeXObj::m_setKeySettings, 1, 1, 400 },
|
||||
{ "getLocSettings", MazeXObj::m_getLocSettings, 0, 0, 400 },
|
||||
{ "setLocSettings", MazeXObj::m_setLocSettings, 1, 1, 400 },
|
||||
{ "getTemplate", MazeXObj::m_getTemplate, 0, 0, 400 },
|
||||
{ "getKeyAdded", MazeXObj::m_getKeyAdded, 0, 0, 400 },
|
||||
{ "setCDPath", MazeXObj::m_setCDPath, 1, 1, 400 },
|
||||
{ "setHDPath", MazeXObj::m_setHDPath, 1, 1, 400 },
|
||||
{ "setMovieBox", MazeXObj::m_setMovieBox, 4, 4, 400 },
|
||||
{ "updateScreen", MazeXObj::m_updateScreen, 1, 1, 400 },
|
||||
{ "fixScreen", MazeXObj::m_fixScreen, 0, 0, 400 },
|
||||
{ "getLevel", MazeXObj::m_getLevel, 0, 0, 400 },
|
||||
{ "getKeyState", MazeXObj::m_getKeyState, 1, 1, 400 },
|
||||
{ "setKeyState", MazeXObj::m_setKeyState, 2, 2, 400 },
|
||||
{ "setPreclickOption", MazeXObj::m_setPreclickOption, 1, 1, 400 },
|
||||
{ "disposeMem", MazeXObj::m_disposeMem, 0, 0, 400 },
|
||||
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static BuiltinProto xlibBuiltins[] = {
|
||||
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
MazeXObject::MazeXObject(ObjectType ObjectType) :Object<MazeXObject>("MazeObj") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MazeXObj::open(ObjectType type, const Common::Path &path) {
|
||||
MazeXObject::initMethods(xlibMethods);
|
||||
MazeXObject *xobj = new MazeXObject(type);
|
||||
if (type == kXtraObj) {
|
||||
g_lingo->_openXtras.push_back(xlibName);
|
||||
g_lingo->_openXtraObjects.push_back(xobj);
|
||||
}
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
g_lingo->initBuiltIns(xlibBuiltins);
|
||||
}
|
||||
|
||||
void MazeXObj::close(ObjectType type) {
|
||||
MazeXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
|
||||
}
|
||||
|
||||
void MazeXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("MazeXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUB(MazeXObj::m_userClicked, 0)
|
||||
XOBJSTUB(MazeXObj::m_checkClick, 0)
|
||||
XOBJSTUB(MazeXObj::m_getKeySettings, "")
|
||||
XOBJSTUB(MazeXObj::m_setKeySettings, 0)
|
||||
XOBJSTUB(MazeXObj::m_getLocSettings, "")
|
||||
XOBJSTUB(MazeXObj::m_setLocSettings, 0)
|
||||
XOBJSTUB(MazeXObj::m_getTemplate, 0)
|
||||
XOBJSTUB(MazeXObj::m_getKeyAdded, 0)
|
||||
XOBJSTUB(MazeXObj::m_setCDPath, 0)
|
||||
XOBJSTUB(MazeXObj::m_setHDPath, 0)
|
||||
XOBJSTUB(MazeXObj::m_setMovieBox, 0)
|
||||
XOBJSTUB(MazeXObj::m_updateScreen, 0)
|
||||
XOBJSTUB(MazeXObj::m_fixScreen, 0)
|
||||
XOBJSTUB(MazeXObj::m_getLevel, 0)
|
||||
XOBJSTUB(MazeXObj::m_getKeyState, 0)
|
||||
XOBJSTUB(MazeXObj::m_setKeyState, 0)
|
||||
XOBJSTUB(MazeXObj::m_setPreclickOption, 0)
|
||||
XOBJSTUB(MazeXObj::m_disposeMem, 0)
|
||||
|
||||
}
|
||||
64
engines/director/lingo/xlibs/m/mazexobj.h
Normal file
64
engines/director/lingo/xlibs/m/mazexobj.h
Normal file
@@ -0,0 +1,64 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_M_MAZEXOBJ_H
|
||||
#define DIRECTOR_LINGO_XLIBS_M_MAZEXOBJ_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MazeXObject : public Object<MazeXObject> {
|
||||
public:
|
||||
MazeXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MazeXObj {
|
||||
|
||||
extern const char *xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_userClicked(int nargs);
|
||||
void m_checkClick(int nargs);
|
||||
void m_getKeySettings(int nargs);
|
||||
void m_setKeySettings(int nargs);
|
||||
void m_getLocSettings(int nargs);
|
||||
void m_setLocSettings(int nargs);
|
||||
void m_getTemplate(int nargs);
|
||||
void m_getKeyAdded(int nargs);
|
||||
void m_setCDPath(int nargs);
|
||||
void m_setHDPath(int nargs);
|
||||
void m_setMovieBox(int nargs);
|
||||
void m_updateScreen(int nargs);
|
||||
void m_fixScreen(int nargs);
|
||||
void m_getLevel(int nargs);
|
||||
void m_getKeyState(int nargs);
|
||||
void m_setKeyState(int nargs);
|
||||
void m_setPreclickOption(int nargs);
|
||||
void m_disposeMem(int nargs);
|
||||
|
||||
} // End of namespace MazeXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
99
engines/director/lingo/xlibs/m/memcheckxobj.cpp
Normal file
99
engines/director/lingo/xlibs/m/memcheckxobj.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/memcheckxobj.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Jewels of the Oracle - Win
|
||||
* Jewels of the Oracle - Mac
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- MemCheck External Factory. 16/03/95 - AAF - New
|
||||
MemCheck
|
||||
IS mNew, virtualFile --Creates a new instance of the XObject
|
||||
X mDispose --Disposes of XObject instance
|
||||
I mMemoryCheck --Checks memory status
|
||||
X mMemoryPurge --Purges memory
|
||||
|
||||
-- Memory Check XObject - aep 95.06.20
|
||||
IS mNew, msg -- Open the XObject
|
||||
X mDispose -- Dispose of XObject
|
||||
I mMemoryCheck -- Return memory info
|
||||
X mMemoryPurge -- Clear chunk o' mem
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MemCheckXObj::xlibName = "MemCheck";
|
||||
const XlibFileDesc MemCheckXObj::fileNames[] = {
|
||||
{ "MemCheck", nullptr }, // Jewels of the Oracle - Win
|
||||
{ "MemCheck.XObj", nullptr }, // Jewels of the Oracle - Mac
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MemCheckXObj::m_new, 1, 1, 400 },
|
||||
{ "dispose", MemCheckXObj::m_dispose, 0, 0, 400 },
|
||||
{ "memoryCheck", MemCheckXObj::m_memoryCheck, 0, 0, 400 },
|
||||
{ "memoryPurge", MemCheckXObj::m_memoryPurge, 0, 0, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
MemCheckXObject::MemCheckXObject(ObjectType ObjectType) :Object<MemCheckXObject>("MemCheck") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MemCheckXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
MemCheckXObject::initMethods(xlibMethods);
|
||||
MemCheckXObject *xobj = new MemCheckXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void MemCheckXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
MemCheckXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
void MemCheckXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("MemCheckXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUBNR(MemCheckXObj::m_dispose)
|
||||
XOBJSTUB(MemCheckXObj::m_memoryCheck, 0)
|
||||
XOBJSTUBNR(MemCheckXObj::m_memoryPurge)
|
||||
|
||||
}
|
||||
49
engines/director/lingo/xlibs/m/memcheckxobj.h
Normal file
49
engines/director/lingo/xlibs/m/memcheckxobj.h
Normal file
@@ -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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MEMCHECKXOBJ_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MEMCHECKXOBJ_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MemCheckXObject : public Object<MemCheckXObject> {
|
||||
public:
|
||||
MemCheckXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MemCheckXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_memoryCheck(int nargs);
|
||||
void m_memoryPurge(int nargs);
|
||||
|
||||
} // End of namespace MemCheckXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
117
engines/director/lingo/xlibs/m/memoryxobj.cpp
Normal file
117
engines/director/lingo/xlibs/m/memoryxobj.cpp
Normal file
@@ -0,0 +1,117 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Chop Suey (Win)
|
||||
* Comedians (Mac)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* Memory is a Mac only XObject.
|
||||
*
|
||||
* Implemented as a no-op, since ScummVM doesn't need to handle memory clears.
|
||||
*
|
||||
*
|
||||
* -- Memory XObject
|
||||
* -- December 18th, 1992
|
||||
* -- Written by Scott Kildall
|
||||
* -- 1992 by Macromedia, Inc
|
||||
* -- All rights reserved
|
||||
* --
|
||||
* I mNew
|
||||
* X mClear
|
||||
* X mCompact
|
||||
* X mPurge
|
||||
* I mAvailBytes
|
||||
* I mAvailBlock
|
||||
* I mStackSpace
|
||||
* I mGetVM
|
||||
* I mGetAddressing
|
||||
* I mGetCache
|
||||
* XI mSetCache
|
||||
* I mGetPhysicalRAM
|
||||
* I mGetMMU
|
||||
* I mGetLogicalPage
|
||||
* I mGetLogicalRAM
|
||||
* I mGetLowMemory
|
||||
*/
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/m/memoryxobj.h"
|
||||
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MemoryXObj::xlibName = "Memory";
|
||||
const XlibFileDesc MemoryXObj::fileNames[] = {
|
||||
{ "Memory XObj", nullptr },
|
||||
{ "Memory", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MemoryXObj::m_new, 0, 0, 300 }, // D3
|
||||
{ "Clear", MemoryXObj::m_clear, 0, 0, 300 }, // D3
|
||||
{ "Purge", MemoryXObj::m_purge, 0, 0, 400 }, // D4
|
||||
{ "GetVM", MemoryXObj::m_getVM, 0, 0, 300 }, // D3
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
void MemoryXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
MemoryXObject::initMethods(xlibMethods);
|
||||
MemoryXObject *xobj = new MemoryXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
MemoryXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MemoryXObject::MemoryXObject(ObjectType ObjectType) :Object<MemoryXObject>("Memory") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MemoryXObj::m_new(int nargs) {
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void MemoryXObj::m_clear(int nargs) {
|
||||
}
|
||||
|
||||
void MemoryXObj::m_purge(int nargs) {
|
||||
}
|
||||
|
||||
void MemoryXObj::m_getVM(int nargs) {
|
||||
g_lingo->push(Datum(0)); // Chop Suey (Win) and Comedians (Mac) require Virtual Memory to be disabled
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
50
engines/director/lingo/xlibs/m/memoryxobj.h
Normal file
50
engines/director/lingo/xlibs/m/memoryxobj.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MEMORYXOBJ_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MEMORYXOBJ_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MemoryXObject : public Object<MemoryXObject> {
|
||||
public:
|
||||
MemoryXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MemoryXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_clear(int nargs);
|
||||
void m_purge(int nargs);
|
||||
void m_getVM(int nargs);
|
||||
|
||||
} // End of namespace MemoryXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
105
engines/director/lingo/xlibs/m/misc.cpp
Normal file
105
engines/director/lingo/xlibs/m/misc.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Around the World With Willy Wabbit
|
||||
* Willy Wabbit Math Adventure
|
||||
*
|
||||
*************************************/
|
||||
|
||||
#include "common/formats/ini-file.h"
|
||||
#include "director/director.h"
|
||||
#include "director/window.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/misc.h"
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const Misc::xlibName = "misc";
|
||||
const XlibFileDesc Misc::fileNames[] = {
|
||||
{ "misc", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "getProfileString", Misc::m_getProfileString, 3, 3, 400 },
|
||||
{ "isFilePresent", Misc::m_isFilePresent, 1, 1, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
void Misc::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
MiscObject::initMethods(xlibMethods);
|
||||
MiscObject *xobj = new MiscObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void Misc::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
MiscObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
MiscObject::MiscObject(ObjectType ObjectType) :Object<MiscObject>("Misc") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void Misc::m_getProfileString(int nargs) {
|
||||
Common::String file = g_lingo->pop().asString();
|
||||
Common::String entry = g_lingo->pop().asString();
|
||||
Common::String section = g_lingo->pop().asString();
|
||||
|
||||
Common::Path filePath = findPath(file);
|
||||
if (filePath.empty()) {
|
||||
warning("Unable to locate config file %s", file.c_str());
|
||||
g_lingo->push(Datum(""));
|
||||
return;
|
||||
}
|
||||
|
||||
Common::INIFile config;
|
||||
config.loadFromFile(filePath);
|
||||
|
||||
Common::String value;
|
||||
if (config.getKey(entry, section, value)) {
|
||||
g_lingo->push(Datum(value));
|
||||
} else {
|
||||
warning("Unable to fetch %s:%s; returning default", section.c_str(), entry.c_str());
|
||||
g_lingo->push(Datum(""));
|
||||
}
|
||||
}
|
||||
|
||||
void Misc::m_isFilePresent(int nargs) {
|
||||
Common::String filename = g_lingo->pop().asString();
|
||||
Common::Path filePath = findMoviePath(filename);
|
||||
if (filePath.empty()) {
|
||||
g_lingo->push(Datum(0));
|
||||
} else {
|
||||
g_lingo->push(Datum(1));
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
47
engines/director/lingo/xlibs/m/misc.h
Normal file
47
engines/director/lingo/xlibs/m/misc.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MISC_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MISC_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MiscObject : public Object<MiscObject> {
|
||||
public:
|
||||
MiscObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace Misc {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_getProfileString(int nargs);
|
||||
void m_isFilePresent(int nargs);
|
||||
|
||||
} // End of namespace Misc
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
144
engines/director/lingo/xlibs/m/miscx.cpp
Normal file
144
engines/director/lingo/xlibs/m/miscx.cpp
Normal file
@@ -0,0 +1,144 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/miscx.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Pippi
|
||||
* AMBER: Journeys Beyond
|
||||
* Total Distortion
|
||||
* Backpacker
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* -- Misc_X, Misc Utilities XObject v2.0
|
||||
* Misc_X
|
||||
* I mNew
|
||||
* X mDispose
|
||||
* S mBootName -- get the name of the boot disk
|
||||
* S mWindowsDirectory -- get the path to the Windows directory
|
||||
* IS mFileExists, filePath -- return 1 if file is there, otherwise 0
|
||||
* ISS mCopyFile, sourcePath, destPath -- return 1 if successful, otherwise 0
|
||||
* IS mFolderExists, folderPath -- return 1 if folder exists, otherwise 0
|
||||
* IS mInsureFolder, folderPath -- create a full path to the folder, return possible error
|
||||
* XS mDeleteFolder, folderPath -- delete folder along with contents
|
||||
* SS mFileList, fontainerPath -- return list of files in the folder
|
||||
* SSSSS mAsk, query, default, btnOK, btnCancel -- dialog box that accepts user input
|
||||
* SSSSS mAnswer, query, btnL, btnM, btnR -- alert type dialog box with variable number of buttons
|
||||
* IS mSpaceOnVol, volumeName -- return the number of free bytes on volume
|
||||
* IS mDeleteGroup, groupName -- delete program group under Windows
|
||||
* ----
|
||||
* -- Copyright 1994 Sanctuary Woods --
|
||||
* -- written by Bob McKay and Brian Parkinson
|
||||
* --
|
||||
* -- Append folder name in mInsureFolder with a colon
|
||||
* -- gXObject(mInsureFolder, the pathName & "bands:genesis:"
|
||||
* --
|
||||
* -- The mAsk dialog box returns the text field if btnOk clicked, otherwise the btnCancel text
|
||||
* -- The mAnswer dialog box returns the text of the button clicked
|
||||
* --
|
||||
* -- For mAnswer dialog box, the number of buttons is variable
|
||||
* -- gXObject(mAnswer, "Are you sure ?", "", "Yes", "No") -- two buttons
|
||||
* -- gXObject(mAnswer, "A simple alert box", "", "", "Ok") -- one button
|
||||
* ----
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MiscX::xlibName = "Misc_X";
|
||||
const XlibFileDesc MiscX::fileNames[] = {
|
||||
{ "MISC_X", nullptr },
|
||||
{ "sharCOPY", nullptr }, // TD loads this up using openXLib("@:sharCOPY.DLL")
|
||||
{ "BPXLIB", nullptr }, // Backpacker
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MiscX::m_new, 0, 0, 400 }, // D4
|
||||
{ "dispose", MiscX::m_dispose, 0, 0, 400 }, // D4
|
||||
{ "bootName", MiscX::m_bootName, 0, 0, 400 }, // D4
|
||||
{ "windowsDirectory", MiscX::m_windowsDirectory, 0, 0, 400 }, // D4
|
||||
{ "fileExists", MiscX::m_fileExists, 1, 1, 400 }, // D4
|
||||
{ "copyFile", MiscX::m_copyFile, 2, 2, 400 }, // D4
|
||||
{ "folderExists", MiscX::m_folderExists, 1, 1, 400 }, // D4
|
||||
{ "insureFolder", MiscX::m_insureFolder, 1, 1, 400 }, // D4
|
||||
{ "prefsFolder", MiscX::m_prefsFolder, 0, 0, 400 }, // D4
|
||||
{ "deleteFolder", MiscX::m_deleteFolder, 1, 1, 400 }, // D4
|
||||
{ "fileList", MiscX::m_fileList, 1, 1, 400 }, // D4
|
||||
{ "ask", MiscX::m_ask, 4, 4, 400 }, // D4
|
||||
{ "answer", MiscX::m_answer, 4, 4, 400 }, // D4
|
||||
{ "spaceOnVol", MiscX::m_spaceOnVol, 1, 1, 400 }, // D4
|
||||
{ "deleteGroup", MiscX::m_deleteGroup, 1, 1, 400 }, // D4
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
MiscXObject::MiscXObject(ObjectType ObjectType) :Object<MiscXObject>("MiscX") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MiscX::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
MiscXObject::initMethods(xlibMethods);
|
||||
MiscXObject *xobj = new MiscXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void MiscX::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
MiscXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
void MiscX::m_new(int nargs) {
|
||||
if (nargs != 0) {
|
||||
warning("MiscX::m_new: expected 0 arguments");
|
||||
g_lingo->dropStack(nargs);
|
||||
}
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUBNR(MiscX::m_dispose)
|
||||
XOBJSTUB(MiscX::m_bootName, "")
|
||||
XOBJSTUB(MiscX::m_windowsDirectory, "")
|
||||
XOBJSTUB(MiscX::m_fileExists, 0)
|
||||
XOBJSTUB(MiscX::m_copyFile, 0)
|
||||
XOBJSTUB(MiscX::m_folderExists, 0)
|
||||
XOBJSTUB(MiscX::m_insureFolder, 0)
|
||||
XOBJSTUB(MiscX::m_prefsFolder, "")
|
||||
XOBJSTUBNR(MiscX::m_deleteFolder)
|
||||
XOBJSTUB(MiscX::m_fileList, "")
|
||||
XOBJSTUB(MiscX::m_ask, "")
|
||||
XOBJSTUB(MiscX::m_answer, "")
|
||||
XOBJSTUB(MiscX::m_spaceOnVol, 0)
|
||||
XOBJSTUB(MiscX::m_deleteGroup, 0)
|
||||
|
||||
}
|
||||
60
engines/director/lingo/xlibs/m/miscx.h
Normal file
60
engines/director/lingo/xlibs/m/miscx.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MISCX_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MISCX_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MiscXObject : public Object<MiscXObject> {
|
||||
public:
|
||||
MiscXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MiscX {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_bootName(int nargs);
|
||||
void m_windowsDirectory(int nargs);
|
||||
void m_fileExists(int nargs);
|
||||
void m_copyFile(int nargs);
|
||||
void m_folderExists(int nargs);
|
||||
void m_insureFolder(int nargs);
|
||||
void m_prefsFolder(int nargs);
|
||||
void m_deleteFolder(int nargs);
|
||||
void m_fileList(int nargs);
|
||||
void m_ask(int nargs);
|
||||
void m_answer(int nargs);
|
||||
void m_spaceOnVol(int nargs);
|
||||
void m_deleteGroup(int nargs);
|
||||
|
||||
} // End of namespace MiscX
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
86
engines/director/lingo/xlibs/m/mmaskxobj.cpp
Normal file
86
engines/director/lingo/xlibs/m/mmaskxobj.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/mmaskxobj.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Jewels of the Oracle - Mac
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- MMEX Mask
|
||||
I mNew
|
||||
II mMask, state
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MMaskXObj::xlibName = "mmaskxobj";
|
||||
const XlibFileDesc MMaskXObj::fileNames[] = {
|
||||
{ "MMASK.XOB", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MMaskXObj::m_new, 0, 0, 400 },
|
||||
{ "dispose", MMaskXObj::m_dispose, 0, 0, 400 },
|
||||
{ "mask", MMaskXObj::m_mask, 1, 1, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
MMaskXObject::MMaskXObject(ObjectType ObjectType) :Object<MMaskXObject>("MMaskXObj") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MMaskXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
MMaskXObject::initMethods(xlibMethods);
|
||||
MMaskXObject *xobj = new MMaskXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void MMaskXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
MMaskXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
void MMaskXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("MMaskXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUBNR(MMaskXObj::m_dispose)
|
||||
XOBJSTUBNR(MMaskXObj::m_mask)
|
||||
|
||||
}
|
||||
48
engines/director/lingo/xlibs/m/mmaskxobj.h
Normal file
48
engines/director/lingo/xlibs/m/mmaskxobj.h
Normal file
@@ -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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MMASKXOBJ_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MMASKXOBJ_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MMaskXObject : public Object<MMaskXObject> {
|
||||
public:
|
||||
MMaskXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MMaskXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_mask(int nargs);
|
||||
|
||||
} // End of namespace MMaskXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
695
engines/director/lingo/xlibs/m/mmovie.cpp
Normal file
695
engines/director/lingo/xlibs/m/mmovie.cpp
Normal file
@@ -0,0 +1,695 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/savefile.h"
|
||||
#include "common/str.h"
|
||||
#include "common/system.h"
|
||||
#include "gui/filebrowser-dialog.h"
|
||||
#include "video/qt_decoder.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/movie.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/mmovie.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Virtual Nightclub
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
Multi Movie XObject by Mediamation Ltd. Copyright © Trip Media Ltd 1995-1996.
|
||||
--MMovie
|
||||
I mNew
|
||||
X mDispose
|
||||
IS mOpenMMovie, fileName
|
||||
II mCloseMMovie, movieIndex
|
||||
ISSSSS mPlaySegment, segmentName, restoreOpt, abortOpt, purgeOpt, asyncOpt
|
||||
ISSSSS mPlaySegLoop, segmentName, restoreOpt, abortOpt, purgeOpt, asyncOpt
|
||||
I mIdleSegment
|
||||
I mStopSegment
|
||||
IS mSeekSegment, segmentName
|
||||
II mSetSegmentTime, segTime
|
||||
IIIII mSetDisplayBounds, left, top, right, bottom
|
||||
II mGetMovieNormalWidth, movieIndex
|
||||
II mGetMovieNormalHeight, movieIndex
|
||||
II mGetSegCount, movieIndex
|
||||
SII mGetSegName, movieIndex, segmentIndex
|
||||
I mGetMovieRate
|
||||
II mSetMovieRate, ratePercent
|
||||
I mFlushEvents
|
||||
IIIII mInvalidateRect, left, top, right, bottom
|
||||
SSI mReadFile, fileName, scramble
|
||||
SSSI mWriteFile, fileName, data, scramble
|
||||
ISS mCopyFile, sourceFileName, destFileName
|
||||
I mCopyFileCont
|
||||
IS mFreeSpace, driveLetter
|
||||
IS mDeleteFile, fileName
|
||||
S mVolList
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MMovieXObj::xlibName = "MMovie";
|
||||
const XlibFileDesc MMovieXObj::fileNames[] = {
|
||||
{ "MMovie", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "Movie", MMovieXObj::m_Movie, 4, 4, 400 },
|
||||
{ "new", MMovieXObj::m_new, 0, 0, 400 },
|
||||
{ "dispose", MMovieXObj::m_dispose, 0, 0, 400 },
|
||||
{ "openMMovie", MMovieXObj::m_openMMovie, 1, 1, 400 },
|
||||
{ "closeMMovie", MMovieXObj::m_closeMMovie, 1, 1, 400 },
|
||||
{ "playSegment", MMovieXObj::m_playSegment, 5, 5, 400 },
|
||||
{ "playSegLoop", MMovieXObj::m_playSegLoop, 5, 5, 400 },
|
||||
{ "idleSegment", MMovieXObj::m_idleSegment, 0, 0, 400 },
|
||||
{ "stopSegment", MMovieXObj::m_stopSegment, 0, 0, 400 },
|
||||
{ "seekSegment", MMovieXObj::m_seekSegment, 1, 1, 400 },
|
||||
{ "setSegmentTime", MMovieXObj::m_setSegmentTime, 1, 1, 400 },
|
||||
{ "setDisplayBounds", MMovieXObj::m_setDisplayBounds, 4, 4, 400 },
|
||||
{ "getMovieNormalWidth", MMovieXObj::m_getMovieNormalWidth, 1, 1, 400 },
|
||||
{ "getMovieNormalHeight", MMovieXObj::m_getMovieNormalHeight, 1, 1, 400 },
|
||||
{ "getSegCount", MMovieXObj::m_getSegCount, 1, 1, 400 },
|
||||
{ "getSegName", MMovieXObj::m_getSegName, 2, 2, 400 },
|
||||
{ "getMovieRate", MMovieXObj::m_getMovieRate, 0, 0, 400 },
|
||||
{ "setMovieRate", MMovieXObj::m_setMovieRate, 1, 1, 400 },
|
||||
{ "flushEvents", MMovieXObj::m_flushEvents, 0, 0, 400 },
|
||||
{ "invalidateRect", MMovieXObj::m_invalidateRect, 4, 4, 400 },
|
||||
{ "readFile", MMovieXObj::m_readFile, 2, 2, 400 },
|
||||
{ "writeFile", MMovieXObj::m_writeFile, 3, 3, 400 },
|
||||
{ "copyFile", MMovieXObj::m_copyFile, 2, 2, 400 },
|
||||
{ "copyFileCont", MMovieXObj::m_copyFileCont, 0, 0, 400 },
|
||||
{ "freeSpace", MMovieXObj::m_freeSpace, 1, 1, 400 },
|
||||
{ "deleteFile", MMovieXObj::m_deleteFile, 1, 1, 400 },
|
||||
{ "volList", MMovieXObj::m_volList, 0, 0, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const BuiltinProto xlibBuiltins[] = {
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
MMovieXObject::MMovieXObject(ObjectType ObjectType) :Object<MMovieXObject>("MMovie") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
MMovieXObject::~MMovieXObject() {
|
||||
_lastFrame.free();
|
||||
for (auto &it : _movies) {
|
||||
if (it._value._video) {
|
||||
delete it._value._video;
|
||||
it._value._video = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int MMovieXObject::playSegment(int movieIndex, int segIndex, bool looping, bool restore, bool shiftAbort, bool abortOnClick, bool purge, bool async) {
|
||||
int result = MMovieError::MMOVIE_INVALID_MOVIE_INDEX;
|
||||
if (_movies.contains(movieIndex)) {
|
||||
MMovieFile &movie = _movies.getVal(movieIndex);
|
||||
result = MMovieError::MMOVIE_INDEX_OUT_OF_RANGE;
|
||||
if (segIndex <= (int)movie.segments.size() && segIndex > 0) {
|
||||
MMovieSegment &segment = movie.segments[segIndex - 1];
|
||||
_currentMovieIndex = movieIndex;
|
||||
_currentSegmentIndex = segIndex;
|
||||
_looping = looping;
|
||||
_restore = restore;
|
||||
_shiftAbort = shiftAbort;
|
||||
_abortOnClick = abortOnClick;
|
||||
_purge = purge;
|
||||
_async = async;
|
||||
debugC(5, kDebugXObj, "MMovieXObject::playSegment(): hitting play on movie %s (%d) segment %s (%d) - %d", movie._path.toString().c_str(), movieIndex, segment._name.c_str(), segIndex, segment._start);
|
||||
movie._video->seek(Audio::Timestamp(0, segment._start, movie._video->getTimeScale()));
|
||||
movie._video->start();
|
||||
result = MMovieError::MMOVIE_NONE;
|
||||
if (!_async) {
|
||||
result = updateScreenBlocking();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MMovieXObject::stopSegment() {
|
||||
if (_currentMovieIndex && _currentSegmentIndex) {
|
||||
MMovieFile &movie = _movies.getVal(_currentMovieIndex);
|
||||
MMovieSegment &seg = movie.segments[_currentSegmentIndex - 1];
|
||||
debugC(5, kDebugXObj, "MMovieXObject::stopSegment(): hitting stop on movie %s (%d) segment %s (%d) - %d", movie._path.toString().c_str(), _currentMovieIndex, seg._name.c_str(), _currentSegmentIndex, seg._start);
|
||||
if (movie._video) {
|
||||
movie._video->stop();
|
||||
}
|
||||
_currentMovieIndex = 0;
|
||||
_currentSegmentIndex = 0;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int MMovieXObject::updateScreenBlocking() {
|
||||
MMovieError result = MMovieError::MMOVIE_PLAYBACK_FINISHED;
|
||||
while (_currentMovieIndex && _currentSegmentIndex) {
|
||||
Common::Event event;
|
||||
bool keepPlaying = true;
|
||||
if (g_director->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_QUIT:
|
||||
g_director->processEventQUIT();
|
||||
// fallthrough
|
||||
case Common::EVENT_KEYDOWN:
|
||||
case Common::EVENT_RBUTTONDOWN:
|
||||
case Common::EVENT_LBUTTONDOWN:
|
||||
if (_abortOnClick) {
|
||||
result = MMovieError::MMOVIE_ABORT_DOUBLE_CLICK;
|
||||
keepPlaying = false;
|
||||
} else if (_shiftAbort) {
|
||||
if (event.type == Common::EVENT_RBUTTONDOWN ||
|
||||
(event.type == Common::EVENT_LBUTTONDOWN &&
|
||||
(g_system->getEventManager()->getModifierState() & Common::KBD_SHIFT))) {
|
||||
result = MMovieError::MMOVIE_ABORT_DOUBLE_CLICK;
|
||||
keepPlaying = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// pass event through to window manager.
|
||||
// this is required so that e.g. the stillDown is kept up to date
|
||||
g_director->_wm->processEvent(event);
|
||||
}
|
||||
if (!keepPlaying)
|
||||
break;
|
||||
updateScreen();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int MMovieXObject::updateScreen() {
|
||||
int result = MMovieError::MMOVIE_CONTINUE_WITHOUT_PLAYING;
|
||||
if (_currentMovieIndex) {
|
||||
MMovieFile &movie = _movies.getVal(_currentMovieIndex);
|
||||
if (_currentSegmentIndex) {
|
||||
MMovieSegment &seg = movie.segments[_currentSegmentIndex - 1];
|
||||
result = getTicks();
|
||||
if (movie._video && movie._video->isPlaying() && movie._video->needsUpdate()) {
|
||||
const Graphics::Surface *frame = movie._video->decodeNextFrame();
|
||||
if (frame && !_bounds.isEmpty()) {
|
||||
debugC(8, kDebugXObj, "MMovieXObject: rendering movie %s (%d), ticks %d", movie._path.toString().c_str(), _currentMovieIndex, getTicks());
|
||||
Graphics::Surface *temp1 = frame->scale(_bounds.width(), _bounds.height(), false);
|
||||
Graphics::Surface *temp2 = temp1->convertTo(g_director->_pixelformat, movie._video->getPalette());
|
||||
_lastFrame.copyFrom(*temp2);
|
||||
temp2->free();
|
||||
delete temp2;
|
||||
temp1->free();
|
||||
delete temp1;
|
||||
}
|
||||
}
|
||||
if (!_bounds.isEmpty())
|
||||
g_system->copyRectToScreen(_lastFrame.getPixels(), _lastFrame.pitch, _bounds.left, _bounds.top, _bounds.width(), _bounds.height());
|
||||
// do a time check
|
||||
uint32 endTime = Audio::Timestamp(0, seg._length + seg._start, movie._video->getTimeScale()).msecs();
|
||||
debugC(8, kDebugXObj, "MMovieXObject::updateScreen(): time: %d, endTime: %d, ticks: %d, endTicks: %d", movie._video->getTime(), endTime, getTicks(), seg._length + seg._start);
|
||||
if (movie._video->getTime() >= endTime) {
|
||||
if (_looping) {
|
||||
debugC(5, kDebugXObj, "MMovieXObject::updateScreen(): rewinding loop on %s (%d), time: %d, ticks: %d", movie._path.toString().c_str(), _currentMovieIndex, movie._video->getTime(), getTicks());
|
||||
movie._video->seek(Audio::Timestamp(0, seg._start, movie._video->getTimeScale()));
|
||||
} else {
|
||||
debugC(5, kDebugXObj, "MMovieXObject::updateScreen(): stopping %s (%d), time: %d, ticks: %d", movie._path.toString().c_str(), _currentMovieIndex, movie._video->getTime(), getTicks());
|
||||
stopSegment();
|
||||
result = MMovieError::MMOVIE_PLAYBACK_FINISHED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
g_system->updateScreen();
|
||||
g_director->delayMillis(10);
|
||||
return result;
|
||||
}
|
||||
|
||||
int MMovieXObject::getTicks() {
|
||||
if (_currentMovieIndex && _currentSegmentIndex) {
|
||||
MMovieFile &movie = _movies.getVal(_currentMovieIndex);
|
||||
MMovieSegment &segment = movie.segments[_currentSegmentIndex - 1];
|
||||
if (movie._video) {
|
||||
_lastTicks = movie._video->getTime() - Audio::Timestamp(0, segment._start, movie._video->getTimeScale()).msecs();
|
||||
_lastTicks = _lastTicks * 60 / 1000;
|
||||
}
|
||||
}
|
||||
return _lastTicks;
|
||||
}
|
||||
|
||||
void MMovieXObj::open(ObjectType type, const Common::Path &path) {
|
||||
MMovieXObject::initMethods(xlibMethods);
|
||||
MMovieXObject *xobj = new MMovieXObject(type);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
g_lingo->initBuiltIns(xlibBuiltins);
|
||||
}
|
||||
|
||||
void MMovieXObj::close(ObjectType type) {
|
||||
MMovieXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
|
||||
}
|
||||
|
||||
void MMovieXObj::m_new(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUB(MMovieXObj::m_Movie, 0)
|
||||
XOBJSTUBNR(MMovieXObj::m_dispose)
|
||||
|
||||
void MMovieXObj::m_openMMovie(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_openMMovie", nargs);
|
||||
if (nargs != 1) {
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(-1));
|
||||
return;
|
||||
}
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
Common::String basename = g_lingo->pop().asString();
|
||||
Common::Path path = findPath(basename);
|
||||
if (path.empty()) {
|
||||
g_lingo->push(MMovieError::MMOVIE_INVALID_OFFSETS_FILE);
|
||||
return;
|
||||
}
|
||||
Common::Path offsetsPath = findPath(basename.substr(0, basename.size()-4) + ".ofs");
|
||||
if (offsetsPath.empty()) {
|
||||
g_lingo->push(MMovieError::MMOVIE_INVALID_OFFSETS_FILE);
|
||||
return;
|
||||
}
|
||||
if (me->_moviePathMap.contains(basename)) {
|
||||
g_lingo->push(MMovieError::MMOVIE_MOVIE_ALREADY_OPEN);
|
||||
return;
|
||||
}
|
||||
Common::File offsetsFile;
|
||||
if (!offsetsFile.open(offsetsPath)) {
|
||||
g_lingo->push(MMovieError::MMOVIE_INVALID_OFFSETS_FILE);
|
||||
return;
|
||||
}
|
||||
|
||||
MMovieFile movie(path);
|
||||
movie._video = new Video::QuickTimeDecoder();
|
||||
if (!movie._video->loadFile(path)) {
|
||||
warning("MMovieXObj::m_openMMovie(): unable to open QT file %s", path.toString().c_str());
|
||||
delete movie._video;
|
||||
movie._video = nullptr;
|
||||
}
|
||||
uint32 offsetCount = offsetsFile.readUint32BE();
|
||||
offsetsFile.skip(0x3c); // rest of header should be blank
|
||||
debugC(5, kDebugXObj, "MMovieXObj:m_openMMovie(): opening movie %s (index %d)", path.toString().c_str(), me->_lastIndex);
|
||||
for (uint32 i = 0; i < offsetCount; i++) {
|
||||
Common::String name = offsetsFile.readString(' ', 0x10);
|
||||
uint32 start = offsetsFile.readUint32BE();
|
||||
uint32 length = offsetsFile.readUint32BE();
|
||||
debugC(5, kDebugXObj, "MMovieXObj:m_openMMovie(): adding segment %s (index %d): start %d (%dms) length %d (%dms)", name.c_str(), movie.segments.size(), start, Audio::Timestamp(0, start, movie._video->getTimeScale()).msecs(), length, Audio::Timestamp(0, length, movie._video->getTimeScale()).msecs());
|
||||
movie.segments.push_back(MMovieSegment(name, start, length));
|
||||
movie.segLookup.setVal(name, movie.segments.size());
|
||||
}
|
||||
me->_movies.setVal(me->_lastIndex, movie);
|
||||
me->_moviePathMap.setVal(basename, me->_lastIndex);
|
||||
g_lingo->push(me->_lastIndex);
|
||||
me->_lastIndex += 1;
|
||||
}
|
||||
|
||||
void MMovieXObj::m_closeMMovie(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_closeMMovie", nargs);
|
||||
if (nargs != 1) {
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_MOVIE_INDEX));
|
||||
return;
|
||||
}
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
int index = g_lingo->pop().asInt();
|
||||
if (!me->_movies.contains(index)) {
|
||||
warning("MMovieXObj::m_closeMMovie(): movie index %d not found", index);
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_MOVIE_INDEX));
|
||||
return;
|
||||
}
|
||||
for (auto &it : me->_moviePathMap) {
|
||||
if (it._value == index) {
|
||||
me->_moviePathMap.erase(it._key);
|
||||
break;
|
||||
}
|
||||
}
|
||||
MMovieFile &file = me->_movies.getVal(index);
|
||||
debugC(5, kDebugXObj, "MMovieXObj:m_openMMovie(): closing movie %s (index %d)", file._path.toString().c_str(), me->_lastIndex);
|
||||
if (file._video) {
|
||||
delete file._video;
|
||||
file._video = nullptr;
|
||||
}
|
||||
me->_movies.erase(index);
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_NONE));
|
||||
}
|
||||
|
||||
void MMovieXObj::m_playSegment(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_playSegment", nargs);
|
||||
if (nargs != 5) {
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_SEGMENT_NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
Common::String asyncOpt = g_lingo->pop().asString();
|
||||
Common::String purgeOpt = g_lingo->pop().asString();
|
||||
Common::String abortOpt = g_lingo->pop().asString();
|
||||
Common::String restoreOpt = g_lingo->pop().asString();
|
||||
Common::String segmentName = g_lingo->pop().asString();
|
||||
|
||||
bool restore = restoreOpt.equalsIgnoreCase("restore");
|
||||
bool shiftAbort = abortOpt.equalsIgnoreCase("shiftAbort");
|
||||
bool abortOnClick = abortOpt.equalsIgnoreCase("abortOnClick");
|
||||
bool purge = purgeOpt.equalsIgnoreCase("purge");
|
||||
bool async = asyncOpt.equalsIgnoreCase("async");
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
for (auto &it : me->_movies) {
|
||||
if (it._value.segLookup.contains(segmentName)) {
|
||||
int segIndex = it._value.segLookup.getVal(segmentName);
|
||||
int result = me->playSegment(it._key, segIndex, false, restore, shiftAbort, abortOnClick, purge, async);
|
||||
int ticks = me->getTicks();
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_playSegment: ticks: %d, result: %d", ticks, result);
|
||||
g_lingo->push(Datum(result));
|
||||
return;
|
||||
}
|
||||
}
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_SEGMENT_NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
void MMovieXObj::m_playSegLoop(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_playSegLoop", nargs);
|
||||
if (nargs != 5) {
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_SEGMENT_NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
Common::String asyncOpt = g_lingo->pop().asString();
|
||||
Common::String purgeOpt = g_lingo->pop().asString();
|
||||
Common::String abortOpt = g_lingo->pop().asString();
|
||||
Common::String restoreOpt = g_lingo->pop().asString();
|
||||
Common::String segmentName = g_lingo->pop().asString();
|
||||
|
||||
bool restore = restoreOpt.equalsIgnoreCase("restore");
|
||||
bool shiftAbort = abortOpt.equalsIgnoreCase("shiftAbort");
|
||||
bool abortOnClick = abortOpt.equalsIgnoreCase("abortOnClick");
|
||||
bool purge = abortOpt.equalsIgnoreCase("purge");
|
||||
bool async = asyncOpt.equalsIgnoreCase("async");
|
||||
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
for (auto &it : me->_movies) {
|
||||
if (it._value.segLookup.contains(segmentName)) {
|
||||
int segIndex = it._value.segLookup.getVal(segmentName);
|
||||
int result = me->playSegment(it._key, segIndex, true, restore, shiftAbort, abortOnClick, purge, async);
|
||||
int ticks = me->getTicks();
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_playSegLoop: ticks: %d, result: %d", ticks, result);
|
||||
g_lingo->push(Datum(result));
|
||||
return;
|
||||
}
|
||||
}
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_SEGMENT_NAME));
|
||||
return;
|
||||
}
|
||||
|
||||
void MMovieXObj::m_idleSegment(int nargs) {
|
||||
if (nargs != 0) {
|
||||
g_lingo->dropStack(nargs);
|
||||
}
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
int result = me->updateScreen();
|
||||
int ticks = me->getTicks();
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_idleSegment(): ticks: %d, result: %d", ticks, result);
|
||||
|
||||
g_lingo->push(Datum(result));
|
||||
}
|
||||
|
||||
void MMovieXObj::m_stopSegment(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_stopSegment", nargs);
|
||||
if (nargs != 0) {
|
||||
g_lingo->dropStack(nargs);
|
||||
}
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
me->stopSegment();
|
||||
g_lingo->push(0);
|
||||
}
|
||||
|
||||
void MMovieXObj::m_seekSegment(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_seekSegment", nargs);
|
||||
if (nargs != 1) {
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_SEGMENT_NAME));
|
||||
return;
|
||||
}
|
||||
Common::String segmentName = g_lingo->pop().asString();
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
for (auto &it : me->_movies) {
|
||||
if (it._value.segLookup.contains(segmentName)) {
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_NONE));
|
||||
return;
|
||||
}
|
||||
}
|
||||
g_lingo->push(Datum(MMovieError::MMOVIE_INVALID_SEGMENT_NAME));
|
||||
}
|
||||
|
||||
|
||||
XOBJSTUB(MMovieXObj::m_setSegmentTime, 0)
|
||||
|
||||
void MMovieXObj::m_setDisplayBounds(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_setDisplayBounds", nargs);
|
||||
if (nargs != 4) {
|
||||
warning("MMovieXObj::m_setDisplayBounds: expecting 4 arguments!");
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(0));
|
||||
return;
|
||||
}
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
Datum bottom = g_lingo->pop();
|
||||
Datum right = g_lingo->pop();
|
||||
Datum top = g_lingo->pop();
|
||||
Datum left = g_lingo->pop();
|
||||
me->_bounds = Common::Rect((int16)left.asInt(), (int16)top.asInt(), (int16)right.asInt(), (int16)bottom.asInt());
|
||||
me->_lastFrame.free();
|
||||
me->_lastFrame.create(me->_bounds.width(), me->_bounds.height(), g_director->_pixelformat);
|
||||
Common::Rect screen = g_director->getCurrentMovie()->_movieRect;
|
||||
me->_bounds.clip(Common::Rect(screen.width(), screen.height()));
|
||||
g_lingo->push(Datum(0));
|
||||
}
|
||||
|
||||
XOBJSTUB(MMovieXObj::m_getMovieNormalWidth, 0)
|
||||
XOBJSTUB(MMovieXObj::m_getMovieNormalHeight, 0)
|
||||
|
||||
void MMovieXObj::m_getSegCount(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_getSegCount", nargs);
|
||||
if (nargs != 1) {
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(MMovieError::MMOVIE_INVALID_MOVIE_INDEX);
|
||||
return;
|
||||
}
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
int movieIndex = g_lingo->pop().asInt();
|
||||
if (!me->_movies.contains(movieIndex)) {
|
||||
g_lingo->push(MMovieError::MMOVIE_INVALID_MOVIE_INDEX);
|
||||
return;
|
||||
}
|
||||
g_lingo->push((int)me->_movies.getVal(movieIndex).segments.size());
|
||||
}
|
||||
|
||||
void MMovieXObj::m_getSegName(int nargs) {
|
||||
if (nargs != 2) {
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Common::String(""));
|
||||
return;
|
||||
}
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
int segmentIndex = g_lingo->pop().asInt();
|
||||
int movieIndex = g_lingo->pop().asInt();
|
||||
if (!me->_movies.contains(movieIndex)) {
|
||||
g_lingo->push(Common::String(""));
|
||||
return;
|
||||
}
|
||||
if (segmentIndex > (int)me->_movies.getVal(movieIndex).segments.size() ||
|
||||
segmentIndex <= 0) {
|
||||
g_lingo->push(Common::String(""));
|
||||
return;
|
||||
}
|
||||
Common::String result = me->_movies.getVal(movieIndex).segments[segmentIndex - 1]._name;
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_getSegName(%d, %d): %s", movieIndex, segmentIndex, result.c_str());
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MMovieXObj::m_getMovieRate(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_getMovieRate", nargs);
|
||||
if (nargs != 0) {
|
||||
g_lingo->dropStack(nargs);
|
||||
}
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
g_lingo->push(Datum(me->_rate));
|
||||
}
|
||||
|
||||
void MMovieXObj::m_setMovieRate(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_setMovieRate", nargs);
|
||||
if (nargs != 1) {
|
||||
warning("MMovieXObj::m_setMovieRate: expecting 4 arguments");
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(0));
|
||||
return;
|
||||
}
|
||||
MMovieXObject *me = static_cast<MMovieXObject *>(g_lingo->_state->me.u.obj);
|
||||
me->_rate = g_lingo->pop().asInt();
|
||||
g_lingo->push(Datum(me->_rate));
|
||||
}
|
||||
|
||||
XOBJSTUB(MMovieXObj::m_flushEvents, 0)
|
||||
XOBJSTUB(MMovieXObj::m_invalidateRect, 0)
|
||||
|
||||
void MMovieXObj::m_readFile(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_readFile", nargs);
|
||||
if (nargs != 2) {
|
||||
warning("MMovieXObj::m_readFile(): expecting 2 arguments");
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(""));
|
||||
return;
|
||||
}
|
||||
Common::SaveFileManager *saves = g_system->getSavefileManager();
|
||||
bool scramble = g_lingo->pop().asInt() != 0;
|
||||
Common::String origPath = g_lingo->pop().asString();
|
||||
Common::String path = origPath;
|
||||
|
||||
Common::String prefix = savePrefix();
|
||||
Common::String result;
|
||||
if (origPath.empty()) {
|
||||
path = getFileNameFromModal(false, Common::String(), Common::String(), "txt");
|
||||
if (path.empty()) {
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_readFile(): read cancelled by modal");
|
||||
g_lingo->push(result);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
path = lastPathComponent(origPath, g_director->_dirSeparator);
|
||||
if (!path.hasSuffixIgnoreCase(".txt"))
|
||||
path += ".txt";
|
||||
}
|
||||
if (!path.hasPrefixIgnoreCase(prefix)) {
|
||||
path = prefix + path;
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *stream = saves->openForLoading(path);
|
||||
if (stream) {
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_readFile(): opening file %s as %s from the saves dir", origPath.c_str(), path.c_str());
|
||||
} else {
|
||||
Common::File *f = new Common::File;
|
||||
Common::Path location = findPath(origPath);
|
||||
if (!location.empty() && f->open(location)) {
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_readFile(): opening file %s from the game dir", origPath.c_str());
|
||||
stream = (Common::SeekableReadStream *)f;
|
||||
} else {
|
||||
delete f;
|
||||
}
|
||||
}
|
||||
|
||||
if (stream) {
|
||||
while (!stream->eos() && !stream->err()) {
|
||||
byte ch = stream->readByte();
|
||||
if (scramble) // remove unbreakable encryption
|
||||
ch ^= 0xa5;
|
||||
result += ch;
|
||||
}
|
||||
delete stream;
|
||||
} else {
|
||||
warning("MMovieXObj::m_readFile(): file %s not found", origPath.c_str());
|
||||
}
|
||||
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MMovieXObj::m_writeFile(int nargs) {
|
||||
g_lingo->printArgs("MMovieXObj::m_writeFile", nargs);
|
||||
if (nargs != 3) {
|
||||
warning("MMovieXObj::m_writeFile(): expecting 3 arguments");
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(""));
|
||||
return;
|
||||
}
|
||||
Common::SaveFileManager *saves = g_system->getSavefileManager();
|
||||
bool scramble = g_lingo->pop().asInt() != 0;
|
||||
Common::String data = g_lingo->pop().asString();
|
||||
Common::String origPath = g_lingo->pop().asString();
|
||||
Common::String path = origPath;
|
||||
Common::String result;
|
||||
|
||||
Common::String prefix = savePrefix();
|
||||
if (origPath.empty()) {
|
||||
path = getFileNameFromModal(true, Common::String(), Common::String(), "txt");
|
||||
if (path.empty()) {
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_writeFile(): read cancelled by modal");
|
||||
g_lingo->push(result);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
path = lastPathComponent(origPath, g_director->_dirSeparator);
|
||||
// Virtual Nightclub makes autosaves at random intervals.
|
||||
// Intercept and give them a sensible name.
|
||||
if (path.hasSuffixIgnoreCase(".VNC") && path.hasPrefixIgnoreCase("VNC_")) {
|
||||
path = Common::String::format("Autosave.txt");
|
||||
}
|
||||
|
||||
if (!path.hasSuffixIgnoreCase(".txt"))
|
||||
path += ".txt";
|
||||
}
|
||||
if (!path.hasPrefixIgnoreCase(prefix)) {
|
||||
path = prefix + path;
|
||||
}
|
||||
|
||||
Common::SeekableWriteStream *stream = saves->openForSaving(path, false);
|
||||
|
||||
if (stream) {
|
||||
debugC(5, kDebugXObj, "MMovieXObj::m_writeFile(): opening file %s as %s from the saves dir", origPath.c_str(), path.c_str());
|
||||
for (auto &it : data) {
|
||||
byte ch = it;
|
||||
if (scramble) // apply world's greatest encryption
|
||||
ch ^= 0xa5;
|
||||
stream->writeByte(ch);
|
||||
}
|
||||
stream->finalize();
|
||||
delete stream;
|
||||
} else {
|
||||
warning("MMovieXObj::m_writeFile(): file %s not found", origPath.c_str());
|
||||
}
|
||||
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
XOBJSTUB(MMovieXObj::m_copyFile, 0)
|
||||
XOBJSTUB(MMovieXObj::m_copyFileCont, 0)
|
||||
XOBJSTUB(MMovieXObj::m_freeSpace, 0)
|
||||
XOBJSTUB(MMovieXObj::m_deleteFile, 0)
|
||||
XOBJSTUB(MMovieXObj::m_volList, "")
|
||||
|
||||
}
|
||||
134
engines/director/lingo/xlibs/m/mmovie.h
Normal file
134
engines/director/lingo/xlibs/m/mmovie.h
Normal file
@@ -0,0 +1,134 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MMOVIE_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MMOVIE_H
|
||||
|
||||
#include "common/hash-str.h"
|
||||
#include "video/qt_decoder.h"
|
||||
namespace Director {
|
||||
|
||||
// taken from shared:1124:mHandleError
|
||||
enum MMovieError {
|
||||
MMOVIE_NONE = 0,
|
||||
MMOVIE_NO_STAGE = -1,
|
||||
MMOVIE_TOO_MANY_OPEN_FILES = -2,
|
||||
MMOVIE_MOVIE_ALREADY_OPEN = -3,
|
||||
MMOVIE_INVALID_MOVIE_INDEX = -4,
|
||||
MMOVIE_INVALID_OFFSETS_FILE = -5,
|
||||
MMOVIE_INVALID_SEGMENT_OFFSET = -6,
|
||||
MMOVIE_NO_MOVIES_OPEN = -7,
|
||||
MMOVIE_INVALID_SEGMENT_NAME = -8,
|
||||
MMOVIE_INDEX_OUT_OF_RANGE = -9,
|
||||
MMOVIE_CONTINUE_WITHOUT_PLAYING = -10,
|
||||
MMOVIE_ABORT_DOUBLE_CLICK = -11,
|
||||
MMOVIE_PLAYBACK_FINISHED = -12,
|
||||
};
|
||||
|
||||
struct MMovieSegment {
|
||||
Common::String _name;
|
||||
uint32 _start = 0;
|
||||
uint32 _length = 0;
|
||||
MMovieSegment() {}
|
||||
MMovieSegment(Common::String name, uint32 start, uint32 length) : _name(name), _start(start), _length(length) {}
|
||||
};
|
||||
|
||||
struct MMovieFile {
|
||||
int _lastIndex = 0;
|
||||
Common::Path _path;
|
||||
Common::Array<MMovieSegment> segments;
|
||||
Common::HashMap<Common::String, uint32, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> segLookup;
|
||||
Video::QuickTimeDecoder *_video = nullptr;
|
||||
MMovieFile() {}
|
||||
MMovieFile(Common::Path path) : _path(path) {}
|
||||
};
|
||||
|
||||
class MMovieXObject : public Object<MMovieXObject> {
|
||||
public:
|
||||
MMovieXObject(ObjectType objType);
|
||||
~MMovieXObject();
|
||||
|
||||
int _rate = 100;
|
||||
Common::Rect _bounds;
|
||||
int _lastIndex = 1;
|
||||
int _currentMovieIndex = 0;
|
||||
int _currentSegmentIndex = 0;
|
||||
bool _looping = false;
|
||||
bool _restore = false;
|
||||
bool _shiftAbort = false;
|
||||
bool _abortOnClick = false;
|
||||
bool _purge = false;
|
||||
bool _async = false;
|
||||
int _lastTicks = -1;
|
||||
|
||||
Common::HashMap<int, MMovieFile> _movies;
|
||||
Common::HashMap<Common::String, int, Common::IgnoreCase_Hash, Common::IgnoreCase_EqualTo> _moviePathMap;
|
||||
|
||||
Graphics::Surface _lastFrame;
|
||||
|
||||
int playSegment(int movieIndex, int segIndex, bool looping, bool restore, bool shiftAbort, bool abortOnClick, bool purge, bool async);
|
||||
bool stopSegment();
|
||||
int updateScreenBlocking();
|
||||
int updateScreen();
|
||||
int getTicks();
|
||||
};
|
||||
|
||||
namespace MMovieXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_Movie(int nargs);
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_openMMovie(int nargs);
|
||||
void m_closeMMovie(int nargs);
|
||||
void m_playSegment(int nargs);
|
||||
void m_playSegLoop(int nargs);
|
||||
void m_idleSegment(int nargs);
|
||||
void m_stopSegment(int nargs);
|
||||
void m_seekSegment(int nargs);
|
||||
void m_setSegmentTime(int nargs);
|
||||
void m_setDisplayBounds(int nargs);
|
||||
void m_getMovieNormalWidth(int nargs);
|
||||
void m_getMovieNormalHeight(int nargs);
|
||||
void m_getSegCount(int nargs);
|
||||
void m_getSegName(int nargs);
|
||||
void m_getMovieRate(int nargs);
|
||||
void m_setMovieRate(int nargs);
|
||||
void m_flushEvents(int nargs);
|
||||
void m_invalidateRect(int nargs);
|
||||
void m_readFile(int nargs);
|
||||
void m_writeFile(int nargs);
|
||||
void m_copyFile(int nargs);
|
||||
void m_copyFileCont(int nargs);
|
||||
void m_freeSpace(int nargs);
|
||||
void m_deleteFile(int nargs);
|
||||
void m_volList(int nargs);
|
||||
|
||||
} // End of namespace MMovieXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
184
engines/director/lingo/xlibs/m/moovxobj.cpp
Normal file
184
engines/director/lingo/xlibs/m/moovxobj.cpp
Normal file
@@ -0,0 +1,184 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* USED IN:
|
||||
* The C.H.A.O.S. Continuum (Windows)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* moovXobj: Creative Multimedia, 1993 <<gzr>>
|
||||
* --moovXobj 10.22.93 <<gzr>>
|
||||
* moovXobj
|
||||
* I mNew --Creates a new instance of the XObject.
|
||||
* X mDispose --Disposes of XObject instance.
|
||||
* S mName --Returns the XObject name (moovobj).
|
||||
* I mMovieInit --Initialize QTW.
|
||||
* I mMovieKill --Dispose of QTW.
|
||||
* I mFondler --Movie idle task.
|
||||
* ISII mPlayMovie name,left,top --Play movie at designated location.
|
||||
* I mPauseMovie --Pause active movie.
|
||||
* II mSoundMovie --Turn movie sound on or off.
|
||||
* I mStopMovie --Stops active movie.
|
||||
* I mMovieDone --Returns true if movie done.
|
||||
*
|
||||
* ScummVM Note: mMovieDone returns true when the movie is _not_ done.
|
||||
*/
|
||||
|
||||
#include "graphics/paletteman.h"
|
||||
#include "video/qt_decoder.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/moovxobj.h"
|
||||
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MoovXObj::xlibName = "moovxobj";
|
||||
const XlibFileDesc MoovXObj::fileNames[] = {
|
||||
{ "moovxobj", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MoovXObj::m_new, 0, 0, 300 }, // D3
|
||||
{ "Dispose", MoovXObj::m_dispose, 0, 0, 300 }, // D3
|
||||
{ "Name", MoovXObj::m_name, 0, 0, 300 }, // D4
|
||||
{ "MovieInit", MoovXObj::m_movieInit, 0, 0, 300 }, // D4
|
||||
{ "MovieKill", MoovXObj::m_movieKill, 0, 0, 300 }, // D4
|
||||
{ "Fondler", MoovXObj::m_fondler, 0, 0, 300 }, // D4
|
||||
{ "PlayMovie", MoovXObj::m_playMovie, 3, 3, 300 }, // D4
|
||||
{ "PauseMovie", MoovXObj::m_pauseMovie, 0, 0, 300 }, // D4
|
||||
{ "SoundMovie", MoovXObj::m_soundMovie, 1, 1, 300 }, // D4
|
||||
{ "StopMovie", MoovXObj::m_stopMovie, 0, 0, 300 }, // D4
|
||||
{ "MovieDone", MoovXObj::m_movieDone, 0, 0, 300 }, // D4
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
void MoovXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
MoovXObject::initMethods(xlibMethods);
|
||||
MoovXObject *xobj = new MoovXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void MoovXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
MoovXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
MoovXObject::MoovXObject(ObjectType ObjectType) :Object<MoovXObject>("MoovXObj") {
|
||||
_objType = ObjectType;
|
||||
_video = nullptr;
|
||||
_x = 0;
|
||||
_y = 0;
|
||||
}
|
||||
|
||||
MoovXObject::~MoovXObject() {
|
||||
if (_video) {
|
||||
delete _video;
|
||||
_video = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void MoovXObj::m_new(int nargs) {
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void MoovXObj::m_dispose(int nargs) {
|
||||
debug(5, "MoovXObj::m_dispose");
|
||||
MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_state->me.u.obj);
|
||||
if (me->_video) {
|
||||
delete me->_video;
|
||||
me->_video = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// unused in C.H.A.O.S.
|
||||
XOBJSTUB(MoovXObj::m_name, "MoovXObj")
|
||||
// called in C.H.A.O.S. ScummVMs setup happens in playMovie
|
||||
XOBJSTUB(MoovXObj::m_movieInit, 0)
|
||||
|
||||
void MoovXObj::m_movieKill(int nargs) {
|
||||
debug(5, "MoovXObj::m_movieKill");
|
||||
MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
if (me->_video)
|
||||
me->_video->stop();
|
||||
}
|
||||
|
||||
void MoovXObj::m_fondler(int nargs) {
|
||||
MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
debug(10, "MoovXObj::m_fondler");
|
||||
Graphics::Surface const *frame;
|
||||
|
||||
if (me->_video && me->_video->needsUpdate()) {
|
||||
frame = me->_video->decodeNextFrame();
|
||||
if (frame) {
|
||||
g_system->copyRectToScreen(frame->getPixels(), frame->pitch, me->_x, me->_y, frame->w, frame->h);
|
||||
g_system->updateScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MoovXObj::m_playMovie(int nargs) {
|
||||
MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_state->me.u.obj);
|
||||
|
||||
me->_y = g_lingo->pop().asInt();
|
||||
me->_x = g_lingo->pop().asInt();
|
||||
Common::String filename = g_lingo->pop().asString();
|
||||
|
||||
debug(5, "MoovXObj::m_playMovie: name: %s, x: %i y: %i", filename.c_str(), me->_x, me->_y);
|
||||
|
||||
me->_video = new Video::QuickTimeDecoder();
|
||||
bool result = me->_video->loadFile(Common::Path(filename, g_director->_dirSeparator));
|
||||
if (result && g_director->_pixelformat.bytesPerPixel == 1) {
|
||||
// Director supports playing back RGB and paletted video in 256 colour mode.
|
||||
// In both cases they are dithered to match the Director palette.
|
||||
me->_video->setDitheringPalette(g_director->getPalette());
|
||||
}
|
||||
me->_video->start();
|
||||
}
|
||||
|
||||
// unused in C.H.A.O.S.
|
||||
XOBJSTUB(MoovXObj::m_pauseMovie, 0)
|
||||
// unused in C.H.A.O.S.
|
||||
XOBJSTUB(MoovXObj::m_soundMovie, 0)
|
||||
// unused in C.H.A.O.S.
|
||||
XOBJSTUB(MoovXObj::m_stopMovie, 0)
|
||||
|
||||
void MoovXObj::m_movieDone(int nargs) {
|
||||
MoovXObject *me = static_cast<MoovXObject *>(g_lingo->_state->me.u.obj);
|
||||
debug(10, "MoovXObj::m_movieDone");
|
||||
bool result = (me->_video && !me->_video->endOfVideo());
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
} // End of namespace Director
|
||||
66
engines/director/lingo/xlibs/m/moovxobj.h
Normal file
66
engines/director/lingo/xlibs/m/moovxobj.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MOOVXOBJ_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MOOVXOBJ_H
|
||||
|
||||
namespace Video {
|
||||
class QuickTimeDecoder;
|
||||
}
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MoovXObject : public Object<MoovXObject> {
|
||||
public:
|
||||
MoovXObject(ObjectType objType);
|
||||
~MoovXObject();
|
||||
|
||||
public:
|
||||
Video::QuickTimeDecoder *_video;
|
||||
int _x;
|
||||
int _y;
|
||||
};
|
||||
|
||||
namespace MoovXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_name(int nargs);
|
||||
void m_movieInit(int nargs);
|
||||
void m_movieKill(int nargs);
|
||||
void m_fondler(int nargs);
|
||||
void m_playMovie(int nargs);
|
||||
void m_pauseMovie(int nargs);
|
||||
void m_soundMovie(int nargs);
|
||||
void m_stopMovie(int nargs);
|
||||
void m_movieDone(int nargs);
|
||||
|
||||
} // End of namespace MoovXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
143
engines/director/lingo/xlibs/m/movemousejp.cpp
Normal file
143
engines/director/lingo/xlibs/m/movemousejp.cpp
Normal file
@@ -0,0 +1,143 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/movemousejp.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* junglepark
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- MoveMouse . Implemented by @Sakai Youichi
|
||||
--MoveMouse
|
||||
I mNew --Creates a new instance of the XObject
|
||||
X mDispose --Disposes of XObject instance
|
||||
S mName --Returns the XObject name (Widget)
|
||||
I mStatus --Returns an integer status code
|
||||
SI mError, code --Returns an error string
|
||||
S mLastError --Returns last error string
|
||||
III mAdd, arg1, arg2 --Returns arg1+arg2
|
||||
SSI mFirst, str, nchars --Return the first nchars of string str
|
||||
V mMul, f1, f2 --Returns f1*f2 as floating point
|
||||
X mGlobals --Sample code to Read & Modify globals
|
||||
X mSymbols --Sample code to work with Symbols
|
||||
X mSendPerform --Sample code to show SendPerform call
|
||||
X mFactory --Sample code to find Factory objects
|
||||
III mSetMouseLoc,h,v --Sample code to find Factory objects
|
||||
I mWtop --Sample code to find Factory objects
|
||||
I mWbottom --Sample code to find Factory objects
|
||||
I mWleft --Sample code to find Factory objects
|
||||
I mWright --Sample code to find Factory objects
|
||||
I mCtop --Sample code to find Factory objects
|
||||
I mCbottom --Sample code to find Factory objects
|
||||
I mCleft --Sample code to find Factory objects
|
||||
I mCright --Sample code to find Factory objects
|
||||
S mGetWindowsDir --GetWindows Directory
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MoveMouseJPXObj::xlibName = "MoveMouse";
|
||||
const XlibFileDesc MoveMouseJPXObj::fileNames[] = {
|
||||
{ "MOVEWIN", "junglepark" },
|
||||
{ "MOVEMOUSE", "junglepark" },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MoveMouseJPXObj::m_new, 0, 0, 400 },
|
||||
{ "dispose", MoveMouseJPXObj::m_dispose, 0, 0, 400 },
|
||||
{ "setMouseLoc", MoveMouseJPXObj::m_setMouseLoc, 2, 2, 400 },
|
||||
{ "wtop", MoveMouseJPXObj::m_wtop, 0, 0, 400 },
|
||||
{ "wbottom", MoveMouseJPXObj::m_wbottom, 0, 0, 400 },
|
||||
{ "wleft", MoveMouseJPXObj::m_wleft, 0, 0, 400 },
|
||||
{ "wright", MoveMouseJPXObj::m_wright, 0, 0, 400 },
|
||||
{ "ctop", MoveMouseJPXObj::m_ctop, 0, 0, 400 },
|
||||
{ "cbottom", MoveMouseJPXObj::m_cbottom, 0, 0, 400 },
|
||||
{ "cleft", MoveMouseJPXObj::m_cleft, 0, 0, 400 },
|
||||
{ "cright", MoveMouseJPXObj::m_cright, 0, 0, 400 },
|
||||
{ "getWindowsDir", MoveMouseJPXObj::m_getWindowsDir, 0, 0, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const BuiltinProto xlibBuiltins[] = {
|
||||
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
MoveMouseJPXObject::MoveMouseJPXObject(ObjectType ObjectType) :Object<MoveMouseJPXObject>("MoveMouse") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MoveMouseJPXObj::open(ObjectType type, const Common::Path &path) {
|
||||
MoveMouseJPXObject::initMethods(xlibMethods);
|
||||
MoveMouseJPXObject *xobj = new MoveMouseJPXObject(type);
|
||||
if (type == kXtraObj)
|
||||
g_lingo->_openXtras.push_back(xlibName);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
g_lingo->initBuiltIns(xlibBuiltins);
|
||||
}
|
||||
|
||||
void MoveMouseJPXObj::close(ObjectType type) {
|
||||
MoveMouseJPXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
|
||||
}
|
||||
|
||||
void MoveMouseJPXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("MoveMouseJPXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUBNR(MoveMouseJPXObj::m_dispose)
|
||||
|
||||
void MoveMouseJPXObj::m_setMouseLoc(int nargs) {
|
||||
if (nargs != 2) {
|
||||
warning("MoveMouseJPXObj::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);
|
||||
}
|
||||
|
||||
XOBJSTUB(MoveMouseJPXObj::m_wtop, 0)
|
||||
XOBJSTUB(MoveMouseJPXObj::m_wbottom, 0)
|
||||
XOBJSTUB(MoveMouseJPXObj::m_wleft, 0)
|
||||
XOBJSTUB(MoveMouseJPXObj::m_wright, 0)
|
||||
XOBJSTUB(MoveMouseJPXObj::m_ctop, 0)
|
||||
XOBJSTUB(MoveMouseJPXObj::m_cbottom, 0)
|
||||
XOBJSTUB(MoveMouseJPXObj::m_cleft, 0)
|
||||
XOBJSTUB(MoveMouseJPXObj::m_cright, 0)
|
||||
XOBJSTUB(MoveMouseJPXObj::m_getWindowsDir, "")
|
||||
|
||||
}
|
||||
57
engines/director/lingo/xlibs/m/movemousejp.h
Normal file
57
engines/director/lingo/xlibs/m/movemousejp.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MOVEMOUSEJP_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MOVEMOUSEJP_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MoveMouseJPXObject : public Object<MoveMouseJPXObject> {
|
||||
public:
|
||||
MoveMouseJPXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MoveMouseJPXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_setMouseLoc(int nargs);
|
||||
void m_wtop(int nargs);
|
||||
void m_wbottom(int nargs);
|
||||
void m_wleft(int nargs);
|
||||
void m_wright(int nargs);
|
||||
void m_ctop(int nargs);
|
||||
void m_cbottom(int nargs);
|
||||
void m_cleft(int nargs);
|
||||
void m_cright(int nargs);
|
||||
void m_getWindowsDir(int nargs);
|
||||
|
||||
} // End of namespace MoveMouseJPXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
93
engines/director/lingo/xlibs/m/movemousexobj.cpp
Normal file
93
engines/director/lingo/xlibs/m/movemousexobj.cpp
Normal file
@@ -0,0 +1,93 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/xlibs/m/movemousexobj.h"
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* USED IN:
|
||||
* MediaBook Sampler CD/XObject Studio
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
* MoveMouse 0.1 - (c) Andrew Green 1993 for Mac
|
||||
*/
|
||||
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MoveMouseXObj::xlibName = "MoveMouse";
|
||||
const XlibFileDesc MoveMouseXObj::fileNames[] = {
|
||||
{ "MoveMouse", nullptr },
|
||||
{ "MoveMouse.XObj", nullptr },
|
||||
{ "MOVEWIN", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MoveMouseXObj::m_new, 0, 0, 400 }, // D4
|
||||
{ "setMouseLoc", MoveMouseXObj::m_setMouseLoc, 2, 2, 400 }, // D4
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
MoveMouseXObject::MoveMouseXObject(ObjectType ObjectType) :Object<MoveMouseXObject>("MoveMouse") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MoveMouseXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
MoveMouseXObject::initMethods(xlibMethods);
|
||||
MoveMouseXObject *xobj = new MoveMouseXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void MoveMouseXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
MoveMouseXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
void MoveMouseXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("MoveMouseXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
void MoveMouseXObj::m_setMouseLoc(int nargs) {
|
||||
if (nargs != 2) {
|
||||
warning("MoveMouseXObj::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);
|
||||
}
|
||||
|
||||
}
|
||||
48
engines/director/lingo/xlibs/m/movemousexobj.h
Normal file
48
engines/director/lingo/xlibs/m/movemousexobj.h
Normal file
@@ -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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#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 *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType 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
|
||||
95
engines/director/lingo/xlibs/m/movieidxxobj.cpp
Normal file
95
engines/director/lingo/xlibs/m/movieidxxobj.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/movieidxxobj.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Jewels of the Oracle - Win
|
||||
* Jewels of the Oracle - Mac
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- MovieIdx External Factory. 16/03/95 - AAF - New
|
||||
MovieIdx
|
||||
I mNew --Creates a new instance of the XObject
|
||||
X mDispose --Disposes of XObject instance
|
||||
SS mMovieInfo, movieName --Returns movie information for a given name
|
||||
|
||||
-- MovieIdx, Movie Index XObject - aep 95.05.01
|
||||
I mNew -- read map given file name
|
||||
X mDispose -- dispose of map
|
||||
SS mMovieInfo -- return info given name
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MovieIdxXObj::xlibName = "MovieIdx";
|
||||
const XlibFileDesc MovieIdxXObj::fileNames[] = {
|
||||
{ "MovieIdx", nullptr }, // Jewels of the Oracle - Win
|
||||
{ "MovieIdx.XObj", nullptr }, // Jewels of the Oracle - Mac
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MovieIdxXObj::m_new, 0, 0, 400 },
|
||||
{ "dispose", MovieIdxXObj::m_dispose, 0, 0, 400 },
|
||||
{ "movieInfo", MovieIdxXObj::m_movieInfo, 1, 1, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
MovieIdxXObject::MovieIdxXObject(ObjectType ObjectType) :Object<MovieIdxXObject>("MovieIdx") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MovieIdxXObj::open(ObjectType type, const Common::Path &path) {
|
||||
if (type == kXObj) {
|
||||
MovieIdxXObject::initMethods(xlibMethods);
|
||||
MovieIdxXObject *xobj = new MovieIdxXObject(kXObj);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
}
|
||||
}
|
||||
|
||||
void MovieIdxXObj::close(ObjectType type) {
|
||||
if (type == kXObj) {
|
||||
MovieIdxXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
void MovieIdxXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("MovieIdxXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUBNR(MovieIdxXObj::m_dispose)
|
||||
XOBJSTUB(MovieIdxXObj::m_movieInfo, "")
|
||||
|
||||
}
|
||||
48
engines/director/lingo/xlibs/m/movieidxxobj.h
Normal file
48
engines/director/lingo/xlibs/m/movieidxxobj.h
Normal file
@@ -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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MOVIEIDXXOBJ_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MOVIEIDXXOBJ_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MovieIdxXObject : public Object<MovieIdxXObject> {
|
||||
public:
|
||||
MovieIdxXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MovieIdxXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_movieInfo(int nargs);
|
||||
|
||||
} // End of namespace MovieIdxXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
381
engines/director/lingo/xlibs/m/movutils.cpp
Normal file
381
engines/director/lingo/xlibs/m/movutils.cpp
Normal file
@@ -0,0 +1,381 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/util.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/movutils.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* AMBER: Journeys Beyond
|
||||
* Gahan Wilson's Ultimate Haunted House
|
||||
* Momi no Ki no Shita de: The Day of St. Claus
|
||||
* Virtual Nightclub
|
||||
* Great Adventures by Fisher-Price: Pirate Ship
|
||||
* Stay Tooned
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- MovieUtilities External Factory, v. 1.0.7 by David Jackson Shields
|
||||
--MovUtils
|
||||
I mNew --Create new XObject instance
|
||||
X mDispose --Dispose of XObject instance
|
||||
S mName --Return the XObject name (MovUtils)
|
||||
SS mGetVolName --Return name of disk drive (volume) from path
|
||||
S mGetSystemPath --Return system directory path as a string
|
||||
S mGetWindowsPath --Return Windows directory path as a string
|
||||
IS mSetDefaultPath --Set current drive:irectory path
|
||||
SS mGetChildWindowNames --Return string of all Child window names,
|
||||
-- given a Parent window name
|
||||
IS mGetNamedWindowHdl --Return the ID handle to the named window
|
||||
-- (needed for MCI commands)
|
||||
XSLLII mDrawLine --Draw line in the named window from point A
|
||||
-- to point B, at specified pen width and color
|
||||
ISLI mDrawOval --Draw filled oval (ellipse) in the named window,
|
||||
-- the bounds RECT, using specified fill color
|
||||
ISLI mDrawRect --Draw filled RECT in the named window, within the bounds
|
||||
-- RECT, using specified fill color
|
||||
ISLII mDrawRoundRect --Draw filled rounded RECT in the named window, within bounds
|
||||
-- RECT, with specified curvature and fill color
|
||||
ISLI mDrawPoly --Draw filled polygon in named window from a linear
|
||||
-- list of coordinates, using specified fill color
|
||||
ISLIII mDrawPie --Draw filled arc in named window, within bounds RECT, from
|
||||
-- start angle to arc angle, using specified fill color
|
||||
I mPrintLandscape --Print the Stage in Landscape orientation using dithered grays
|
||||
SS mNoPunct --Remove all punctuation chars from text
|
||||
SS mToUpperCase --Convert text to all upperCase chars
|
||||
SS mToLowerCase --Convert text to all lowerCase chars
|
||||
SS mTrimWhiteChars --Remove leading and trailing 'white space' chars from text
|
||||
SS mDollarFormat --Convert number string to US currency format
|
||||
ISI mGetWordStart --Find number of chars to start of specified word
|
||||
ISI mGetWordEnd --Find number of chars to end of specified word
|
||||
ISI mGetLineStart --Find number of chars to start of specified line
|
||||
ISI mGetLineEnd --Find number of chars to end of specified line
|
||||
IS mIsAlphaNum --Return Boolean whether char is alphaNumeric
|
||||
IS mIsAlpha --Return Boolean whether char is alphabetic
|
||||
IS mIsUpper --Return Boolean whether char is upperCase alphabetic
|
||||
IS mIsLower --Return Boolean whether char is lowerCase alphabetic
|
||||
IS mIsDigit --Return Boolean whether char is a decimal digit
|
||||
IS mIsPunctuation --Return Boolean whether char is punctuation
|
||||
IS mIsWhiteSpace --Return Boolean whether char is a 'white space' char
|
||||
IS mIsPrintable --Return Boolean whether char is printable
|
||||
IS mIsGraphic --Return Boolean whether char is graphic
|
||||
IS mIsControl --Return Boolean whether char is a control char
|
||||
IS mIsHex --Return Boolean whether char is a hexadecimal digit
|
||||
III mBitSet --Set specified bit within a long integer
|
||||
III mBitTest --Test specified bit within a long integer
|
||||
III mBitClear --Clear specified bit within a long integer
|
||||
II mBitShiftL --Shift specified bit left within a long integer
|
||||
II mBitShiftR --Shift specified bit right within a long integer
|
||||
III mBitAnd --Perform logical AND operation of two long integers
|
||||
III mBitOr --Perform logical OR operation of two long integers
|
||||
III mBitXOr --Perform logical XOR operation of two long integers
|
||||
II mBitNot --Perform logical NOT operation on a long integer
|
||||
IS mBitStringToNumber --Translate string of '1's and '0's to a long integer
|
||||
PL mStageToCast --Returns a picture handle to the image in the Rect on Stage
|
||||
ISL mStageToDIB --Save, to a named bitmap file, the image in the Rect on Stage
|
||||
ISL mStageToPICT --Save, to a Mac PICT file, the image in the Rect on Stage
|
||||
SS mCRtoCRLF --Add a LineFeed to each Return char within Macintosh text
|
||||
SS mCRLFtoCR --Remove LineFeed from each end of line within Windows text
|
||||
III mGetMessage --Get mouse/key messages from the application message queue
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MovUtilsXObj::xlibNames[] = {
|
||||
"MovUtils",
|
||||
"MovieUtilities",
|
||||
nullptr
|
||||
};
|
||||
const XlibFileDesc MovUtilsXObj::fileNames[] = {
|
||||
{ "MOVUTILS", nullptr },
|
||||
{ "MovieUtilities", nullptr },
|
||||
{ "movieutl", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MovUtilsXObj::m_new, 0, 0, 400 },
|
||||
{ "dispose", MovUtilsXObj::m_dispose, 0, 0, 400 },
|
||||
{ "name", MovUtilsXObj::m_name, 0, 0, 400 },
|
||||
{ "getVolName", MovUtilsXObj::m_getVolName, 1, 1, 400 },
|
||||
{ "getSystemPath", MovUtilsXObj::m_getSystemPath, 0, 0, 400 },
|
||||
{ "getWindowsPath", MovUtilsXObj::m_getWindowsPath, 0, 0, 400 },
|
||||
{ "setDefaultPath", MovUtilsXObj::m_setDefaultPath, 1, 1, 400 },
|
||||
{ "getChildWindowNames", MovUtilsXObj::m_getChildWindowNames, 1, 1, 400 },
|
||||
{ "getNamedWindowHdl", MovUtilsXObj::m_getNamedWindowHdl, 1, 1, 400 },
|
||||
{ "drawLine", MovUtilsXObj::m_drawLine, 5, 5, 400 },
|
||||
{ "drawOval", MovUtilsXObj::m_drawOval, 3, 3, 400 },
|
||||
{ "drawRect", MovUtilsXObj::m_drawRect, 3, 3, 400 },
|
||||
{ "drawRoundRect", MovUtilsXObj::m_drawRoundRect, 4, 4, 400 },
|
||||
{ "drawPoly", MovUtilsXObj::m_drawPoly, 3, 3, 400 },
|
||||
{ "drawPie", MovUtilsXObj::m_drawPie, 5, 5, 400 },
|
||||
{ "printLandscape", MovUtilsXObj::m_printLandscape, 0, 0, 400 },
|
||||
{ "noPunct", MovUtilsXObj::m_noPunct, 1, 1, 400 },
|
||||
{ "toUpperCase", MovUtilsXObj::m_toUpperCase, 1, 1, 400 },
|
||||
{ "toLowerCase", MovUtilsXObj::m_toLowerCase, 1, 1, 400 },
|
||||
{ "trimWhiteChars", MovUtilsXObj::m_trimWhiteChars, 1, 1, 400 },
|
||||
{ "dollarFormat", MovUtilsXObj::m_dollarFormat, 1, 1, 400 },
|
||||
{ "getWordStart", MovUtilsXObj::m_getWordStart, 2, 2, 400 },
|
||||
{ "getWordEnd", MovUtilsXObj::m_getWordEnd, 2, 2, 400 },
|
||||
{ "getLineStart", MovUtilsXObj::m_getLineStart, 2, 2, 400 },
|
||||
{ "getLineEnd", MovUtilsXObj::m_getLineEnd, 2, 2, 400 },
|
||||
{ "isAlphaNum", MovUtilsXObj::m_isAlphaNum, 1, 1, 400 },
|
||||
{ "isAlpha", MovUtilsXObj::m_isAlpha, 1, 1, 400 },
|
||||
{ "isUpper", MovUtilsXObj::m_isUpper, 1, 1, 400 },
|
||||
{ "isLower", MovUtilsXObj::m_isLower, 1, 1, 400 },
|
||||
{ "isDigit", MovUtilsXObj::m_isDigit, 1, 1, 400 },
|
||||
{ "isPunctuation", MovUtilsXObj::m_isPunctuation, 1, 1, 400 },
|
||||
{ "isWhiteSpace", MovUtilsXObj::m_isWhiteSpace, 1, 1, 400 },
|
||||
{ "isPrintable", MovUtilsXObj::m_isPrintable, 1, 1, 400 },
|
||||
{ "isGraphic", MovUtilsXObj::m_isGraphic, 1, 1, 400 },
|
||||
{ "isControl", MovUtilsXObj::m_isControl, 1, 1, 400 },
|
||||
{ "isHex", MovUtilsXObj::m_isHex, 1, 1, 400 },
|
||||
{ "bitSet", MovUtilsXObj::m_bitSet, 2, 2, 400 },
|
||||
{ "bitTest", MovUtilsXObj::m_bitTest, 2, 2, 400 },
|
||||
{ "bitClear", MovUtilsXObj::m_bitClear, 2, 2, 400 },
|
||||
{ "bitShiftL", MovUtilsXObj::m_bitShiftL, 1, 1, 400 },
|
||||
{ "bitShiftR", MovUtilsXObj::m_bitShiftR, 1, 1, 400 },
|
||||
{ "bitAnd", MovUtilsXObj::m_bitAnd, 2, 2, 400 },
|
||||
{ "bitOr", MovUtilsXObj::m_bitOr, 2, 2, 400 },
|
||||
{ "bitXOr", MovUtilsXObj::m_bitXOr, 2, 2, 400 },
|
||||
{ "bitNot", MovUtilsXObj::m_bitNot, 1, 1, 400 },
|
||||
{ "bitStringToNumber", MovUtilsXObj::m_bitStringToNumber, 1, 1, 400 },
|
||||
{ "stageToCast", MovUtilsXObj::m_stageToCast, 1, 1, 400 },
|
||||
{ "stageToDIB", MovUtilsXObj::m_stageToDIB, 2, 2, 400 },
|
||||
{ "stageToPICT", MovUtilsXObj::m_stageToPICT, 2, 2, 400 },
|
||||
{ "cRtoCRLF", MovUtilsXObj::m_cRtoCRLF, 1, 1, 400 },
|
||||
{ "cRLFtoCR", MovUtilsXObj::m_cRLFtoCR, 1, 1, 400 },
|
||||
{ "getMessage", MovUtilsXObj::m_getMessage, 2, 2, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const BuiltinProto xlibBuiltins[] = {
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
MovUtilsXObject::MovUtilsXObject(ObjectType ObjectType) :Object<MovUtilsXObject>("MovUtils") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MovUtilsXObj::open(ObjectType type, const Common::Path &path) {
|
||||
MovUtilsXObject::initMethods(xlibMethods);
|
||||
MovUtilsXObject *xobj = new MovUtilsXObject(type);
|
||||
for (uint i = 0; xlibNames[i]; i++) {
|
||||
g_lingo->exposeXObject(xlibNames[i], xobj);
|
||||
}
|
||||
g_lingo->initBuiltIns(xlibBuiltins);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::close(ObjectType type) {
|
||||
MovUtilsXObject::cleanupMethods();
|
||||
for (uint i = 0; xlibNames[i]; i++) {
|
||||
g_lingo->_globalvars[xlibNames[i]] = Datum();
|
||||
}
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("MovUtilsXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUBNR(MovUtilsXObj::m_dispose)
|
||||
XOBJSTUB(MovUtilsXObj::m_name, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_getVolName, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_getSystemPath, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_getWindowsPath, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_setDefaultPath, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_getChildWindowNames, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_getNamedWindowHdl, 0)
|
||||
XOBJSTUBNR(MovUtilsXObj::m_drawLine)
|
||||
XOBJSTUB(MovUtilsXObj::m_drawOval, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_drawRect, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_drawRoundRect, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_drawPoly, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_drawPie, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_printLandscape, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_noPunct, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_toUpperCase, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_toLowerCase, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_trimWhiteChars, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_dollarFormat, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_getWordStart, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_getWordEnd, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_getLineStart, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_getLineEnd, 0)
|
||||
|
||||
void MovUtilsXObj::m_isAlphaNum(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isAlphaNum(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isAlnum(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isAlpha(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isAlpha(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isAlpha(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isUpper(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isUpper(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isUpper(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isLower(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isLower(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isLower(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isDigit(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isDigit(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isDigit(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isPunctuation(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isPunctuation(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isPunct(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isWhiteSpace(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isWhiteSpace(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isSpace(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isPrintable(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isPrintable(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isPrint(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isGraphic(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isGraphic(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isGraph(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isControl(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isControl(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isCntrl(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
void MovUtilsXObj::m_isHex(int nargs) {
|
||||
Datum result(0);
|
||||
if (nargs != 1) {
|
||||
warning("MovUtilsXObj::m_isHex(): expected 1 arg");
|
||||
g_lingo->dropStack(nargs);
|
||||
} else {
|
||||
char test = g_lingo->pop().asString().firstChar();
|
||||
result = Datum(Common::isXDigit(test) ? 1 : 0);
|
||||
}
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
XOBJSTUB(MovUtilsXObj::m_bitSet, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_bitTest, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_bitClear, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_bitShiftL, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_bitShiftR, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_bitAnd, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_bitOr, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_bitXOr, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_bitNot, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_bitStringToNumber, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_stageToCast, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_stageToDIB, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_stageToPICT, 0)
|
||||
XOBJSTUB(MovUtilsXObj::m_cRtoCRLF, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_cRLFtoCR, "")
|
||||
XOBJSTUB(MovUtilsXObj::m_getMessage, 0)
|
||||
|
||||
}
|
||||
97
engines/director/lingo/xlibs/m/movutils.h
Normal file
97
engines/director/lingo/xlibs/m/movutils.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MOVUTILS_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MOVUTILS_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MovUtilsXObject : public Object<MovUtilsXObject> {
|
||||
public:
|
||||
MovUtilsXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MovUtilsXObj {
|
||||
|
||||
extern const char *const xlibNames[];
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_name(int nargs);
|
||||
void m_getVolName(int nargs);
|
||||
void m_getSystemPath(int nargs);
|
||||
void m_getWindowsPath(int nargs);
|
||||
void m_setDefaultPath(int nargs);
|
||||
void m_getChildWindowNames(int nargs);
|
||||
void m_getNamedWindowHdl(int nargs);
|
||||
void m_drawLine(int nargs);
|
||||
void m_drawOval(int nargs);
|
||||
void m_drawRect(int nargs);
|
||||
void m_drawRoundRect(int nargs);
|
||||
void m_drawPoly(int nargs);
|
||||
void m_drawPie(int nargs);
|
||||
void m_printLandscape(int nargs);
|
||||
void m_noPunct(int nargs);
|
||||
void m_toUpperCase(int nargs);
|
||||
void m_toLowerCase(int nargs);
|
||||
void m_trimWhiteChars(int nargs);
|
||||
void m_dollarFormat(int nargs);
|
||||
void m_getWordStart(int nargs);
|
||||
void m_getWordEnd(int nargs);
|
||||
void m_getLineStart(int nargs);
|
||||
void m_getLineEnd(int nargs);
|
||||
void m_isAlphaNum(int nargs);
|
||||
void m_isAlpha(int nargs);
|
||||
void m_isUpper(int nargs);
|
||||
void m_isLower(int nargs);
|
||||
void m_isDigit(int nargs);
|
||||
void m_isPunctuation(int nargs);
|
||||
void m_isWhiteSpace(int nargs);
|
||||
void m_isPrintable(int nargs);
|
||||
void m_isGraphic(int nargs);
|
||||
void m_isControl(int nargs);
|
||||
void m_isHex(int nargs);
|
||||
void m_bitSet(int nargs);
|
||||
void m_bitTest(int nargs);
|
||||
void m_bitClear(int nargs);
|
||||
void m_bitShiftL(int nargs);
|
||||
void m_bitShiftR(int nargs);
|
||||
void m_bitAnd(int nargs);
|
||||
void m_bitOr(int nargs);
|
||||
void m_bitXOr(int nargs);
|
||||
void m_bitNot(int nargs);
|
||||
void m_bitStringToNumber(int nargs);
|
||||
void m_stageToCast(int nargs);
|
||||
void m_stageToDIB(int nargs);
|
||||
void m_stageToPICT(int nargs);
|
||||
void m_cRtoCRLF(int nargs);
|
||||
void m_cRLFtoCR(int nargs);
|
||||
void m_getMessage(int nargs);
|
||||
|
||||
} // End of namespace MovUtilsXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
314
engines/director/lingo/xlibs/m/msfile.cpp
Normal file
314
engines/director/lingo/xlibs/m/msfile.cpp
Normal file
@@ -0,0 +1,314 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/savefile.h"
|
||||
#include "common/file.h"
|
||||
#include "gui/filebrowser-dialog.h"
|
||||
#include "gui/browser.h"
|
||||
#include "director/director.h"
|
||||
#include "director/picture.h"
|
||||
#include "director/types.h"
|
||||
#include "director/util.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/msfile.h"
|
||||
|
||||
/*************************************
|
||||
*
|
||||
* USED IN:
|
||||
* The Simpsons Cartoon Studio
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/*
|
||||
"I mNew --Instantiates XObject" 1028:0023 string 56
|
||||
"X mDispose --Removes XObject Instance" 1028:005b string 60
|
||||
"S mName --Returns XObject Name" 1028:0097 string 56
|
||||
"SS mGetFullDirList, dospath --Returns MS-DOS Full Directory List (use *.*)" 1028:00cf string 80
|
||||
"SS mGetFileList, dospath --Returns MS-DOS File List (use *.*)" 1028:011f string 70
|
||||
"SS mGetDirList, dospath --Returns MS-DOS Directory List (use *.*)" 1028:0165 string 75
|
||||
"II mGetDiskFree, drive --Returns Free disk space, drive is 0 for current, 1 for A, ..." 1028:01b0 string 97
|
||||
"SS mGetVolLabel, drive --Returns Drive Label (use d:\\*.*)" 1028:0211 string 68
|
||||
"IS mCreateDir, dospath --Creates an MS-DOS Directory" 1028:0255 string 63
|
||||
"IS mRemoveDir, dospath --Removes an MS-DOS Directory" 1028:0294 string 63
|
||||
"S mGetCurrDir --Returns Current Working Directory" 1028:02d3 string 69
|
||||
"IS mSetCurrDir, dospath --Sets Current Working Directory" 1028:0318 string 66
|
||||
"IS mRemoveFile, dospath --Deletes File named by dospath" 1028:035a string 65
|
||||
"ISS mRenameFile, oldpath ,newpath --Renames File named by oldpath" 1028:039b string 74
|
||||
"ISS mCopyFile, srcpath, destpath --Copys srcpath to destpath, overwrites" 1028:03e5 string 82
|
||||
"ISSI mCopyFiles, srcpath, destpath, incsubdir --Copys srcpath to destpath, overwrites" 1028:0437 string 90
|
||||
"ISSSS mSetAppINI, app, key, string, file --Sets app.ini" 1028:0491 string 57
|
||||
"SSSS mGetAppINI, app, key, file --Gets app.ini" 1028:04ca string 57
|
||||
"S mGetWindowsDirectory --Gets Windows directory path" 1028:0503 string 72
|
||||
"I mGetWinVer --Gets Windows major version number" 1028:054b string 78
|
||||
"I mRestartWindows --Gets Windows major version number" 1028:0599 string 78
|
||||
"SSSS mOpenFileDlg, title, defspec, file --Displays Director Open File Dialog Box" 1028:05e7 string 83
|
||||
"SSSS mSaveFileDlg, title, defspec, file --Displays Director Save File Dialog Box" 1028:063a string 83
|
||||
"SSSS mGetOFileName, deffile, filter, defext --Displays Open File Dialog Box" 1028:068d string 78
|
||||
"SSSS mGetSFileName, deffile, filter, defext --Displays Save File Dialog Box" 1028:06db string 78
|
||||
"SSSS mDisplayDlg, title, message, defspec --Displays Dialog Box" 1028:0729 string 66
|
||||
"ISSSS mProgMgrAdd, group, command, title, icon --\r\r" 1028:076b string 57
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MSFile::xlibName = "MSFile";
|
||||
const XlibFileDesc MSFile::fileNames[] = {
|
||||
{"MSFile", nullptr},
|
||||
{"MSFILE16", nullptr},
|
||||
{nullptr, nullptr},
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
// XObject
|
||||
{"new", MSFile::m_new, 0, 0, 400},
|
||||
{"dispose", MSFile::m_dispose, 0, 0, 400},
|
||||
{"name", MSFile::m_name, 0, 1, 400},
|
||||
{"getFullDirList", MSFile::m_getFullDirList, 1, 1, 400},
|
||||
{"getFileList", MSFile::m_getFileList, 1, 1, 400},
|
||||
{"getDirList", MSFile::m_getDirList, 1, 1, 400},
|
||||
{"getDiskFree", MSFile::m_getDiskFree, 1, 1, 400},
|
||||
{"getVolLabel", MSFile::m_getVolLabel, 1, 1, 400},
|
||||
{"createDir", MSFile::m_createDir, 1, 1, 400},
|
||||
{"removeDir", MSFile::m_removeDir, 1, 1, 400},
|
||||
{"getCurrDir", MSFile::m_getCurrDir, 0, 1, 400},
|
||||
{"setCurrDir", MSFile::m_setCurrDir, 1, 1, 400},
|
||||
{"removeFile", MSFile::m_removeFile, 1, 1, 400},
|
||||
{"renameFile", MSFile::m_renameFile, 2, 1, 400},
|
||||
{"copyFile", MSFile::m_copyFile, 2, 1, 400},
|
||||
{"copyFiles", MSFile::m_copyFiles, 3, 1, 400},
|
||||
{"setAppINI", MSFile::m_setAppINI, 4, 1, 400},
|
||||
{"getAppINI", MSFile::m_getAppINI, 3, 1, 400},
|
||||
{"getWindowsDirectory", MSFile::m_getWindowsDirectory, 0, 1, 400},
|
||||
{"getWinVer", MSFile::m_getWinVer, 0, 1, 400},
|
||||
{"restartWindows", MSFile::m_restartWindows, 0 ,1, 400},
|
||||
{"openFileDlg", MSFile::m_openFileDlg, 3, 1, 400},
|
||||
{"saveFileDlg", MSFile::m_saveFileDlg, 3, 1, 400},
|
||||
{"getOFileName", MSFile::m_getOFileName, 3, 1, 400},
|
||||
{"getSFileName", MSFile::m_getSFileName, 3, 1, 400},
|
||||
{"displayDlg", MSFile::m_displayDlg, 3, 1, 400},
|
||||
{"progMgrAdd", MSFile::m_progMgrAdd, 4, 1, 400},
|
||||
{nullptr, nullptr, 0, 0, 0}};
|
||||
|
||||
static const BuiltinProto xlibBuiltins[] = {
|
||||
{nullptr, nullptr, 0, 0, 0, VOIDSYM}};
|
||||
|
||||
MSFileObject::MSFileObject(ObjectType objType) : Object<MSFileObject>("MSFile") {
|
||||
_objType = objType;
|
||||
_lastError = msErrorNone;
|
||||
}
|
||||
|
||||
MSFileObject::MSFileObject(const MSFileObject &obj) : Object<MSFileObject>(obj) {
|
||||
_objType = obj.getObjType();
|
||||
_lastError = msErrorNone;
|
||||
}
|
||||
|
||||
MSFileObject::~MSFileObject() {
|
||||
}
|
||||
|
||||
void MSFileObject::dispose() {
|
||||
_disposed = true;
|
||||
}
|
||||
|
||||
bool MSFileObject::hasProp(const Common::String &propName) {
|
||||
return (propName == "name");
|
||||
}
|
||||
|
||||
Datum MSFileObject::getProp(const Common::String &propName) {
|
||||
if (propName == "name")
|
||||
return Datum(MSFile::xlibName);
|
||||
warning("MSFile::getProp: unknown property '%s'", propName.c_str());
|
||||
return Datum();
|
||||
}
|
||||
|
||||
void MSFile::m_new(int nargs) {
|
||||
Datum result = g_lingo->_state->me;
|
||||
g_lingo->push(result);
|
||||
}
|
||||
|
||||
XOBJSTUB(MSFile::m_dispose, 0)
|
||||
XOBJSTUB(MSFile::m_name, "")
|
||||
XOBJSTUB(MSFile::m_getFullDirList, "")
|
||||
XOBJSTUB(MSFile::m_getFileList, "")
|
||||
XOBJSTUB(MSFile::m_getDirList, "")
|
||||
|
||||
void MSFile::m_getDiskFree(int nargs) {
|
||||
// We don't care about the drive letter. We will always just return 500 MB.
|
||||
g_lingo->pop();
|
||||
|
||||
// 500 MB in KB
|
||||
g_lingo->push(Datum(500 * 1024 * 1024));
|
||||
}
|
||||
|
||||
void MSFile::m_getVolLabel(int nargs) {
|
||||
Datum d = g_lingo->pop();
|
||||
|
||||
Common::String volLabel;
|
||||
|
||||
const char *gameId = g_director->getGameId();
|
||||
if (strncmp(gameId, "simpsonsstudio", 14) == 0 || strncmp(gameId, "simpsonsplayer", 14) == 0) {
|
||||
volLabel = "Simpsons";
|
||||
} else {
|
||||
warning("MSFile::m_getVolLabel(): Unsupported gameid '%s'", gameId);
|
||||
}
|
||||
|
||||
g_lingo->push(volLabel);
|
||||
}
|
||||
|
||||
XOBJSTUB(MSFile::m_createDir, 0)
|
||||
XOBJSTUB(MSFile::m_removeDir, 0)
|
||||
XOBJSTUB(MSFile::m_getCurrDir, "")
|
||||
XOBJSTUB(MSFile::m_setCurrDir, 0)
|
||||
XOBJSTUB(MSFile::m_removeFile, 0)
|
||||
XOBJSTUB(MSFile::m_renameFile, 0)
|
||||
|
||||
Common::Path MSFile::resolveSourceFilePath(const Common::String& srcParam) {
|
||||
return findPath(srcParam);
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *MSFile::openSourceStream(const Common::Path &srcFilePath, const Common::String &srcParam, char dirSeparator) {
|
||||
Common::SaveFileManager *saves = g_system->getSavefileManager();
|
||||
Common::String prefix = savePrefix();
|
||||
|
||||
// The source file may be a save file in the ScummVM save folder.
|
||||
Common::String saveFileName = lastPathComponent(srcParam, dirSeparator);
|
||||
|
||||
// Modify the source file name to match the name of the potential save file
|
||||
if (!saveFileName.hasSuffixIgnoreCase(".txt")) {
|
||||
saveFileName += ".txt";
|
||||
}
|
||||
|
||||
if (!saveFileName.hasPrefixIgnoreCase(prefix)) {
|
||||
saveFileName = prefix + saveFileName;
|
||||
}
|
||||
|
||||
// Try to open the save file
|
||||
Common::SeekableReadStream *srcReadStream = saves->openForLoading(saveFileName);
|
||||
|
||||
// If the save file was not found then we will try opening the file directly
|
||||
if (!srcReadStream) {
|
||||
// We have a relative path so we can open it using Common::File
|
||||
Common::File *srcFile = new Common::File();
|
||||
if (srcFilePath.empty() || !srcFile->open(srcFilePath)) {
|
||||
warning("MSFile::m_copyFile(): Error opening file %s", srcFilePath.toString(Common::Path::kNativeSeparator).c_str());
|
||||
delete srcFile;
|
||||
return nullptr;
|
||||
}
|
||||
srcReadStream = srcFile;
|
||||
}
|
||||
|
||||
return srcReadStream;
|
||||
}
|
||||
|
||||
Common::SeekableWriteStream *MSFile::openDestinationStream(Common::String &destFileName) {
|
||||
Common::SaveFileManager *saves = g_system->getSavefileManager();
|
||||
Common::String prefix = savePrefix();
|
||||
|
||||
Common::OutSaveFile *destFile = nullptr;
|
||||
|
||||
if (!destFileName.hasSuffixIgnoreCase(".txt")) {
|
||||
destFileName += ".txt";
|
||||
}
|
||||
|
||||
if (!destFileName.hasPrefixIgnoreCase(prefix)) {
|
||||
destFileName = prefix + destFileName;
|
||||
}
|
||||
|
||||
destFile = saves->openForSaving(destFileName, false);
|
||||
|
||||
return destFile;
|
||||
}
|
||||
|
||||
bool MSFile::copyStream(Common::SeekableReadStream* srcStream, Common::SeekableWriteStream* destStream) {
|
||||
if (srcStream && destStream) {
|
||||
destStream->writeStream(srcStream);
|
||||
destStream->finalize();
|
||||
bool success = !destStream->err();
|
||||
delete destStream;
|
||||
return success;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MSFile::copyGameFile(const Common::String& srcParam, const Common::String& destParam) {
|
||||
char dirSeparator = g_director->_dirSeparator;
|
||||
Common::Path srcFilePath = resolveSourceFilePath(srcParam);
|
||||
Common::String destFileName = Common::lastPathComponent(destParam, dirSeparator);
|
||||
|
||||
Common::SeekableReadStream *srcStream = openSourceStream(srcFilePath, srcParam, dirSeparator);
|
||||
Common::SeekableWriteStream *destStream = openDestinationStream(destFileName);
|
||||
|
||||
return copyStream(srcStream, destStream);
|
||||
}
|
||||
|
||||
void MSFile::m_copyFile(int nargs) {
|
||||
Datum d2 = g_lingo->pop();
|
||||
Datum d1 = g_lingo->pop();
|
||||
|
||||
// The source and destination file parameters are absolute paths from the games perspective but do not match the paths for ScummVM
|
||||
Common::String srcParam = d1.asString();
|
||||
Common::String destParam = d2.asString();
|
||||
|
||||
bool success = copyGameFile(srcParam, destParam);
|
||||
|
||||
g_lingo->push(Datum(success ? 0 : 1)); // Push 0 for success, 1 for failure
|
||||
}
|
||||
|
||||
XOBJSTUB(MSFile::m_copyFiles, 0)
|
||||
XOBJSTUB(MSFile::m_setAppINI, 0)
|
||||
XOBJSTUB(MSFile::m_getAppINI, "")
|
||||
XOBJSTUB(MSFile::m_getWindowsDirectory, "")
|
||||
XOBJSTUB(MSFile::m_getWinVer, 0)
|
||||
XOBJSTUB(MSFile::m_restartWindows, 0)
|
||||
XOBJSTUB(MSFile::m_openFileDlg, "")
|
||||
XOBJSTUB(MSFile::m_saveFileDlg, "")
|
||||
|
||||
void MSFile::m_getOFileName(int nargs) {
|
||||
Datum d3 = g_lingo->pop();
|
||||
Datum d2 = g_lingo->pop();
|
||||
Datum d1 = g_lingo->pop();
|
||||
|
||||
Common::String defFile = d1.asString();
|
||||
Common::String filter = d2.asString();
|
||||
Common::String defExt = d3.asString();
|
||||
|
||||
g_lingo->push(getFileNameFromModal(false, defFile, filter, defExt.c_str()));
|
||||
}
|
||||
|
||||
XOBJSTUB(MSFile::m_getSFileName, "")
|
||||
XOBJSTUB(MSFile::m_displayDlg, "")
|
||||
XOBJSTUB(MSFile::m_progMgrAdd, 0)
|
||||
|
||||
void MSFile::open(ObjectType type, const Common::Path &path) {
|
||||
MSFileObject::initMethods(xlibMethods);
|
||||
MSFileObject *xobj = new MSFileObject(type);
|
||||
if (g_director->getVersion() >= 500)
|
||||
g_lingo->_openXtras.push_back(xlibName);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
g_lingo->initBuiltIns(xlibBuiltins);
|
||||
}
|
||||
|
||||
void MSFile::close(ObjectType type) {
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
}
|
||||
} // End of namespace Director
|
||||
91
engines/director/lingo/xlibs/m/msfile.h
Normal file
91
engines/director/lingo/xlibs/m/msfile.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MSFILE_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MSFILE_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
enum MSFileError {
|
||||
msErrorNone = 0,
|
||||
};
|
||||
|
||||
class MSFileObject : public Object<MSFileObject> {
|
||||
public:
|
||||
MSFileError _lastError;
|
||||
|
||||
public:
|
||||
MSFileObject(ObjectType objType);
|
||||
MSFileObject(const MSFileObject &obj);
|
||||
~MSFileObject() override;
|
||||
|
||||
bool hasProp(const Common::String &propName) override;
|
||||
Datum getProp(const Common::String &propName) override;
|
||||
|
||||
void dispose() override;
|
||||
};
|
||||
|
||||
namespace MSFile {
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
Common::Path resolveSourceFilePath(const Common::String &srcParam);
|
||||
Common::SeekableReadStream *openSourceStream(const Common::Path &srcFilePath, const Common::String &srcParam, char dirSeperator);
|
||||
Common::SeekableWriteStream *openDestinationStream(Common::String &destFileName);
|
||||
bool copyStream(Common::SeekableReadStream *srcStream, Common::SeekableWriteStream *destStream);
|
||||
bool copyGameFile(const Common::String &srcParam, const Common::String &destParam);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_name(int nargs);
|
||||
void m_getFullDirList(int nargs);
|
||||
void m_getFileList(int nargs);
|
||||
void m_getDirList(int nargs);
|
||||
void m_getDiskFree(int nargs);
|
||||
void m_getVolLabel(int nargs);
|
||||
void m_createDir(int nargs);
|
||||
void m_removeDir(int nargs);
|
||||
void m_getCurrDir(int nargs);
|
||||
void m_setCurrDir(int nargs);
|
||||
void m_removeFile(int nargs);
|
||||
void m_renameFile(int nargs);
|
||||
void m_copyFile(int nargs);
|
||||
void m_copyFiles(int nargs);
|
||||
void m_setAppINI(int nargs);
|
||||
void m_getAppINI(int nargs);
|
||||
void m_getWindowsDirectory(int nargs);
|
||||
void m_getWinVer(int nargs);
|
||||
void m_restartWindows(int nargs);
|
||||
void m_openFileDlg(int nargs);
|
||||
void m_saveFileDlg(int nargs);
|
||||
void m_getOFileName(int nargs);
|
||||
void m_getSFileName(int nargs);
|
||||
void m_displayDlg(int nargs);
|
||||
void m_progMgrAdd(int args);
|
||||
|
||||
} // End of namespace MSFile
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
121
engines/director/lingo/xlibs/m/mystisle.cpp
Normal file
121
engines/director/lingo/xlibs/m/mystisle.cpp
Normal file
@@ -0,0 +1,121 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/system.h"
|
||||
|
||||
#include "director/director.h"
|
||||
#include "director/lingo/lingo.h"
|
||||
#include "director/lingo/lingo-object.h"
|
||||
#include "director/lingo/lingo-utils.h"
|
||||
#include "director/lingo/xlibs/m/mystisle.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* Mysterious Island: A Race Against Time and Hot Lava
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- MystIsle External Factory, v. 1.0 by David Jackson-Shields
|
||||
--MYSTISLE
|
||||
I mNew --Creates new instance
|
||||
X mDispose --Disposes of XObject instance
|
||||
S mName --Returns the XObject name (MystIsle)
|
||||
I mGetLastError --Returns most recent error code
|
||||
I mGetSysVersion --returns MS Windows version as an integer
|
||||
I mGetQTVersion --returns QuickTime version as an integer
|
||||
I mVerifyUnlocked --verify startup volume is writable (for Prefs)
|
||||
S mGetPrefsPath --return path of Windows directory
|
||||
IPP mDiagnostic, picHdl1, picHdl2 --for testing during development
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *const MystIsleXObj::xlibName = "MystIsle";
|
||||
const XlibFileDesc MystIsleXObj::fileNames[] = {
|
||||
{ "MYSTISLE", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static const MethodProto xlibMethods[] = {
|
||||
{ "new", MystIsleXObj::m_new, 0, 0, 400 },
|
||||
{ "dispose", MystIsleXObj::m_dispose, 0, 0, 400 },
|
||||
{ "name", MystIsleXObj::m_name, 0, 0, 400 },
|
||||
{ "getLastError", MystIsleXObj::m_getLastError, 0, 0, 400 },
|
||||
{ "getSysVersion", MystIsleXObj::m_getSysVersion, 0, 0, 400 },
|
||||
{ "getQTVersion", MystIsleXObj::m_getQTVersion, 0, 0, 400 },
|
||||
{ "verifyUnlocked", MystIsleXObj::m_verifyUnlocked, 0, 0, 400 },
|
||||
{ "getPrefsPath", MystIsleXObj::m_getPrefsPath, 0, 0, 400 },
|
||||
{ "diagnostic", MystIsleXObj::m_diagnostic, 2, 2, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const BuiltinProto xlibBuiltins[] = {
|
||||
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
MystIsleXObject::MystIsleXObject(ObjectType ObjectType) :Object<MystIsleXObject>("MystIsle") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
void MystIsleXObj::open(ObjectType type, const Common::Path &path) {
|
||||
MystIsleXObject::initMethods(xlibMethods);
|
||||
MystIsleXObject *xobj = new MystIsleXObject(type);
|
||||
if (type == kXtraObj)
|
||||
g_lingo->_openXtras.push_back(xlibName);
|
||||
g_lingo->exposeXObject(xlibName, xobj);
|
||||
g_lingo->initBuiltIns(xlibBuiltins);
|
||||
}
|
||||
|
||||
void MystIsleXObj::close(ObjectType type) {
|
||||
MystIsleXObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
|
||||
}
|
||||
|
||||
void MystIsleXObj::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("MystIsleXObj::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUBNR(MystIsleXObj::m_dispose)
|
||||
XOBJSTUB(MystIsleXObj::m_name, "MystIsle")
|
||||
XOBJSTUB(MystIsleXObj::m_getLastError, 0)
|
||||
|
||||
void MystIsleXObj::m_getSysVersion(int nargs) {
|
||||
// Checks the installed OS version, return minimum expected version
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(g_director->getPlatform() == Common::kPlatformWindows ? 310 : 700));
|
||||
}
|
||||
|
||||
void MystIsleXObj::m_getQTVersion(int nargs) {
|
||||
// Checks the installed QuickTime version, return minimum expected version
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(Datum(g_director->getPlatform() == Common::kPlatformWindows ? 110 : 200));
|
||||
}
|
||||
|
||||
XOBJSTUB(MystIsleXObj::m_verifyUnlocked, 0) // Check whether the drive is writable (locked) or read-only (unlocked), return unlocked
|
||||
XOBJSTUB(MystIsleXObj::m_getPrefsPath, "")
|
||||
XOBJSTUB(MystIsleXObj::m_diagnostic, 0)
|
||||
}
|
||||
54
engines/director/lingo/xlibs/m/mystisle.h
Normal file
54
engines/director/lingo/xlibs/m/mystisle.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DIRECTOR_LINGO_XLIBS_MYSTISLE_H
|
||||
#define DIRECTOR_LINGO_XLIBS_MYSTISLE_H
|
||||
|
||||
namespace Director {
|
||||
|
||||
class MystIsleXObject : public Object<MystIsleXObject> {
|
||||
public:
|
||||
MystIsleXObject(ObjectType objType);
|
||||
};
|
||||
|
||||
namespace MystIsleXObj {
|
||||
|
||||
extern const char *const xlibName;
|
||||
extern const XlibFileDesc fileNames[];
|
||||
|
||||
void open(ObjectType type, const Common::Path &path);
|
||||
void close(ObjectType type);
|
||||
|
||||
void m_new(int nargs);
|
||||
void m_dispose(int nargs);
|
||||
void m_name(int nargs);
|
||||
void m_getLastError(int nargs);
|
||||
void m_getSysVersion(int nargs);
|
||||
void m_getQTVersion(int nargs);
|
||||
void m_verifyUnlocked(int nargs);
|
||||
void m_getPrefsPath(int nargs);
|
||||
void m_diagnostic(int nargs);
|
||||
|
||||
} // End of namespace MystIsleXObj
|
||||
|
||||
} // End of namespace Director
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user