1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

Implement script instructions Become/UndoWerewolf

This commit is contained in:
Emanuel Guevel 2013-08-05 23:24:48 +02:00
parent 20d40c4368
commit 5188a1c2cd
2 changed files with 29 additions and 1 deletions

View File

@ -343,5 +343,9 @@ op 0x2000213: HitOnMe
op 0x2000214: HitOnMe, explicit
op 0x2000215: DisableTeleporting
op 0x2000216: EnableTeleporting
op 0x2000217: BecomeWerewolf
op 0x2000218: BecomeWerewolfExplicit
op 0x2000219: UndoWerewolf
op 0x200021a: UndoWerewolfExplicit
opcodes 0x2000217-0x3ffffff unused
opcodes 0x2000219-0x3ffffff unused

View File

@ -1056,6 +1056,18 @@ namespace MWScript
}
};
template <class R, bool set>
class OpSetWerewolf : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
MWBase::Environment::get().getWorld()->setWerewolf(ptr, set);
}
};
const int numberOfAttributes = 8;
const int opcodeGetAttribute = 0x2000027;
@ -1148,6 +1160,10 @@ namespace MWScript
const int opcodeOnDeathExplicit = 0x2000205;
const int opcodeIsWerewolf = 0x20001fd;
const int opcodeIsWerewolfExplicit = 0x20001fe;
const int opcodeBecomeWerewolf = 0x2000217;
const int opcodeBecomeWerewolfExplicit = 0x2000218;
const int opcodeUndoWerewolf = 0x2000219;
const int opcodeUndoWerewolfExplicit = 0x200021a;
void registerExtensions (Compiler::Extensions& extensions)
{
@ -1266,6 +1282,9 @@ namespace MWScript
extensions.registerFunction ("ondeath", 'l', "", opcodeOnDeath, opcodeOnDeathExplicit);
extensions.registerFunction ("iswerewolf", 'l', "", opcodeIsWerewolf, opcodeIsWerewolfExplicit);
extensions.registerInstruction("becomewerewolf", "", opcodeBecomeWerewolf, opcodeBecomeWerewolfExplicit);
extensions.registerInstruction("undowerewolf", "", opcodeUndoWerewolf, opcodeBecomeWerewolfExplicit);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -1386,6 +1405,11 @@ namespace MWScript
interpreter.installSegment5 (opcodeIsWerewolf, new OpIsWerewolf<ImplicitRef>);
interpreter.installSegment5 (opcodeIsWerewolfExplicit, new OpIsWerewolf<ExplicitRef>);
interpreter.installSegment5 (opcodeBecomeWerewolf, new OpSetWerewolf<ImplicitRef, true>);
interpreter.installSegment5 (opcodeBecomeWerewolfExplicit, new OpSetWerewolf<ExplicitRef, true>);
interpreter.installSegment5 (opcodeUndoWerewolf, new OpSetWerewolf<ImplicitRef, false>);
interpreter.installSegment5 (opcodeUndoWerewolfExplicit, new OpSetWerewolf<ExplicitRef, false>);
}
}
}