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

GetAttacked

This commit is contained in:
scrawl 2012-11-24 02:48:53 +01:00
parent 50baf6dac7
commit 600ed5f38a
2 changed files with 21 additions and 1 deletions

View File

@ -260,5 +260,7 @@ op 0x20001cf: GetEffect
op 0x20001d0: GetEffect, explicit
op 0x20001d1: GetArmorType
op 0x20001d2: GetArmorType, explicit
opcodes 0x20001d3-0x3ffffff unused
op 0x20001d3: GetAttacked
op 0x20001d4: GetAttacked, explicit
opcodes 0x20001d5-0x3ffffff unused

View File

@ -306,6 +306,19 @@ namespace MWScript
}
};
template <class R>
class OpGetAttacked : public Interpreter::Opcode0
{
public:
virtual void execute (Interpreter::Runtime& runtime)
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push(MWWorld::Class::get(ptr).getCreatureStats (ptr).getAttacked ());
}
};
const int opcodeXBox = 0x200000c;
const int opcodeOnActivate = 0x200000d;
const int opcodeActivate = 0x2000075;
@ -329,6 +342,8 @@ namespace MWScript
const int opcodeGetLockedExplicit = 0x20001c8;
const int opcodeGetEffect = 0x20001cf;
const int opcodeGetEffectExplicit = 0x20001d0;
const int opcodeGetAttacked = 0x20001d3;
const int opcodeGetAttackedExplicit = 0x20001d4;
void registerExtensions (Compiler::Extensions& extensions)
{
@ -357,6 +372,7 @@ namespace MWScript
extensions.registerInstruction ("wakeuppc", "", opcodeWakeUpPc);
extensions.registerFunction ("getlocked", 'l', "", opcodeGetLocked, opcodeGetLockedExplicit);
extensions.registerFunction ("geteffect", 'l', "l", opcodeGetEffect, opcodeGetEffectExplicit);
extensions.registerFunction ("getattacked", 'l', "", opcodeGetAttacked, opcodeGetAttackedExplicit);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
@ -384,6 +400,8 @@ namespace MWScript
interpreter.installSegment5 (opcodeGetLockedExplicit, new OpGetLocked<ExplicitRef>);
interpreter.installSegment5 (opcodeGetEffect, new OpGetEffect<ImplicitRef>);
interpreter.installSegment5 (opcodeGetEffectExplicit, new OpGetEffect<ExplicitRef>);
interpreter.installSegment5 (opcodeGetAttacked, new OpGetAttacked<ImplicitRef>);
interpreter.installSegment5 (opcodeGetAttackedExplicit, new OpGetAttacked<ExplicitRef>);
}
}
}