1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-27 05:10:26 +00:00

Always enable fog of war in map window

This commit is contained in:
elsid 2023-08-10 20:49:35 +02:00
parent f1c3b42cfb
commit 1c4b6a552f
No known key found for this signature in database
GPG key ID: 4DE04C198CBA7625
3 changed files with 10 additions and 7 deletions

View file

@ -11,7 +11,7 @@
#include <components/esm3/loadmgef.hpp> #include <components/esm3/loadmgef.hpp>
#include <components/misc/resourcehelpers.hpp> #include <components/misc/resourcehelpers.hpp>
#include <components/resource/resourcesystem.hpp> #include <components/resource/resourcesystem.hpp>
#include <components/settings/settings.hpp> #include <components/settings/values.hpp>
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
@ -88,7 +88,7 @@ namespace MWGui
HUD::HUD(CustomMarkerCollection& customMarkers, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender) HUD::HUD(CustomMarkerCollection& customMarkers, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender)
: WindowBase("openmw_hud.layout") : WindowBase("openmw_hud.layout")
, LocalMapBase(customMarkers, localMapRender) , LocalMapBase(customMarkers, localMapRender, Settings::map().mLocalMapHudFogOfWar)
, mHealth(nullptr) , mHealth(nullptr)
, mMagicka(nullptr) , mMagicka(nullptr)
, mStamina(nullptr) , mStamina(nullptr)

View file

@ -167,7 +167,8 @@ namespace MWGui
// ------------------------------------------------------ // ------------------------------------------------------
LocalMapBase::LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender) LocalMapBase::LocalMapBase(
CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender, bool fogOfWarEnabled)
: mLocalMapRender(localMapRender) : mLocalMapRender(localMapRender)
, mCurX(0) , mCurX(0)
, mCurY(0) , mCurY(0)
@ -176,6 +177,7 @@ namespace MWGui
, mCompass(nullptr) , mCompass(nullptr)
, mChanged(true) , mChanged(true)
, mFogOfWarToggled(true) , mFogOfWarToggled(true)
, mFogOfWarEnabled(fogOfWarEnabled)
, mNumCells(1) , mNumCells(1)
, mCellDistance(0) , mCellDistance(0)
, mCustomMarkers(markers) , mCustomMarkers(markers)
@ -244,7 +246,7 @@ namespace MWGui
void LocalMapBase::applyFogOfWar() void LocalMapBase::applyFogOfWar()
{ {
if (!mFogOfWarToggled || !Settings::map().mLocalMapHudFogOfWar) if (!mFogOfWarToggled || !mFogOfWarEnabled)
{ {
for (auto& entry : mMaps) for (auto& entry : mMaps)
{ {
@ -595,7 +597,7 @@ namespace MWGui
else else
entry.mMapTexture = std::make_unique<osgMyGUI::OSGTexture>(std::string(), nullptr); entry.mMapTexture = std::make_unique<osgMyGUI::OSGTexture>(std::string(), nullptr);
} }
if (!entry.mFogTexture && mFogOfWarToggled && Settings::map().mLocalMapHudFogOfWar) if (!entry.mFogTexture && mFogOfWarToggled && mFogOfWarEnabled)
{ {
osg::ref_ptr<osg::Texture2D> tex = mLocalMapRender->getFogOfWarTexture(entry.mCellX, entry.mCellY); osg::ref_ptr<osg::Texture2D> tex = mLocalMapRender->getFogOfWarTexture(entry.mCellX, entry.mCellY);
if (tex) if (tex)
@ -752,7 +754,7 @@ namespace MWGui
#else #else
: WindowPinnableBase("openmw_map_window.layout") : WindowPinnableBase("openmw_map_window.layout")
#endif #endif
, LocalMapBase(customMarkers, localMapRender) , LocalMapBase(customMarkers, localMapRender, true)
, NoDrop(drag, mMainWidget) , NoDrop(drag, mMainWidget)
, mGlobalMap(nullptr) , mGlobalMap(nullptr)
, mGlobalMapImage(nullptr) , mGlobalMapImage(nullptr)

View file

@ -73,7 +73,7 @@ namespace MWGui
class LocalMapBase class LocalMapBase
{ {
public: public:
LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender); LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender, bool fogOfWarEnabled);
virtual ~LocalMapBase(); virtual ~LocalMapBase();
void init(MyGUI::ScrollView* widget, MyGUI::ImageBox* compass, int cellDistance = Constants::CellGridRadius); void init(MyGUI::ScrollView* widget, MyGUI::ImageBox* compass, int cellDistance = Constants::CellGridRadius);
@ -125,6 +125,7 @@ namespace MWGui
std::string mPrefix; std::string mPrefix;
bool mChanged; bool mChanged;
bool mFogOfWarToggled; bool mFogOfWarToggled;
bool mFogOfWarEnabled;
int mNumCells; // for convenience, mCellDistance * 2 + 1 int mNumCells; // for convenience, mCellDistance * 2 + 1
int mCellDistance; int mCellDistance;