mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-03 22:45:35 +00:00
GetEffect
This commit is contained in:
parent
e8ef4dba1e
commit
d7811624d5
2 changed files with 26 additions and 1 deletions
|
@ -256,5 +256,7 @@ op 0x20001cb: GetForceRun
|
||||||
op 0x20001cc: GetForceSneak
|
op 0x20001cc: GetForceSneak
|
||||||
op 0x20001cd: GetForceRun, explicit
|
op 0x20001cd: GetForceRun, explicit
|
||||||
op 0x20001ce: GetForceSneak, explicit
|
op 0x20001ce: GetForceSneak, explicit
|
||||||
opcodes 0x20001cd-0x3ffffff unused
|
op 0x20001cf: GetEffect
|
||||||
|
op 0x20001d0: GetEffect, explicit
|
||||||
|
opcodes 0x20001d1-0x3ffffff unused
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "../mwworld/player.hpp"
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
#include "../mwmechanics/npcstats.hpp"
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
#include "../mwmechanics/creaturestats.hpp"
|
||||||
|
|
||||||
#include "interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
#include "ref.hpp"
|
#include "ref.hpp"
|
||||||
|
@ -340,6 +341,23 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <class R>
|
||||||
|
class OpGetEffect : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
MWWorld::Ptr ptr = R()(runtime);
|
||||||
|
|
||||||
|
int key = runtime[0].mInteger;
|
||||||
|
runtime.pop();
|
||||||
|
|
||||||
|
runtime.push (MWWorld::Class::get(ptr).getCreatureStats (ptr).getMagicEffects ().get (
|
||||||
|
MWMechanics::EffectKey(key)).mMagnitude > 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeXBox = 0x200000c;
|
const int opcodeXBox = 0x200000c;
|
||||||
const int opcodeOnActivate = 0x200000d;
|
const int opcodeOnActivate = 0x200000d;
|
||||||
const int opcodeActivate = 0x2000075;
|
const int opcodeActivate = 0x2000075;
|
||||||
|
@ -367,6 +385,8 @@ namespace MWScript
|
||||||
const int opcodeGetForceSneak = 0x20001cc;
|
const int opcodeGetForceSneak = 0x20001cc;
|
||||||
const int opcodeGetForceRunExplicit = 0x20001cd;
|
const int opcodeGetForceRunExplicit = 0x20001cd;
|
||||||
const int opcodeGetForceSneakExplicit = 0x20001ce;
|
const int opcodeGetForceSneakExplicit = 0x20001ce;
|
||||||
|
const int opcodeGetEffect = 0x20001cf;
|
||||||
|
const int opcodeGetEffectExplicit = 0x20001d0;
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
|
@ -398,6 +418,7 @@ namespace MWScript
|
||||||
extensions.registerFunction ("getpcsneaking", 'l', "", opcodeGetPcSneaking);
|
extensions.registerFunction ("getpcsneaking", 'l', "", opcodeGetPcSneaking);
|
||||||
extensions.registerFunction ("getforcerun", 'l', "", opcodeGetForceRun, opcodeGetForceRunExplicit);
|
extensions.registerFunction ("getforcerun", 'l', "", opcodeGetForceRun, opcodeGetForceRunExplicit);
|
||||||
extensions.registerFunction ("getforcesneak", 'l', "", opcodeGetForceSneak, opcodeGetForceSneakExplicit);
|
extensions.registerFunction ("getforcesneak", 'l', "", opcodeGetForceSneak, opcodeGetForceSneakExplicit);
|
||||||
|
extensions.registerFunction ("geteffect", 'l', "l", opcodeGetEffect, opcodeGetEffectExplicit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
|
@ -429,6 +450,8 @@ namespace MWScript
|
||||||
interpreter.installSegment5 (opcodeGetForceRunExplicit, new OpGetForceRun<ExplicitRef>);
|
interpreter.installSegment5 (opcodeGetForceRunExplicit, new OpGetForceRun<ExplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeGetForceSneak, new OpGetForceSneak<ImplicitRef>);
|
interpreter.installSegment5 (opcodeGetForceSneak, new OpGetForceSneak<ImplicitRef>);
|
||||||
interpreter.installSegment5 (opcodeGetForceSneakExplicit, new OpGetForceSneak<ExplicitRef>);
|
interpreter.installSegment5 (opcodeGetForceSneakExplicit, new OpGetForceSneak<ExplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeGetEffect, new OpGetEffect<ImplicitRef>);
|
||||||
|
interpreter.installSegment5 (opcodeGetEffectExplicit, new OpGetEffect<ExplicitRef>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue