mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-22 16:20:58 +00:00
added ondeath script function
This commit is contained in:
parent
fd2c07a6f4
commit
e4ed5b836e
@ -315,5 +315,6 @@ op 0x20001f8: Drop
|
|||||||
op 0x20001f9: Drop, explicit reference
|
op 0x20001f9: Drop, explicit reference
|
||||||
op 0x20001fa: DropSoulGem
|
op 0x20001fa: DropSoulGem
|
||||||
op 0x20001fb: DropSoulGem, explicit reference
|
op 0x20001fb: DropSoulGem, explicit reference
|
||||||
|
op 0x20001fc: OnDeath
|
||||||
|
|
||||||
opcodes 0x20001fa-0x3ffffff unused
|
opcodes 0x20001fd-0x3ffffff unused
|
||||||
|
@ -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 numberOfAttributes = 8;
|
||||||
|
|
||||||
const int opcodeGetAttribute = 0x2000027;
|
const int opcodeGetAttribute = 0x2000027;
|
||||||
@ -1114,6 +1135,8 @@ namespace MWScript
|
|||||||
const int opcodeLowerRank = 0x20001ea;
|
const int opcodeLowerRank = 0x20001ea;
|
||||||
const int opcodeLowerRankExplicit = 0x20001eb;
|
const int opcodeLowerRankExplicit = 0x20001eb;
|
||||||
|
|
||||||
|
const int opcodeOnDeath = 0x20001fc;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
static const char *attributes[numberOfAttributes] =
|
static const char *attributes[numberOfAttributes] =
|
||||||
@ -1227,6 +1250,8 @@ namespace MWScript
|
|||||||
extensions.registerInstruction ("pcclearexpelled", "/S", opcodePcClearExpelled, opcodePcClearExpelledExplicit);
|
extensions.registerInstruction ("pcclearexpelled", "/S", opcodePcClearExpelled, opcodePcClearExpelledExplicit);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
@ -1341,6 +1366,8 @@ namespace MWScript
|
|||||||
interpreter.installSegment5 (opcodeRaiseRankExplicit, new OpRaiseRank<ExplicitRef>);
|
interpreter.installSegment5 (opcodeRaiseRankExplicit, new OpRaiseRank<ExplicitRef>);
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user