mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-01 19:36:40 +00:00
Use settings values for Map settings
This commit is contained in:
parent
bdb4808588
commit
9acb93ab29
7 changed files with 56 additions and 62 deletions
|
@ -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, Settings::Manager::getBool("local map hud fog of war", "Map"))
|
, LocalMapBase(customMarkers, localMapRender)
|
||||||
, mHealth(nullptr)
|
, mHealth(nullptr)
|
||||||
, mMagicka(nullptr)
|
, mMagicka(nullptr)
|
||||||
, mStamina(nullptr)
|
, mStamina(nullptr)
|
||||||
|
|
|
@ -87,14 +87,13 @@ namespace
|
||||||
|
|
||||||
int getLocalViewingDistance()
|
int getLocalViewingDistance()
|
||||||
{
|
{
|
||||||
if (!Settings::Manager::getBool("allow zooming", "Map"))
|
if (!Settings::map().mAllowZooming)
|
||||||
return Constants::CellGridRadius;
|
return Constants::CellGridRadius;
|
||||||
if (!Settings::Manager::getBool("distant terrain", "Terrain"))
|
if (!Settings::Manager::getBool("distant terrain", "Terrain"))
|
||||||
return Constants::CellGridRadius;
|
return Constants::CellGridRadius;
|
||||||
const int maxLocalViewingDistance
|
|
||||||
= std::max(Settings::Manager::getInt("max local viewing distance", "Map"), Constants::CellGridRadius);
|
|
||||||
const int viewingDistanceInCells = Settings::camera().mViewingDistance / Constants::CellSizeInUnits;
|
const int viewingDistanceInCells = Settings::camera().mViewingDistance / Constants::CellSizeInUnits;
|
||||||
return std::clamp(viewingDistanceInCells, Constants::CellGridRadius, maxLocalViewingDistance);
|
return std::clamp(
|
||||||
|
viewingDistanceInCells, Constants::CellGridRadius, Settings::map().mMaxLocalViewingDistance.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,8 +167,7 @@ namespace MWGui
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
|
|
||||||
LocalMapBase::LocalMapBase(
|
LocalMapBase::LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender)
|
||||||
CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender, bool fogOfWarEnabled)
|
|
||||||
: mLocalMapRender(localMapRender)
|
: mLocalMapRender(localMapRender)
|
||||||
, mCurX(0)
|
, mCurX(0)
|
||||||
, mCurY(0)
|
, mCurY(0)
|
||||||
|
@ -178,8 +176,6 @@ namespace MWGui
|
||||||
, mCompass(nullptr)
|
, mCompass(nullptr)
|
||||||
, mChanged(true)
|
, mChanged(true)
|
||||||
, mFogOfWarToggled(true)
|
, mFogOfWarToggled(true)
|
||||||
, mFogOfWarEnabled(fogOfWarEnabled)
|
|
||||||
, mMapWidgetSize(0)
|
|
||||||
, mNumCells(1)
|
, mNumCells(1)
|
||||||
, mCellDistance(0)
|
, mCellDistance(0)
|
||||||
, mCustomMarkers(markers)
|
, mCustomMarkers(markers)
|
||||||
|
@ -200,11 +196,12 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
mLocalMap = widget;
|
mLocalMap = widget;
|
||||||
mCompass = compass;
|
mCompass = compass;
|
||||||
mMapWidgetSize = std::max(1, Settings::Manager::getInt("local map widget size", "Map"));
|
|
||||||
mCellDistance = cellDistance;
|
mCellDistance = cellDistance;
|
||||||
mNumCells = mCellDistance * 2 + 1;
|
mNumCells = mCellDistance * 2 + 1;
|
||||||
|
|
||||||
mLocalMap->setCanvasSize(mMapWidgetSize * mNumCells, mMapWidgetSize * mNumCells);
|
const int mapWidgetSize = Settings::map().mLocalMapWidgetSize;
|
||||||
|
|
||||||
|
mLocalMap->setCanvasSize(mapWidgetSize * mNumCells, mapWidgetSize * mNumCells);
|
||||||
|
|
||||||
mCompass->setDepth(Local_CompassLayer);
|
mCompass->setDepth(Local_CompassLayer);
|
||||||
mCompass->setNeedMouseFocus(false);
|
mCompass->setNeedMouseFocus(false);
|
||||||
|
@ -214,12 +211,12 @@ namespace MWGui
|
||||||
for (int my = 0; my < mNumCells; ++my)
|
for (int my = 0; my < mNumCells; ++my)
|
||||||
{
|
{
|
||||||
MyGUI::ImageBox* map = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
MyGUI::ImageBox* map = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||||
MyGUI::IntCoord(mx * mMapWidgetSize, my * mMapWidgetSize, mMapWidgetSize, mMapWidgetSize),
|
MyGUI::IntCoord(mx * mapWidgetSize, my * mapWidgetSize, mapWidgetSize, mapWidgetSize),
|
||||||
MyGUI::Align::Top | MyGUI::Align::Left);
|
MyGUI::Align::Top | MyGUI::Align::Left);
|
||||||
map->setDepth(Local_MapLayer);
|
map->setDepth(Local_MapLayer);
|
||||||
|
|
||||||
MyGUI::ImageBox* fog = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
MyGUI::ImageBox* fog = mLocalMap->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||||
MyGUI::IntCoord(mx * mMapWidgetSize, my * mMapWidgetSize, mMapWidgetSize, mMapWidgetSize),
|
MyGUI::IntCoord(mx * mapWidgetSize, my * mapWidgetSize, mapWidgetSize, mapWidgetSize),
|
||||||
MyGUI::Align::Top | MyGUI::Align::Left);
|
MyGUI::Align::Top | MyGUI::Align::Left);
|
||||||
fog->setDepth(Local_FogLayer);
|
fog->setDepth(Local_FogLayer);
|
||||||
fog->setColour(MyGUI::Colour(0, 0, 0));
|
fog->setColour(MyGUI::Colour(0, 0, 0));
|
||||||
|
@ -247,7 +244,7 @@ namespace MWGui
|
||||||
|
|
||||||
void LocalMapBase::applyFogOfWar()
|
void LocalMapBase::applyFogOfWar()
|
||||||
{
|
{
|
||||||
if (!mFogOfWarToggled || !mFogOfWarEnabled)
|
if (!mFogOfWarToggled || !Settings::map().mLocalMapHudFogOfWar)
|
||||||
{
|
{
|
||||||
for (auto& entry : mMaps)
|
for (auto& entry : mMaps)
|
||||||
{
|
{
|
||||||
|
@ -464,7 +461,7 @@ namespace MWGui
|
||||||
|
|
||||||
float LocalMapBase::getWidgetSize() const
|
float LocalMapBase::getWidgetSize() const
|
||||||
{
|
{
|
||||||
return mLocalMapZoom * mMapWidgetSize;
|
return mLocalMapZoom * Settings::map().mLocalMapWidgetSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocalMapBase::setPlayerPos(int cellX, int cellY, const float nx, const float ny)
|
void LocalMapBase::setPlayerPos(int cellX, int cellY, const float nx, const float ny)
|
||||||
|
@ -598,7 +595,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 && mFogOfWarEnabled)
|
if (!entry.mFogTexture && mFogOfWarToggled && Settings::map().mLocalMapHudFogOfWar)
|
||||||
{
|
{
|
||||||
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)
|
||||||
|
@ -760,12 +757,10 @@ namespace MWGui
|
||||||
, mGlobalMap(nullptr)
|
, mGlobalMap(nullptr)
|
||||||
, mGlobalMapImage(nullptr)
|
, mGlobalMapImage(nullptr)
|
||||||
, mGlobalMapOverlay(nullptr)
|
, mGlobalMapOverlay(nullptr)
|
||||||
, mGlobal(Settings::Manager::getBool("global", "Map"))
|
|
||||||
, mEventBoxGlobal(nullptr)
|
, mEventBoxGlobal(nullptr)
|
||||||
, mEventBoxLocal(nullptr)
|
, mEventBoxLocal(nullptr)
|
||||||
, mGlobalMapRender(std::make_unique<MWRender::GlobalMap>(localMapRender->getRoot(), workQueue))
|
, mGlobalMapRender(std::make_unique<MWRender::GlobalMap>(localMapRender->getRoot(), workQueue))
|
||||||
, mEditNoteDialog()
|
, mEditNoteDialog()
|
||||||
, mAllowZooming(Settings::Manager::getBool("allow zooming", "Map"))
|
|
||||||
{
|
{
|
||||||
static bool registered = false;
|
static bool registered = false;
|
||||||
if (!registered)
|
if (!registered)
|
||||||
|
@ -799,12 +794,18 @@ namespace MWGui
|
||||||
|
|
||||||
getWidget(mButton, "WorldButton");
|
getWidget(mButton, "WorldButton");
|
||||||
mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked);
|
mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &MapWindow::onWorldButtonClicked);
|
||||||
mButton->setCaptionWithReplacing(mGlobal ? "#{sLocal}" : "#{sWorld}");
|
|
||||||
|
const bool global = Settings::map().mGlobal;
|
||||||
|
|
||||||
|
mButton->setCaptionWithReplacing(global ? "#{sLocal}" : "#{sWorld}");
|
||||||
|
|
||||||
getWidget(mEventBoxGlobal, "EventBoxGlobal");
|
getWidget(mEventBoxGlobal, "EventBoxGlobal");
|
||||||
mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
mEventBoxGlobal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
||||||
mEventBoxGlobal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
mEventBoxGlobal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
||||||
if (mAllowZooming)
|
|
||||||
|
const bool allowZooming = Settings::map().mAllowZooming;
|
||||||
|
|
||||||
|
if (allowZooming)
|
||||||
mEventBoxGlobal->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
mEventBoxGlobal->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
||||||
mEventBoxGlobal->setDepth(Global_ExploreOverlayLayer);
|
mEventBoxGlobal->setDepth(Global_ExploreOverlayLayer);
|
||||||
|
|
||||||
|
@ -812,13 +813,13 @@ namespace MWGui
|
||||||
mEventBoxLocal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
mEventBoxLocal->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
||||||
mEventBoxLocal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
mEventBoxLocal->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
||||||
mEventBoxLocal->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onMapDoubleClicked);
|
mEventBoxLocal->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onMapDoubleClicked);
|
||||||
if (mAllowZooming)
|
if (allowZooming)
|
||||||
mEventBoxLocal->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
mEventBoxLocal->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
||||||
|
|
||||||
LocalMapBase::init(mLocalMap, mPlayerArrowLocal, getLocalViewingDistance());
|
LocalMapBase::init(mLocalMap, mPlayerArrowLocal, getLocalViewingDistance());
|
||||||
|
|
||||||
mGlobalMap->setVisible(mGlobal);
|
mGlobalMap->setVisible(global);
|
||||||
mLocalMap->setVisible(!mGlobal);
|
mLocalMap->setVisible(!global);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::onNoteEditOk()
|
void MapWindow::onNoteEditOk()
|
||||||
|
@ -895,8 +896,7 @@ namespace MWGui
|
||||||
|
|
||||||
void MapWindow::onMapZoomed(MyGUI::Widget* sender, int rel)
|
void MapWindow::onMapZoomed(MyGUI::Widget* sender, int rel)
|
||||||
{
|
{
|
||||||
const static int localWidgetSize = Settings::Manager::getInt("local map widget size", "Map");
|
const int localWidgetSize = Settings::map().mLocalMapWidgetSize;
|
||||||
|
|
||||||
const bool zoomOut = rel < 0;
|
const bool zoomOut = rel < 0;
|
||||||
const bool zoomIn = !zoomOut;
|
const bool zoomIn = !zoomOut;
|
||||||
const double speedDiff = zoomOut ? 1.0 / speed : speed;
|
const double speedDiff = zoomOut ? 1.0 / speed : speed;
|
||||||
|
@ -906,7 +906,7 @@ namespace MWGui
|
||||||
/ float(localWidgetSize),
|
/ float(localWidgetSize),
|
||||||
float(mLocalMap->getWidth()) / localMapSizeInUnits, float(mLocalMap->getHeight()) / localMapSizeInUnits });
|
float(mLocalMap->getWidth()) / localMapSizeInUnits, float(mLocalMap->getHeight()) / localMapSizeInUnits });
|
||||||
|
|
||||||
if (mGlobal)
|
if (Settings::map().mGlobal)
|
||||||
{
|
{
|
||||||
const float currentGlobalZoom = mGlobalMapZoom;
|
const float currentGlobalZoom = mGlobalMapZoom;
|
||||||
const float currentMinGlobalMapZoom
|
const float currentMinGlobalMapZoom
|
||||||
|
@ -961,11 +961,11 @@ namespace MWGui
|
||||||
|
|
||||||
void MapWindow::zoomOnCursor(float speedDiff)
|
void MapWindow::zoomOnCursor(float speedDiff)
|
||||||
{
|
{
|
||||||
auto map = mGlobal ? mGlobalMap : mLocalMap;
|
auto map = Settings::map().mGlobal ? mGlobalMap : mLocalMap;
|
||||||
auto cursor = MyGUI::InputManager::getInstance().getMousePosition() - map->getAbsolutePosition();
|
auto cursor = MyGUI::InputManager::getInstance().getMousePosition() - map->getAbsolutePosition();
|
||||||
auto centerView = map->getViewOffset() - cursor;
|
auto centerView = map->getViewOffset() - cursor;
|
||||||
|
|
||||||
mGlobal ? updateGlobalMap() : updateLocalMap();
|
Settings::map().mGlobal ? updateGlobalMap() : updateLocalMap();
|
||||||
|
|
||||||
map->setViewOffset(MyGUI::IntPoint(std::round(centerView.left * speedDiff) + cursor.left,
|
map->setViewOffset(MyGUI::IntPoint(std::round(centerView.left * speedDiff) + cursor.left,
|
||||||
std::round(centerView.top * speedDiff) + cursor.top));
|
std::round(centerView.top * speedDiff) + cursor.top));
|
||||||
|
@ -1053,7 +1053,7 @@ namespace MWGui
|
||||||
MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
|
MyGUI::Colour::parse(MyGUI::LanguageManager::getInstance().replaceTags("#{fontcolour=normal}")));
|
||||||
markerWidget->setDepth(Global_MarkerLayer);
|
markerWidget->setDepth(Global_MarkerLayer);
|
||||||
markerWidget->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
markerWidget->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
||||||
if (mAllowZooming)
|
if (Settings::map().mAllowZooming)
|
||||||
markerWidget->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
markerWidget->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
||||||
markerWidget->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
markerWidget->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
||||||
|
|
||||||
|
@ -1177,7 +1177,7 @@ namespace MWGui
|
||||||
|
|
||||||
MyGUI::IntPoint diff = MyGUI::IntPoint(_left, _top) - mLastDragPos;
|
MyGUI::IntPoint diff = MyGUI::IntPoint(_left, _top) - mLastDragPos;
|
||||||
|
|
||||||
if (!mGlobal)
|
if (!Settings::map().mGlobal)
|
||||||
{
|
{
|
||||||
mNeedDoorMarkersUpdate = true;
|
mNeedDoorMarkersUpdate = true;
|
||||||
mLocalMap->setViewOffset(mLocalMap->getViewOffset() + diff);
|
mLocalMap->setViewOffset(mLocalMap->getViewOffset() + diff);
|
||||||
|
@ -1190,13 +1190,14 @@ namespace MWGui
|
||||||
|
|
||||||
void MapWindow::onWorldButtonClicked(MyGUI::Widget* _sender)
|
void MapWindow::onWorldButtonClicked(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
mGlobal = !mGlobal;
|
const bool global = !Settings::map().mGlobal;
|
||||||
mGlobalMap->setVisible(mGlobal);
|
|
||||||
mLocalMap->setVisible(!mGlobal);
|
|
||||||
|
|
||||||
Settings::Manager::setBool("global", "Map", mGlobal);
|
Settings::map().mGlobal.set(global);
|
||||||
|
|
||||||
mButton->setCaptionWithReplacing(mGlobal ? "#{sLocal}" : "#{sWorld}");
|
mGlobalMap->setVisible(global);
|
||||||
|
mLocalMap->setVisible(!global);
|
||||||
|
|
||||||
|
mButton->setCaptionWithReplacing(global ? "#{sLocal}" : "#{sWorld}");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::onPinToggled()
|
void MapWindow::onPinToggled()
|
||||||
|
@ -1340,7 +1341,7 @@ namespace MWGui
|
||||||
marker->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
marker->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
||||||
marker->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
marker->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
||||||
marker->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onCustomMarkerDoubleClicked);
|
marker->eventMouseButtonDoubleClick += MyGUI::newDelegate(this, &MapWindow::onCustomMarkerDoubleClicked);
|
||||||
if (mAllowZooming)
|
if (Settings::map().mAllowZooming)
|
||||||
marker->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
marker->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1348,7 +1349,7 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
marker->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
marker->eventMouseDrag += MyGUI::newDelegate(this, &MapWindow::onMouseDrag);
|
||||||
marker->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
marker->eventMouseButtonPressed += MyGUI::newDelegate(this, &MapWindow::onDragStart);
|
||||||
if (mAllowZooming)
|
if (Settings::map().mAllowZooming)
|
||||||
marker->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
marker->eventMouseWheel += MyGUI::newDelegate(this, &MapWindow::onMapZoomed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace MWGui
|
||||||
class LocalMapBase
|
class LocalMapBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender, bool fogOfWarEnabled = true);
|
LocalMapBase(CustomMarkerCollection& markers, MWRender::LocalMap* localMapRender);
|
||||||
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,9 +125,6 @@ namespace MWGui
|
||||||
std::string mPrefix;
|
std::string mPrefix;
|
||||||
bool mChanged;
|
bool mChanged;
|
||||||
bool mFogOfWarToggled;
|
bool mFogOfWarToggled;
|
||||||
bool mFogOfWarEnabled;
|
|
||||||
|
|
||||||
int mMapWidgetSize;
|
|
||||||
|
|
||||||
int mNumCells; // for convenience, mCellDistance * 2 + 1
|
int mNumCells; // for convenience, mCellDistance * 2 + 1
|
||||||
int mCellDistance;
|
int mCellDistance;
|
||||||
|
@ -301,7 +298,6 @@ namespace MWGui
|
||||||
MyGUI::ImageBox* mPlayerArrowGlobal;
|
MyGUI::ImageBox* mPlayerArrowGlobal;
|
||||||
MyGUI::Button* mButton;
|
MyGUI::Button* mButton;
|
||||||
MyGUI::IntPoint mLastDragPos;
|
MyGUI::IntPoint mLastDragPos;
|
||||||
bool mGlobal;
|
|
||||||
|
|
||||||
MyGUI::IntCoord mLastScrollWindowCoordinates;
|
MyGUI::IntCoord mLastScrollWindowCoordinates;
|
||||||
|
|
||||||
|
@ -328,7 +324,6 @@ namespace MWGui
|
||||||
|
|
||||||
EditNoteDialog mEditNoteDialog;
|
EditNoteDialog mEditNoteDialog;
|
||||||
ESM::CustomMarker mEditingMarker;
|
ESM::CustomMarker mEditingMarker;
|
||||||
bool mAllowZooming;
|
|
||||||
|
|
||||||
void onPinToggled() override;
|
void onPinToggled() override;
|
||||||
void onTitleDoubleClicked() override;
|
void onTitleDoubleClicked() override;
|
||||||
|
|
|
@ -263,8 +263,7 @@ namespace MWRender
|
||||||
};
|
};
|
||||||
|
|
||||||
GlobalMap::GlobalMap(osg::Group* root, SceneUtil::WorkQueue* workQueue)
|
GlobalMap::GlobalMap(osg::Group* root, SceneUtil::WorkQueue* workQueue)
|
||||||
: mCellSize(Settings::map().mGlobalMapCellSize)
|
: mRoot(root)
|
||||||
, mRoot(root)
|
|
||||||
, mWorkQueue(workQueue)
|
, mWorkQueue(workQueue)
|
||||||
, mWidth(0)
|
, mWidth(0)
|
||||||
, mHeight(0)
|
, mHeight(0)
|
||||||
|
@ -304,11 +303,13 @@ namespace MWRender
|
||||||
mMaxY = it->getGridY();
|
mMaxY = it->getGridY();
|
||||||
}
|
}
|
||||||
|
|
||||||
mWidth = mCellSize * (mMaxX - mMinX + 1);
|
const int cellSize = Settings::map().mGlobalMapCellSize;
|
||||||
mHeight = mCellSize * (mMaxY - mMinY + 1);
|
|
||||||
|
mWidth = cellSize * (mMaxX - mMinX + 1);
|
||||||
|
mHeight = cellSize * (mMaxY - mMinY + 1);
|
||||||
|
|
||||||
mWorkItem
|
mWorkItem
|
||||||
= new CreateMapWorkItem(mWidth, mHeight, mMinX, mMinY, mMaxX, mMaxY, mCellSize, esmStore.get<ESM::Land>());
|
= new CreateMapWorkItem(mWidth, mHeight, mMinX, mMinY, mMaxX, mMaxY, cellSize, esmStore.get<ESM::Land>());
|
||||||
mWorkQueue->addWorkItem(mWorkItem);
|
mWorkQueue->addWorkItem(mWorkItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,14 +413,15 @@ namespace MWRender
|
||||||
if (!localMapTexture)
|
if (!localMapTexture)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int originX = (cellX - mMinX) * mCellSize;
|
const int cellSize = Settings::map().mGlobalMapCellSize;
|
||||||
int originY = (cellY - mMinY + 1)
|
const int originX = (cellX - mMinX) * cellSize;
|
||||||
* mCellSize; // +1 because we want the top left corner of the cell, not the bottom left
|
// +1 because we want the top left corner of the cell, not the bottom left
|
||||||
|
const int originY = (cellY - mMinY + 1) * cellSize;
|
||||||
|
|
||||||
if (cellX > mMaxX || cellX < mMinX || cellY > mMaxY || cellY < mMinY)
|
if (cellX > mMaxX || cellX < mMinX || cellY > mMaxY || cellY < mMinY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
requestOverlayTextureUpdate(originX, mHeight - originY, mCellSize, mCellSize, localMapTexture, false, true);
|
requestOverlayTextureUpdate(originX, mHeight - originY, cellSize, cellSize, localMapTexture, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlobalMap::clear()
|
void GlobalMap::clear()
|
||||||
|
@ -520,7 +522,7 @@ namespace MWRender
|
||||||
// If cell bounds of the currently loaded content and the loaded savegame do not match,
|
// If cell bounds of the currently loaded content and the loaded savegame do not match,
|
||||||
// we need to resize source/dest boxes to accommodate
|
// we need to resize source/dest boxes to accommodate
|
||||||
// This means nonexisting cells will be dropped silently
|
// This means nonexisting cells will be dropped silently
|
||||||
int cellImageSizeDst = mCellSize;
|
const int cellImageSizeDst = Settings::map().mGlobalMapCellSize;
|
||||||
|
|
||||||
// Completely off-screen? -> no need to blit anything
|
// Completely off-screen? -> no need to blit anything
|
||||||
if (bounds.mMaxX < mMinX || bounds.mMaxY < mMinY || bounds.mMinX > mMaxX || bounds.mMinY > mMaxY)
|
if (bounds.mMaxX < mMinX || bounds.mMaxY < mMinY || bounds.mMinX > mMaxX || bounds.mMinY > mMaxY)
|
||||||
|
|
|
@ -86,8 +86,6 @@ namespace MWRender
|
||||||
bool clear, bool cpuCopy, float srcLeft = 0.f, float srcTop = 0.f, float srcRight = 1.f,
|
bool clear, bool cpuCopy, float srcLeft = 0.f, float srcTop = 0.f, float srcRight = 1.f,
|
||||||
float srcBottom = 1.f);
|
float srcBottom = 1.f);
|
||||||
|
|
||||||
int mCellSize;
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Group> mRoot;
|
osg::ref_ptr<osg::Group> mRoot;
|
||||||
|
|
||||||
typedef std::vector<osg::ref_ptr<osg::Camera>> CameraVector;
|
typedef std::vector<osg::ref_ptr<osg::Camera>> CameraVector;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <components/sceneutil/rtt.hpp>
|
#include <components/sceneutil/rtt.hpp>
|
||||||
#include <components/sceneutil/shadow.hpp>
|
#include <components/sceneutil/shadow.hpp>
|
||||||
#include <components/sceneutil/visitor.hpp>
|
#include <components/sceneutil/visitor.hpp>
|
||||||
#include <components/settings/settings.hpp>
|
#include <components/settings/values.hpp>
|
||||||
#include <components/stereo/multiview.hpp>
|
#include <components/stereo/multiview.hpp>
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
|
@ -75,16 +75,13 @@ namespace MWRender
|
||||||
|
|
||||||
LocalMap::LocalMap(osg::Group* root)
|
LocalMap::LocalMap(osg::Group* root)
|
||||||
: mRoot(root)
|
: mRoot(root)
|
||||||
, mMapResolution(Settings::Manager::getInt("local map resolution", "Map"))
|
, mMapResolution(
|
||||||
|
Settings::map().mLocalMapResolution * MWBase::Environment::get().getWindowManager()->getScalingFactor())
|
||||||
, mMapWorldSize(Constants::CellSizeInUnits)
|
, mMapWorldSize(Constants::CellSizeInUnits)
|
||||||
, mCellDistance(Constants::CellGridRadius)
|
, mCellDistance(Constants::CellGridRadius)
|
||||||
, mAngle(0.f)
|
, mAngle(0.f)
|
||||||
, mInterior(false)
|
, mInterior(false)
|
||||||
{
|
{
|
||||||
// Increase map resolution, if use UI scaling
|
|
||||||
float uiScale = MWBase::Environment::get().getWindowManager()->getScalingFactor();
|
|
||||||
mMapResolution *= uiScale;
|
|
||||||
|
|
||||||
SceneUtil::FindByNameVisitor find("Scene Root");
|
SceneUtil::FindByNameVisitor find("Scene Root");
|
||||||
mRoot->accept(find);
|
mRoot->accept(find);
|
||||||
mSceneRoot = find.mFoundNode;
|
mSceneRoot = find.mFoundNode;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef OPENMW_COMPONENTS_SETTINGS_CATEGORIES_MAP_H
|
#ifndef OPENMW_COMPONENTS_SETTINGS_CATEGORIES_MAP_H
|
||||||
#define OPENMW_COMPONENTS_SETTINGS_CATEGORIES_MAP_H
|
#define OPENMW_COMPONENTS_SETTINGS_CATEGORIES_MAP_H
|
||||||
|
|
||||||
|
#include "components/misc/constants.hpp"
|
||||||
#include "components/settings/sanitizerimpl.hpp"
|
#include "components/settings/sanitizerimpl.hpp"
|
||||||
#include "components/settings/settingvalue.hpp"
|
#include "components/settings/settingvalue.hpp"
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ namespace Settings
|
||||||
SettingValue<bool> mGlobal{ mIndex, "Map", "global" };
|
SettingValue<bool> mGlobal{ mIndex, "Map", "global" };
|
||||||
SettingValue<bool> mAllowZooming{ mIndex, "Map", "allow zooming" };
|
SettingValue<bool> mAllowZooming{ mIndex, "Map", "allow zooming" };
|
||||||
SettingValue<int> mMaxLocalViewingDistance{ mIndex, "Map", "max local viewing distance",
|
SettingValue<int> mMaxLocalViewingDistance{ mIndex, "Map", "max local viewing distance",
|
||||||
makeMaxSanitizerInt(1) };
|
makeMaxSanitizerInt(Constants::CellGridRadius) };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue