Issue #350: console only script instructions
parent
04ae3cbadd
commit
90de02b901
@ -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
|
Loading…
Reference in New Issue