Add explicit variant of 'OnActivate'

new-script-api
scrawl 7 years ago
parent e564dd842e
commit 0c6ef17fb5

@ -453,5 +453,6 @@ op 0x2000302: Fixme
op 0x2000303: Fixme, explicit
op 0x2000304: Show
op 0x2000305: Show, explicit
op 0x2000306: OnActivate, explicit
opcodes 0x2000304-0x3ffffff unused
opcodes 0x2000307-0x3ffffff unused

@ -131,16 +131,14 @@ namespace MWScript
}
};
template <class R>
class OpOnActivate : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
InterpreterContext& context =
static_cast<InterpreterContext&> (runtime.getContext());
MWWorld::Ptr ptr = context.getReference();
MWWorld::Ptr ptr = R()(runtime);
runtime.push (ptr.getRefData().onActivate());
}
@ -1280,7 +1278,8 @@ namespace MWScript
void installOpcodes (Interpreter::Interpreter& interpreter)
{
interpreter.installSegment5 (Compiler::Misc::opcodeXBox, new OpXBox);
interpreter.installSegment5 (Compiler::Misc::opcodeOnActivate, new OpOnActivate);
interpreter.installSegment5 (Compiler::Misc::opcodeOnActivate, new OpOnActivate<ImplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeOnActivateExplicit, new OpOnActivate<ExplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeActivate, new OpActivate<ImplicitRef>);
interpreter.installSegment5 (Compiler::Misc::opcodeActivateExplicit, new OpActivate<ExplicitRef>);
interpreter.installSegment3 (Compiler::Misc::opcodeLock, new OpLock<ImplicitRef>);

@ -240,7 +240,7 @@ namespace Compiler
void registerExtensions (Extensions& extensions)
{
extensions.registerFunction ("xbox", 'l', "", opcodeXBox);
extensions.registerFunction ("onactivate", 'l', "", opcodeOnActivate);
extensions.registerFunction ("onactivate", 'l', "", opcodeOnActivate, opcodeOnActivateExplicit);
extensions.registerInstruction ("activate", "x", opcodeActivate, opcodeActivateExplicit);
extensions.registerInstruction ("lock", "/l", opcodeLock, opcodeLockExplicit);
extensions.registerInstruction ("unlock", "", opcodeUnlock, opcodeUnlockExplicit);

@ -200,6 +200,7 @@ namespace Compiler
{
const int opcodeXBox = 0x200000c;
const int opcodeOnActivate = 0x200000d;
const int opcodeOnActivateExplicit = 0x2000306;
const int opcodeActivate = 0x2000075;
const int opcodeActivateExplicit = 0x2000244;
const int opcodeLock = 0x20004;

Loading…
Cancel
Save