diff --git a/apps/openmw/mwbase/windowmanager.hpp b/apps/openmw/mwbase/windowmanager.hpp index 2d923b63d..77941a43a 100644 --- a/apps/openmw/mwbase/windowmanager.hpp +++ b/apps/openmw/mwbase/windowmanager.hpp @@ -105,6 +105,9 @@ namespace MWBase virtual void toggleVisible (MWGui::GuiWindow wnd) = 0; + virtual void forceHide(MWGui::GuiWindow wnd) = 0; + virtual void unsetForceHide(MWGui::GuiWindow wnd) = 0; + /// Disallow all inventory mode windows virtual void disallowAll() = 0; diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index e36374941..ffaffb661 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -386,6 +386,9 @@ namespace MWBase /// Returns true if teleport spell effects are allowed. virtual bool isTeleportingEnabled() const = 0; + + /// Turn actor into werewolf or normal form. + virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf) = 0; }; } diff --git a/apps/openmw/mwgui/containeritemmodel.cpp b/apps/openmw/mwgui/containeritemmodel.cpp index 5d23744b2..e23b4f77f 100644 --- a/apps/openmw/mwgui/containeritemmodel.cpp +++ b/apps/openmw/mwgui/containeritemmodel.cpp @@ -76,7 +76,7 @@ void ContainerItemModel::copyItem (const ItemStack& item, size_t count) const MWWorld::Ptr& source = mItemSources[mItemSources.size()-1]; int origCount = item.mBase.getRefData().getCount(); item.mBase.getRefData().setCount(count); - MWWorld::ContainerStoreIterator it = MWWorld::Class::get(source).getContainerStore(source).add(item.mBase); + MWWorld::ContainerStoreIterator it = MWWorld::Class::get(source).getContainerStore(source).add(item.mBase, source); if (*it != item.mBase) item.mBase.getRefData().setCount(origCount); else diff --git a/apps/openmw/mwgui/hud.cpp b/apps/openmw/mwgui/hud.cpp index f82fbda2b..9c737e5e4 100644 --- a/apps/openmw/mwgui/hud.cpp +++ b/apps/openmw/mwgui/hud.cpp @@ -10,6 +10,7 @@ #include "../mwworld/class.hpp" #include "../mwmechanics/creaturestats.hpp" +#include "../mwmechanics/npcstats.hpp" #include "inventorywindow.hpp" #include "console.hpp" @@ -494,7 +495,14 @@ namespace MWGui MyGUI::Gui::getInstance().destroyWidget(mWeapImage->getChildAt(0)); mWeapStatus->setProgressRange(100); mWeapStatus->setProgressPosition(0); - mWeapImage->setImageTexture("icons\\k\\stealth_handtohand.dds"); + + MWBase::World *world = MWBase::Environment::get().getWorld(); + MWWorld::Ptr player = world->getPlayer().getPlayer(); + if (MWWorld::Class::get(player).getNpcStats(player).isWerewolf()) + mWeapImage->setImageTexture("icons\\k\\tx_werewolf_hand.dds"); + else + mWeapImage->setImageTexture("icons\\k\\stealth_handtohand.dds"); + mWeapBox->clearUserStrings(); } diff --git a/apps/openmw/mwgui/inventoryitemmodel.cpp b/apps/openmw/mwgui/inventoryitemmodel.cpp index c78bc2c00..30269cd9c 100644 --- a/apps/openmw/mwgui/inventoryitemmodel.cpp +++ b/apps/openmw/mwgui/inventoryitemmodel.cpp @@ -42,7 +42,7 @@ void InventoryItemModel::copyItem (const ItemStack& item, size_t count) { int origCount = item.mBase.getRefData().getCount(); item.mBase.getRefData().setCount(count); - MWWorld::ContainerStoreIterator it = MWWorld::Class::get(mActor).getContainerStore(mActor).add(item.mBase); + MWWorld::ContainerStoreIterator it = MWWorld::Class::get(mActor).getContainerStore(mActor).add(item.mBase, mActor); if (*it != item.mBase) item.mBase.getRefData().setCount(origCount); else diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 7ad17fab0..3b848f2e0 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -304,7 +304,7 @@ namespace MWGui int origCount = ptr.getRefData().getCount(); ptr.getRefData().setCount(mDragAndDrop->mDraggedCount); - it = invStore.add(ptr); + it = invStore.add(ptr, mPtr); ptr.getRefData().setCount(origCount); mDragAndDrop->mSourceModel->removeItem(mDragAndDrop->mItem, mDragAndDrop->mDraggedCount); @@ -481,7 +481,7 @@ namespace MWGui // add to player inventory // can't use ActionTake here because we need an MWWorld::Ptr to the newly inserted object MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer(); - MWWorld::Ptr newObject = *MWWorld::Class::get (player).getContainerStore (player).add (object); + MWWorld::Ptr newObject = *MWWorld::Class::get (player).getContainerStore (player).add (object, player); // remove from world MWBase::Environment::get().getWorld()->deleteObject (object); diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index 498fbace8..a073a2899 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -225,7 +225,7 @@ namespace MWGui assert(amount > 0); MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), "Gold_001"); ref.getPtr().getRefData().setCount(amount); - playerStore.add(ref.getPtr()); + playerStore.add(ref.getPtr(), player); } } diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 7cf9eaa64..9b9a21fa9 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -105,6 +105,7 @@ namespace MWGui , mGui(NULL) , mGarbageDialogs() , mShown(GW_ALL) + , mForceHidden(GW_None) , mAllowed(GW_ALL) , mRestAllowed(true) , mShowFPSLevel(fpsLevel) @@ -435,7 +436,7 @@ namespace MWGui // This is controlled both by what windows the // user has opened/closed (the 'shown' variable) and by what // windows we are allowed to show (the 'allowed' var.) - int eff = mShown & mAllowed; + int eff = mShown & mAllowed & ~mForceHidden; // Show the windows we want mMap ->setVisible(eff & GW_Map); @@ -1127,7 +1128,19 @@ namespace MWGui void WindowManager::toggleVisible (GuiWindow wnd) { - mShown = (mShown & wnd) ? (GuiWindow) (mShown & ~wnd) : (GuiWindow) (mShown | wnd); + mShown = (GuiWindow)(mShown ^ wnd); + updateVisible(); + } + + void WindowManager::forceHide(GuiWindow wnd) + { + mForceHidden = (GuiWindow)(mForceHidden | wnd); + updateVisible(); + } + + void WindowManager::unsetForceHide(GuiWindow wnd) + { + mForceHidden = (GuiWindow)(mForceHidden & ~wnd); updateVisible(); } diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 8188946e1..e49b33647 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -115,6 +115,9 @@ namespace MWGui virtual void toggleVisible(GuiWindow wnd); + virtual void forceHide(MWGui::GuiWindow wnd); + virtual void unsetForceHide(MWGui::GuiWindow wnd); + // Disallow all inventory mode windows virtual void disallowAll(); @@ -341,6 +344,7 @@ namespace MWGui void cleanupGarbage(); GuiWindow mShown; // Currently shown windows in inventory mode + GuiWindow mForceHidden; // Hidden windows (overrides mShown) /* Currently ALLOWED windows in inventory mode. This is used at the start of the game, when windows are enabled one by one diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 0d720ecac..d2da8d2dc 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -39,10 +39,8 @@ namespace MWMechanics void Actors::updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused) { - if (!paused && ptr.getRefData().getHandle()!="player") - MWWorld::Class::get (ptr).getInventoryStore (ptr).autoEquip (ptr); if(!paused) - updateDrowning(ptr,duration); + updateDrowning(ptr, duration); } void Actors::adjustMagicEffects (const MWWorld::Ptr& creature) diff --git a/apps/openmw/mwmechanics/actors.hpp b/apps/openmw/mwmechanics/actors.hpp index 777fdbb9a..a289a9174 100644 --- a/apps/openmw/mwmechanics/actors.hpp +++ b/apps/openmw/mwmechanics/actors.hpp @@ -34,7 +34,7 @@ namespace MWMechanics float mDuration; - void updateNpc (const MWWorld::Ptr& ptr, float duration, bool paused); + void updateNpc(const MWWorld::Ptr &ptr, float duration, bool paused); void adjustMagicEffects (const MWWorld::Ptr& creature); diff --git a/apps/openmw/mwmechanics/alchemy.cpp b/apps/openmw/mwmechanics/alchemy.cpp index 718200372..1d992be41 100644 --- a/apps/openmw/mwmechanics/alchemy.cpp +++ b/apps/openmw/mwmechanics/alchemy.cpp @@ -287,7 +287,7 @@ void MWMechanics::Alchemy::addPotion (const std::string& name) } MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), record->mId); - MWWorld::Class::get (mAlchemist).getContainerStore (mAlchemist).add (ref.getPtr()); + MWWorld::Class::get (mAlchemist).getContainerStore (mAlchemist).add (ref.getPtr(), mAlchemist); } void MWMechanics::Alchemy::increaseSkill() diff --git a/apps/openmw/mwmechanics/enchanting.cpp b/apps/openmw/mwmechanics/enchanting.cpp index e1b416efb..4e26b5027 100644 --- a/apps/openmw/mwmechanics/enchanting.cpp +++ b/apps/openmw/mwmechanics/enchanting.cpp @@ -65,7 +65,7 @@ namespace MWMechanics if(boost::iequals(mSoulGemPtr.get()->mBase->mId, "Misc_SoulGem_Azura")) { MWWorld::ManualRef azura (MWBase::Environment::get().getWorld()->getStore(), "Misc_SoulGem_Azura"); - MWWorld::Class::get (player).getContainerStore (player).add (azura.getPtr()); + MWWorld::Class::get (player).getContainerStore (player).add (azura.getPtr(), player); } if(mSelfEnchanting) @@ -93,7 +93,7 @@ namespace MWMechanics MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), mOldItemId); ref.getPtr().getRefData().setCount (mOldItemCount-1); - MWWorld::Class::get (player).getContainerStore (player).add (ref.getPtr()); + MWWorld::Class::get (player).getContainerStore (player).add (ref.getPtr(), player); if(!mSelfEnchanting) payForEnchantment(); diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index 69ba1c5cb..2dbf5028a 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -13,7 +13,9 @@ #include #include +#include "../mwworld/class.hpp" #include "../mwworld/esmstore.hpp" +#include "../mwworld/player.hpp" #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" diff --git a/apps/openmw/mwmechanics/repair.cpp b/apps/openmw/mwmechanics/repair.cpp index 8ed449885..66c492bf8 100644 --- a/apps/openmw/mwmechanics/repair.cpp +++ b/apps/openmw/mwmechanics/repair.cpp @@ -32,7 +32,7 @@ void Repair::repair(const MWWorld::Ptr &itemToRepair) if (mTool.getRefData().getCount() > 1 && uses == ref->mBase->mData.mUses) { MWWorld::ContainerStore& store = MWWorld::Class::get(player).getContainerStore(player); - MWWorld::ContainerStoreIterator it = store.add(mTool); + MWWorld::ContainerStoreIterator it = store.add(mTool, player); it->getRefData().setCount(mTool.getRefData().getCount()-1); it->getCellRef().mCharge = -1; diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index 3a69fa3a7..2f3ef2d79 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -65,7 +65,7 @@ namespace MWScript ref.getPtr().getRefData().setLocals(*esmscript); } - MWWorld::Class::get (ptr).getContainerStore (ptr).add (ref.getPtr()); + MWWorld::Class::get (ptr).getContainerStore (ptr).add (ref.getPtr(), ptr); // Spawn a messagebox (only for items added to player's inventory and if player is talking to someone) if (ptr == MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer() ) diff --git a/apps/openmw/mwscript/docs/vmformat.txt b/apps/openmw/mwscript/docs/vmformat.txt index 59d988410..005fb82c4 100644 --- a/apps/openmw/mwscript/docs/vmformat.txt +++ b/apps/openmw/mwscript/docs/vmformat.txt @@ -343,5 +343,9 @@ op 0x2000213: HitOnMe op 0x2000214: HitOnMe, explicit op 0x2000215: DisableTeleporting op 0x2000216: EnableTeleporting +op 0x2000217: BecomeWerewolf +op 0x2000218: BecomeWerewolfExplicit +op 0x2000219: UndoWerewolf +op 0x200021a: UndoWerewolfExplicit -opcodes 0x2000217-0x3ffffff unused +opcodes 0x200021b-0x3ffffff unused diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index b9d665465..9dc5327d9 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -347,7 +347,7 @@ namespace MWScript ref.getPtr().getCellRef().mSoul = creature; - MWWorld::Class::get (ptr).getContainerStore (ptr).add (ref.getPtr()); + MWWorld::Class::get (ptr).getContainerStore (ptr).add (ref.getPtr(), ptr); } }; diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index edcd24b68..063344c46 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -1057,6 +1057,18 @@ namespace MWScript } }; + template + class OpSetWerewolf : public Interpreter::Opcode0 + { + public: + + virtual void execute (Interpreter::Runtime& runtime) + { + MWWorld::Ptr ptr = R()(runtime); + MWBase::Environment::get().getWorld()->setWerewolf(ptr, set); + } + }; + void installOpcodes (Interpreter::Interpreter& interpreter) { @@ -1121,6 +1133,7 @@ namespace MWScript interpreter.installSegment5 (Compiler::Stats::opcodeRemoveSpell, new OpRemoveSpell); interpreter.installSegment5 (Compiler::Stats::opcodeRemoveSpellExplicit, new OpRemoveSpell); + interpreter.installSegment5 (Compiler::Stats::opcodeGetSpell, new OpGetSpell); interpreter.installSegment5 (Compiler::Stats::opcodeGetSpellExplicit, new OpGetSpell); @@ -1176,6 +1189,11 @@ namespace MWScript interpreter.installSegment5 (Compiler::Stats::opcodeIsWerewolf, new OpIsWerewolf); interpreter.installSegment5 (Compiler::Stats::opcodeIsWerewolfExplicit, new OpIsWerewolf); + + interpreter.installSegment5 (Compiler::Stats::opcodeBecomeWerewolf, new OpSetWerewolf); + interpreter.installSegment5 (Compiler::Stats::opcodeBecomeWerewolfExplicit, new OpSetWerewolf); + interpreter.installSegment5 (Compiler::Stats::opcodeUndoWerewolf, new OpSetWerewolf); + interpreter.installSegment5 (Compiler::Stats::opcodeUndoWerewolfExplicit, new OpSetWerewolf); } } } diff --git a/apps/openmw/mwworld/actiontake.cpp b/apps/openmw/mwworld/actiontake.cpp index cdd19b46e..d3c4aa2f6 100644 --- a/apps/openmw/mwworld/actiontake.cpp +++ b/apps/openmw/mwworld/actiontake.cpp @@ -17,7 +17,7 @@ namespace MWWorld // insert into player's inventory MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPtr ("player", true); - MWWorld::Class::get (player).getContainerStore (player).add (getTarget()); + MWWorld::Class::get (player).getContainerStore (player).add (getTarget(), player); MWBase::Environment::get().getWorld()->deleteObject (getTarget()); } diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index a9d57c128..cd30f1ac0 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -74,9 +74,9 @@ bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2) return false; } -MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& ptr) +MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr, const Ptr& actorPtr) { - MWWorld::ContainerStoreIterator it = addImp(ptr); + MWWorld::ContainerStoreIterator it = addImp(itemPtr); MWWorld::Ptr item = *it; std::string script = MWWorld::Class::get(item).getScript(item); diff --git a/apps/openmw/mwworld/containerstore.hpp b/apps/openmw/mwworld/containerstore.hpp index 559463d46..bdf6d28e4 100644 --- a/apps/openmw/mwworld/containerstore.hpp +++ b/apps/openmw/mwworld/containerstore.hpp @@ -65,7 +65,7 @@ namespace MWWorld ContainerStoreIterator end(); - ContainerStoreIterator add (const Ptr& ptr); + virtual ContainerStoreIterator add (const Ptr& itemPtr, const Ptr& actorPtr); ///< Add the item pointed to by \a ptr to this container. (Stacks automatically if needed) /// /// \note The item pointed to is not required to exist beyond this function call. diff --git a/apps/openmw/mwworld/inventorystore.cpp b/apps/openmw/mwworld/inventorystore.cpp index 9d07ecb76..e737ab827 100644 --- a/apps/openmw/mwworld/inventorystore.cpp +++ b/apps/openmw/mwworld/inventorystore.cpp @@ -64,6 +64,22 @@ MWWorld::InventoryStore& MWWorld::InventoryStore::operator= (const InventoryStor return *this; } +MWWorld::ContainerStoreIterator MWWorld::InventoryStore::add(const Ptr& itemPtr, const Ptr& actorPtr) +{ + const MWWorld::ContainerStoreIterator& retVal = MWWorld::ContainerStore::add(itemPtr, actorPtr); + + // Auto-equip items if an armor/clothing item is added, but not for the player nor werewolves + if ((actorPtr.getRefData().getHandle() != "player") + && !(MWWorld::Class::get(actorPtr).getNpcStats(actorPtr).isWerewolf())) + { + std::string type = itemPtr.getTypeName(); + if ((type == typeid(ESM::Armor).name()) || (type == typeid(ESM::Clothing).name())) + autoEquip(actorPtr); + } + + return retVal; +} + void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& iterator) { if (slot<0 || slot>=static_cast (mSlots.size())) @@ -110,6 +126,23 @@ void MWWorld::InventoryStore::equip (int slot, const ContainerStoreIterator& ite flagAsModified(); } +void MWWorld::InventoryStore::unequipAll(const MWWorld::Ptr& actor) +{ + for (int slot=0; slot < MWWorld::InventoryStore::Slots; ++slot) + { + MWWorld::ContainerStoreIterator it = getSlot(slot); + if (it != end()) + { + equip(slot, end()); + std::string script = MWWorld::Class::get(*it).getScript(*it); + + // Unset OnPCEquip Variable on item's script, if it has a script with that variable declared + if((actor.getRefData().getHandle() == "player") && (script != "")) + (*it).mRefData->getLocals().setVarByInt(script, "onpcequip", 0); + } + } +} + MWWorld::ContainerStoreIterator MWWorld::InventoryStore::getSlot (int slot) { if (slot<0 || slot>=static_cast (mSlots.size())) diff --git a/apps/openmw/mwworld/inventorystore.hpp b/apps/openmw/mwworld/inventorystore.hpp index 0801e04bc..f0cba0f9f 100644 --- a/apps/openmw/mwworld/inventorystore.hpp +++ b/apps/openmw/mwworld/inventorystore.hpp @@ -65,6 +65,17 @@ namespace MWWorld InventoryStore& operator= (const InventoryStore& store); + virtual ContainerStoreIterator add (const Ptr& itemPtr, const Ptr& actorPtr); + ///< Add the item pointed to by \a ptr to this container. (Stacks automatically if needed) + /// Auto-equip items if specific conditions are fulfilled (see the implementation). + /// + /// \note The item pointed to is not required to exist beyond this function call. + /// + /// \attention Do not add items to an existing stack by increasing the count instead of + /// calling this function! + /// + /// @return if stacking happened, return iterator to the item that was stacked against, otherwise iterator to the newly inserted item. + void equip (int slot, const ContainerStoreIterator& iterator); ///< \note \a iterator can be an end-iterator @@ -78,6 +89,9 @@ namespace MWWorld ContainerStoreIterator getSlot (int slot); + void unequipAll(const MWWorld::Ptr& actor); + ///< Unequip all currently equipped items. + void autoEquip (const MWWorld::Ptr& npc); ///< Auto equip items according to stats and item value. diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 7703470b4..cfb2fa74d 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -16,6 +16,7 @@ #include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/movement.hpp" +#include "../mwmechanics/npcstats.hpp" #include "../mwrender/sky.hpp" #include "../mwrender/animation.hpp" @@ -1859,4 +1860,36 @@ namespace MWWorld return mTeleportEnabled; } + void World::setWerewolf(const MWWorld::Ptr& actor, bool werewolf) + { + MWMechanics::NpcStats& npcStats = Class::get(actor).getNpcStats(actor); + + // The actor does not have to change state + if (npcStats.isWerewolf() == werewolf) + return; + + npcStats.setWerewolf(werewolf); + + MWWorld::InventoryStore& invStore = MWWorld::Class::get(actor).getInventoryStore(actor); + if (werewolf) + invStore.unequipAll(actor); + + if (actor.getRefData().getHandle() == "player") + { + // Update the GUI only when called on the player + MWBase::WindowManager* windowManager = MWBase::Environment::get().getWindowManager(); + if (werewolf) + { + windowManager->forceHide(MWGui::GW_Inventory); + windowManager->forceHide(MWGui::GW_Magic); + windowManager->unsetSelectedWeapon(); + } + else + { + windowManager->unsetForceHide(MWGui::GW_Inventory); + windowManager->unsetForceHide(MWGui::GW_Magic); + } + } + } + } diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index cb2e00e1f..43b57f379 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -430,6 +430,8 @@ namespace MWWorld /// Returns true if teleport spell effects are allowed. virtual bool isTeleportingEnabled() const; + + virtual void setWerewolf(const MWWorld::Ptr& actor, bool werewolf); }; } diff --git a/components/compiler/extensions0.cpp b/components/compiler/extensions0.cpp index 5eca8ed7a..54bf6de2e 100644 --- a/components/compiler/extensions0.cpp +++ b/components/compiler/extensions0.cpp @@ -418,6 +418,9 @@ namespace Compiler extensions.registerFunction ("ondeath", 'l', "", opcodeOnDeath, opcodeOnDeathExplicit); extensions.registerFunction ("iswerewolf", 'l', "", opcodeIsWerewolf, opcodeIsWerewolfExplicit); + + extensions.registerInstruction("becomewerewolf", "", opcodeBecomeWerewolf, opcodeBecomeWerewolfExplicit); + extensions.registerInstruction("undowerewolf", "", opcodeUndoWerewolf, opcodeUndoWerewolfExplicit); } } @@ -458,4 +461,4 @@ namespace Compiler extensions.registerInstruction ("user4", "", opcodeUser4, opcodeUser4); } } -} \ No newline at end of file +} diff --git a/components/compiler/opcodes.hpp b/components/compiler/opcodes.hpp index a0191b0a5..5c61cee8b 100644 --- a/components/compiler/opcodes.hpp +++ b/components/compiler/opcodes.hpp @@ -333,8 +333,6 @@ namespace Compiler const int opcodeGetRace = 0x20001d9; const int opcodeGetRaceExplicit = 0x20001da; - const int opcodeGetWerewolfKills = 0x20001e2; - const int opcodePcExpelled = 0x20018; const int opcodePcExpelledExplicit = 0x20019; const int opcodePcExpell = 0x2001a; @@ -347,8 +345,15 @@ namespace Compiler const int opcodeLowerRankExplicit = 0x20001eb; const int opcodeOnDeath = 0x20001fc; const int opcodeOnDeathExplicit = 0x2000205; + + const int opcodeBecomeWerewolf = 0x2000217; + const int opcodeBecomeWerewolfExplicit = 0x2000218; + const int opcodeUndoWerewolf = 0x2000219; + const int opcodeUndoWerewolfExplicit = 0x200021a; const int opcodeIsWerewolf = 0x20001fd; const int opcodeIsWerewolfExplicit = 0x20001fe; + + const int opcodeGetWerewolfKills = 0x20001e2; } namespace Transformation @@ -404,4 +409,4 @@ namespace Compiler } } -#endif \ No newline at end of file +#endif