mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 20:56:39 +00:00 
			
		
		
		
	Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
		
						commit
						356b53bd22
					
				
					 32 changed files with 203 additions and 115 deletions
				
			
		|  | @ -74,6 +74,7 @@ add_openmw_dir (mwmechanics | |||
|     mechanicsmanagerimp stat character creaturestats magiceffects movement actors objects | ||||
|     drawstate spells activespells npcstats aipackage aisequence alchemy aiwander aitravel aifollow | ||||
|     aiescort aiactivate aicombat repair enchanting pathfinding security spellsuccess spellcasting | ||||
|     disease | ||||
|     ) | ||||
| 
 | ||||
| add_openmw_dir (mwbase | ||||
|  |  | |||
|  | @ -21,6 +21,7 @@ | |||
| #include "../mwmechanics/npcstats.hpp" | ||||
| #include "../mwmechanics/movement.hpp" | ||||
| #include "../mwmechanics/spellcasting.hpp" | ||||
| #include "../mwmechanics/disease.hpp" | ||||
| 
 | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/actiontalk.hpp" | ||||
|  | @ -517,7 +518,8 @@ namespace MWClass | |||
|                 MWBase::Environment::get().getSoundManager()->playSound3D(victim, "critical damage", 1.0f, 1.0f); | ||||
|             } | ||||
| 
 | ||||
|             healthdmg = (otherstats.getFatigue().getCurrent() < 1.0f); | ||||
|             healthdmg = (otherstats.getFatigue().getCurrent() < 1.0f) | ||||
|                     || (otherstats.getMagicEffects().get(ESM::MagicEffect::Paralyze).mMagnitude > 0); | ||||
|             if(stats.isWerewolf()) | ||||
|             { | ||||
|                 healthdmg = true; | ||||
|  | @ -603,6 +605,9 @@ namespace MWClass | |||
|                 ptr.getRefData().getLocals().setVarByInt(script, "onpchitme", 1); | ||||
|         } | ||||
| 
 | ||||
|         if (!attacker.isEmpty()) | ||||
|             MWMechanics::diseaseContact(ptr, attacker); | ||||
| 
 | ||||
|         if(damage > 0.0f) | ||||
|         { | ||||
|             // 'ptr' is losing health. Play a 'hit' voiced dialog entry if not already saying
 | ||||
|  |  | |||
|  | @ -251,7 +251,7 @@ namespace MWDialogue | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     void DialogueManager::executeTopic (const std::string& topic, bool randomResponse) | ||||
|     void DialogueManager::executeTopic (const std::string& topic) | ||||
|     { | ||||
|         Filter filter (mActor, mChoice, mTalkedTo); | ||||
| 
 | ||||
|  | @ -262,12 +262,9 @@ namespace MWDialogue | |||
| 
 | ||||
|         MWGui::DialogueWindow* win = MWBase::Environment::get().getWindowManager()->getDialogueWindow(); | ||||
| 
 | ||||
|         std::vector<const ESM::DialInfo *> infos = filter.list (dialogue, true, true); | ||||
| 
 | ||||
|         if (!infos.empty()) | ||||
|         const ESM::DialInfo* info = filter.search(dialogue, true); | ||||
|         if (info) | ||||
|         { | ||||
|             const ESM::DialInfo* info = infos[randomResponse ? std::rand() % infos.size() : 0]; | ||||
| 
 | ||||
|             parseText (info->mResponse); | ||||
| 
 | ||||
|             std::string title; | ||||
|  | @ -509,7 +506,7 @@ namespace MWDialogue | |||
|             text = "Bribe"; | ||||
|         } | ||||
| 
 | ||||
|         executeTopic (text + (success ? " Success" : " Fail"), true); | ||||
|         executeTopic (text + (success ? " Success" : " Fail")); | ||||
|     } | ||||
| 
 | ||||
|     int DialogueManager::getTemporaryDispositionChange() const | ||||
|  |  | |||
|  | @ -44,7 +44,7 @@ namespace MWDialogue | |||
|             bool compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code); | ||||
|             void executeScript (const std::string& script); | ||||
| 
 | ||||
|             void executeTopic (const std::string& topic, bool randomResponse=false); | ||||
|             void executeTopic (const std::string& topic); | ||||
| 
 | ||||
|         public: | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,6 +5,7 @@ | |||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/journal.hpp" | ||||
| #include "../mwbase/mechanicsmanager.hpp" | ||||
| #include "../mwbase/dialoguemanager.hpp" | ||||
| 
 | ||||
| #include "../mwworld/class.hpp" | ||||
| #include "../mwworld/player.hpp" | ||||
|  | @ -133,7 +134,8 @@ bool MWDialogue::Filter::testDisposition (const ESM::DialInfo& info, bool invert | |||
|     if (isCreature) | ||||
|         return true; | ||||
| 
 | ||||
|     int actorDisposition = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor); | ||||
|     int actorDisposition = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor) | ||||
|             + MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange(); | ||||
|     // For service refusal, the disposition check is inverted. However, a value of 0 still means "always succeed".
 | ||||
|     return invert ? (info.mData.mDisposition == 0 || actorDisposition < info.mData.mDisposition) | ||||
|                   : (actorDisposition >= info.mData.mDisposition); | ||||
|  |  | |||
|  | @ -44,6 +44,11 @@ namespace MWGui | |||
|         adjustButton(mNextPageButton); | ||||
|         adjustButton(mPrevPageButton); | ||||
| 
 | ||||
|         mLeftPage->setNeedMouseFocus(true); | ||||
|         mLeftPage->eventMouseWheel += MyGUI::newDelegate(this, &BookWindow::onMouseWheel); | ||||
|         mRightPage->setNeedMouseFocus(true); | ||||
|         mRightPage->eventMouseWheel += MyGUI::newDelegate(this, &BookWindow::onMouseWheel); | ||||
| 
 | ||||
|         if (mNextPageButton->getSize().width == 64) | ||||
|         { | ||||
|             // english button has a 7 pixel wide strip of garbage on its right edge
 | ||||
|  | @ -54,6 +59,14 @@ namespace MWGui | |||
|         center(); | ||||
|     } | ||||
| 
 | ||||
|     void BookWindow::onMouseWheel(MyGUI::Widget *_sender, int _rel) | ||||
|     { | ||||
|         if (_rel < 0) | ||||
|             nextPage(); | ||||
|         else | ||||
|             prevPage(); | ||||
|     } | ||||
| 
 | ||||
|     void BookWindow::clearPages() | ||||
|     { | ||||
|         for (std::vector<MyGUI::Widget*>::iterator it=mPages.begin(); | ||||
|  | @ -89,6 +102,7 @@ namespace MWGui | |||
|                 parent = mRightPage; | ||||
| 
 | ||||
|             MyGUI::Widget* pageWidget = parent->createWidgetReal<MyGUI::Widget>("", MyGUI::FloatCoord(0.0,0.0,1.0,1.0), MyGUI::Align::Default, "BookPage" + boost::lexical_cast<std::string>(i)); | ||||
|             pageWidget->setNeedMouseFocus(false); | ||||
|             parser.parsePage(*it, pageWidget, mLeftPage->getSize().width); | ||||
|             mPages.push_back(pageWidget); | ||||
|             ++i; | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ namespace MWGui | |||
|             void onPrevPageButtonClicked (MyGUI::Widget* sender); | ||||
|             void onCloseButtonClicked (MyGUI::Widget* sender); | ||||
|             void onTakeButtonClicked (MyGUI::Widget* sender); | ||||
|             void onMouseWheel(MyGUI::Widget* _sender, int _rel); | ||||
| 
 | ||||
|             void updatePages(); | ||||
|             void clearPages(); | ||||
|  |  | |||
|  | @ -119,8 +119,6 @@ namespace MWGui | |||
| 
 | ||||
|         // Set up the log window
 | ||||
|         mHistory->setOverflowToTheLeft(true); | ||||
|         mHistory->setEditStatic(true); | ||||
|         mHistory->setVisibleVScroll(true); | ||||
| 
 | ||||
|         // compiler
 | ||||
|         Compiler::registerExtensions (mExtensions, mConsoleOnlyScripts); | ||||
|  | @ -215,7 +213,7 @@ namespace MWGui | |||
|         { | ||||
|             std::vector<std::string> matches; | ||||
|             listNames(); | ||||
|             mCommandLine->setCaption(complete( mCommandLine->getCaption(), matches )); | ||||
|             mCommandLine->setCaption(complete( mCommandLine->getOnlyText(), matches )); | ||||
| #if 0 | ||||
|             int i = 0; | ||||
|             for(std::vector<std::string>::iterator it=matches.begin(); it < matches.end(); ++it,++i ) | ||||
|  | @ -234,7 +232,7 @@ namespace MWGui | |||
|         { | ||||
|             // If the user was editing a string, store it for later
 | ||||
|             if(mCurrent == mCommandHistory.end()) | ||||
|                 mEditString = mCommandLine->getCaption(); | ||||
|                 mEditString = mCommandLine->getOnlyText(); | ||||
| 
 | ||||
|             if(mCurrent != mCommandHistory.begin()) | ||||
|             { | ||||
|  | @ -259,7 +257,7 @@ namespace MWGui | |||
| 
 | ||||
|     void Console::acceptCommand(MyGUI::EditBox* _sender) | ||||
|     { | ||||
|         const std::string &cm = mCommandLine->getCaption(); | ||||
|         const std::string &cm = mCommandLine->getOnlyText(); | ||||
|         if(cm.empty()) return; | ||||
| 
 | ||||
|         // Add the command to the history, and set the current pointer to
 | ||||
|  |  | |||
|  | @ -72,7 +72,7 @@ void InventoryItemModel::update() | |||
|         // NOTE: Don't show WerewolfRobe objects in the inventory, or allow them to be taken.
 | ||||
|         // Vanilla likely uses a hack like this since there's no other way to prevent it from
 | ||||
|         // being shown or taken.
 | ||||
|         if(item.getCellRef().mRefID == "WerewolfRobe") | ||||
|         if(item.getCellRef().mRefID == "werewolfrobe") | ||||
|             continue; | ||||
| 
 | ||||
|         ItemStack newItem (item, this, item.getRefData().getCount()); | ||||
|  |  | |||
|  | @ -425,7 +425,7 @@ namespace MWGui | |||
|             // NOTE: Don't allow users to select WerewolfRobe objects in the inventory. Vanilla
 | ||||
|             // likely uses a hack like this since there's no other way to prevent it from being
 | ||||
|             // taken.
 | ||||
|             if(item.getCellRef().mRefID == "WerewolfRobe") | ||||
|             if(item.getCellRef().mRefID == "werewolfrobe") | ||||
|                 return MWWorld::Ptr(); | ||||
|             return item; | ||||
|         } | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ | |||
| #include "containeritemmodel.hpp" | ||||
| #include "tradeitemmodel.hpp" | ||||
| #include "countdialog.hpp" | ||||
| #include "dialogue.hpp" | ||||
| 
 | ||||
| namespace MWGui | ||||
| { | ||||
|  | @ -340,6 +341,9 @@ namespace MWGui | |||
|             addOrRemoveGold(-mCurrentBalance, mPtr); | ||||
|         } | ||||
| 
 | ||||
|         MWBase::Environment::get().getWindowManager()->getDialogueWindow()->addResponse( | ||||
|             MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sBarterDialog5")->getString()); | ||||
| 
 | ||||
|         std::string sound = "Item Gold Up"; | ||||
|         MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); | ||||
| 
 | ||||
|  |  | |||
|  | @ -9,6 +9,7 @@ | |||
| #include <MyGUI_RenderManager.h> | ||||
| #include <MyGUI_Widget.h> | ||||
| #include <MyGUI_Button.h> | ||||
| #include <MyGUI_EditBox.h> | ||||
| 
 | ||||
| #include <openengine/ogre/renderer.hpp> | ||||
| 
 | ||||
|  | @ -19,7 +20,6 @@ | |||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| #include "../mwbase/soundmanager.hpp" | ||||
| #include "../mwgui/bookwindow.hpp" | ||||
| #include "../mwmechanics/creaturestats.hpp" | ||||
| 
 | ||||
| using namespace ICS; | ||||
|  | @ -497,6 +497,9 @@ namespace MWInput | |||
|                         edit->deleteTextSelection(); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             if (edit && !edit->getEditStatic()) | ||||
|             { | ||||
|                 if (arg.keysym.sym == SDLK_c && (arg.keysym.mod & SDL_Keymod(KMOD_CTRL))) | ||||
|                 { | ||||
|                     std::string text = edit->getTextSelection(); | ||||
|  | @ -591,15 +594,6 @@ namespace MWInput | |||
|             mMouseWheel = int(arg.z); | ||||
| 
 | ||||
|             MyGUI::InputManager::getInstance().injectMouseMove( int(mMouseX), int(mMouseY), mMouseWheel); | ||||
| 
 | ||||
|             //if the player is reading a book and flicking the mouse wheel
 | ||||
|             if (MWBase::Environment::get().getWindowManager()->getMode() == MWGui::GM_Book && arg.zrel) | ||||
|             { | ||||
|                 if (arg.zrel < 0) | ||||
|                     MWBase::Environment::get().getWindowManager()->getBookWindow()->nextPage(); | ||||
|                 else | ||||
|                     MWBase::Environment::get().getWindowManager()->getBookWindow()->prevPage(); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         if (mMouseLookEnabled) | ||||
|  | @ -676,7 +670,7 @@ namespace MWInput | |||
|         if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return; | ||||
| 
 | ||||
|         // Not allowed before the magic window is accessible
 | ||||
|         if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Magic)) | ||||
|         if (!mControlSwitch["playermagic"]) | ||||
|             return; | ||||
| 
 | ||||
|         MWMechanics::DrawState_ state = mPlayer->getDrawState(); | ||||
|  | @ -691,7 +685,7 @@ namespace MWInput | |||
|         if (MWBase::Environment::get().getWindowManager()->isGuiMode()) return; | ||||
| 
 | ||||
|         // Not allowed before the inventory window is accessible
 | ||||
|         if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) | ||||
|         if (!mControlSwitch["playerfighting"]) | ||||
|             return; | ||||
| 
 | ||||
|         MWMechanics::DrawState_ state = mPlayer->getDrawState(); | ||||
|  |  | |||
|  | @ -408,17 +408,17 @@ namespace MWMechanics | |||
|         static std::map<int, std::string> boundItemsMap; | ||||
|         if (boundItemsMap.empty()) | ||||
|         { | ||||
|             boundItemsMap[ESM::MagicEffect::BoundBattleAxe] = "battle_axe"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundBoots] = "boots"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundCuirass] = "cuirass"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundDagger] = "dagger"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundGloves] = "gauntlet"; // Note: needs both _left and _right variants, see below
 | ||||
|             boundItemsMap[ESM::MagicEffect::BoundHelm] = "helm"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundLongbow] = "longbow"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundLongsword] = "longsword"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundMace] = "mace"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundShield] = "shield"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundSpear] = "spear"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundBattleAxe] = "sMagicBoundBattleAxeID"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundBoots] = "sMagicBoundBootsID"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundCuirass] = "sMagicBoundCuirassID"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundDagger] = "sMagicBoundDaggerID"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundGloves] = "sMagicBoundLeftGauntletID"; // Note: needs RightGauntlet variant too (see below)
 | ||||
|             boundItemsMap[ESM::MagicEffect::BoundHelm] = "sMagicBoundHelmID"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundLongbow] = "sMagicBoundLongbowID"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundLongsword] = "sMagicBoundLongswordID"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundMace] = "sMagicBoundMaceID"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundShield] = "sMagicBoundShieldID"; | ||||
|             boundItemsMap[ESM::MagicEffect::BoundSpear] = "sMagicBoundSpearID"; | ||||
|         } | ||||
| 
 | ||||
|         for (std::map<int, std::string>::iterator it = boundItemsMap.begin(); it != boundItemsMap.end(); ++it) | ||||
|  | @ -427,11 +427,13 @@ namespace MWMechanics | |||
|             int magnitude = creatureStats.getMagicEffects().get(it->first).mMagnitude; | ||||
|             if (found != (magnitude > 0)) | ||||
|             { | ||||
|                 std::string item = "bound_" + it->second; | ||||
|                 std::string itemGmst = it->second; | ||||
|                 std::string item = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find( | ||||
|                             itemGmst)->getString(); | ||||
|                 if (it->first == ESM::MagicEffect::BoundGloves) | ||||
|                 { | ||||
|                     adjustBoundItem(item + "_left", magnitude > 0, ptr); | ||||
|                     adjustBoundItem(item + "_right", magnitude > 0, ptr); | ||||
|                     adjustBoundItem("sMagicBoundLeftGauntletID", magnitude > 0, ptr); | ||||
|                     adjustBoundItem("sMagicBoundRightGauntletID", magnitude > 0, ptr); | ||||
|                 } | ||||
|                 else | ||||
|                     adjustBoundItem(item, magnitude > 0, ptr); | ||||
|  | @ -447,26 +449,28 @@ namespace MWMechanics | |||
|         static std::map<int, std::string> summonMap; | ||||
|         if (summonMap.empty()) | ||||
|         { | ||||
|             summonMap[ESM::MagicEffect::SummonAncestralGhost] = "ancestor_ghost_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonBear] = "BM_bear_black_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonBonelord] = "bonelord_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonBonewalker] = "bonewalker_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonBonewolf] = "BM_wolf_bone_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonCenturionSphere] = "centurion_sphere_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonClannfear] = "clannfear_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonDaedroth] = "daedroth_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonDremora] = "dremora_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonFabricant] = "fabricant_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonFlameAtronach] = "atronach_flame_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonFrostAtronach] = "atronach_frost_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonGoldenSaint] = "golden saint_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonGreaterBonewalker] = "bonewalker_greater_summ"; | ||||
|             summonMap[ESM::MagicEffect::SummonHunger] = "hunger_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonScamp] = "scamp_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonSkeletalMinion] = "skeleton_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonStormAtronach] = "atronach_storm_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonWingedTwilight] = "winged twilight_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonWolf] = "BM_wolf_grey_summon"; | ||||
|             summonMap[ESM::MagicEffect::SummonAncestralGhost] = "sMagicAncestralGhostID"; | ||||
|             summonMap[ESM::MagicEffect::SummonBonelord] = "sMagicBonelordID"; | ||||
|             summonMap[ESM::MagicEffect::SummonBonewalker] = "sMagicLeastBonewalkerID"; | ||||
|             summonMap[ESM::MagicEffect::SummonCenturionSphere] = "sMagicCenturionSphereID"; | ||||
|             summonMap[ESM::MagicEffect::SummonClannfear] = "sMagicClannfearID"; | ||||
|             summonMap[ESM::MagicEffect::SummonDaedroth] = "sMagicDaedrothID"; | ||||
|             summonMap[ESM::MagicEffect::SummonDremora] = "sMagicDremoraID"; | ||||
|             summonMap[ESM::MagicEffect::SummonFabricant] = "sMagicFabricantID"; | ||||
|             summonMap[ESM::MagicEffect::SummonFlameAtronach] = "sMagicFlameAtronachID"; | ||||
|             summonMap[ESM::MagicEffect::SummonFrostAtronach] = "sMagicFrostAtronachID"; | ||||
|             summonMap[ESM::MagicEffect::SummonGoldenSaint] = "sMagicGoldenSaintID"; | ||||
|             summonMap[ESM::MagicEffect::SummonGreaterBonewalker] = "sMagicGreaterBonewalkerID"; | ||||
|             summonMap[ESM::MagicEffect::SummonHunger] = "sMagicHungerID"; | ||||
|             summonMap[ESM::MagicEffect::SummonScamp] = "sMagicScampID"; | ||||
|             summonMap[ESM::MagicEffect::SummonSkeletalMinion] = "sMagicSkeletalMinionID"; | ||||
|             summonMap[ESM::MagicEffect::SummonStormAtronach] = "sMagicStormAtronachID"; | ||||
|             summonMap[ESM::MagicEffect::SummonWingedTwilight] = "sMagicWingedTwilightID"; | ||||
|             summonMap[ESM::MagicEffect::SummonWolf] = "sMagicCreature01ID"; | ||||
|             summonMap[ESM::MagicEffect::SummonBear] = "sMagicCreature02ID"; | ||||
|             summonMap[ESM::MagicEffect::SummonBonewolf] = "sMagicCreature03ID"; | ||||
|             summonMap[ESM::MagicEffect::SummonCreature04] = "sMagicCreature04ID"; | ||||
|             summonMap[ESM::MagicEffect::SummonCreature05] = "sMagicCreature05ID"; | ||||
|         } | ||||
| 
 | ||||
|         for (std::map<int, std::string>::iterator it = summonMap.begin(); it != summonMap.end(); ++it) | ||||
|  | @ -489,15 +493,20 @@ namespace MWMechanics | |||
|                     ipos.rot[1] = 0; | ||||
|                     ipos.rot[2] = 0; | ||||
| 
 | ||||
|                     MWWorld::CellStore* store = ptr.getCell(); | ||||
|                     MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), it->second, 1); | ||||
|                     ref.getPtr().getCellRef().mPos = ipos; | ||||
|                     std::string creatureID = | ||||
|                             MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(it->second)->getString(); | ||||
| 
 | ||||
|                     // TODO: Add AI to follow player and fight for him
 | ||||
|                     if (!creatureID.empty()) | ||||
|                     { | ||||
|                         MWWorld::CellStore* store = ptr.getCell(); | ||||
|                         MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), creatureID, 1); | ||||
|                         ref.getPtr().getCellRef().mPos = ipos; | ||||
| 
 | ||||
|                     creatureStats.mSummonedCreatures.insert(std::make_pair(it->first, | ||||
|                         MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),*store,ipos).getRefData().getHandle())); | ||||
|                         // TODO: Add AI to follow player and fight for him
 | ||||
| 
 | ||||
|                         creatureStats.mSummonedCreatures.insert(std::make_pair(it->first, | ||||
|                             MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),*store,ipos).getRefData().getHandle())); | ||||
|                     } | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|  | @ -797,7 +806,12 @@ namespace MWMechanics | |||
|                 iter->second->updateContinuousVfx(); | ||||
| 
 | ||||
|             for(PtrControllerMap::iterator iter(mActors.begin());iter != mActors.end();++iter) | ||||
|             { | ||||
|                 if (iter->first.getClass().getCreatureStats(iter->first).getMagicEffects().get( | ||||
|                             ESM::MagicEffect::Paralyze).mMagnitude > 0) | ||||
|                     iter->second->skipAnim(); | ||||
|                 iter->second->update(duration); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|     void Actors::restoreDynamicStats() | ||||
|  |  | |||
|  | @ -91,6 +91,8 @@ namespace MWMechanics | |||
|         mPathFinder.checkPathCompleted(pos.pos[0],pos.pos[1],pos.pos[2]); | ||||
| 
 | ||||
|         float zAngle = mPathFinder.getZAngleToNext(pos.pos[0], pos.pos[1]); | ||||
| 
 | ||||
|         // TODO: use movement settings instead of rotating directly
 | ||||
|         MWBase::Environment::get().getWorld()->rotateObject(actor, 0, 0, zAngle, false); | ||||
|         MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 1; | ||||
| 
 | ||||
|  | @ -105,6 +107,7 @@ namespace MWMechanics | |||
|             float directionResult = sqrt(directionX * directionX + directionY * directionY); | ||||
| 
 | ||||
|             zAngle = Ogre::Radian( acos(directionY / directionResult) * sgn(asin(directionX / directionResult)) ).valueDegrees(); | ||||
|             // TODO: use movement settings instead of rotating directly
 | ||||
|             MWBase::Environment::get().getWorld()->rotateObject(actor, 0, 0, zAngle, false); | ||||
| 
 | ||||
|             mPathFinder.clearPath(); | ||||
|  |  | |||
|  | @ -161,6 +161,7 @@ namespace MWMechanics | |||
|         if(distanceBetweenResult <= mMaxDist * mMaxDist) | ||||
|         { | ||||
|             float zAngle = mPathFinder.getZAngleToNext(pos.pos[0], pos.pos[1]); | ||||
|             // TODO: use movement settings instead of rotating directly
 | ||||
|             MWBase::Environment::get().getWorld()->rotateObject(actor, 0, 0, zAngle, false); | ||||
|             MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 1; | ||||
|             mMaxDist = 470; | ||||
|  |  | |||
|  | @ -97,6 +97,7 @@ namespace MWMechanics | |||
|         } | ||||
| 
 | ||||
|         float zAngle = mPathFinder.getZAngleToNext(pos.pos[0], pos.pos[1]); | ||||
|         // TODO: use movement settings instead of rotating directly
 | ||||
|         world->rotateObject(actor, 0, 0, zAngle, false); | ||||
|         movement.mPosition[1] = 1; | ||||
| 
 | ||||
|  |  | |||
|  | @ -236,6 +236,7 @@ namespace MWMechanics | |||
|         if(mWalking) | ||||
|         { | ||||
|             float zAngle = mPathFinder.getZAngleToNext(pos.pos[0], pos.pos[1]); | ||||
|             // TODO: use movement settings instead of rotating directly
 | ||||
|             world->rotateObject(actor, 0, 0, zAngle, false); | ||||
|             MWWorld::Class::get(actor).getMovementSettings(actor).mPosition[1] = 1; | ||||
| 
 | ||||
|  |  | |||
|  | @ -955,9 +955,12 @@ void CharacterController::update(float duration) | |||
|         refreshCurrentAnims(idlestate, movestate, forcestateupdate); | ||||
| 
 | ||||
|         rot *= duration * Ogre::Math::RadiansToDegrees(1.0f); | ||||
|         world->rotateObject(mPtr, rot.x, rot.y, rot.z, true); | ||||
| 
 | ||||
|         world->queueMovement(mPtr, vec); | ||||
|         if (!mSkipAnim) | ||||
|         { | ||||
|             world->rotateObject(mPtr, rot.x, rot.y, rot.z, true); | ||||
|             world->queueMovement(mPtr, vec); | ||||
|         } | ||||
|         movement = vec; | ||||
|     } | ||||
|     else if(cls.getCreatureStats(mPtr).isDead()) | ||||
|  |  | |||
							
								
								
									
										53
									
								
								apps/openmw/mwmechanics/disease.hpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								apps/openmw/mwmechanics/disease.hpp
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,53 @@ | |||
| #ifndef OPENMW_MECHANICS_DISEASE_H | ||||
| #define OPENMW_MECHANICS_DISEASE_H | ||||
| 
 | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/world.hpp" | ||||
| #include "../mwworld/ptr.hpp" | ||||
| #include "../mwworld/class.hpp" | ||||
| #include "../mwmechanics/spells.hpp" | ||||
| #include "../mwmechanics/creaturestats.hpp" | ||||
| 
 | ||||
| namespace MWMechanics | ||||
| { | ||||
| 
 | ||||
|     /// Call when \a actor has got in contact with \a carrier (e.g. hit by him, or loots him)
 | ||||
|     inline void diseaseContact (MWWorld::Ptr actor, MWWorld::Ptr carrier) | ||||
|     { | ||||
|         if (!carrier.getClass().isActor()) | ||||
|             return; | ||||
| 
 | ||||
|         float fDiseaseXferChance = | ||||
|                 MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find( | ||||
|                     "fDiseaseXferChance")->getFloat(); | ||||
| 
 | ||||
|         Spells& spells = carrier.getClass().getCreatureStats(carrier).getSpells(); | ||||
|         for (Spells::TIterator it = spells.begin(); it != spells.end(); ++it) | ||||
|         { | ||||
|             const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(it->first); | ||||
|             if (spell->mData.mType == ESM::Spell::ST_Disease | ||||
|                     || spell->mData.mType == ESM::Spell::ST_Blight) | ||||
|             { | ||||
|                 float roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
 | ||||
|                 if (roll < fDiseaseXferChance) | ||||
|                 { | ||||
|                     // Contracted disease!
 | ||||
|                     actor.getClass().getCreatureStats(actor).getSpells().add(it->first); | ||||
| 
 | ||||
|                     if (actor.getRefData().getHandle() == "player") | ||||
|                     { | ||||
|                         std::string msg = "sMagicContractDisease"; | ||||
|                         msg = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(msg)->getString(); | ||||
|                         if (msg.find("%s") != std::string::npos) | ||||
|                             msg.replace(msg.find("%s"), 2, spell->mName); | ||||
|                         MWBase::Environment::get().getWindowManager()->messageBox(msg); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| #endif | ||||
|  | @ -68,6 +68,12 @@ namespace MWMechanics | |||
|                 MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find ( | ||||
|                 effectIt->mEffectID); | ||||
| 
 | ||||
|             // If player is healing someone, show the target's HP bar
 | ||||
|             if (caster.getRefData().getHandle() == "player" && target != caster | ||||
|                     && effectIt->mEffectID == ESM::MagicEffect::RestoreHealth | ||||
|                     && target.getClass().isActor()) | ||||
|                 MWBase::Environment::get().getWindowManager()->setEnemy(target); | ||||
| 
 | ||||
|             float magnitudeMult = 1; | ||||
|             if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful && target.getClass().isActor()) | ||||
|             { | ||||
|  |  | |||
|  | @ -368,4 +368,6 @@ op 0x200022d: RemoveEffects | |||
| op 0x200022e: RemoveEffects, explicit | ||||
| op 0x200022f: Resurrect | ||||
| op 0x2000230: Resurrect, explicit | ||||
| opcodes 0x200022f-0x3ffffff unused | ||||
| op 0x2000231: GetSpellReadied | ||||
| op 0x2000232: GetSpellReadied, explicit | ||||
| opcodes 0x2000233-0x3ffffff unused | ||||
|  |  | |||
|  | @ -465,7 +465,20 @@ namespace MWScript | |||
|                 { | ||||
|                     MWWorld::Ptr ptr = R()(runtime); | ||||
| 
 | ||||
|                     runtime.push(MWWorld::Class::get(ptr).getNpcStats (ptr).getDrawState () == MWMechanics::DrawState_Weapon); | ||||
|                     runtime.push(ptr.getClass().getNpcStats (ptr).getDrawState () == MWMechanics::DrawState_Weapon); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|         template <class R> | ||||
|         class OpGetSpellReadied : public Interpreter::Opcode0 | ||||
|         { | ||||
|             public: | ||||
| 
 | ||||
|                 virtual void execute (Interpreter::Runtime& runtime) | ||||
|                 { | ||||
|                     MWWorld::Ptr ptr = R()(runtime); | ||||
| 
 | ||||
|                     runtime.push(ptr.getClass().getNpcStats (ptr).getDrawState () == MWMechanics::DrawState_Spell); | ||||
|                 } | ||||
|         }; | ||||
| 
 | ||||
|  | @ -776,6 +789,8 @@ namespace MWScript | |||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetAttackedExplicit, new OpGetAttacked<ExplicitRef>); | ||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetWeaponDrawn, new OpGetWeaponDrawn<ImplicitRef>); | ||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetWeaponDrawnExplicit, new OpGetWeaponDrawn<ExplicitRef>); | ||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetSpellReadied, new OpGetSpellReadied<ImplicitRef>); | ||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetSpellReadiedExplicit, new OpGetSpellReadied<ExplicitRef>); | ||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetSpellEffects, new OpGetSpellEffects<ImplicitRef>); | ||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetSpellEffectsExplicit, new OpGetSpellEffects<ExplicitRef>); | ||||
|             interpreter.installSegment5 (Compiler::Misc::opcodeGetCurrentTime, new OpGetCurrentTime); | ||||
|  |  | |||
|  | @ -5,6 +5,8 @@ | |||
| 
 | ||||
| #include "../mwgui/container.hpp" | ||||
| 
 | ||||
| #include "../mwmechanics/disease.hpp" | ||||
| 
 | ||||
| #include "class.hpp" | ||||
| #include "containerstore.hpp" | ||||
| 
 | ||||
|  | @ -21,6 +23,8 @@ namespace MWWorld | |||
|         if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) | ||||
|             return; | ||||
| 
 | ||||
|         MWMechanics::diseaseContact(actor, getTarget()); | ||||
| 
 | ||||
|         MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Container); | ||||
|         MWBase::Environment::get().getWindowManager()->getContainerWindow()->open(getTarget(), mLoot); | ||||
|     } | ||||
|  |  | |||
|  | @ -64,7 +64,7 @@ namespace MWWorld | |||
| 
 | ||||
|                 // initialise
 | ||||
|                 ESM::CellRef& cellRef = mPtr.getCellRef(); | ||||
|                 cellRef.mRefID = name; | ||||
|                 cellRef.mRefID = Misc::StringUtils::lowerCase(name); | ||||
|                 cellRef.mRefnum = -1; | ||||
|                 cellRef.mScale = 1; | ||||
|                 cellRef.mFactIndex = 0; | ||||
|  |  | |||
|  | @ -1967,11 +1967,11 @@ namespace MWWorld | |||
|         { | ||||
|             InventoryStore &inv = actor.getClass().getInventoryStore(actor); | ||||
| 
 | ||||
|             inv.equip(InventoryStore::Slot_Robe, inv.ContainerStore::add("WerewolfRobe", 1, actor), actor); | ||||
|             inv.equip(InventoryStore::Slot_Robe, inv.ContainerStore::add("werewolfrobe", 1, actor), actor); | ||||
|         } | ||||
|         else | ||||
|         { | ||||
|             actor.getClass().getContainerStore(actor).remove("WerewolfRobe", 1, actor); | ||||
|             actor.getClass().getContainerStore(actor).remove("werewolfrobe", 1, actor); | ||||
|         } | ||||
| 
 | ||||
|         if(actor.getRefData().getHandle() == "player") | ||||
|  |  | |||
|  | @ -251,6 +251,7 @@ namespace Compiler | |||
|             extensions.registerInstruction ("dropsoulgem", "c", opcodeDropSoulGem, opcodeDropSoulGemExplicit); | ||||
|             extensions.registerFunction ("getattacked", 'l', "", opcodeGetAttacked, opcodeGetAttackedExplicit); | ||||
|             extensions.registerFunction ("getweapondrawn", 'l', "", opcodeGetWeaponDrawn, opcodeGetWeaponDrawnExplicit); | ||||
|             extensions.registerFunction ("getspellreadied", 'l', "", opcodeGetSpellReadied, opcodeGetSpellReadiedExplicit); | ||||
|             extensions.registerFunction ("getspelleffects", 'l', "c", opcodeGetSpellEffects, opcodeGetSpellEffectsExplicit); | ||||
|             extensions.registerFunction ("getcurrenttime", 'f', "", opcodeGetCurrentTime); | ||||
|             extensions.registerInstruction ("setdelete", "l", opcodeSetDelete, opcodeSetDeleteExplicit); | ||||
|  |  | |||
|  | @ -205,6 +205,8 @@ namespace Compiler | |||
|         const int opcodeGetAttackedExplicit = 0x20001d4; | ||||
|         const int opcodeGetWeaponDrawn = 0x20001d7; | ||||
|         const int opcodeGetWeaponDrawnExplicit = 0x20001d8; | ||||
|         const int opcodeGetSpellReadied = 0x2000231; | ||||
|         const int opcodeGetSpellReadiedExplicit = 0x2000232; | ||||
|         const int opcodeGetSpellEffects = 0x20001db; | ||||
|         const int opcodeGetSpellEffectsExplicit = 0x20001dc; | ||||
|         const int opcodeGetCurrentTime = 0x20001dd; | ||||
|  |  | |||
|  | @ -8,7 +8,6 @@ set(MYGUI_FILES | |||
|     black.png | ||||
|     core.skin | ||||
|     core.xml | ||||
|     EBGaramond-Regular.ttf | ||||
|     openmw_alchemy_window.layout | ||||
|     openmw_book.layout | ||||
|     openmw_box.skin.xml | ||||
|  |  | |||
										
											Binary file not shown.
										
									
								
							|  | @ -7,9 +7,12 @@ | |||
|     <Property key="Visible" value="false"/> | ||||
| 
 | ||||
|     <!-- Log window --> | ||||
|     <Widget type="EditBox" skin="MW_ConsoleLog" position="5 5 380 328" align="Stretch" name="list_History"> | ||||
|     <Widget type="EditBox" skin="MW_TextBoxEdit" position="5 5 380 328" align="Stretch" name="list_History"> | ||||
|         <Property key="MultiLine" value="1"/> | ||||
|         <Property key="ReadOnly" value="true"/> | ||||
|         <Property key="FontName" value="MonoFont"/> | ||||
|         <Property key="TextAlign" value="Left Top"/> | ||||
|         <Property key="TextColour" value="1 1 1"/> | ||||
|     </Widget> | ||||
| 
 | ||||
|     <!-- Command line --> | ||||
|  |  | |||
|  | @ -2,19 +2,6 @@ | |||
| 
 | ||||
| <MyGUI type="Skin"> | ||||
| 
 | ||||
|     <!-- Console Output --> | ||||
| 
 | ||||
|     <Skin name="MW_LogClient" size="10 10"> | ||||
|         <Property key="FontName" value="MonoFont"/> | ||||
|         <Property key="TextAlign" value="Left Top"/> | ||||
|         <Property key="TextColour" value="1 1 1"/> | ||||
|         <BasisSkin type="EditText" offset="0 0 10 10" align="Stretch"/> | ||||
|     </Skin> | ||||
| 
 | ||||
|     <Skin name="MW_ConsoleLog" size="0 0 50 50"> | ||||
|         <Property key="WordWrap" value="true"/> | ||||
|         <Child type="TextBox" skin="MW_LogClient" offset="0 0 35 10" align="Stretch" name="Client"/> | ||||
|     </Skin> | ||||
| 
 | ||||
|     <!-- Console Input --> | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,31 +1,8 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <MyGUI type="Resource" version="1.1"> | ||||
|     <Resource type="ResourceTrueTypeFont" name="EB Garamond"> | ||||
|         <Property key="Source" value="EBGaramond-Regular.ttf"/> | ||||
|         <Property key="Size" value="16"/> | ||||
|         <Property key="Resolution" value="72"/> | ||||
|         <Property key="Antialias" value="false"/> | ||||
|         <Property key="TabWidth" value="8"/> | ||||
|         <Property key="OffsetHeight" value="0"/> | ||||
|         <Codes> | ||||
|             <Code range="33 126"/> | ||||
|             <Code range="160"/> <!-- Non-breaking space --> | ||||
|             <Code range="192 382"/> <!-- Central and Eastern European languages glyphs --> | ||||
|             <Code range="1025 1105"/> | ||||
|             <Code range="2026"/> <!-- Ellipsis --> | ||||
|             <Code range="8470"/> | ||||
|             <Code range="8211"/>   <!-- Minus --> | ||||
|             <Code range="8216 8217"/> <!-- Single quotes --> | ||||
|             <Code range="8220 8221"/> <!-- Right and Left Double Quotation mark --> | ||||
|             <Code hide="128"/> | ||||
|             <Code hide="1026 1039"/> | ||||
|             <Code hide="1104"/> | ||||
|         </Codes> | ||||
|     </Resource> | ||||
| 
 | ||||
|     <Resource type="ResourceTrueTypeFont" name="MonoFont"> | ||||
|         <Property key="Source" value="DejaVuLGCSansMono.ttf"/> | ||||
|         <Property key="Size" value="18"/> | ||||
|         <Property key="Size" value="17"/> | ||||
|         <Property key="Resolution" value="50"/> | ||||
|         <Property key="Antialias" value="false"/> | ||||
|         <Property key="TabWidth" value="8"/> | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue