Initial commit
This commit is contained in:
103
engines/director/lingo/xtras/oscheck.cpp
Normal file
103
engines/director/lingo/xtras/oscheck.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
/* 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/xtras/oscheck.h"
|
||||
|
||||
/**************************************************
|
||||
*
|
||||
* USED IN:
|
||||
* sinkha
|
||||
*
|
||||
**************************************************/
|
||||
|
||||
/*
|
||||
-- xtra osCheck
|
||||
new object me
|
||||
-- Template handlers --
|
||||
* chos -- returns true if Japan OS
|
||||
|
||||
*/
|
||||
|
||||
namespace Director {
|
||||
|
||||
const char *OSCheckXtra::xlibName = "OSCheck";
|
||||
const XlibFileDesc OSCheckXtra::fileNames[] = {
|
||||
{ "oscheck", nullptr },
|
||||
{ nullptr, nullptr },
|
||||
};
|
||||
|
||||
static MethodProto xlibMethods[] = {
|
||||
{ "new", OSCheckXtra::m_new, 0, 0, 400 },
|
||||
{ nullptr, nullptr, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static BuiltinProto xlibBuiltins[] = {
|
||||
{ "chos", OSCheckXtra::m_chos, 0, 0, 400, HBLTIN },
|
||||
{ nullptr, nullptr, 0, 0, 0, VOIDSYM }
|
||||
};
|
||||
|
||||
OSCheckXtraObject::OSCheckXtraObject(ObjectType ObjectType) :Object<OSCheckXtraObject>("OSCheck") {
|
||||
_objType = ObjectType;
|
||||
}
|
||||
|
||||
bool OSCheckXtraObject::hasProp(const Common::String &propName) {
|
||||
return (propName == "name");
|
||||
}
|
||||
|
||||
Datum OSCheckXtraObject::getProp(const Common::String &propName) {
|
||||
if (propName == "name")
|
||||
return Datum(OSCheckXtra::xlibName);
|
||||
warning("OSCheckXtra::getProp: unknown property '%s'", propName.c_str());
|
||||
return Datum();
|
||||
}
|
||||
|
||||
void OSCheckXtra::open(ObjectType type, const Common::Path &path) {
|
||||
OSCheckXtraObject::initMethods(xlibMethods);
|
||||
OSCheckXtraObject *xobj = new OSCheckXtraObject(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 OSCheckXtra::close(ObjectType type) {
|
||||
OSCheckXtraObject::cleanupMethods();
|
||||
g_lingo->_globalvars[xlibName] = Datum();
|
||||
|
||||
}
|
||||
|
||||
void OSCheckXtra::m_new(int nargs) {
|
||||
g_lingo->printSTUBWithArglist("OSCheckXtra::m_new", nargs);
|
||||
g_lingo->dropStack(nargs);
|
||||
g_lingo->push(g_lingo->_state->me);
|
||||
}
|
||||
|
||||
XOBJSTUB(OSCheckXtra::m_chos, 0)
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user