From 2ffe1206a64111b2fd7c051fa86cf02815a77db2 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Fri, 31 Dec 2010 19:09:25 +0100 Subject: [PATCH] merged opcode classes that came in explicit and implicit variants --- apps/openmw/CMakeLists.txt | 1 + apps/openmw/mwscript/aiextensions.cpp | 121 +----- apps/openmw/mwscript/containerextensions.cpp | 145 +------ apps/openmw/mwscript/miscextensions.cpp | 69 +-- apps/openmw/mwscript/ref.hpp | 41 ++ apps/openmw/mwscript/soundextensions.cpp | 335 +++++--------- apps/openmw/mwscript/statsextensions.cpp | 434 ++----------------- 7 files changed, 237 insertions(+), 909 deletions(-) create mode 100644 apps/openmw/mwscript/ref.hpp diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index 88aaaecd4..ffbcf590f 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -103,6 +103,7 @@ set(GAMESCRIPT_HEADER mwscript/controlextensions.hpp mwscript/extensions.hpp mwscript/globalscripts.hpp + mwscript/ref.hpp ) source_group(apps\\openmw\\mwscript FILES ${GAMESCRIPT} ${GAMESCRIPT_HEADER}) diff --git a/apps/openmw/mwscript/aiextensions.cpp b/apps/openmw/mwscript/aiextensions.cpp index cd36eac9e..6d74ae45a 100644 --- a/apps/openmw/mwscript/aiextensions.cpp +++ b/apps/openmw/mwscript/aiextensions.cpp @@ -8,6 +8,7 @@ #include #include "interpretercontext.hpp" +#include "ref.hpp" #include @@ -15,46 +16,14 @@ namespace MWScript { namespace Ai { + template class OpAiTravel : public Interpreter::Opcode1 { public: virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - MWWorld::Ptr ptr = context.getReference(); - - Interpreter::Type_Float x = runtime[0].mInteger; - runtime.pop(); - - Interpreter::Type_Float y = runtime[0].mInteger; - runtime.pop(); - - Interpreter::Type_Float z = runtime[0].mInteger; - runtime.pop(); - - // discard additional arguments (reset), because we have no idea what they mean. - for (unsigned int i=0; i (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Float x = runtime[0].mInteger; runtime.pop(); @@ -72,56 +41,14 @@ namespace MWScript } }; + template class OpAiEscort : public Interpreter::Opcode1 { public: virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getReference(); - - std::string actor = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Float duration = runtime[0].mInteger; - runtime.pop(); - - Interpreter::Type_Float x = runtime[0].mInteger; - runtime.pop(); - - Interpreter::Type_Float y = runtime[0].mInteger; - runtime.pop(); - - Interpreter::Type_Float z = runtime[0].mInteger; - runtime.pop(); - - // discard additional arguments (reset), because we have no idea what they mean. - for (unsigned int i=0; i (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); + MWWorld::Ptr ptr = R()(runtime); std::string actor = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); @@ -146,16 +73,14 @@ namespace MWScript } }; + template class OpGetAiPackageDone : public Interpreter::Opcode0 { public: virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - MWWorld::Ptr ptr = context.getReference(); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = 0; @@ -163,25 +88,6 @@ namespace MWScript } }; - class OpGetAiPackageDoneExplicit : public Interpreter::Opcode0 - { - public: - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - - Interpreter::Type_Integer value = 0; - - runtime.push (value); - } - }; const int opcodeAiTravel = 0x20000; @@ -204,12 +110,13 @@ namespace MWScript void installOpcodes (Interpreter::Interpreter& interpreter) { - interpreter.installSegment3 (opcodeAiTravel, new OpAiTravel); - interpreter.installSegment3 (opcodeAiTravelExplicit, new OpAiTravelExplicit); - interpreter.installSegment3 (opcodeAiEscort, new OpAiEscort); - interpreter.installSegment3 (opcodeAiEscortExplicit, new OpAiEscortExplicit); - interpreter.installSegment5 (opcodeGetAiPackageDone, new OpGetAiPackageDone); - interpreter.installSegment5 (opcodeGetAiPackageDoneExplicit, new OpGetAiPackageDoneExplicit); + interpreter.installSegment3 (opcodeAiTravel, new OpAiTravel); + interpreter.installSegment3 (opcodeAiTravelExplicit, new OpAiTravel); + interpreter.installSegment3 (opcodeAiEscort, new OpAiEscort); + interpreter.installSegment3 (opcodeAiEscortExplicit, new OpAiEscort); + interpreter.installSegment5 (opcodeGetAiPackageDone, new OpGetAiPackageDone); + interpreter.installSegment5 (opcodeGetAiPackageDoneExplicit, + new OpGetAiPackageDone); } } } diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index 1121d8eff..aef48ddec 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -14,17 +14,21 @@ #include "../mwworld/containerutil.hpp" #include "interpretercontext.hpp" +#include "ref.hpp" namespace MWScript { namespace Container { + template class OpAddItem : public Interpreter::Opcode0 { public: virtual void execute (Interpreter::Runtime& runtime) { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context = static_cast (runtime.getContext()); @@ -37,40 +41,6 @@ namespace MWScript if (count<0) throw std::runtime_error ("second argument for AddItem must be non-negative"); - MWWorld::Ptr ptr = context.getReference(); - - MWWorld::ManualRef ref (context.getWorld().getStore(), item); - - ref.getPtr().getRefData().setCount (count); - - MWWorld::Class::get (ref.getPtr()).insertIntoContainer (ref.getPtr(), - MWWorld::Class::get (ptr).getContainerStore (ptr)); - } - }; - - class OpAddItemExplicit : public Interpreter::Opcode0 - { - public: - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - std::string item = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Integer count = runtime[0].mInteger; - runtime.pop(); - - if (count<0) - throw std::runtime_error ("second argument for AddItem must be non-negative"); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - MWWorld::ManualRef ref (context.getWorld().getStore(), item); ref.getPtr().getRefData().setCount (count); @@ -80,55 +50,21 @@ namespace MWScript } }; + template class OpGetItemCount : public Interpreter::Opcode0 { public: virtual void execute (Interpreter::Runtime& runtime) { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context = static_cast (runtime.getContext()); std::string item = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWWorld::Ptr ptr = context.getReference(); - - std::vector list; - - MWWorld::listItemsInContainer (item, - MWWorld::Class::get (ptr).getContainerStore (ptr), - context.getWorld().getStore(), list); - - Interpreter::Type_Integer sum = 0; - - for (std::vector::iterator iter (list.begin()); iter!=list.end(); - ++iter) - { - sum += iter->getRefData().getCount(); - } - - runtime.push (sum); - } - }; - - class OpGetItemCountExplicit : public Interpreter::Opcode0 - { - public: - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - std::string item = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - std::vector list; MWWorld::listItemsInContainer (item, @@ -147,12 +83,15 @@ namespace MWScript } }; + template class OpRemoveItem : public Interpreter::Opcode0 { public: virtual void execute (Interpreter::Runtime& runtime) { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context = static_cast (runtime.getContext()); @@ -165,58 +104,6 @@ namespace MWScript if (count<0) throw std::runtime_error ("second argument for RemoveItem must be non-negative"); - MWWorld::Ptr ptr = context.getReference(); - - std::vector list; - - MWWorld::listItemsInContainer (item, - MWWorld::Class::get (ptr).getContainerStore (ptr), - context.getWorld().getStore(), list); - - for (std::vector::iterator iter (list.begin()); - iter!=list.end() && count; - ++iter) - { - if (iter->getRefData().getCount()<=count) - { - count -= iter->getRefData().getCount(); - iter->getRefData().setCount (0); - } - else - { - iter->getRefData().setCount (iter->getRefData().getCount()-count); - count = 0; - } - } - - // To be fully compatible with original Morrowind, we would need to check if - // count is >= 0 here and throw an exception. But let's be tollerant instead. - } - }; - - class OpRemoveItemExplicit : public Interpreter::Opcode0 - { - public: - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - std::string item = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Integer count = runtime[0].mInteger; - runtime.pop(); - - if (count<0) - throw std::runtime_error ("second argument for RemoveItem must be non-negative"); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - std::vector list; MWWorld::listItemsInContainer (item, @@ -262,12 +149,12 @@ namespace MWScript void installOpcodes (Interpreter::Interpreter& interpreter) { - interpreter.installSegment5 (opcodeAddItem, new OpAddItem); - interpreter.installSegment5 (opcodeAddItemExplicit, new OpAddItemExplicit); - interpreter.installSegment5 (opcodeGetItemCount, new OpGetItemCount); - interpreter.installSegment5 (opcodeGetItemCountExplicit, new OpGetItemCountExplicit); - interpreter.installSegment5 (opcodeRemoveItem, new OpRemoveItem); - interpreter.installSegment5 (opcodeRemoveItemExplicit, new OpRemoveItemExplicit); + interpreter.installSegment5 (opcodeAddItem, new OpAddItem); + interpreter.installSegment5 (opcodeAddItemExplicit, new OpAddItem); + interpreter.installSegment5 (opcodeGetItemCount, new OpGetItemCount); + interpreter.installSegment5 (opcodeGetItemCountExplicit, new OpGetItemCount); + interpreter.installSegment5 (opcodeRemoveItem, new OpRemoveItem); + interpreter.installSegment5 (opcodeRemoveItemExplicit, new OpRemoveItem); } } } diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 9cb65dcd7..a04065f9c 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -7,10 +7,11 @@ #include #include -#include "interpretercontext.hpp" - #include "../mwworld/class.hpp" +#include "interpretercontext.hpp" +#include "ref.hpp" + namespace MWScript { namespace Misc @@ -55,42 +56,14 @@ namespace MWScript } }; + template class OpLock : public Interpreter::Opcode1 { public: virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) { - InterpreterContext& context = - static_cast (runtime.getContext()); - - MWWorld::Ptr ptr = context.getReference(); - - Interpreter::Type_Integer lockLevel = 100; - - if (arg0==1) - { - lockLevel = runtime[0].mInteger; - runtime.pop(); - } - - MWWorld::Class::get (ptr).lock (ptr, lockLevel); - } - }; - - class OpLockExplicit : public Interpreter::Opcode1 - { - public: - - virtual void execute (Interpreter::Runtime& runtime, unsigned int arg0) - { - InterpreterContext& context = - static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer lockLevel = 100; @@ -104,34 +77,14 @@ namespace MWScript } }; + template class OpUnlock : public Interpreter::Opcode0 { public: virtual void execute (Interpreter::Runtime& runtime) { - InterpreterContext& context = - static_cast (runtime.getContext()); - - MWWorld::Ptr ptr = context.getReference(); - - MWWorld::Class::get (ptr).unlock (ptr); - } - }; - - class OpUnlockExplicit : public Interpreter::Opcode0 - { - public: - - virtual void execute (Interpreter::Runtime& runtime) - { - InterpreterContext& context = - static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); + MWWorld::Ptr ptr = R()(runtime); MWWorld::Class::get (ptr).unlock (ptr); } @@ -160,10 +113,10 @@ namespace MWScript interpreter.installSegment5 (opcodeXBox, new OpXBox); interpreter.installSegment5 (opcodeOnActivate, new OpOnActivate); interpreter.installSegment5 (opcodeActivate, new OpActivate); - interpreter.installSegment3 (opcodeLock, new OpLock); - interpreter.installSegment3 (opcodeLockExplicit, new OpLockExplicit); - interpreter.installSegment5 (opcodeUnlock, new OpUnlock); - interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlockExplicit); + interpreter.installSegment3 (opcodeLock, new OpLock); + interpreter.installSegment3 (opcodeLockExplicit, new OpLock); + interpreter.installSegment5 (opcodeUnlock, new OpUnlock); + interpreter.installSegment5 (opcodeUnlockExplicit, new OpUnlock); } } } diff --git a/apps/openmw/mwscript/ref.hpp b/apps/openmw/mwscript/ref.hpp new file mode 100644 index 000000000..5ca1ea4d6 --- /dev/null +++ b/apps/openmw/mwscript/ref.hpp @@ -0,0 +1,41 @@ +#ifndef GAME_MWSCRIPT_REF_H +#define GAME_MWSCRIPT_REF_H + +#include + +#include + +#include "../mwworld/ptr.hpp" +#include "../mwworld/world.hpp" + +#include "interpretercontext.hpp" + +namespace MWScript +{ + struct ExplicitRef + { + MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const + { + MWScript::InterpreterContext& context + = static_cast (runtime.getContext()); + + std::string id = runtime.getStringLiteral (runtime[0].mInteger); + runtime.pop(); + + return context.getWorld().getPtr (id, false); + } + }; + + struct ImplicitRef + { + MWWorld::Ptr operator() (Interpreter::Runtime& runtime) const + { + MWScript::InterpreterContext& context + = static_cast (runtime.getContext()); + + return context.getReference(); + } + }; +} + +#endif diff --git a/apps/openmw/mwscript/soundextensions.cpp b/apps/openmw/mwscript/soundextensions.cpp index 58554ef16..d5cc41b76 100644 --- a/apps/openmw/mwscript/soundextensions.cpp +++ b/apps/openmw/mwscript/soundextensions.cpp @@ -7,22 +7,26 @@ #include #include -#include "interpretercontext.hpp" - #include "../mwworld/world.hpp" #include "../mwsound/soundmanager.hpp" +#include "interpretercontext.hpp" +#include "ref.hpp" + namespace MWScript { namespace Sound { + template class OpSay : public Interpreter::Opcode0 { public: - + virtual void execute (Interpreter::Runtime& runtime) { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context = static_cast (runtime.getContext()); @@ -32,296 +36,173 @@ namespace MWScript std::string text = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - context.getSoundManager().say (context.getReference(), file); + context.getSoundManager().say (ptr, file); context.messageBox (text); - } - }; - + } + }; + + template class OpSayDone : public Interpreter::Opcode0 { public: - + virtual void execute (Interpreter::Runtime& runtime) { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context = static_cast (runtime.getContext()); - - runtime.push (context.getSoundManager().sayDone (context.getReference())); - } - }; - + + runtime.push (context.getSoundManager().sayDone (ptr)); + } + }; + class OpStreamMusic : public Interpreter::Opcode0 { public: - + virtual void execute (Interpreter::Runtime& runtime) { MWScript::InterpreterContext& context = static_cast (runtime.getContext()); - + std::string sound = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - + context.getSoundManager().streamMusic (sound); - } - }; + } + }; class OpPlaySound : public Interpreter::Opcode0 { public: - + virtual void execute (Interpreter::Runtime& runtime) { MWScript::InterpreterContext& context = static_cast (runtime.getContext()); - + std::string sound = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - + context.getSoundManager().playSound (sound, 1.0, 1.0); - } - }; - + } + }; + class OpPlaySoundVP : public Interpreter::Opcode0 { public: - + virtual void execute (Interpreter::Runtime& runtime) { MWScript::InterpreterContext& context = static_cast (runtime.getContext()); - + std::string sound = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - + Interpreter::Type_Float volume = runtime[0].mFloat; runtime.pop(); Interpreter::Type_Float pitch = runtime[0].mFloat; runtime.pop(); - + context.getSoundManager().playSound (sound, volume, pitch); - } - }; - + } + }; + + template class OpPlaySound3D : public Interpreter::Opcode0 { bool mLoop; - + public: - + OpPlaySound3D (bool loop) : mLoop (loop) {} - + virtual void execute (Interpreter::Runtime& runtime) { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context = static_cast (runtime.getContext()); - + std::string sound = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - - context.getSoundManager().playSound3D (context.getReference(), sound, - 1.0, 1.0, mLoop); - } - }; - + + context.getSoundManager().playSound3D (ptr, sound, 1.0, 1.0, mLoop); + } + }; + + template class OpPlaySoundVP3D : public Interpreter::Opcode0 { bool mLoop; - + public: - + OpPlaySoundVP3D (bool loop) : mLoop (loop) {} - + virtual void execute (Interpreter::Runtime& runtime) { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context = static_cast (runtime.getContext()); - + std::string sound = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - + Interpreter::Type_Float volume = runtime[0].mFloat; runtime.pop(); Interpreter::Type_Float pitch = runtime[0].mFloat; runtime.pop(); - - context.getSoundManager().playSound3D (context.getReference(), sound, volume, - pitch, mLoop); - } - }; + context.getSoundManager().playSound3D (ptr, sound, volume, pitch, mLoop); + } + }; + + template class OpStopSound : public Interpreter::Opcode0 { public: - + virtual void execute (Interpreter::Runtime& runtime) { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context = static_cast (runtime.getContext()); - + std::string sound = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - - context.getSoundManager().stopSound3D (context.getReference(), sound); - } - }; - + + context.getSoundManager().stopSound3D (ptr, sound); + } + }; + + template class OpGetSoundPlaying : public Interpreter::Opcode0 { public: - + virtual void execute (Interpreter::Runtime& runtime) { + MWWorld::Ptr ptr = R()(runtime); + MWScript::InterpreterContext& context = static_cast (runtime.getContext()); - + int index = runtime[0].mInteger; runtime.pop(); - + runtime.push (context.getSoundManager().getSoundPlaying ( - context.getReference(), runtime.getStringLiteral (index))); - } + ptr, runtime.getStringLiteral (index))); + } }; - - class OpSayExplicit : public Interpreter::Opcode0 - { - public: - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - std::string file = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - std::string text = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - context.getSoundManager().say (context.getWorld().getPtr (id, true), - file); - } - }; - - class OpSayDoneExplicit : public Interpreter::Opcode0 - { - public: - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - runtime.push (context.getSoundManager().sayDone ( - context.getWorld().getPtr (id, true))); - } - }; - - class OpPlaySound3DExplicit : public Interpreter::Opcode0 - { - bool mLoop; - - public: - - OpPlaySound3DExplicit (bool loop) : mLoop (loop) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - std::string sound = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - context.getSoundManager().playSound3D ( - context.getWorld().getPtr (id, true), sound, 1.0, 1.0, mLoop); - } - }; - - class OpPlaySoundVP3DExplicit : public Interpreter::Opcode0 - { - bool mLoop; - - public: - - OpPlaySoundVP3DExplicit (bool loop) : mLoop (loop) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - std::string sound = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Float volume = runtime[0].mFloat; - runtime.pop(); - - Interpreter::Type_Float pitch = runtime[0].mFloat; - runtime.pop(); - - context.getSoundManager().playSound3D ( - context.getWorld().getPtr (id, true), sound, volume, pitch, mLoop); - - } - }; - - class OpStopSoundExplicit : public Interpreter::Opcode0 - { - public: - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - std::string sound = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - context.getSoundManager().stopSound3D ( - context.getWorld().getPtr (id, true), sound); - } - }; - - class OpGetSoundPlayingExplicit : public Interpreter::Opcode0 - { - public: - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - int index = runtime[0].mInteger; - runtime.pop(); - - runtime.push (context.getSoundManager().getSoundPlaying ( - context.getWorld().getPtr (id, true), - runtime.getStringLiteral (index))); - } - }; - const int opcodeSay = 0x2000001; const int opcodeSayDone = 0x2000002; const int opcodeStreamMusic = 0x2000003; @@ -342,7 +223,7 @@ namespace MWScript const int opcodePlayLoopSound3DVPExplicit = 0x200001e; const int opcodeStopSoundExplicit = 0x200001f; const int opcodeGetSoundPlayingExplicit = 0x2000020; - + void registerExtensions (Compiler::Extensions& extensions) { extensions.registerInstruction ("say", "SS", opcodeSay, opcodeSayExplicit); @@ -361,37 +242,37 @@ namespace MWScript extensions.registerInstruction ("stopsound", "c", opcodeStopSound, opcodeStopSoundExplicit); extensions.registerFunction ("getsoundplaying", 'l', "c", opcodeGetSoundPlaying, - opcodeGetSoundPlayingExplicit); + opcodeGetSoundPlayingExplicit); } - + void installOpcodes (Interpreter::Interpreter& interpreter) { - interpreter.installSegment5 (opcodeSay, new OpSay); - interpreter.installSegment5 (opcodeSayDone, new OpSayDone); + interpreter.installSegment5 (opcodeSay, new OpSay); + interpreter.installSegment5 (opcodeSayDone, new OpSayDone); interpreter.installSegment5 (opcodeStreamMusic, new OpStreamMusic); interpreter.installSegment5 (opcodePlaySound, new OpPlaySound); interpreter.installSegment5 (opcodePlaySoundVP, new OpPlaySoundVP); - interpreter.installSegment5 (opcodePlaySound3D, new OpPlaySound3D (false)); - interpreter.installSegment5 (opcodePlaySound3DVP, new OpPlaySoundVP3D (false)); - interpreter.installSegment5 (opcodePlayLoopSound3D, new OpPlaySound3D (true)); - interpreter.installSegment5 (opcodePlayLoopSound3DVP, new OpPlaySoundVP3D (true)); - interpreter.installSegment5 (opcodeStopSound, new OpStopSound); - interpreter.installSegment5 (opcodeGetSoundPlaying, new OpGetSoundPlaying); - - interpreter.installSegment5 (opcodeSayExplicit, new OpSayExplicit); - interpreter.installSegment5 (opcodeSayDoneExplicit, new OpSayDoneExplicit); - interpreter.installSegment5 (opcodePlaySound3DExplicit, - new OpPlaySound3DExplicit (false)); - interpreter.installSegment5 (opcodePlaySound3DVPExplicit, - new OpPlaySoundVP3DExplicit (false)); - interpreter.installSegment5 (opcodePlayLoopSound3DExplicit, - new OpPlaySound3DExplicit (true)); - interpreter.installSegment5 (opcodePlayLoopSound3DVPExplicit, - new OpPlaySoundVP3DExplicit (true)); - interpreter.installSegment5 (opcodeStopSoundExplicit, new OpStopSoundExplicit); - interpreter.installSegment5 (opcodeGetSoundPlayingExplicit, - new OpGetSoundPlayingExplicit); - } - } -} + interpreter.installSegment5 (opcodePlaySound3D, new OpPlaySound3D (false)); + interpreter.installSegment5 (opcodePlaySound3DVP, new OpPlaySoundVP3D (false)); + interpreter.installSegment5 (opcodePlayLoopSound3D, new OpPlaySound3D (true)); + interpreter.installSegment5 (opcodePlayLoopSound3DVP, + new OpPlaySoundVP3D (true)); + interpreter.installSegment5 (opcodeStopSound, new OpStopSound); + interpreter.installSegment5 (opcodeGetSoundPlaying, new OpGetSoundPlaying); + interpreter.installSegment5 (opcodeSayExplicit, new OpSay); + interpreter.installSegment5 (opcodeSayDoneExplicit, new OpSayDone); + interpreter.installSegment5 (opcodePlaySound3DExplicit, + new OpPlaySound3D (false)); + interpreter.installSegment5 (opcodePlaySound3DVPExplicit, + new OpPlaySoundVP3D (false)); + interpreter.installSegment5 (opcodePlayLoopSound3DExplicit, + new OpPlaySound3D (true)); + interpreter.installSegment5 (opcodePlayLoopSound3DVPExplicit, + new OpPlaySoundVP3D (true)); + interpreter.installSegment5 (opcodeStopSoundExplicit, new OpStopSound); + interpreter.installSegment5 (opcodeGetSoundPlayingExplicit, + new OpGetSoundPlaying); + } + } +} diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 17635667c..ca82830d9 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -12,11 +12,13 @@ #include "../mwmechanics/creaturestats.hpp" #include "interpretercontext.hpp" +#include "ref.hpp" namespace MWScript { namespace Stats { + template class OpGetAttribute : public Interpreter::Opcode0 { int mIndex; @@ -27,36 +29,7 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - MWWorld::Ptr ptr = context.getReference(); - - Interpreter::Type_Integer value = - MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex]. - getModified(); - - runtime.push (value); - } - }; - - class OpGetAttributeExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpGetAttributeExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex]. @@ -66,6 +39,7 @@ namespace MWScript } }; + template class OpSetAttribute : public Interpreter::Opcode0 { int mIndex; @@ -76,45 +50,17 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWWorld::Ptr ptr = context.getReference(); - - MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex]. - setModified (value, 0); - } - }; - - class OpSetAttributeExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpSetAttributeExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Integer value = runtime[0].mInteger; - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex]. setModified (value, 0); } }; + template class OpModAttribute : public Interpreter::Opcode0 { int mIndex; @@ -125,14 +71,11 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWWorld::Ptr ptr = context.getReference(); - value += MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex]. getModified(); @@ -141,36 +84,7 @@ namespace MWScript } }; - class OpModAttributeExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpModAttributeExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Integer value = runtime[0].mInteger; - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - - value += - MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex]. - getModified(); - - MWWorld::Class::get (ptr).getCreatureStats (ptr).mAttributes[mIndex]. - setModified (value, 0, 100); - } - }; - + template class OpGetDynamic : public Interpreter::Opcode0 { int mIndex; @@ -181,46 +95,7 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - MWWorld::Ptr ptr = context.getReference(); - - if (mIndex==0 && MWWorld::Class::get (ptr).hasItemHealth (ptr)) - { - // health is a special case - Interpreter::Type_Integer value = - MWWorld::Class::get (ptr).getItemMaxHealth (ptr); - runtime.push (value); - - return; - } - - Interpreter::Type_Integer value = - MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex]. - getCurrent(); - - runtime.push (value); - } - }; - - class OpGetDynamicExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpGetDynamicExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); + MWWorld::Ptr ptr = R()(runtime); if (mIndex==0 && MWWorld::Class::get (ptr).hasItemHealth (ptr)) { @@ -240,6 +115,7 @@ namespace MWScript } }; + template class OpSetDynamic : public Interpreter::Opcode0 { int mIndex; @@ -250,45 +126,17 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWWorld::Ptr ptr = context.getReference(); - - MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex]. - setModified (value, 0); - } - }; - - class OpSetDynamicExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpSetDynamicExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Integer value = runtime[0].mInteger; - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - MWWorld::Class::get (ptr).getCreatureStats (ptr).mDynamic[mIndex]. setModified (value, 0); } }; + template class OpModDynamic : public Interpreter::Opcode0 { int mIndex; @@ -299,14 +147,11 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer diff = runtime[0].mInteger; runtime.pop(); - MWWorld::Ptr ptr = context.getReference(); - MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr); Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent(); @@ -318,40 +163,7 @@ namespace MWScript } }; - class OpModDynamicExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpModDynamicExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Integer diff = runtime[0].mInteger; - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - - MWMechanics::CreatureStats& stats = - MWWorld::Class::get (ptr).getCreatureStats (ptr); - - Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent(); - - stats.mDynamic[mIndex].setModified ( - diff + stats.mDynamic[mIndex].getModified(), 0); - - stats.mDynamic[mIndex].setCurrent (diff + current); - } - }; - - + template class OpModCurrentDynamic : public Interpreter::Opcode0 { int mIndex; @@ -362,14 +174,11 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer diff = runtime[0].mInteger; runtime.pop(); - MWWorld::Ptr ptr = context.getReference(); - MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr); Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent(); @@ -378,36 +187,7 @@ namespace MWScript } }; - class OpModCurrentDynamicExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpModCurrentDynamicExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Integer diff = runtime[0].mInteger; - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - - MWMechanics::CreatureStats& stats = - MWWorld::Class::get (ptr).getCreatureStats (ptr); - - Interpreter::Type_Integer current = stats.mDynamic[mIndex].getCurrent(); - - stats.mDynamic[mIndex].setCurrent (diff + current); - } - }; - + template class OpGetDynamicGetRatio : public Interpreter::Opcode0 { int mIndex; @@ -418,10 +198,7 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - MWWorld::Ptr ptr = context.getReference(); + MWWorld::Ptr ptr = R()(runtime); MWMechanics::CreatureStats& stats = MWWorld::Class::get (ptr).getCreatureStats (ptr); @@ -436,38 +213,7 @@ namespace MWScript } }; - class OpGetDynamicGetRatioExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpGetDynamicGetRatioExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - - MWMechanics::CreatureStats& stats = - MWWorld::Class::get (ptr).getCreatureStats (ptr); - - Interpreter::Type_Float value = 0; - - Interpreter::Type_Float max = stats.mDynamic[mIndex].getModified(); - - if (max>0) - value = stats.mDynamic[mIndex].getCurrent() / max; - - runtime.push (value); - } - }; - + template class OpGetSkill : public Interpreter::Opcode0 { int mIndex; @@ -478,36 +224,7 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - MWWorld::Ptr ptr = context.getReference(); - - Interpreter::Type_Integer value = - MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex]. - getModified(); - - runtime.push (value); - } - }; - - class OpGetSkillExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpGetSkillExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex]. @@ -517,6 +234,7 @@ namespace MWScript } }; + template class OpSetSkill : public Interpreter::Opcode0 { int mIndex; @@ -527,45 +245,17 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWWorld::Ptr ptr = context.getReference(); - - MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex]. - setModified (value, 0); - } - }; - - class OpSetSkillExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpSetSkillExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Integer value = runtime[0].mInteger; - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex]. setModified (value, 0); } }; + template class OpModSkill : public Interpreter::Opcode0 { int mIndex; @@ -576,14 +266,11 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); + MWWorld::Ptr ptr = R()(runtime); Interpreter::Type_Integer value = runtime[0].mInteger; runtime.pop(); - MWWorld::Ptr ptr = context.getReference(); - value += MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex]. getModified(); @@ -592,36 +279,6 @@ namespace MWScript } }; - class OpModSkillExplicit : public Interpreter::Opcode0 - { - int mIndex; - - public: - - OpModSkillExplicit (int index) : mIndex (index) {} - - virtual void execute (Interpreter::Runtime& runtime) - { - MWScript::InterpreterContext& context - = static_cast (runtime.getContext()); - - std::string id = runtime.getStringLiteral (runtime[0].mInteger); - runtime.pop(); - - Interpreter::Type_Integer value = runtime[0].mInteger; - runtime.pop(); - - MWWorld::Ptr ptr = context.getWorld().getPtr (id, false); - - value += - MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex]. - getModified(); - - MWWorld::Class::get (ptr).getNpcStats (ptr).mSkill[mIndex]. - setModified (value, 0, 100); - } - }; - const int numberOfAttributes = 8; const int opcodeGetAttribute = 0x2000027; @@ -729,53 +386,54 @@ namespace MWScript { for (int i=0; i (i)); interpreter.installSegment5 (opcodeGetAttributeExplicit+i, - new OpGetAttributeExplicit (i)); + new OpGetAttribute (i)); - interpreter.installSegment5 (opcodeSetAttribute+i, new OpSetAttribute (i)); + interpreter.installSegment5 (opcodeSetAttribute+i, new OpSetAttribute (i)); interpreter.installSegment5 (opcodeSetAttributeExplicit+i, - new OpSetAttributeExplicit (i)); + new OpSetAttribute (i)); - interpreter.installSegment5 (opcodeModAttribute+i, new OpModAttribute (i)); + interpreter.installSegment5 (opcodeModAttribute+i, new OpModAttribute (i)); interpreter.installSegment5 (opcodeModAttributeExplicit+i, - new OpModAttributeExplicit (i)); + new OpModAttribute (i)); } for (int i=0; i (i)); interpreter.installSegment5 (opcodeGetDynamicExplicit+i, - new OpGetDynamicExplicit (i)); + new OpGetDynamic (i)); - interpreter.installSegment5 (opcodeSetDynamic+i, new OpSetDynamic (i)); + interpreter.installSegment5 (opcodeSetDynamic+i, new OpSetDynamic (i)); interpreter.installSegment5 (opcodeSetDynamicExplicit+i, - new OpSetDynamicExplicit (i)); + new OpSetDynamic (i)); - interpreter.installSegment5 (opcodeModDynamic+i, new OpModDynamic (i)); + interpreter.installSegment5 (opcodeModDynamic+i, new OpModDynamic (i)); interpreter.installSegment5 (opcodeModDynamicExplicit+i, - new OpModDynamicExplicit (i)); + new OpModDynamic (i)); - interpreter.installSegment5 (opcodeModCurrentDynamic+i, new OpModCurrentDynamic (i)); + interpreter.installSegment5 (opcodeModCurrentDynamic+i, + new OpModCurrentDynamic (i)); interpreter.installSegment5 (opcodeModCurrentDynamicExplicit+i, - new OpModCurrentDynamicExplicit (i)); + new OpModCurrentDynamic (i)); interpreter.installSegment5 (opcodeGetDynamicGetRatio+i, - new OpGetDynamicGetRatio (i)); + new OpGetDynamicGetRatio (i)); interpreter.installSegment5 (opcodeGetDynamicGetRatioExplicit+i, - new OpGetDynamicGetRatioExplicit (i)); + new OpGetDynamicGetRatio (i)); } for (int i=0; i (i)); + interpreter.installSegment5 (opcodeGetSkillExplicit+i, new OpGetSkill (i)); - interpreter.installSegment5 (opcodeSetSkill+i, new OpSetSkill (i)); - interpreter.installSegment5 (opcodeSetSkillExplicit+i, new OpSetSkillExplicit (i)); + interpreter.installSegment5 (opcodeSetSkill+i, new OpSetSkill (i)); + interpreter.installSegment5 (opcodeSetSkillExplicit+i, new OpSetSkill (i)); - interpreter.installSegment5 (opcodeModSkill+i, new OpModSkill (i)); - interpreter.installSegment5 (opcodeModSkillExplicit+i, new OpModSkillExplicit (i)); + interpreter.installSegment5 (opcodeModSkill+i, new OpModSkill (i)); + interpreter.installSegment5 (opcodeModSkillExplicit+i, new OpModSkill (i)); } } }