mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-26 14:56:39 +00:00 
			
		
		
		
	Merge branch 'fix_fog_of_war' into 'master'
Always enable fog of war in map window (#7525) Closes #7525 See merge request OpenMW/openmw!3330
This commit is contained in:
		
						commit
						8307a3d82e
					
				
					 3 changed files with 10 additions and 7 deletions
				
			
		|  | @ -11,7 +11,7 @@ | |||
| #include <components/esm3/loadmgef.hpp> | ||||
| #include <components/misc/resourcehelpers.hpp> | ||||
| #include <components/resource/resourcesystem.hpp> | ||||
| #include <components/settings/settings.hpp> | ||||
| #include <components/settings/values.hpp> | ||||
| 
 | ||||
| #include "../mwbase/environment.hpp" | ||||
| #include "../mwbase/windowmanager.hpp" | ||||
|  | @ -88,7 +88,7 @@ namespace MWGui | |||
| 
 | ||||
|     HUD::HUD(CustomMarkerCollection& customMarkers, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender) | ||||
|         : WindowBase("openmw_hud.layout") | ||||
|         , LocalMapBase(customMarkers, localMapRender) | ||||
|         , LocalMapBase(customMarkers, localMapRender, Settings::map().mLocalMapHudFogOfWar) | ||||
|         , mHealth(nullptr) | ||||
|         , mMagicka(nullptr) | ||||
|         , mStamina(nullptr) | ||||
|  |  | |||
|  | @ -167,7 +167,8 @@ namespace MWGui | |||
| 
 | ||||
|     // ------------------------------------------------------
 | ||||
| 
 | ||||
|     LocalMapBase::LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender) | ||||
|     LocalMapBase::LocalMapBase( | ||||
|         CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender, bool fogOfWarEnabled) | ||||
|         : mLocalMapRender(localMapRender) | ||||
|         , mCurX(0) | ||||
|         , mCurY(0) | ||||
|  | @ -176,6 +177,7 @@ namespace MWGui | |||
|         , mCompass(nullptr) | ||||
|         , mChanged(true) | ||||
|         , mFogOfWarToggled(true) | ||||
|         , mFogOfWarEnabled(fogOfWarEnabled) | ||||
|         , mNumCells(1) | ||||
|         , mCellDistance(0) | ||||
|         , mCustomMarkers(markers) | ||||
|  | @ -244,7 +246,7 @@ namespace MWGui | |||
| 
 | ||||
|     void LocalMapBase::applyFogOfWar() | ||||
|     { | ||||
|         if (!mFogOfWarToggled || !Settings::map().mLocalMapHudFogOfWar) | ||||
|         if (!mFogOfWarToggled || !mFogOfWarEnabled) | ||||
|         { | ||||
|             for (auto& entry : mMaps) | ||||
|             { | ||||
|  | @ -595,7 +597,7 @@ namespace MWGui | |||
|                 else | ||||
|                     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); | ||||
|                 if (tex) | ||||
|  | @ -752,7 +754,7 @@ namespace MWGui | |||
| #else | ||||
|         : WindowPinnableBase("openmw_map_window.layout") | ||||
| #endif | ||||
|         , LocalMapBase(customMarkers, localMapRender) | ||||
|         , LocalMapBase(customMarkers, localMapRender, true) | ||||
|         , NoDrop(drag, mMainWidget) | ||||
|         , mGlobalMap(nullptr) | ||||
|         , mGlobalMapImage(nullptr) | ||||
|  |  | |||
|  | @ -73,7 +73,7 @@ namespace MWGui | |||
|     class LocalMapBase | ||||
|     { | ||||
|     public: | ||||
|         LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender); | ||||
|         LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender, bool fogOfWarEnabled); | ||||
|         virtual ~LocalMapBase(); | ||||
|         void init(MyGUI::ScrollView* widget, MyGUI::ImageBox* compass, int cellDistance = Constants::CellGridRadius); | ||||
| 
 | ||||
|  | @ -125,6 +125,7 @@ namespace MWGui | |||
|         std::string mPrefix; | ||||
|         bool mChanged; | ||||
|         bool mFogOfWarToggled; | ||||
|         bool mFogOfWarEnabled; | ||||
| 
 | ||||
|         int mNumCells; // for convenience, mCellDistance * 2 + 1
 | ||||
|         int mCellDistance; | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue