GetWeaponDrawn

This commit is contained in:
scrawl 2012-11-24 03:04:26 +01:00
parent be82d1452f
commit 70aa7459f5
2 changed files with 21 additions and 1 deletions

View file

@ -264,5 +264,7 @@ op 0x20001d3: GetAttacked
op 0x20001d4: GetAttacked, explicit
op 0x20001d5: HasItemEquipped
op 0x20001d6: HasItemEquipped, explicit
opcodes 0x20001d5-0x3ffffff unused
op 0x20001d7: GetWeaponDrawn
op 0x20001d8: GetWeaponDrawn, explicit
opcodes 0x20001d9-0x3ffffff unused

View file

@ -319,6 +319,19 @@ namespace MWScript
}
};
template <class R>
class OpGetWeaponDrawn : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push(MWWorld::Class::get(ptr).getNpcStats (ptr).getDrawState () == MWMechanics::DrawState_Weapon);
}
};
const int opcodeXBox = 0x200000c;
const int opcodeOnActivate = 0x200000d;
const int opcodeActivate = 0x2000075;
@ -344,6 +357,8 @@ namespace MWScript
const int opcodeGetEffectExplicit = 0x20001d0;
const int opcodeGetAttacked = 0x20001d3;
const int opcodeGetAttackedExplicit = 0x20001d4;
const int opcodeGetWeaponDrawn = 0x20001d7;
const int opcodeGetWeaponDrawnExplicit = 0x20001d8;
void registerExtensions (Compiler::Extensions& extensions)
{
@ -373,6 +388,7 @@ namespace MWScript
extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit);
extensions.registerFunction ("geteffect", 'l', "l", opcodeGetEffect, opcodeGetEffectExplicit);
extensions.registerFunction ("getattacked", 'l', "", opcodeGetAttacked, opcodeGetAttackedExplicit);
extensions.registerFunction ("getweapondrawn", 'l', "", opcodeGetWeaponDrawn, opcodeGetWeaponDrawnExplicit);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -402,6 +418,8 @@ namespace MWScript
interpreter.installSegment5 (opcodeGetEffectExplicit, new OpGetEffect<ExplicitRef>);
interpreter.installSegment5 (opcodeGetAttacked, new OpGetAttacked<ImplicitRef>);
interpreter.installSegment5 (opcodeGetAttackedExplicit, new OpGetAttacked<ExplicitRef>);
interpreter.installSegment5 (opcodeGetWeaponDrawnExplicit, new OpGetWeaponDrawn<ExplicitRef>);
interpreter.installSegment5 (opcodeGetWeaponDrawnExplicit, new OpGetWeaponDrawn<ExplicitRef>);
}
}
}