Merge branch 'master' into HEAD
Conflicts: apps/openmw/mwscript/docs/vmformat.txt libs/openengine/ogre/renderer.cppactorid
commit
c251fbdf23
@ -0,0 +1,24 @@
|
||||
|
||||
#include "consoleextensions.hpp"
|
||||
|
||||
#include <components/compiler/extensions.hpp>
|
||||
|
||||
#include <components/interpreter/interpreter.hpp>
|
||||
#include <components/interpreter/runtime.hpp>
|
||||
#include <components/interpreter/opcodes.hpp>
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
namespace Console
|
||||
{
|
||||
void registerExtensions (Compiler::Extensions& extensions)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#ifndef GAME_SCRIPT_CONSOLEEXTENSIONS_H
|
||||
#define GAME_SCRIPT_CONSOLEEXTENSIONS_H
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
class Extensions;
|
||||
}
|
||||
|
||||
namespace Interpreter
|
||||
{
|
||||
class Interpreter;
|
||||
}
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
/// \brief Script functionality limited to the console
|
||||
namespace Console
|
||||
{
|
||||
void registerExtensions (Compiler::Extensions& extensions);
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,91 @@
|
||||
|
||||
#include "userextensions.hpp"
|
||||
|
||||
#include <components/compiler/extensions.hpp>
|
||||
|
||||
#include <components/interpreter/interpreter.hpp>
|
||||
#include <components/interpreter/runtime.hpp>
|
||||
#include <components/interpreter/opcodes.hpp>
|
||||
#include <components/interpreter/context.hpp>
|
||||
|
||||
#include "ref.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
/// Temporary script extensions.
|
||||
///
|
||||
/// \attention Do not commit changes to this file to a git repository!
|
||||
namespace User
|
||||
{
|
||||
class OpUser1 : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
runtime.getContext().report ("user1: not in use");
|
||||
}
|
||||
};
|
||||
|
||||
class OpUser2 : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
runtime.getContext().report ("user2: not in use");
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpUser3 : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
// MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
runtime.getContext().report ("user3: not in use");
|
||||
}
|
||||
};
|
||||
|
||||
template<class R>
|
||||
class OpUser4 : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
// MWWorld::Ptr ptr = R()(runtime);
|
||||
|
||||
runtime.getContext().report ("user4: not in use");
|
||||
}
|
||||
};
|
||||
|
||||
const int opcodeUser1 = 0x200016c;
|
||||
const int opcodeUser2 = 0x200016d;
|
||||
const int opcodeUser3 = 0x200016e;
|
||||
const int opcodeUser3Explicit = 0x200016f;
|
||||
const int opcodeUser4 = 0x2000170;
|
||||
const int opcodeUser4Explicit = 0x2000171;
|
||||
|
||||
void registerExtensions (Compiler::Extensions& extensions)
|
||||
{
|
||||
extensions.registerInstruction ("user1", "", opcodeUser1);
|
||||
extensions.registerInstruction ("user2", "", opcodeUser2);
|
||||
extensions.registerInstruction ("user3", "", opcodeUser3, opcodeUser3);
|
||||
extensions.registerInstruction ("user4", "", opcodeUser4, opcodeUser4);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
{
|
||||
interpreter.installSegment5 (opcodeUser1, new OpUser1);
|
||||
interpreter.installSegment5 (opcodeUser2, new OpUser2);
|
||||
interpreter.installSegment5 (opcodeUser3, new OpUser3<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeUser3Explicit, new OpUser3<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeUser4, new OpUser4<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeUser4Explicit, new OpUser4<ExplicitRef>);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
#ifndef GAME_SCRIPT_USEREXTENSIONS_H
|
||||
#define GAME_SCRIPT_USEREXTENSIONS_H
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
class Extensions;
|
||||
}
|
||||
|
||||
namespace Interpreter
|
||||
{
|
||||
class Interpreter;
|
||||
}
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
/// \brief Temporaty script functionality limited to the console
|
||||
namespace User
|
||||
{
|
||||
void registerExtensions (Compiler::Extensions& extensions);
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,37 @@
|
||||
#include "ogreplugin.hpp"
|
||||
|
||||
#include <OgrePrerequisites.h>
|
||||
#include <OgreRoot.h>
|
||||
|
||||
namespace Files {
|
||||
|
||||
bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot) {
|
||||
pluginName = pluginName + OGRE_PLUGIN_DEBUG_SUFFIX;
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
std::ostringstream verStream;
|
||||
verStream << "." << OGRE_VERSION_MAJOR << "." << OGRE_VERSION_MINOR << "." << OGRE_VERSION_PATCH;
|
||||
pluginName = pluginName + verStream.str();
|
||||
#endif
|
||||
|
||||
std::string pluginExt;
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
||||
pluginExt = ".dll";
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
||||
pluginExt = ".dylib";
|
||||
#endif
|
||||
#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
|
||||
pluginExt = ".so";
|
||||
#endif
|
||||
|
||||
std::string pluginPath = pluginDir + "/" + pluginName + pluginExt;
|
||||
if (boost::filesystem::exists(pluginPath)) {
|
||||
ogreRoot.loadPlugin(pluginPath);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Open Morrowind - an opensource Elder Scrolls III: Morrowind
|
||||
* engine implementation.
|
||||
*
|
||||
* Copyright (C) 2011 Open Morrowind Team
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/** \file components/files/ogreplugin.hpp */
|
||||
|
||||
#ifndef COMPONENTS_FILES_OGREPLUGIN_H
|
||||
#define COMPONENTS_FILES_OGREPLUGIN_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
namespace Ogre {
|
||||
class Root;
|
||||
}
|
||||
|
||||
#if (BOOST_VERSION <= 104300)
|
||||
namespace boost {
|
||||
namespace filesystem {
|
||||
inline path absolute(const path& p, const path& base=current_path()) {
|
||||
// call obsolete version of this function on older boost
|
||||
return complete(p, base);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* (BOOST_VERSION <= 104300) */
|
||||
|
||||
/**
|
||||
* \namespace Files
|
||||
*/
|
||||
namespace Files {
|
||||
|
||||
/**
|
||||
* \brief Loads Ogre plugin with given name.
|
||||
*
|
||||
* \param pluginDir absolute path to plugins
|
||||
* \param pluginName plugin name, for example "RenderSystem_GL"
|
||||
* \param ogreRoot Ogre::Root instance
|
||||
*
|
||||
* \return whether plugin was located or not
|
||||
*/
|
||||
bool loadOgrePlugin(const std::string &pluginDir, std::string pluginName, Ogre::Root &ogreRoot);
|
||||
|
||||
}
|
||||
|
||||
#endif /* COMPONENTS_FILES_OGREPLUGIN_H */
|
Loading…
Reference in New Issue