|
|
|
@ -1025,6 +1025,27 @@ namespace MWScript
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class OpOnDeath : public Interpreter::Opcode0
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
virtual void execute (Interpreter::Runtime& runtime)
|
|
|
|
|
{
|
|
|
|
|
MWScript::InterpreterContext& context
|
|
|
|
|
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr ptr = context.getReference();
|
|
|
|
|
|
|
|
|
|
Interpreter::Type_Integer value =
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).hasDied();
|
|
|
|
|
|
|
|
|
|
if (value)
|
|
|
|
|
MWWorld::Class::get (ptr).getCreatureStats (ptr).clearHasDied();
|
|
|
|
|
|
|
|
|
|
runtime.push (value);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const int numberOfAttributes = 8;
|
|
|
|
|
|
|
|
|
|
const int opcodeGetAttribute = 0x2000027;
|
|
|
|
@ -1114,6 +1135,8 @@ namespace MWScript
|
|
|
|
|
const int opcodeLowerRank = 0x20001ea;
|
|
|
|
|
const int opcodeLowerRankExplicit = 0x20001eb;
|
|
|
|
|
|
|
|
|
|
const int opcodeOnDeath = 0x20001fc;
|
|
|
|
|
|
|
|
|
|
void registerExtensions (Compiler::Extensions& extensions)
|
|
|
|
|
{
|
|
|
|
|
static const char *attributes[numberOfAttributes] =
|
|
|
|
@ -1227,6 +1250,8 @@ namespace MWScript
|
|
|
|
|
extensions.registerInstruction ("pcclearexpelled", "/S", opcodePcClearExpelled, opcodePcClearExpelledExplicit);
|
|
|
|
|
extensions.registerInstruction ("raiserank", "", opcodeRaiseRank, opcodeRaiseRankExplicit);
|
|
|
|
|
extensions.registerInstruction ("lowerrank", "", opcodeLowerRank, opcodeLowerRankExplicit);
|
|
|
|
|
|
|
|
|
|
extensions.registerFunction ("ondeath", 'l', "", opcodeOnDeath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
|
|
|
@ -1341,6 +1366,8 @@ namespace MWScript
|
|
|
|
|
interpreter.installSegment5 (opcodeRaiseRankExplicit, new OpRaiseRank<ExplicitRef>);
|
|
|
|
|
interpreter.installSegment5 (opcodeLowerRank, new OpLowerRank<ImplicitRef>);
|
|
|
|
|
interpreter.installSegment5 (opcodeLowerRankExplicit, new OpLowerRank<ExplicitRef>);
|
|
|
|
|
|
|
|
|
|
interpreter.installSegment5 (opcodeOnDeath, new OpOnDeath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|