mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:53:52 +00:00
added OnActivate
This commit is contained in:
parent
eff931b464
commit
f5a70abd4b
4 changed files with 25 additions and 3 deletions
|
@ -34,5 +34,6 @@ op 0x2000009: PlayLoopSound3DVP
|
||||||
op 0x200000a: StopSound
|
op 0x200000a: StopSound
|
||||||
op 0x200000b: GetSoundPlaying
|
op 0x200000b: GetSoundPlaying
|
||||||
op 0x200000c: XBox (always 0)
|
op 0x200000c: XBox (always 0)
|
||||||
opcodes 0x200000d-0x3ffffff unused
|
op 0x200000d: OnActivate
|
||||||
|
opcodes 0x200000e-0x3ffffff unused
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,11 @@ namespace MWScript
|
||||||
return std::sqrt (diff[0]*diff[0] + diff[1]*diff[1] + diff[2]*diff[2]);
|
return std::sqrt (diff[0]*diff[0] + diff[1]*diff[1] + diff[2]*diff[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InterpreterContext::hasBeenActivated() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
MWWorld::World& InterpreterContext::getWorld()
|
MWWorld::World& InterpreterContext::getWorld()
|
||||||
{
|
{
|
||||||
return *mEnvironment.mWorld;
|
return *mEnvironment.mWorld;
|
||||||
|
|
|
@ -69,6 +69,8 @@ namespace MWScript
|
||||||
|
|
||||||
virtual float getDistance (const std::string& name);
|
virtual float getDistance (const std::string& name);
|
||||||
|
|
||||||
|
virtual bool hasBeenActivated() const;
|
||||||
|
|
||||||
MWWorld::World& getWorld();
|
MWWorld::World& getWorld();
|
||||||
|
|
||||||
MWSound::SoundManager& getSoundManager();
|
MWSound::SoundManager& getSoundManager();
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
|
#include "interpretercontext.hpp"
|
||||||
|
|
||||||
namespace MWScript
|
namespace MWScript
|
||||||
{
|
{
|
||||||
namespace Misc
|
namespace Misc
|
||||||
|
@ -21,18 +23,30 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class OpOnActivate : public Interpreter::Opcode0
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
virtual void execute (Interpreter::Runtime& runtime)
|
||||||
|
{
|
||||||
|
runtime.push (static_cast<InterpreterContext&> (
|
||||||
|
runtime.getContext()).hasBeenActivated());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const int opcodeXBox = 0x200000c;
|
const int opcodeXBox = 0x200000c;
|
||||||
|
const int opcodeOnActivate = 0x200000d;
|
||||||
|
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
extensions.registerFunction ("xbox", 'l', "", opcodeXBox);
|
extensions.registerFunction ("xbox", 'l', "", opcodeXBox);
|
||||||
|
extensions.registerFunction ("onactivate", 'l', "", opcodeOnActivate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
{
|
{
|
||||||
interpreter.installSegment5 (opcodeXBox, new OpXBox);
|
interpreter.installSegment5 (opcodeXBox, new OpXBox);
|
||||||
|
interpreter.installSegment5 (opcodeOnActivate, new OpOnActivate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue