Make OnDeath work with explicit reference

This commit is contained in:
scrawl 2013-04-26 02:08:53 +02:00
parent a373f53988
commit 7821610ec6
2 changed files with 8 additions and 9 deletions

View File

@ -324,5 +324,6 @@ op 0x2000201: RotateWorld
op 0x2000202: RotateWorld, explicit reference op 0x2000202: RotateWorld, explicit reference
op 0x2000203: SetAtStart op 0x2000203: SetAtStart
op 0x2000204: SetAtStart, explicit op 0x2000204: SetAtStart, explicit
op 0x2000205: OnDeath, explicit
opcodes 0x2000205-0x3ffffff unused opcodes 0x2000206-0x3ffffff unused

View File

@ -1025,16 +1025,14 @@ namespace MWScript
} }
}; };
template <class R>
class OpOnDeath : public Interpreter::Opcode0 class OpOnDeath : public Interpreter::Opcode0
{ {
public: public:
virtual void execute (Interpreter::Runtime& runtime) virtual void execute (Interpreter::Runtime& runtime)
{ {
MWScript::InterpreterContext& context MWWorld::Ptr ptr = R()(runtime);
= static_cast<MWScript::InterpreterContext&> (runtime.getContext());
MWWorld::Ptr ptr = context.getReference();
Interpreter::Type_Integer value = Interpreter::Type_Integer value =
MWWorld::Class::get (ptr).getCreatureStats (ptr).hasDied(); MWWorld::Class::get (ptr).getCreatureStats (ptr).hasDied();
@ -1146,9 +1144,8 @@ namespace MWScript
const int opcodeRaiseRankExplicit = 0x20001e9; const int opcodeRaiseRankExplicit = 0x20001e9;
const int opcodeLowerRank = 0x20001ea; const int opcodeLowerRank = 0x20001ea;
const int opcodeLowerRankExplicit = 0x20001eb; const int opcodeLowerRankExplicit = 0x20001eb;
const int opcodeOnDeath = 0x20001fc; const int opcodeOnDeath = 0x20001fc;
const int opcodeOnDeathExplicit = 0x2000205;
const int opcodeIsWerewolf = 0x20001fd; const int opcodeIsWerewolf = 0x20001fd;
const int opcodeIsWerewolfExplicit = 0x20001fe; const int opcodeIsWerewolfExplicit = 0x20001fe;
@ -1266,7 +1263,7 @@ namespace MWScript
extensions.registerInstruction ("raiserank", "", opcodeRaiseRank, opcodeRaiseRankExplicit); extensions.registerInstruction ("raiserank", "", opcodeRaiseRank, opcodeRaiseRankExplicit);
extensions.registerInstruction ("lowerrank", "", opcodeLowerRank, opcodeLowerRankExplicit); extensions.registerInstruction ("lowerrank", "", opcodeLowerRank, opcodeLowerRankExplicit);
extensions.registerFunction ("ondeath", 'l', "", opcodeOnDeath); extensions.registerFunction ("ondeath", 'l', "", opcodeOnDeath, opcodeOnDeathExplicit);
extensions.registerFunction ("iswerewolf", 'l', "", opcodeIsWerewolf, opcodeIsWerewolfExplicit); extensions.registerFunction ("iswerewolf", 'l', "", opcodeIsWerewolf, opcodeIsWerewolfExplicit);
} }
@ -1384,7 +1381,8 @@ namespace MWScript
interpreter.installSegment5 (opcodeLowerRank, new OpLowerRank<ImplicitRef>); interpreter.installSegment5 (opcodeLowerRank, new OpLowerRank<ImplicitRef>);
interpreter.installSegment5 (opcodeLowerRankExplicit, new OpLowerRank<ExplicitRef>); interpreter.installSegment5 (opcodeLowerRankExplicit, new OpLowerRank<ExplicitRef>);
interpreter.installSegment5 (opcodeOnDeath, new OpOnDeath); interpreter.installSegment5 (opcodeOnDeath, new OpOnDeath<ImplicitRef>);
interpreter.installSegment5 (opcodeOnDeathExplicit, new OpOnDeath<ExplicitRef>);
interpreter.installSegment5 (opcodeIsWerewolf, new OpIsWerewolf<ImplicitRef>); interpreter.installSegment5 (opcodeIsWerewolf, new OpIsWerewolf<ImplicitRef>);
interpreter.installSegment5 (opcodeIsWerewolfExplicit, new OpIsWerewolf<ExplicitRef>); interpreter.installSegment5 (opcodeIsWerewolfExplicit, new OpIsWerewolf<ExplicitRef>);