Make Detect Life spell detect NPCs when in werewolf form (Fixes #1527)

deque
scrawl 11 years ago
parent 4f9ebd148c
commit 1244da85df

@ -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())
return false;
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…
Cancel
Save