mirror of https://github.com/OpenMW/openmw.git
added CellChanged script function
parent
32eafaa301
commit
f0c492ae22
@ -0,0 +1,42 @@
|
||||
|
||||
#include "cellextensions.hpp"
|
||||
|
||||
#include <components/compiler/extensions.hpp>
|
||||
|
||||
#include <components/interpreter/interpreter.hpp>
|
||||
#include <components/interpreter/runtime.hpp>
|
||||
#include <components/interpreter/opcodes.hpp>
|
||||
|
||||
#include "interpretercontext.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
namespace Cell
|
||||
{
|
||||
class OpCellChanged : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
InterpreterContext& context
|
||||
= static_cast<InterpreterContext&> (runtime.getContext());
|
||||
|
||||
runtime.push (context.cellChanged() ? 1 : 0);
|
||||
}
|
||||
};
|
||||
|
||||
const int opcodeCellChanged = 0x2000000;
|
||||
|
||||
void registerExtensions (Compiler::Extensions& extensions)
|
||||
{
|
||||
extensions.registerFunction ("cellchanged", 'l', "", opcodeCellChanged);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
{
|
||||
interpreter.installSegment5 (opcodeCellChanged, new OpCellChanged);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
#ifndef GAME_SCRIPT_CELLEXTENSIONS_H
|
||||
#define GAME_SCRIPT_CELLEXTENSIONS_H
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
class Extensions;
|
||||
}
|
||||
|
||||
namespace Interpreter
|
||||
{
|
||||
class Interpreter;
|
||||
}
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
/// \brief cell-related script functionality
|
||||
namespace Cell
|
||||
{
|
||||
void registerExtensions (Compiler::Extensions& extensions);
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,26 @@
|
||||
OpenMW Extensions:
|
||||
|
||||
Segment 0:
|
||||
(not implemented yet)
|
||||
opcodes 0x20-0x3f unused
|
||||
|
||||
Segment 1:
|
||||
(not implemented yet)
|
||||
opcodes 0x20-0x3f unused
|
||||
|
||||
Segment 2:
|
||||
(not implemented yet)
|
||||
opcodes 0x200-0x3ff unused
|
||||
|
||||
Segment 3:
|
||||
(not implemented yet)
|
||||
opcodes 0x200-0x3ff unused
|
||||
|
||||
Segment 4:
|
||||
(not implemented yet)
|
||||
opcodes 0x200-0x3ff unused
|
||||
|
||||
Segment 5:
|
||||
op 2000000: push 1 if cell has changed since last frame, 0 if not
|
||||
opcodes 0x2000001-0x3ffffff unused
|
||||
|
@ -0,0 +1,13 @@
|
||||
|
||||
#include "extensions.hpp"
|
||||
|
||||
#include "cellextensions.hpp"
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
void registerExtensions (Compiler::Extensions& extensions)
|
||||
{
|
||||
Cell::registerExtensions (extensions);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,14 @@
|
||||
#ifndef GAME_SCRIPT_EXTENSIONS_H
|
||||
#define GAME_SCRIPT_EXTENSIONS_H
|
||||
|
||||
namespace Compiler
|
||||
{
|
||||
class Extensions;
|
||||
}
|
||||
|
||||
namespace MWScript
|
||||
{
|
||||
void registerExtensions (Compiler::Extensions& extensions);
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue