Initial commit

This commit is contained in:
2026-02-02 04:50:13 +01:00
commit 5b11698731
22592 changed files with 7677434 additions and 0 deletions

View File

@@ -0,0 +1,132 @@
/* 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/s/savenrestorexobj.h"
/**************************************************
*
* USED IN:
* wttf
*
**************************************************/
/*
-- SaveNRestore XObj v 1.0d2 (c) 1995 Samizdat Productions. All Rights Reserved.
-- written by Christopher P. Kelly
I mNew
II mWriteSettingsFile
II mReadSettingsFile
IS mSetDirectorMovie
IS mSetSubLocation1
IS mSetSubLocation2
IIII mSetKeys whichList position value
IS mSetMazeKeys
IS mSetMazeLocation
S mGetDirectorMovie
S mGetSubLocation1
S mGetSubLocation2
III mGetKeys whichList position
S mGetMazeKeys
S mGetMazeLocation
*/
namespace Director {
const char *SaveNRestoreXObj::xlibName = "SaveNRestoreXObj";
const XlibFileDesc SaveNRestoreXObj::fileNames[] = {
{ "SaveNRestoreXObj", nullptr },
{ nullptr, nullptr },
};
static MethodProto xlibMethods[] = {
{ "new", SaveNRestoreXObj::m_new, 0, 0, 400 },
{ "writeSettingsFile", SaveNRestoreXObj::m_writeSettingsFile, 1, 1, 400 },
{ "readSettingsFile", SaveNRestoreXObj::m_readSettingsFile, 1, 1, 400 },
{ "setDirectorMovie", SaveNRestoreXObj::m_setDirectorMovie, 1, 1, 400 },
{ "setSubLocation1", SaveNRestoreXObj::m_setSubLocation1, 1, 1, 400 },
{ "setSubLocation2", SaveNRestoreXObj::m_setSubLocation2, 1, 1, 400 },
{ "setKeys", SaveNRestoreXObj::m_setKeys, 3, 3, 400 },
{ "setMazeKeys", SaveNRestoreXObj::m_setMazeKeys, 1, 1, 400 },
{ "setMazeLocation", SaveNRestoreXObj::m_setMazeLocation, 1, 1, 400 },
{ "getDirectorMovie", SaveNRestoreXObj::m_getDirectorMovie, 0, 0, 400 },
{ "getSubLocation1", SaveNRestoreXObj::m_getSubLocation1, 0, 0, 400 },
{ "getSubLocation2", SaveNRestoreXObj::m_getSubLocation2, 0, 0, 400 },
{ "getKeys", SaveNRestoreXObj::m_getKeys, 2, 2, 400 },
{ "getMazeKeys", SaveNRestoreXObj::m_getMazeKeys, 0, 0, 400 },
{ "getMazeLocation", SaveNRestoreXObj::m_getMazeLocation, 0, 0, 400 },
{ nullptr, nullptr, 0, 0, 0 }
};
static BuiltinProto xlibBuiltins[] = {
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
};
SaveNRestoreXObject::SaveNRestoreXObject(ObjectType ObjectType) :Object<SaveNRestoreXObject>("SaveNRestoreXObj") {
_objType = ObjectType;
}
void SaveNRestoreXObj::open(ObjectType type, const Common::Path &path) {
SaveNRestoreXObject::initMethods(xlibMethods);
SaveNRestoreXObject *xobj = new SaveNRestoreXObject(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 SaveNRestoreXObj::close(ObjectType type) {
SaveNRestoreXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
void SaveNRestoreXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("SaveNRestoreXObj::m_new", nargs);
g_lingo->dropStack(nargs);
g_lingo->push(g_lingo->_state->me);
}
XOBJSTUB(SaveNRestoreXObj::m_writeSettingsFile, 0)
XOBJSTUB(SaveNRestoreXObj::m_readSettingsFile, 0)
XOBJSTUB(SaveNRestoreXObj::m_setDirectorMovie, 0)
XOBJSTUB(SaveNRestoreXObj::m_setSubLocation1, 0)
XOBJSTUB(SaveNRestoreXObj::m_setSubLocation2, 0)
XOBJSTUB(SaveNRestoreXObj::m_setKeys, 0)
XOBJSTUB(SaveNRestoreXObj::m_setMazeKeys, 0)
XOBJSTUB(SaveNRestoreXObj::m_setMazeLocation, 0)
XOBJSTUB(SaveNRestoreXObj::m_getDirectorMovie, "")
XOBJSTUB(SaveNRestoreXObj::m_getSubLocation1, "")
XOBJSTUB(SaveNRestoreXObj::m_getSubLocation2, "")
XOBJSTUB(SaveNRestoreXObj::m_getKeys, 0)
XOBJSTUB(SaveNRestoreXObj::m_getMazeKeys, "")
XOBJSTUB(SaveNRestoreXObj::m_getMazeLocation, "")
}

View 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_S_SAVENRESTOREXOBJ_H
#define DIRECTOR_LINGO_XLIBS_S_SAVENRESTOREXOBJ_H
namespace Director {
class SaveNRestoreXObject : public Object<SaveNRestoreXObject> {
public:
SaveNRestoreXObject(ObjectType objType);
};
namespace SaveNRestoreXObj {
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_writeSettingsFile(int nargs);
void m_readSettingsFile(int nargs);
void m_setDirectorMovie(int nargs);
void m_setSubLocation1(int nargs);
void m_setSubLocation2(int nargs);
void m_setKeys(int nargs);
void m_setMazeKeys(int nargs);
void m_setMazeLocation(int nargs);
void m_getDirectorMovie(int nargs);
void m_getSubLocation1(int nargs);
void m_getSubLocation2(int nargs);
void m_getKeys(int nargs);
void m_getMazeKeys(int nargs);
void m_getMazeLocation(int nargs);
} // End of namespace SaveNRestoreXObj
} // End of namespace Director
#endif

View File

@@ -0,0 +1,104 @@
/* 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:
* Standard Macromedia Director XObject
*
*************************************/
/*
* Use the SerialPort XObject to send and receive data over the Macintoshs
* two standard serial ports (commonly called the modem and printer ports).
* This XObject is built into Macromedia Director, so you dont have to open
* an XLibrary to use it.
*
* Reference: Director 4 Using Lingo, pages 315-320
*/
#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/s/serialportxobj.h"
namespace Director {
const char *const SerialPortXObj::xlibName = "SerialPort";
const XlibFileDesc SerialPortXObj::fileNames[] = {
{ "SerialPort", nullptr },
{ nullptr, nullptr },
};
static const MethodProto xlibMethods[] = {
{ "new", SerialPortXObj::m_new, 1, 1, 200 }, // D2
{ "GetPortNum", SerialPortXObj::m_getPortNum, 0, 0, 200 }, // D2
{ "WriteString", SerialPortXObj::m_writeString, 1, 1, 200 }, // D2
{ "WriteChar", SerialPortXObj::m_writeChar, 1, 1, 200 }, // D2
{ "ReadString", SerialPortXObj::m_readString, 0, 0, 200 }, // D2
{ "ReadChar", SerialPortXObj::m_readChar, 0, 0, 200 }, // D2
{ "ReadCount", SerialPortXObj::m_readCount, 0, 0, 200 }, // D2
{ "ReadFlush", SerialPortXObj::m_readFlush, 0, 0, 200 }, // D2
{ "ConfigChan", SerialPortXObj::m_configChan, 2, 2, 200 }, // D2
{ "HShakeChan", SerialPortXObj::m_hShakeChan, 3, 3, 200 }, // D2
{ "SetUp", SerialPortXObj::m_setUp, 3, 3, 200 }, // D2
{ nullptr, nullptr, 0, 0, 0 }
};
void SerialPortXObj::open(ObjectType type, const Common::Path &path) {
if (type == kXObj) {
SerialPortXObject::initMethods(xlibMethods);
SerialPortXObject *xobj = new SerialPortXObject(kXObj);
g_lingo->exposeXObject(xlibName, xobj);
}
}
void SerialPortXObj::close(ObjectType type) {
if (type == kXObj) {
SerialPortXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
}
SerialPortXObject::SerialPortXObject(ObjectType ObjectType) :Object<SerialPortXObject>("SerialPort") {
_objType = ObjectType;
}
void SerialPortXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("SerialPortXObj::m_new", nargs);
g_lingo->dropStack(nargs);
g_lingo->push(g_lingo->_state->me);
}
XOBJSTUBV(SerialPortXObj::m_getPortNum)
XOBJSTUBV(SerialPortXObj::m_writeString)
XOBJSTUBV(SerialPortXObj::m_writeChar)
XOBJSTUBV(SerialPortXObj::m_readString)
XOBJSTUBV(SerialPortXObj::m_readChar)
XOBJSTUBV(SerialPortXObj::m_readCount)
XOBJSTUBV(SerialPortXObj::m_readFlush)
XOBJSTUBV(SerialPortXObj::m_configChan)
XOBJSTUBV(SerialPortXObj::m_hShakeChan)
XOBJSTUBV(SerialPortXObj::m_setUp)
} // End of namespace Director

View File

@@ -0,0 +1,56 @@
/* 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_SERIALPORTXOBJ_H
#define DIRECTOR_LINGO_XLIBS_SERIALPORTXOBJ_H
namespace Director {
class SerialPortXObject : public Object<SerialPortXObject> {
public:
SerialPortXObject(ObjectType objType);
};
namespace SerialPortXObj {
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_getPortNum(int nargs);
void m_writeString(int nargs);
void m_writeChar(int nargs);
void m_readString(int nargs);
void m_readChar(int nargs);
void m_readCount(int nargs);
void m_readFlush(int nargs);
void m_configChan(int nargs);
void m_hShakeChan(int nargs);
void m_setUp(int nargs);
} // End of namespace SerialPortXObj
} // End of namespace Director
#endif

View File

@@ -0,0 +1,112 @@
/* 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/s/smallutil.h"
/**************************************************
*
* USED IN:
* flipper
*
**************************************************/
/*
-- SmallUtil, xobject 08Aug95 PF
-- ©1995 - Interactive Multimedia Unit
-- Central Queensland University
-- CodeWarrior version, 16May95 EA
-- xobject framework, 29nov94 JT
--
I mNew -- Create an instance of SmallUtil
X mDispose -- Destroy the instance of SmallUtil
I mQTVersion -- Return QT Version
S mQTVersionasText -- Return QT Version as Text "."delimited
I mSMVersion -- Return Sound Manager Version
S mSMVersionasText -- Return Sound Manager Version "." delimited
S mFontList -- Return List of FOND's
S mVolumeList -- Return List of Mounted Volumes
*/
namespace Director {
const char *SmallUtilXObj::xlibName = "SmallUtil";
const XlibFileDesc SmallUtilXObj::fileNames[] = {
{ "SmallUtil", nullptr },
{ nullptr, nullptr },
};
static MethodProto xlibMethods[] = {
{ "new", SmallUtilXObj::m_new, 0, 0, 400 },
{ "dispose", SmallUtilXObj::m_dispose, 0, 0, 400 },
{ "qTVersion", SmallUtilXObj::m_qTVersion, 0, 0, 400 },
{ "qTVersionasText", SmallUtilXObj::m_qTVersionasText, 0, 0, 400 },
{ "sMVersion", SmallUtilXObj::m_sMVersion, 0, 0, 400 },
{ "sMVersionasText", SmallUtilXObj::m_sMVersionasText, 0, 0, 400 },
{ "fontList", SmallUtilXObj::m_fontList, 0, 0, 400 },
{ "volumeList", SmallUtilXObj::m_volumeList, 0, 0, 400 },
{ nullptr, nullptr, 0, 0, 0 }
};
static BuiltinProto xlibBuiltins[] = {
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
};
SmallUtilXObject::SmallUtilXObject(ObjectType ObjectType) :Object<SmallUtilXObject>("SmallUtil") {
_objType = ObjectType;
}
void SmallUtilXObj::open(ObjectType type, const Common::Path &path) {
SmallUtilXObject::initMethods(xlibMethods);
SmallUtilXObject *xobj = new SmallUtilXObject(type);
if (type == kXtraObj)
g_lingo->_openXtras.push_back(xlibName);
g_lingo->exposeXObject(xlibName, xobj);
g_lingo->initBuiltIns(xlibBuiltins);
}
void SmallUtilXObj::close(ObjectType type) {
SmallUtilXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
void SmallUtilXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("SmallUtilXObj::m_new", nargs);
g_lingo->dropStack(nargs);
g_lingo->push(g_lingo->_state->me);
}
XOBJSTUBNR(SmallUtilXObj::m_dispose)
XOBJSTUB(SmallUtilXObj::m_qTVersion, 0)
XOBJSTUB(SmallUtilXObj::m_qTVersionasText, "2.5")
XOBJSTUB(SmallUtilXObj::m_sMVersion, 0)
XOBJSTUB(SmallUtilXObj::m_sMVersionasText, "3.2")
XOBJSTUB(SmallUtilXObj::m_fontList, "")
XOBJSTUB(SmallUtilXObj::m_volumeList, "")
}

View File

@@ -0,0 +1,53 @@
/* 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_SMALLUTIL_H
#define DIRECTOR_LINGO_XLIBS_SMALLUTIL_H
namespace Director {
class SmallUtilXObject : public Object<SmallUtilXObject> {
public:
SmallUtilXObject(ObjectType objType);
};
namespace SmallUtilXObj {
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_dispose(int nargs);
void m_qTVersion(int nargs);
void m_qTVersionasText(int nargs);
void m_sMVersion(int nargs);
void m_sMVersionasText(int nargs);
void m_fontList(int nargs);
void m_volumeList(int nargs);
} // End of namespace SmallUtilXObj
} // End of namespace Director
#endif

View File

@@ -0,0 +1,175 @@
/* 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:
* Meet MediaBand
*
*************************************/
/*
* -- SoundJam Copyright © Canter Technology 1995
* SoundJam
* II mNew, numberOfChannels
* ISI mDefineFileSound, fullPathName, numberOfBeats
* III mDefineCastSound, castMemberNumber, numberOfBeats
* II mUndefineSound, soundID
* III mReadSome, soundID, byteCount
* II mStartSound, soundID
* II mSwitchNew, soundID
* II mSwitchParallel, soundID
* I mHasSwitchHappened
* X mToggleMute
* X mStop
* X mDispose
*/
#include "director/director.h"
#include "director/window.h"
#include "director/sound.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
#include "director/lingo/lingo-utils.h"
#include "director/lingo/xlibs/s/soundjam.h"
namespace Director {
const char *const SoundJam::xlibName = "SoundJam";
const XlibFileDesc SoundJam::fileNames[] = {
{ "SoundJam", nullptr },
{ nullptr, nullptr },
};
const int kJamChannel = 3;
static const MethodProto xlibMethods[] = {
{ "new", SoundJam::m_new, 1, 1, 400 },
{ "defineFileSound", SoundJam::m_defineFileSound, 2, 2, 400 },
{ "defineCastSound", SoundJam::m_defineCastSound, 2, 2, 400 },
{ "undefineSound", SoundJam::m_undefineSound, 1, 1, 400 },
{ "readSome", SoundJam::m_readSome, 2, 2, 400 },
{ "startSound", SoundJam::m_startSound, 1, 1, 400 },
{ "switchNew", SoundJam::m_switchNew, 1, 1, 400 },
{ "switchParallel", SoundJam::m_switchParallel, 1, 1, 400 },
{ "hasSwitchHappened", SoundJam::m_hasSwitchHappened, 0, 0, 400 },
{ "toggleMute", SoundJam::m_toggleMute, 0, 0, 400 },
{ "stop", SoundJam::m_stop, 0, 0, 400 },
{ nullptr, nullptr, 0, 0, 0 }
};
void SoundJam::open(ObjectType type, const Common::Path &path) {
if (type == kXObj) {
SoundJamObject::initMethods(xlibMethods);
SoundJamObject *xobj = new SoundJamObject(kXObj);
g_lingo->exposeXObject(xlibName, xobj);
}
}
void SoundJam::close(ObjectType type) {
if (type == kXObj) {
SoundJamObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
}
SoundJamObject::SoundJamObject(ObjectType objType) : Object<SoundJamObject>("SoundJam") {
_objType = objType;
}
void SoundJam::m_new(int nargs) {
int numberOfChannels = g_lingo->pop().asInt();
if (numberOfChannels != 1) {
warning("SoundJam::m_new: Expected numberOfChannels = 1, got %d", numberOfChannels);
g_lingo->push(Datum());
return;
}
g_lingo->push(g_lingo->_state->me);
}
XOBJSTUB(SoundJam::m_defineFileSound, 0)
void SoundJam::m_defineCastSound(int nargs) {
SoundJamObject *me = static_cast<SoundJamObject *>(g_lingo->_state->me.u.obj);
/* Datum numberOfBeats = */ g_lingo->pop();
CastMemberID castMemberNumber = g_lingo->pop().asMemberID();
int soundID = 0;
while (me->_soundMap.contains(soundID))
soundID++;
me->_soundMap[soundID] = castMemberNumber;
g_lingo->push(soundID);
}
void SoundJam::m_undefineSound(int nargs) {
SoundJamObject *me = static_cast<SoundJamObject *>(g_lingo->_state->me.u.obj);
int soundID = g_lingo->pop().asInt();
if (soundID < 0) {
g_lingo->push(0); // success
return;
}
if (!me->_soundMap.contains(soundID)) {
warning("SoundJam::m_undefineSound: Sound %d is not defined", soundID);
g_lingo->push(-1); // error
return;
}
me->_soundMap.erase(soundID);
g_lingo->push(0); // success
}
XOBJSTUB(SoundJam::m_readSome, 0)
XOBJSTUB(SoundJam::m_startSound, 0)
void SoundJam::m_switchNew(int nargs) {
SoundJamObject *me = static_cast<SoundJamObject *>(g_lingo->_state->me.u.obj);
int soundID = g_lingo->pop().asInt();
if (!me->_soundMap.contains(soundID)) {
warning("SoundJam::m_switchNew: Sound %d is not defined", soundID);
g_lingo->push(-1); // error
return;
}
DirectorSound *sound = g_director->getCurrentWindow()->getSoundManager();
sound->setPuppetSound(me->_soundMap[soundID], kJamChannel);
sound->playPuppetSound(kJamChannel);
g_lingo->push(0); // success
}
XOBJSTUB(SoundJam::m_switchParallel, 0)
XOBJSTUB(SoundJam::m_hasSwitchHappened, 0)
XOBJSTUBNR(SoundJam::m_toggleMute)
void SoundJam::m_stop(int nargs) {
DirectorSound *sound = g_director->getCurrentWindow()->getSoundManager();
sound->setPuppetSound(SoundID(), kJamChannel);
sound->playPuppetSound(kJamChannel);
}
} // End of namespace Director

View File

@@ -0,0 +1,59 @@
/* 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_SOUNDJAM_H
#define DIRECTOR_LINGO_XLIBS_SOUNDJAM_H
namespace Director {
class SoundJamObject : public Object<SoundJamObject> {
public:
Common::HashMap<int, CastMemberID> _soundMap;
public:
SoundJamObject(ObjectType objType);
};
namespace SoundJam {
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_defineFileSound(int nargs);
void m_defineCastSound(int nargs);
void m_undefineSound(int nargs);
void m_readSome(int nargs);
void m_startSound(int nargs);
void m_switchNew(int nargs);
void m_switchParallel(int nargs);
void m_hasSwitchHappened(int nargs);
void m_toggleMute(int nargs);
void m_stop(int nargs);
} // End of namespace SoundJam
} // End of namespace Director
#endif

View File

@@ -0,0 +1,657 @@
/* 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:
* DEVO Presents: Adventures of the Smart Patrol
* The Dark Eye
*
**************************************************/
/*
* -- SpaceMgr XObject. Copyright 1995 Inscape v1.0b1 10March95 BDL
* SpaceMgr
* I mNew --Creates a new instance
* X mDispose --Disposes XObject instance
* I mLastError --Last error code
* I mMemUsed --RAM occupied by this object and data
* S mListData --List all data
* I mSortAll --Sort internal arrays
* IS mCheckForDups, bool --Set to true to check for Duplicate items before adding an element
* IS mParseText, text --Parse Text into a space structure
* S mGetCurData --List Current data
* ISSSS mSetCurData, sc, s, n, v --pass in names of elements to make current
* ISS mAddSpaceCollection, name, data --Add a Space Collection
* IS mRemoveSpaceCollection, name --Remove a Space Collection
* IS mSetCurSpaceCollection, name --Set current SpaceCollection
* S mGetCurSpaceCollection --Get current SpaceCollection
* SS mGetSpaceCollection, name --Get SpaceCollection with name
* ISS mAddSpace, name, data --Add a Space
* IS mRemoveSpace, name --Remove a Space
* IS mSetCurSpace, name --Set current Space
* S mGetCurSpace --Get current Space
* SS mGetSpace, name --Get Space with name
* ISS mAddNode, name, data --Add a Node
* IS mRemoveNode, name --Remove a Node
* IS mSetCurNode, name --Set current Node
* S mGetCurNode --Get current Node
* SS mGetNode, name --Get Node with name
* ISS mAddView, name, data --Add a View
* IS mRemoveView, name --Remove a View
* IS mSetCurView, name --Set current View
* S mGetCurView --Get current View
* SS mGetView, name --Get View with name
* ISS mAddLocalLink, name, data --Add a link to the current view
* IS mRemoveLocalLink, name --Remove a link from the current View
* I mRemoveLocalLinks --Remove all links from the current View
* SS mGetLocalLink, name --Get link with name from the current view
* S mGetLocalLinks --Get all links from the current view
* ISS mAddGlobalLink, name, data --Add a global link
* IS mRemoveGlobalLink, name --Remove a global link
* SS mGetGlobalLink, name --Get global link with name
* S mGetGlobalLinks --Get list of all global links
*/
#include "common/system.h"
#include "common/tokenizer.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/s/spacemgr.h"
#include "director/util.h"
namespace Director {
const char *const SpaceMgr::xlibName = "SpaceMgr";
const XlibFileDesc SpaceMgr::fileNames[] = {
{ "SpaceMgr", nullptr },
{ nullptr, nullptr },
};
static const MethodProto xlibMethods[] = {
{ "new", SpaceMgr::m_new, 0, 0, 400 }, // D4
{ "dispose", SpaceMgr::m_dispose, 1, 1, 400 }, // D4
{ "lastError", SpaceMgr::m_lastError, 0, 0, 400 }, // D4
{ "memUsed", SpaceMgr::m_memUsed, 0, 0, 400 }, // D4
{ "listData", SpaceMgr::m_listData, 0, 0, 400 }, // D4
{ "sortAll", SpaceMgr::m_sortAll, 0, 0, 400 }, // D4
{ "checkForDups", SpaceMgr::m_checkForDups, 1, 1, 400 }, // D4
{ "parseText", SpaceMgr::m_parseText, 1, 1, 400 }, // D4
{ "getCurData", SpaceMgr::m_getCurData, 0, 0, 400 }, // D4
{ "setCurData", SpaceMgr::m_setCurData, 4, 4, 400 }, // D4
{ "addSpaceCollection", SpaceMgr::m_addSpaceCollection, 2, 2, 400 }, // D4
{ "removeSpaceCollection", SpaceMgr::m_removeSpaceCollection, 1, 1, 400 }, // D4
{ "setCurSpaceCollection", SpaceMgr::m_setCurSpaceCollection, 1, 1, 400 }, // D4
{ "getCurSpaceCollection", SpaceMgr::m_getCurSpaceCollection, 0, 0, 400 }, // D4
{ "getSpaceCollection", SpaceMgr::m_getSpaceCollection, 1, 1, 400 }, // D4
{ "addSpace", SpaceMgr::m_addSpace, 2, 2, 400 }, // D4
{ "removeSpace", SpaceMgr::m_removeSpace, 1, 1, 400 }, // D4
{ "setCurSpace", SpaceMgr::m_setCurSpace, 1, 1, 400 }, // D4
{ "getCurSpace", SpaceMgr::m_getCurSpace, 0, 0, 400 }, // D4
{ "getSpace", SpaceMgr::m_getSpace, 1, 1, 400 }, // D4
{ "addNode", SpaceMgr::m_addNode, 2, 2, 400 }, // D4
{ "removeNode", SpaceMgr::m_removeNode, 1, 1, 400 }, // D4
{ "setCurNode", SpaceMgr::m_setCurNode, 1, 1, 400 }, // D4
{ "getCurNode", SpaceMgr::m_getCurNode, 0, 0, 400 }, // D4
{ "getNode", SpaceMgr::m_getNode, 1, 1, 400 }, // D4
{ "addView", SpaceMgr::m_addView, 2, 2, 400 }, // D4
{ "removeView", SpaceMgr::m_removeView, 1, 1, 400 }, // D4
{ "setCurView", SpaceMgr::m_setCurView, 1, 1, 400 }, // D4
{ "getCurView", SpaceMgr::m_getCurView, 0, 0, 400 }, // D4
{ "getView", SpaceMgr::m_getView, 1, 1, 400 }, // D4
{ "addLocalLink", SpaceMgr::m_addLocalLink, 2, 2, 400 }, // D4
{ "removeLocalLink", SpaceMgr::m_removeLocalLink, 1, 1, 400 }, // D4
{ "removeLocalLinks", SpaceMgr::m_removeLocalLinks, 0, 0, 400 }, // D4
{ "getLocalLink", SpaceMgr::m_getLocalLink, 1, 1, 400 }, // D4
{ "getLocalLinks", SpaceMgr::m_getLocalLink, 1, 1, 400 }, // D4
{ "addGlobalLink", SpaceMgr::m_addGlobalLink, 2, 2, 400 }, // D4
{ "removeGlobalLink", SpaceMgr::m_removeGlobalLink, 1, 1, 400 }, // D4
{ "getGlobalLink", SpaceMgr::m_getGlobalLink, 1, 1, 400 }, // D4
{ "getGlobalLinks", SpaceMgr::m_getGlobalLinks, 0, 0, 400 }, // D4
{ nullptr, nullptr, 0, 0, 0 }
};
SpaceMgrXObject::SpaceMgrXObject(ObjectType ObjectType) :Object<SpaceMgrXObject>("SpaceMgr") {
_objType = ObjectType;
}
void SpaceMgr::open(ObjectType type, const Common::Path &path) {
if (type == kXObj) {
SpaceMgrXObject::initMethods(xlibMethods);
SpaceMgrXObject *xobj = new SpaceMgrXObject(kXObj);
g_lingo->exposeXObject(xlibName, xobj);
}
}
void SpaceMgr::close(ObjectType type) {
if (type == kXObj) {
SpaceMgrXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
}
void SpaceMgr::m_new(int nargs) {
if (nargs != 0) {
warning("SpaceMgr::m_new: expected 0 arguments");
g_lingo->dropStack(nargs);
}
g_lingo->push(g_lingo->_state->me);
}
XOBJSTUBNR(SpaceMgr::m_dispose)
XOBJSTUB(SpaceMgr::m_lastError, 0)
XOBJSTUB(SpaceMgr::m_memUsed, 0)
XOBJSTUB(SpaceMgr::m_listData, "")
XOBJSTUB(SpaceMgr::m_sortAll, 0)
void SpaceMgr::m_checkForDups(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_checkForDups: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(0));
return;
}
Datum arg = g_lingo->pop();
if (arg.type != STRING) {
warning("SpaceMgr::m_checkForDups: expected arg to be a string, not %s", arg.type2str());
g_lingo->push(Datum(0));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
me->_checkForDups = (arg.u.s->c_str()[0] == 't') || (arg.u.s->c_str()[0] == 'T');
g_lingo->push(Datum(0));
}
void SpaceMgr::m_parseText(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_parseText: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(0));
return;
}
Datum text = g_lingo->pop();
if (text.type != STRING) {
warning("SpaceMgr::m_parseText: expected text to be a string, not %s", text.type2str());
g_lingo->push(Datum(0));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String result = *text.u.s;
if (debugLevelSet(5)) {
debugC(5, kDebugXObj, "SpaceMgr::m_parseText:\n%s", formatStringForDump(result).c_str());
}
Common::StringTokenizer instructions = Common::StringTokenizer(result, "\r");
while (!instructions.empty()) {
Common::String instructionBody = instructions.nextToken();
Common::StringTokenizer instruction = Common::StringTokenizer(instructionBody, " ");
Common::String type = instruction.nextToken();
if (type == "SPACECOLLECTION") {
me->_curSpaceCollection = instruction.nextToken();
me->_curSpace = "";
me->_curNode = "";
me->_curView = "";
if (!(me->_spaceCollections.contains(me->_curSpaceCollection) && me->_checkForDups)) {
me->_spaceCollections.getOrCreateVal(me->_curSpaceCollection);
}
} else if (type == "SPACE") {
me->_curSpace = instruction.nextToken();
me->_curNode = "";
me->_curView = "";
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
if (!(sc.spaces.contains(me->_curSpaceCollection) && me->_checkForDups)) {
sc.spaces.getOrCreateVal(me->_curSpace);
}
} else if (type == "NODE") {
me->_curNode = instruction.nextToken();
me->_curView = "";
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
Space &s = sc.spaces.getVal(me->_curSpace);
if (!(s.nodes.contains(me->_curNode) && me->_checkForDups)) {
s.nodes.getOrCreateVal(me->_curNode);
}
} else if (type == "VIEW") {
me->_curView = instruction.nextToken();
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
Space &s = sc.spaces.getVal(me->_curSpace);
Node &n = s.nodes.getVal(me->_curNode);
if (!(n.views.contains(me->_curView) && me->_checkForDups)) {
n.views.getOrCreateVal(me->_curView).payload = instruction.nextToken();
}
} else if (type == "LLINK") {
Common::String target = instruction.nextToken();
Common::String payload = instruction.nextToken();
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
Space &s = sc.spaces.getVal(me->_curSpace);
Node &n = s.nodes.getVal(me->_curNode);
View &v = n.views.getVal(me->_curView);
if (!(v.llinks.contains(target) && me->_checkForDups)) {
v.llinks.getOrCreateVal(target).payload = payload;
}
} else {
warning("SpaceMgr::m_parseText: Unhandled instruction %s", instructionBody.c_str());
}
}
g_lingo->push(Datum(0));
}
void SpaceMgr::m_getCurData(int nargs) {
if (nargs != 0) {
warning("SpaceMgr::m_getCurData: expected 0 arguments");
g_lingo->dropStack(nargs);
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String result;
if (me->_spaceCollections.contains(me->_curSpaceCollection)) {
result += "SPACECOLLECTION " + me->_curSpaceCollection;
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
if (sc.spaces.contains(me->_curSpace)) {
result += "\r";
result += "SPACE " + me->_curSpace;
Space &s = sc.spaces.getVal(me->_curSpace);
if (s.nodes.contains(me->_curNode)) {
result += "\r";
result += "NODE " + me->_curNode;
Node &n = s.nodes.getVal(me->_curNode);
if (n.views.contains(me->_curView)) {
result += "\r";
result += "VIEW " + me->_curView;
}
}
}
}
if (debugLevelSet(5)) {
debugC(5, kDebugXObj, "SpaceMgr::m_getCurData: %s", formatStringForDump(result).c_str());
}
g_lingo->push(Datum(result));
}
void SpaceMgr::m_setCurData(int nargs) {
if (nargs != 4) {
warning("SpaceMgr::m_setCurData: expected 4 arguments");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(0));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Datum view = g_lingo->pop();
Datum node = g_lingo->pop();
Datum space = g_lingo->pop();
Datum spaceCollection = g_lingo->pop();
if (spaceCollection.type != STRING ||
space.type != STRING ||
node.type != STRING ||
view.type != STRING) {
warning("SpaceMgr::m_setCurData: expected args to be a string");
g_lingo->push(Datum(0));
return;
}
if (!spaceCollection.u.s->empty())
me->_curSpaceCollection = *spaceCollection.u.s;
if (!space.u.s->empty())
me->_curSpace = *space.u.s;
if (!node.u.s->empty())
me->_curNode = *node.u.s;
if (!view.u.s->empty())
me->_curView = *view.u.s;
debugC(5, kDebugXObj, "SpaceMgr::m_setCurData: %s %s %s %s", me->_curSpaceCollection.c_str(), me->_curSpace.c_str(), me->_curNode.c_str(), me->_curView.c_str());
g_lingo->push(Datum(0));
}
XOBJSTUB(SpaceMgr::m_addSpaceCollection, 0)
void SpaceMgr::m_removeSpaceCollection(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_removeSpaceCollection: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(0));
return;
}
Common::String sc = g_lingo->pop().asString();
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
if (me->_spaceCollections.contains(sc)) {
me->_spaceCollections.erase(sc);
}
debugC(5, kDebugXObj, "SpaceMgr::m_removeSpaceCollection: %s", sc.c_str());
g_lingo->push(Datum(0));
}
void SpaceMgr::m_setCurSpaceCollection(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_setCurSpaceCollection: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(0));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Datum spaceCollection = g_lingo->pop();
if (spaceCollection.type != STRING) {
warning("SpaceMgr::m_setCurSpaceCollection: expected spaceCollection to be a string, not %s", spaceCollection.type2str());
g_lingo->push(Datum(0));
return;
}
if (!spaceCollection.u.s->empty())
me->_curSpaceCollection = *spaceCollection.u.s;
debugC(5, kDebugXObj, "SpaceMgr::m_setCurSpaceCollection: %s", spaceCollection.u.s->c_str());
g_lingo->push(Datum(0));
}
void SpaceMgr::m_getCurSpaceCollection(int nargs) {
if (nargs != 0) {
warning("SpaceMgr::m_getCurSpaceCollection: expected 0 arguments");
g_lingo->dropStack(nargs);
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String result;
if (!me->_curSpaceCollection.empty()) {
if (me->_spaceCollections.contains(me->_curSpaceCollection)) {
result = "SPACECOLLECTION " + me->_curSpaceCollection;
}
}
debugC(5, kDebugXObj, "SpaceMgr::m_getCurSpaceCollection: %s", result.c_str());
g_lingo->push(Datum(result));
}
void SpaceMgr::m_getSpaceCollection(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_getSpaceCollection: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(""));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String sc = g_lingo->pop().asString();
Common::String result;
if (me->_spaceCollections.contains(sc)) {
result = "SPACECOLLECTION " + me->_curSpaceCollection;
}
debugC(5, kDebugXObj, "SpaceMgr::m_getSpaceCollection: %s", result.c_str());
g_lingo->push(Datum(result));
}
XOBJSTUB(SpaceMgr::m_addSpace, 0)
XOBJSTUB(SpaceMgr::m_removeSpace, 0)
void SpaceMgr::m_setCurSpace(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_setCurSpace: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(0));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Datum space = g_lingo->pop();
if (space.type != STRING) {
warning("SpaceMgr::m_setCurSpace: expected space to be a string, not %s", space.type2str());
g_lingo->push(Datum(0));
return;
}
if (!space.u.s->empty())
me->_curSpace = *space.u.s;
debugC(5, kDebugXObj, "SpaceMgr::m_setCurSpace: %s", space.u.s->c_str());
g_lingo->push(Datum(0));
}
void SpaceMgr::m_getCurSpace(int nargs) {
if (nargs != 0) {
warning("SpaceMgr::m_getCurSpace: expected 0 arguments");
g_lingo->dropStack(nargs);
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String result;
if (!me->_curSpace.empty()) {
if (me->_spaceCollections.contains(me->_curSpaceCollection)) {
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
if (sc.spaces.contains(me->_curSpace)) {
result = "SPACE " + me->_curSpace;
}
}
}
debugC(5, kDebugXObj, "SpaceMgr::m_getCurSpace: %s", result.c_str());
g_lingo->push(Datum(result));
}
void SpaceMgr::m_getSpace(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_getSpace: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(""));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String sp = g_lingo->pop().asString();
Common::String result;
if (me->_spaceCollections.contains(me->_curSpaceCollection)) {
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
if (sc.spaces.contains(sp)) {
result = "SPACE " + sp;
}
}
debugC(5, kDebugXObj, "SpaceMgr::m_getSpace: %s", result.c_str());
g_lingo->push(Datum(result));
}
XOBJSTUB(SpaceMgr::m_addNode, 0)
XOBJSTUB(SpaceMgr::m_removeNode, 0)
void SpaceMgr::m_setCurNode(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_setCurNode: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(0));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Datum node = g_lingo->pop();
if (node.type != STRING) {
warning("SpaceMgr::m_setCurNode: expected node to be a string, not %s", node.type2str());
g_lingo->push(Datum(0));
return;
}
if (!node.u.s->empty())
me->_curNode = *node.u.s;
debugC(5, kDebugXObj, "SpaceMgr::m_setCurNode: %s", node.u.s->c_str());
g_lingo->push(Datum(0));
}
void SpaceMgr::m_getCurNode(int nargs) {
if (nargs != 0) {
warning("SpaceMgr::m_getCurNode: expected 0 arguments");
g_lingo->dropStack(nargs);
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String result;
if (!me->_curNode.empty()) {
if (me->_spaceCollections.contains(me->_curSpaceCollection)) {
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
if (sc.spaces.contains(me->_curSpace)) {
Space &s = sc.spaces.getVal(me->_curSpace);
if (s.nodes.contains(me->_curNode)) {
result = "NODE " + me->_curNode;
}
}
}
}
debugC(5, kDebugXObj, "SpaceMgr::m_getCurNode: %s", result.c_str());
g_lingo->push(Datum(result));
}
void SpaceMgr::m_getNode(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_getNode: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(""));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String no = g_lingo->pop().asString();
Common::String result;
if (me->_spaceCollections.contains(me->_curSpaceCollection)) {
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
if (sc.spaces.contains(me->_curSpace)) {
Space &s = sc.spaces.getVal(me->_curSpace);
if (s.nodes.contains(no)) {
result = "NODE " + no;
}
}
}
debugC(5, kDebugXObj, "SpaceMgr::m_getNode: %s", result.c_str());
g_lingo->push(Datum(result));
}
XOBJSTUB(SpaceMgr::m_addView, 0)
XOBJSTUB(SpaceMgr::m_removeView, 0)
void SpaceMgr::m_setCurView(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_setCurView: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(0));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Datum view = g_lingo->pop();
if (view.type != STRING) {
warning("SpaceMgr::m_setCurView: expected view to be a string, not %s", view.type2str());
g_lingo->push(Datum(0));
return;
}
if (!view.u.s->empty())
me->_curView = *view.u.s;
debugC(5, kDebugXObj, "SpaceMgr::m_setCurView: %s", view.u.s->c_str());
g_lingo->push(Datum(0));
}
void SpaceMgr::m_getCurView(int nargs) {
if (nargs != 0) {
warning("SpaceMgr::m_getCurView: expected 0 arguments");
g_lingo->dropStack(nargs);
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String result;
if (!me->_curView.empty()) {
if (me->_spaceCollections.contains(me->_curSpaceCollection)) {
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
if (sc.spaces.contains(me->_curSpace)) {
Space &s = sc.spaces.getVal(me->_curSpace);
if (s.nodes.contains(me->_curNode)) {
Node &n = s.nodes.getVal(me->_curNode);
if (n.views.contains(me->_curView)) {
result = "VIEW " + me->_curView + " " + n.views[me->_curView].payload;
}
}
}
}
}
debugC(5, kDebugXObj, "SpaceMgr::m_getCurView: %s", result.c_str());
g_lingo->push(Datum(result));
}
void SpaceMgr::m_getView(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_getView: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(""));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String vi = g_lingo->pop().asString();
Common::String result;
if (me->_spaceCollections.contains(me->_curSpaceCollection)) {
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
if (sc.spaces.contains(me->_curSpace)) {
Space &s = sc.spaces.getVal(me->_curSpace);
if (s.nodes.contains(me->_curNode)) {
Node &n = s.nodes.getVal(me->_curNode);
if (n.views.contains(vi)) {
result = "VIEW " + vi + " " + n.views[vi].payload;
}
}
}
}
debugC(5, kDebugXObj, "SpaceMgr::m_getView: %s", result.c_str());
g_lingo->push(Datum(result));
}
XOBJSTUB(SpaceMgr::m_addLocalLink, 0)
XOBJSTUB(SpaceMgr::m_removeLocalLink, 0)
XOBJSTUB(SpaceMgr::m_removeLocalLinks, 0)
void SpaceMgr::m_getLocalLink(int nargs) {
if (nargs != 1) {
warning("SpaceMgr::m_getLocalLink: expected 1 argument");
g_lingo->dropStack(nargs);
g_lingo->push(Datum(""));
return;
}
SpaceMgrXObject *me = static_cast<SpaceMgrXObject *>(g_lingo->_state->me.u.obj);
Common::String ll = g_lingo->pop().asString();
Common::String result;
if (me->_spaceCollections.contains(me->_curSpaceCollection)) {
SpaceCollection &sc = me->_spaceCollections.getVal(me->_curSpaceCollection);
if (sc.spaces.contains(me->_curSpace)) {
Space &s = sc.spaces.getVal(me->_curSpace);
if (s.nodes.contains(me->_curNode)) {
Node &n = s.nodes.getVal(me->_curNode);
if (n.views.contains(me->_curView)) {
View &v = n.views.getVal(me->_curView);
if (v.llinks.contains(ll)) {
result = "LLINK " + ll + " " + v.llinks[ll].payload;
}
}
}
}
}
debugC(5, kDebugXObj, "SpaceMgr::m_getLocalLink: %s", result.c_str());
g_lingo->push(Datum(result));
}
XOBJSTUB(SpaceMgr::m_getLocalLinks, "")
XOBJSTUB(SpaceMgr::m_addGlobalLink, "")
XOBJSTUB(SpaceMgr::m_removeGlobalLink, 0)
XOBJSTUB(SpaceMgr::m_getGlobalLink, "")
XOBJSTUB(SpaceMgr::m_getGlobalLinks, "")
} // End of namespace Director

View File

@@ -0,0 +1,112 @@
/* 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_SPACEMGR_H
#define DIRECTOR_LINGO_XLIBS_SPACEMGR_H
namespace Director {
namespace SpaceMgr {
struct LLink {
Common::String payload;
};
struct View {
Common::String payload;
Common::HashMap<Common::String, LLink> llinks;
};
struct Node {
Common::HashMap<Common::String, View> views;
};
struct Space {
Common::HashMap<Common::String, Node> nodes;
};
struct SpaceCollection {
Common::HashMap<Common::String, Space> spaces;
};
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_lastError(int nargs);
void m_memUsed(int nargs);
void m_listData(int nargs);
void m_sortAll(int nargs);
void m_checkForDups(int nargs);
void m_parseText(int nargs);
void m_getCurData(int nargs);
void m_setCurData(int nargs);
void m_addSpaceCollection(int nargs);
void m_removeSpaceCollection(int nargs);
void m_setCurSpaceCollection(int nargs);
void m_getCurSpaceCollection(int nargs);
void m_getSpaceCollection(int nargs);
void m_addSpace(int nargs);
void m_removeSpace(int nargs);
void m_setCurSpace(int nargs);
void m_getCurSpace(int nargs);
void m_getSpace(int nargs);
void m_addNode(int nargs);
void m_removeNode(int nargs);
void m_setCurNode(int nargs);
void m_getCurNode(int nargs);
void m_getNode(int nargs);
void m_addView(int nargs);
void m_removeView(int nargs);
void m_setCurView(int nargs);
void m_getCurView(int nargs);
void m_getView(int nargs);
void m_addLocalLink(int nargs);
void m_removeLocalLink(int nargs);
void m_removeLocalLinks(int nargs);
void m_getLocalLink(int nargs);
void m_getLocalLinks(int nargs);
void m_addGlobalLink(int nargs);
void m_removeGlobalLink(int nargs);
void m_getGlobalLink(int nargs);
void m_getGlobalLinks(int nargs);
} // End of namespace SpaceMgr
class SpaceMgrXObject : public Object<SpaceMgrXObject> {
public:
SpaceMgrXObject(ObjectType objType);
Common::String _curSpaceCollection;
Common::String _curSpace;
Common::String _curNode;
Common::String _curView;
bool _checkForDups = false;
Common::HashMap<Common::String, SpaceMgr::SpaceCollection> _spaceCollections;
};
} // End of namespace Director
#endif

View 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/>.
*
*/
/*************************************
*
* USED IN:
* מיץ פטל (Mitz Petel)
*
*************************************/
/* -- StageTocast XObject
StageTC
IIIII mNew, rgnTop, rgnLeft, rgnBottom, rgnRight --Creates a new instance of the XObject
I mDispose --Disposes of XObject instance
I mGetHandle --Copies a portion of the stage onto a cast member
*/
#include "director/director.h"
#include "director/lingo/lingo.h"
#include "director/lingo/lingo-object.h"
#include "director/lingo/xlibs/s/stagetc.h"
namespace Director {
const char *const StageTCXObj::xlibName = "StageTC";
const XlibFileDesc StageTCXObj::fileNames[] = {
{ "STAGETC", nullptr },
{ nullptr, nullptr },
};
static const MethodProto xlibMethods[] = {
{ "New", StageTCXObj::m_new, 4, 4, 400 }, // D4
{ "Dispose", StageTCXObj::m_dispose, 0, 0, 400 }, // D4
{ "GetHandle", StageTCXObj::m_gethandle, 0, 0, 400 }, // D4
{ nullptr, nullptr, 0, 0, 0 }
};
void StageTCXObj::open(ObjectType type, const Common::Path &path) {
if (type == kXObj) {
StageTCXObject::initMethods(xlibMethods);
StageTCXObject *xobj = new StageTCXObject(kXObj);
g_lingo->exposeXObject(xlibName, xobj);
}
}
void StageTCXObj::close(ObjectType type) {
if (type == kXObj) {
StageTCXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
}
StageTCXObject::StageTCXObject(ObjectType ObjectType) :Object<StageTCXObject>("StageTC") {
_objType = ObjectType;
}
void StageTCXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("StageTCXObj::m_new", nargs);
g_lingo->push(g_lingo->_state->me);
}
void StageTCXObj::m_dispose(int nargs) {
g_lingo->printSTUBWithArglist("StageTCXObj::m_dispose", nargs);
g_lingo->dropStack(nargs);
}
void StageTCXObj::m_gethandle(int nargs) {
g_lingo->printSTUBWithArglist("StageTCXObj::m_gethandle", nargs);
g_lingo->dropStack(nargs);
}
} // End of namespace Director

View 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_STAGETCXOBJ_H
#define DIRECTOR_LINGO_XLIBS_STAGETCXOBJ_H
namespace Director {
class StageTCXObject : public Object<StageTCXObject> {
public:
StageTCXObject(ObjectType objType);
};
namespace StageTCXObj {
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_gethandle(int nargs);
} // End of namespace StageTCXObj
} // End of namespace Director
#endif

View File

@@ -0,0 +1,96 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 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/s/syscolor.h"
/**************************************************
*
* USED IN:
* Mummy: Tomb of the Pharaoh
*
**************************************************/
/*
-- System color Save/Restore XObject
--SysColor
I mNew --Creates a new instance of the XObject
X mDispose --Disposes of XObject instance
X mSaveColors --Saves windows system colors, then sets UI to monochrome
X mRestoreColors --Restores windows system colors
*/
namespace Director {
const char *const SysColorXObj::xlibName = "SysColor";
const XlibFileDesc SysColorXObj::fileNames[] = {
{ "SYSCOLOR", nullptr },
{ nullptr, nullptr },
};
static const MethodProto xlibMethods[] = {
{ "new", SysColorXObj::m_new, 0, 0, 400 },
{ "dispose", SysColorXObj::m_dispose, 0, 0, 400 },
{ "saveColors", SysColorXObj::m_saveColors, 0, 0, 400 },
{ "restoreColors", SysColorXObj::m_restoreColors, 0, 0, 400 },
{ nullptr, nullptr, 0, 0, 0 }
};
static const BuiltinProto xlibBuiltins[] = {
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
};
SysColorXObject::SysColorXObject(ObjectType ObjectType) :Object<SysColorXObject>("SysColor") {
_objType = ObjectType;
}
void SysColorXObj::open(ObjectType type, const Common::Path &path) {
SysColorXObject::initMethods(xlibMethods);
SysColorXObject *xobj = new SysColorXObject(type);
if (type == kXtraObj)
g_lingo->_openXtras.push_back(xlibName);
g_lingo->exposeXObject(xlibName, xobj);
g_lingo->initBuiltIns(xlibBuiltins);
}
void SysColorXObj::close(ObjectType type) {
SysColorXObject::cleanupMethods();
g_lingo->_globalvars[xlibName] = Datum();
}
void SysColorXObj::m_new(int nargs) {
g_lingo->printSTUBWithArglist("SysColorXObj::m_new", nargs);
g_lingo->dropStack(nargs);
g_lingo->push(g_lingo->_state->me);
}
XOBJSTUBNR(SysColorXObj::m_dispose)
XOBJSTUBNR(SysColorXObj::m_saveColors)
XOBJSTUBNR(SysColorXObj::m_restoreColors)
}

View 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_SYSCOLOR_H
#define DIRECTOR_LINGO_XLIBS_SYSCOLOR_H
namespace Director {
class SysColorXObject : public Object<SysColorXObject> {
public:
SysColorXObject(ObjectType objType);
};
namespace SysColorXObj {
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_saveColors(int nargs);
void m_restoreColors(int nargs);
} // End of namespace SysColorXObj
} // End of namespace Director
#endif