Implement Resurrect instruction

actorid
scrawl 11 years ago
parent b4230f716e
commit 55c5d7cee4

@ -266,8 +266,10 @@ namespace MWMechanics
if (mDead)
{
if (mDynamic[0].getCurrent()<1)
mDynamic[0].setCurrent (1);
{
mDynamic[0].setModified(mDynamic[0].getModified(), 1);
mDynamic[0].setCurrent(1);
}
if (mDynamic[0].getCurrent()>=1)
mDead = false;
}

@ -366,4 +366,6 @@ op 0x200022b: RemoveSpellEffects
op 0x200022c: RemoveSpellEffects, explicit
op 0x200022d: RemoveEffects
op 0x200022e: RemoveEffects, explicit
op 0x200022f: Resurrect
op 0x2000230: Resurrect, explicit
opcodes 0x200022f-0x3ffffff unused

@ -1104,6 +1104,18 @@ namespace MWScript
}
};
template <class R>
class OpResurrect : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
ptr.getClass().getCreatureStats(ptr).resurrect();
}
};
void installOpcodes (Interpreter::Interpreter& interpreter)
{
for (int i=0; i<Compiler::Stats::numberOfAttributes; ++i)
@ -1170,7 +1182,9 @@ namespace MWScript
interpreter.installSegment5 (Compiler::Stats::opcodeRemoveSpellEffects, new OpRemoveSpellEffects<ImplicitRef>);
interpreter.installSegment5 (Compiler::Stats::opcodeRemoveSpellEffectsExplicit,
new OpRemoveSpellEffects<ExplicitRef>);
interpreter.installSegment5 (Compiler::Stats::opcodeResurrect, new OpResurrect<ImplicitRef>);
interpreter.installSegment5 (Compiler::Stats::opcodeResurrectExplicit,
new OpResurrect<ExplicitRef>);
interpreter.installSegment5 (Compiler::Stats::opcodeRemoveEffects, new OpRemoveEffects<ImplicitRef>);
interpreter.installSegment5 (Compiler::Stats::opcodeRemoveEffectsExplicit,
new OpRemoveEffects<ExplicitRef>);

@ -395,6 +395,8 @@ namespace Compiler
opcodeRemoveSpellEffectsExplicit);
extensions.registerInstruction ("removeeffects", "l", opcodeRemoveEffects,
opcodeRemoveEffectsExplicit);
extensions.registerInstruction ("resurrect", "", opcodeResurrect,
opcodeResurrectExplicit);
extensions.registerFunction ("getspell", 'l', "c", opcodeGetSpell, opcodeGetSpellExplicit);
extensions.registerInstruction("pcraiserank","/S",opcodePCRaiseRank);

@ -374,6 +374,8 @@ namespace Compiler
const int opcodeRemoveSpellEffectsExplicit = 0x200022c;
const int opcodeRemoveEffects = 0x200022d;
const int opcodeRemoveEffectsExplicit = 0x200022e;
const int opcodeResurrect = 0x200022f;
const int opcodeResurrectExplicit = 0x2000230;
}
namespace Transformation

Loading…
Cancel
Save