mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-28 17:56:37 +00:00 
			
		
		
		
	Merge remote-tracking branch 'scrawl/master'
This commit is contained in:
		
						commit
						31b8dad4e0
					
				
					 11 changed files with 77 additions and 49 deletions
				
			
		|  | @ -797,6 +797,10 @@ namespace MWClass | |||
|     boost::shared_ptr<MWWorld::Action> Npc::activate (const MWWorld::Ptr& ptr, | ||||
|         const MWWorld::Ptr& actor) const | ||||
|     { | ||||
|         // player got activated by another NPC
 | ||||
|         if(ptr.getRefData().getHandle() == "player") | ||||
|             return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor)); | ||||
| 
 | ||||
|         if(get(actor).isNpc() && get(actor).getNpcStats(actor).isWerewolf()) | ||||
|         { | ||||
|             const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  | @ -814,10 +818,6 @@ namespace MWClass | |||
|         if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak)) | ||||
|             return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr)); // stealing
 | ||||
|          | ||||
|         // player got activated by another NPC
 | ||||
|         if(ptr.getRefData().getHandle() == "player") | ||||
|             return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor)); | ||||
| 
 | ||||
|         return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(ptr)); | ||||
| 
 | ||||
|     } | ||||
|  |  | |||
|  | @ -144,7 +144,6 @@ namespace MWDialogue | |||
| 
 | ||||
|         //setup the list of topics known by the actor. Topics who are also on the knownTopics list will be added to the GUI
 | ||||
|         updateTopics(); | ||||
|         updateGlobals(); | ||||
| 
 | ||||
|         //greeting
 | ||||
|         const MWWorld::Store<ESM::Dialogue> &dialogs = | ||||
|  | @ -392,6 +391,8 @@ namespace MWDialogue | |||
|         win->setKeywords(keywordList); | ||||
| 
 | ||||
|         mChoice = choice; | ||||
| 
 | ||||
|         updateGlobals(); | ||||
|     } | ||||
| 
 | ||||
|     void DialogueManager::keywordSelected (const std::string& keyword) | ||||
|  |  | |||
|  | @ -783,7 +783,8 @@ public: | |||
| 
 | ||||
|             ActiveTextFormats::iterator i = mActiveTextFormats.find (Font); | ||||
| 
 | ||||
|             mNode->outOfDate (i->second->mRenderItem); | ||||
|             if (mNode) | ||||
|                 mNode->outOfDate (i->second->mRenderItem); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | @ -1125,6 +1126,8 @@ public: | |||
| protected: | ||||
|     void onMouseLostFocus(Widget* _new) | ||||
|     { | ||||
|         // NOTE: MyGUI also fires eventMouseLostFocus for widgets that are about to be destroyed (if they had focus).
 | ||||
|         // Child widgets may already be destroyed! So be careful.
 | ||||
|         if (PageDisplay* pd = dynamic_cast <PageDisplay*> (getSubWidgetText ())) | ||||
|         { | ||||
|             pd->onMouseLostFocus (); | ||||
|  |  | |||
|  | @ -41,6 +41,13 @@ namespace MWGui | |||
| 
 | ||||
|     LocalMapBase::~LocalMapBase() | ||||
|     { | ||||
|         // Clear our "lost focus" delegate for marker widgets first, otherwise it will
 | ||||
|         // fire when the widget is about to be destroyed and the mouse cursor is over it.
 | ||||
|         // At that point, other widgets may already be destroyed, so applyFogOfWar (which is called by the delegate) would crash.
 | ||||
|         for (std::vector<MyGUI::Widget*>::iterator it = mDoorMarkerWidgets.begin(); it != mDoorMarkerWidgets.end(); ++it) | ||||
|             (*it)->eventMouseLostFocus.clear(); | ||||
|         for (std::vector<MyGUI::Widget*>::iterator it = mMarkerWidgets.begin(); it != mMarkerWidgets.end(); ++it) | ||||
|             (*it)->eventMouseLostFocus.clear(); | ||||
|     } | ||||
| 
 | ||||
|     void LocalMapBase::init(MyGUI::ScrollView* widget, MyGUI::ImageBox* compass, OEngine::GUI::Layout* layout, bool mapDragAndDrop) | ||||
|  | @ -86,6 +93,11 @@ namespace MWGui | |||
|     { | ||||
|         mFogOfWar = !mFogOfWar; | ||||
|         applyFogOfWar(); | ||||
| 
 | ||||
|         // clear all previous door markers
 | ||||
|         for (std::vector<MyGUI::Widget*>::iterator it = mDoorMarkerWidgets.begin(); it != mDoorMarkerWidgets.end(); ++it) | ||||
|             MyGUI::Gui::getInstance().destroyWidget(*it); | ||||
|         mDoorMarkerWidgets.clear(); | ||||
|     } | ||||
| 
 | ||||
|     void LocalMapBase::applyFogOfWar() | ||||
|  | @ -172,14 +184,10 @@ namespace MWGui | |||
|         mInterior = interior; | ||||
|         mChanged = false; | ||||
| 
 | ||||
|         // clear all previous markers
 | ||||
|         for (unsigned int i=0; i< mLocalMap->getChildCount(); ++i) | ||||
|         { | ||||
|             if (mLocalMap->getChildAt(i)->getName ().substr (0, 4) == "Door") | ||||
|             { | ||||
|                 MyGUI::Gui::getInstance ().destroyWidget (mLocalMap->getChildAt(i)); | ||||
|             } | ||||
|         } | ||||
|         // clear all previous door markers
 | ||||
|         for (std::vector<MyGUI::Widget*>::iterator it = mDoorMarkerWidgets.begin(); it != mDoorMarkerWidgets.end(); ++it) | ||||
|             MyGUI::Gui::getInstance().destroyWidget(*it); | ||||
|         mDoorMarkerWidgets.clear(); | ||||
| 
 | ||||
|         // Update the map textures
 | ||||
|         for (int mx=0; mx<3; ++mx) | ||||
|  | @ -243,6 +251,8 @@ namespace MWGui | |||
|             // Used by tooltips to not show the tooltip if marker is hidden by fog of war
 | ||||
|             markerWidget->setUserString("IsMarker", "true"); | ||||
|             markerWidget->setUserData(markerPos); | ||||
| 
 | ||||
|             mDoorMarkerWidgets.push_back(markerWidget); | ||||
|         } | ||||
| 
 | ||||
|         updateMarkers(); | ||||
|  | @ -344,13 +354,9 @@ namespace MWGui | |||
|     void LocalMapBase::updateMarkers() | ||||
|     { | ||||
|         // clear all previous markers
 | ||||
|         for (unsigned int i=0; i< mLocalMap->getChildCount(); ++i) | ||||
|         { | ||||
|             if (mLocalMap->getChildAt(i)->getName ().substr (0, 6) == "Marker") | ||||
|             { | ||||
|                 MyGUI::Gui::getInstance ().destroyWidget (mLocalMap->getChildAt(i)); | ||||
|             } | ||||
|         } | ||||
|         for (std::vector<MyGUI::Widget*>::iterator it = mMarkerWidgets.begin(); it != mMarkerWidgets.end(); ++it) | ||||
|             MyGUI::Gui::getInstance().destroyWidget(*it); | ||||
|         mMarkerWidgets.clear(); | ||||
| 
 | ||||
|         addDetectionMarkers(MWBase::World::Detect_Creature); | ||||
|         addDetectionMarkers(MWBase::World::Detect_Key); | ||||
|  | @ -373,6 +379,7 @@ namespace MWGui | |||
|             markerWidget->setImageTexture("textures\\menu_map_smark.dds"); | ||||
|             markerWidget->setUserString("IsMarker", "true"); | ||||
|             markerWidget->setUserData(markerPos); | ||||
|             mMarkerWidgets.push_back(markerWidget); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -55,12 +55,13 @@ namespace MWGui | |||
|         bool mChanged; | ||||
|         bool mFogOfWar; | ||||
| 
 | ||||
|         typedef std::pair<int, int> CellId; | ||||
|         std::vector<CellId> mMarkers; | ||||
| 
 | ||||
|         std::vector<MyGUI::ImageBox*> mMapWidgets; | ||||
|         std::vector<MyGUI::ImageBox*> mFogWidgets; | ||||
| 
 | ||||
|         // Keep track of created marker widgets, just to easily remove them later.
 | ||||
|         std::vector<MyGUI::Widget*> mDoorMarkerWidgets; // Doors
 | ||||
|         std::vector<MyGUI::Widget*> mMarkerWidgets; // Other markers
 | ||||
| 
 | ||||
|         void applyFogOfWar(); | ||||
| 
 | ||||
|         void onMarkerFocused(MyGUI::Widget* w1, MyGUI::Widget* w2); | ||||
|  | @ -127,6 +128,10 @@ namespace MWGui | |||
|         MyGUI::IntPoint mLastDragPos; | ||||
|         bool mGlobal; | ||||
| 
 | ||||
|         // Markers on global map
 | ||||
|         typedef std::pair<int, int> CellId; | ||||
|         std::vector<CellId> mMarkers; | ||||
| 
 | ||||
|         MyGUI::Button* mEventBoxGlobal; | ||||
|         MyGUI::Button* mEventBoxLocal; | ||||
| 
 | ||||
|  |  | |||
|  | @ -250,6 +250,9 @@ namespace MWMechanics | |||
|             if (state == MWMechanics::DrawState_Spell || state == MWMechanics::DrawState_Nothing) | ||||
|                 actorCls.getCreatureStats(actor).setDrawState(MWMechanics::DrawState_Weapon); | ||||
| 
 | ||||
|             // TODO: Check equipped weapon and equip a different one if we can't attack with it
 | ||||
|             // (e.g. no ammunition, or wrong type of ammunition equipped, etc. autoEquip is not very smart in this regard))
 | ||||
| 
 | ||||
|             //Get weapon speed and range
 | ||||
|             MWWorld::ContainerStoreIterator weaponSlot = | ||||
|                 MWMechanics::getActiveWeapon(actorCls.getCreatureStats(actor), actorCls.getInventoryStore(actor), &weaptype); | ||||
|  | @ -260,8 +263,9 @@ namespace MWMechanics | |||
|                     MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>(); | ||||
|                 weapRange = gmst.find("fHandToHandReach")->getFloat(); | ||||
|             } | ||||
|             else | ||||
|             else if (weaptype != WeapType_PickProbe && weaptype != WeapType_Spell) | ||||
|             { | ||||
|                 // All other WeapTypes are actually weapons, so get<ESM::Weapon> is safe.
 | ||||
|                 weapon = weaponSlot->get<ESM::Weapon>()->mBase; | ||||
|                 weapRange = weapon->mData.mReach; | ||||
|                 weapSpeed = weapon->mData.mSpeed; | ||||
|  |  | |||
|  | @ -825,13 +825,13 @@ namespace MWMechanics | |||
|         commitCrime(ptr, victim, OT_Theft, item.getClass().getValue(item) * count); | ||||
|     } | ||||
| 
 | ||||
|     bool MechanicsManager::commitCrime(const MWWorld::Ptr &ptr, const MWWorld::Ptr &victim, OffenseType type, int arg) | ||||
|     bool MechanicsManager::commitCrime(const MWWorld::Ptr &player, const MWWorld::Ptr &victim, OffenseType type, int arg) | ||||
|     { | ||||
|         // NOTE: int arg can be from itemTaken() so DON'T modify it, since it is
 | ||||
|         //  passed to reportCrime later on in this function.
 | ||||
| 
 | ||||
|         // Only player can commit crime
 | ||||
|         if (ptr.getRefData().getHandle() != "player") | ||||
|         if (player.getRefData().getHandle() != "player") | ||||
|             return false; | ||||
| 
 | ||||
|         const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore(); | ||||
|  | @ -856,7 +856,7 @@ namespace MWMechanics | |||
| 
 | ||||
|         // Find all the actors within the alarm radius
 | ||||
|         std::vector<MWWorld::Ptr> neighbors; | ||||
|         mActors.getObjectsInRange(Ogre::Vector3(ptr.getRefData().getPosition().pos), | ||||
|         mActors.getObjectsInRange(Ogre::Vector3(player.getRefData().getPosition().pos), | ||||
|                                     esmStore.get<ESM::GameSetting>().find("fAlarmRadius")->getInt(), neighbors); | ||||
| 
 | ||||
|         int id = MWBase::Environment::get().getWorld()->getPlayer().getNewCrimeId(); | ||||
|  | @ -864,10 +864,10 @@ namespace MWMechanics | |||
|         // Find actors who witnessed the crime
 | ||||
|         for (std::vector<MWWorld::Ptr>::iterator it = neighbors.begin(); it != neighbors.end(); ++it) | ||||
|         { | ||||
|             if (*it == ptr) continue; // not the player
 | ||||
|             if (*it == player) continue; // not the player
 | ||||
| 
 | ||||
|             // Was the crime seen?
 | ||||
|             if (MWBase::Environment::get().getWorld()->getLOS(ptr, *it) && awarenessCheck(ptr, *it) ) | ||||
|             if (MWBase::Environment::get().getWorld()->getLOS(player, *it) && awarenessCheck(player, *it) ) | ||||
|             { | ||||
|                 // TODO: Add more messages
 | ||||
|                 if (type == OT_Theft) | ||||
|  | @ -881,8 +881,8 @@ namespace MWMechanics | |||
|                     // This applies to both NPCs and creatures
 | ||||
| 
 | ||||
|                     // ... except if this is a guard: then the player is given a chance to pay a fine / go to jail instead
 | ||||
|                     if (type == OT_Assault && !ptr.getClass().isClass(ptr, "guard")) | ||||
|                         MWBase::Environment::get().getMechanicsManager()->startCombat(victim, ptr); | ||||
|                     if (type == OT_Assault && !it->getClass().isClass(*it, "guard")) | ||||
|                         MWBase::Environment::get().getMechanicsManager()->startCombat(victim, player); | ||||
|                 } | ||||
| 
 | ||||
|                 // Crime reporting only applies to NPCs
 | ||||
|  | @ -897,7 +897,7 @@ namespace MWMechanics | |||
|                     // Tell everyone, including yourself
 | ||||
|                     for (std::vector<MWWorld::Ptr>::iterator it1 = neighbors.begin(); it1 != neighbors.end(); ++it1) | ||||
|                     { | ||||
|                         if (   *it1 == ptr  | ||||
|                         if (   *it1 == player | ||||
|                             || !it1->getClass().isNpc()) continue; // not the player and is an NPC
 | ||||
| 
 | ||||
|                         // Will other witnesses paticipate in crime
 | ||||
|  | @ -914,7 +914,7 @@ namespace MWMechanics | |||
|             } | ||||
|         } | ||||
|         if (reported) | ||||
|             reportCrime(ptr, victim, type, arg); | ||||
|             reportCrime(player, victim, type, arg); | ||||
|         return reported; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -92,14 +92,17 @@ namespace | |||
|         if (!record) | ||||
|             return; | ||||
| 
 | ||||
|         for (typename MWWorld::CellRefList<T>::List::iterator iter (collection.mList.begin()); | ||||
|             iter!=collection.mList.end(); ++iter) | ||||
|             if (iter->mRef.mRefNum==state.mRef.mRefNum) | ||||
|             { | ||||
|                 // overwrite existing reference
 | ||||
|                 iter->load (state); | ||||
|                 return; | ||||
|             } | ||||
|         if (state.mRef.mRefNum.mContentFile != -1) | ||||
|         { | ||||
|             for (typename MWWorld::CellRefList<T>::List::iterator iter (collection.mList.begin()); | ||||
|                 iter!=collection.mList.end(); ++iter) | ||||
|                 if (iter->mRef.mRefNum==state.mRef.mRefNum) | ||||
|                 { | ||||
|                     // overwrite existing reference
 | ||||
|                     iter->load (state); | ||||
|                     return; | ||||
|                 } | ||||
|         } | ||||
| 
 | ||||
|         // new reference
 | ||||
|         MWWorld::LiveCellRef<T> ref (record); | ||||
|  |  | |||
|  | @ -192,12 +192,17 @@ void MWWorld::InventoryStore::autoEquip (const MWWorld::Ptr& actor) | |||
|     { | ||||
|         Ptr test = *iter; | ||||
| 
 | ||||
|         // Don't autoEquip lights
 | ||||
|         // Don't autoEquip lights. Handled in Actors::updateEquippedLight based on environment light.
 | ||||
|         if (test.getTypeName() == typeid(ESM::Light).name()) | ||||
|         { | ||||
|             continue; | ||||
|         } | ||||
| 
 | ||||
|         // Don't auto-equip probes or lockpicks. NPCs can't use them (yet). And AiCombat would attempt to "attack" with them.
 | ||||
|         // NOTE: In the future AiCombat should handle equipping appropriate weapons
 | ||||
|         if (test.getTypeName() == typeid(ESM::Lockpick).name() || test.getTypeName() == typeid(ESM::Probe).name()) | ||||
|             continue; | ||||
| 
 | ||||
|         // Only autoEquip if we are the original owner of the item.
 | ||||
|         // This stops merchants from auto equipping anything you sell to them.
 | ||||
|         // ...unless this is a companion, he should always equip items given to him.
 | ||||
|  |  | |||
|  | @ -22,7 +22,7 @@ void MWWorld::LiveCellRefBase::loadImp (const ESM::ObjectState& state) | |||
|         std::string scriptId = mClass->getScript (ptr); | ||||
| 
 | ||||
|         mData.setLocals (*MWBase::Environment::get().getWorld()->getStore(). | ||||
|             get<ESM::Script>().search (scriptId)); | ||||
|             get<ESM::Script>().find (scriptId)); | ||||
|         mData.getLocals().read (state.mLocals, scriptId); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -3,10 +3,8 @@ | |||
| <MyGUI type="Layout"> | ||||
|     <Widget type="Widget" layer="HUD" position="0 0 300 200" name="_Main"> | ||||
|         <!-- Energy bars --> | ||||
|         <Widget type="Widget" skin="" position="13 131 65 12" align="Left Bottom" name="EnemyHealthFrame"> | ||||
|             <Widget type="ProgressBar" skin="MW_EnergyBar_Yellow" position="0 0 65 12" align="Left Bottom" name="EnemyHealth"> | ||||
|                 <Property key="Visible" value="false"/> | ||||
|             </Widget> | ||||
|         <Widget type="ProgressBar" skin="MW_EnergyBar_Yellow" position="13 131 65 12" align="Left Bottom" name="EnemyHealth"> | ||||
|             <Property key="Visible" value="false"/> | ||||
|         </Widget> | ||||
|         <Widget type="Button" skin="" position="13 146 65 12" align="Left Bottom" name="HealthFrame"> | ||||
|             <UserString key="ToolTipType" value="Layout"/> | ||||
|  | @ -54,6 +52,7 @@ | |||
|             <Property key="TextAlign" value="Left"/> | ||||
|             <Property key="TextShadow" value="true"/> | ||||
|             <Property key="TextShadowColour" value="0 0 0"/> | ||||
|             <Property key="NeedMouse" value="false"/> | ||||
|         </Widget> | ||||
| 
 | ||||
|         <!-- Equipped weapon box --> | ||||
|  | @ -101,6 +100,7 @@ | |||
|             <Property key="TextAlign" value="Right"/> | ||||
|             <Property key="TextShadow" value="true"/> | ||||
|             <Property key="TextShadowColour" value="0 0 0"/> | ||||
|             <Property key="NeedMouse" value="false"/> | ||||
|         </Widget> | ||||
| 
 | ||||
|         <!-- Map box --> | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue