mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Make Detect Life spell detect NPCs when in werewolf form (Fixes #1527)
This commit is contained in:
parent
4f9ebd148c
commit
1244da85df
4 changed files with 39 additions and 8 deletions
|
@ -384,6 +384,8 @@ namespace MWGui
|
|||
|
||||
void HUD::onFrame(float dt)
|
||||
{
|
||||
LocalMapBase::onFrame(dt);
|
||||
|
||||
mCellNameTimer -= dt;
|
||||
mWeaponSpellTimer -= dt;
|
||||
if (mCellNameTimer < 0)
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace MWGui
|
|||
, mLastDirectionX(0.0f)
|
||||
, mLastDirectionY(0.0f)
|
||||
, mCompass(NULL)
|
||||
, mMarkerUpdateTimer(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -345,6 +346,18 @@ namespace MWGui
|
|||
markerWidget->setUserString("IsMarker", "true");
|
||||
markerWidget->setUserData(markerPos);
|
||||
markerWidget->setColour(markerColour);
|
||||
mMarkerWidgets.push_back(markerWidget);
|
||||
}
|
||||
}
|
||||
|
||||
void LocalMapBase::onFrame(float dt)
|
||||
{
|
||||
mMarkerUpdateTimer += dt;
|
||||
|
||||
if (mMarkerUpdateTimer >= 0.25)
|
||||
{
|
||||
mMarkerUpdateTimer = 0;
|
||||
updateMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -471,6 +484,8 @@ namespace MWGui
|
|||
|
||||
void MapWindow::onFrame(float dt)
|
||||
{
|
||||
LocalMapBase::onFrame(dt);
|
||||
|
||||
for (std::vector<CellId>::iterator it = mQueuedToExplore.begin(); it != mQueuedToExplore.end(); ++it)
|
||||
{
|
||||
mGlobalMapRender->exploreCell(it->first, it->second);
|
||||
|
|
|
@ -35,6 +35,8 @@ namespace MWGui
|
|||
void setPlayerDir(const float x, const float y);
|
||||
void setPlayerPos(const float x, const float y);
|
||||
|
||||
void onFrame(float dt);
|
||||
|
||||
bool toggleFogOfWar();
|
||||
|
||||
struct MarkerPosition
|
||||
|
@ -73,12 +75,14 @@ namespace MWGui
|
|||
virtual void notifyMapChanged() {}
|
||||
|
||||
// Update markers (Detect X effects, Mark/Recall effects)
|
||||
// Note, door markers handled in setActiveCell
|
||||
// Note, door markers are handled in setActiveCell
|
||||
void updateMarkers();
|
||||
void addDetectionMarkers(int type);
|
||||
|
||||
OEngine::GUI::Layout* mLayout;
|
||||
|
||||
float mMarkerUpdateTimer;
|
||||
|
||||
bool mMapDragAndDrop;
|
||||
|
||||
float mLastPositionX;
|
||||
|
|
|
@ -2445,14 +2445,15 @@ namespace MWWorld
|
|||
if (!ptr.getRefData().isEnabled())
|
||||
return true;
|
||||
|
||||
// Consider references inside containers as well
|
||||
if (ptr.getClass().isActor() || ptr.getClass().getTypeName() == typeid(ESM::Container).name())
|
||||
// Consider references inside containers as well (except if we are looking for a Creature, they cannot be in containers)
|
||||
if (mType != World::Detect_Creature &&
|
||||
(ptr.getClass().isActor() || ptr.getClass().getTypeName() == typeid(ESM::Container).name()))
|
||||
{
|
||||
MWWorld::ContainerStore& store = ptr.getClass().getContainerStore(ptr);
|
||||
{
|
||||
for (MWWorld::ContainerStoreIterator it = store.begin(); it != store.end(); ++it)
|
||||
{
|
||||
if (needToAdd(*it))
|
||||
if (needToAdd(*it, mDetector))
|
||||
{
|
||||
mOut.push_back(ptr);
|
||||
return true;
|
||||
|
@ -2461,16 +2462,25 @@ namespace MWWorld
|
|||
}
|
||||
}
|
||||
|
||||
if (needToAdd(ptr))
|
||||
if (needToAdd(ptr, mDetector))
|
||||
mOut.push_back(ptr);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool needToAdd (MWWorld::Ptr ptr)
|
||||
bool needToAdd (MWWorld::Ptr ptr, MWWorld::Ptr detector)
|
||||
{
|
||||
if (mType == World::Detect_Creature && ptr.getClass().getTypeName() != typeid(ESM::Creature).name())
|
||||
if (mType == World::Detect_Creature)
|
||||
{
|
||||
// If in werewolf form, this detects only NPCs, otherwise only creatures
|
||||
if (detector.getClass().isNpc() && detector.getClass().getNpcStats(detector).isWerewolf())
|
||||
{
|
||||
if (ptr.getClass().getTypeName() != typeid(ESM::NPC).name())
|
||||
return false;
|
||||
}
|
||||
else if (ptr.getClass().getTypeName() != typeid(ESM::Creature).name())
|
||||
return false;
|
||||
}
|
||||
if (mType == World::Detect_Key && !ptr.getClass().isKey(ptr))
|
||||
return false;
|
||||
if (mType == World::Detect_Enchantment && ptr.getClass().getEnchantment(ptr).empty())
|
||||
|
|
Loading…
Reference in a new issue