diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index f0aafbbbc..6863b2e13 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -61,6 +61,7 @@ set(GAMESCRIPT mwscript/statsextensions.cpp mwscript/containerextensions.cpp mwscript/aiextensions.cpp + mwscript/controlextensions.cpp mwscript/extensions.cpp mwscript/globalscripts.cpp ) @@ -77,6 +78,7 @@ set(GAMESCRIPT_HEADER mwscript/statsextensions.hpp mwscript/containerextensions.hpp mwscript/aiextensions.hpp + mwscript/controlextensions.hpp mwscript/extensions.hpp mwscript/globalscripts.hpp ) diff --git a/apps/openmw/mwscript/controlextensions.cpp b/apps/openmw/mwscript/controlextensions.cpp new file mode 100644 index 000000000..e38ee7c2d --- /dev/null +++ b/apps/openmw/mwscript/controlextensions.cpp @@ -0,0 +1,70 @@ + +#include "statsextensions.hpp" + +#include + +#include +#include +#include + +#include "interpretercontext.hpp" + +#include + +namespace MWScript +{ + namespace Control + { + class OpSetControl : public Interpreter::Opcode0 + { + std::string mControl; + bool mEnable; + + public: + + OpSetControl (const std::string& control, bool enable) + : mControl (control), mEnable (enable) + {} + + virtual void execute (Interpreter::Runtime& runtime) + { + if (mEnable) + std::cout << "enable: " << mControl << std::endl; + else + std::cout << "disable: " << mControl << std::endl; + } + }; + + const int numberOfControls = 7; + + const int opcodeEnable = 0x200007e; + const int opcodeDisable = 0x2000085; + + const char *controls[numberOfControls] = + { + "playercontrols", "playerfighting", "playerjumping", "playerlooking", "playermagic", + "playerviewswitch", "vanitymode" + }; + + void registerExtensions (Compiler::Extensions& extensions) + { + std::string enable ("enable"); + std::string disable ("disable"); + + for (int i=0; i