From 4f0fc79ea4b0aac71019f9d23559d66aacdfc784 Mon Sep 17 00:00:00 2001 From: scrawl Date: Fri, 26 Sep 2014 12:47:33 +0200 Subject: [PATCH] Change global map cell size from 24 to 18 and make it configurable --- apps/openmw/mwgui/mapwindow.cpp | 8 ++++--- apps/openmw/mwrender/globalmap.cpp | 36 ++++++++++++++---------------- apps/openmw/mwrender/globalmap.hpp | 8 +++++-- files/settings-default.cfg | 4 ++++ 4 files changed, 32 insertions(+), 24 deletions(-) diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index cea505465..43ea6f7f9 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -675,10 +675,12 @@ namespace MWGui float worldX, worldY; mGlobalMapRender->cellTopLeftCornerToImageSpace (x, y, worldX, worldY); + int markerSize = 12; + int offset = mGlobalMapRender->getCellSize()/2 - markerSize/2; MyGUI::IntCoord widgetCoord( - worldX * mGlobalMapRender->getWidth()+6, - worldY * mGlobalMapRender->getHeight()+6, - 12, 12); + worldX * mGlobalMapRender->getWidth()+offset, + worldY * mGlobalMapRender->getHeight()+offset, + markerSize, markerSize); static int _counter=0; MyGUI::Button* markerWidget = mGlobalMapOverlay->createWidget("ButtonImage", diff --git a/apps/openmw/mwrender/globalmap.cpp b/apps/openmw/mwrender/globalmap.cpp index 6ebcfcd26..4e0bd00f9 100644 --- a/apps/openmw/mwrender/globalmap.cpp +++ b/apps/openmw/mwrender/globalmap.cpp @@ -29,6 +29,7 @@ namespace MWRender , mWidth(0) , mHeight(0) { + mCellSize = Settings::Manager::getInt("global map cell size", "Map"); } GlobalMap::~GlobalMap() @@ -57,9 +58,8 @@ namespace MWRender mMaxY = it->getGridY(); } - int cellSize = 24; - mWidth = cellSize*(mMaxX-mMinX+1); - mHeight = cellSize*(mMaxY-mMinY+1); + mWidth = mCellSize*(mMaxX-mMinX+1); + mHeight = mCellSize*(mMaxY-mMinY+1); loadingListener->loadingOn(); loadingListener->setLabel("Creating map"); @@ -90,16 +90,16 @@ namespace MWRender land->loadData(mask); } - for (int cellY=0; cellY mMaxX || cellX < mMinX || cellY > mMaxY || cellY < mMinY) return; @@ -213,17 +211,17 @@ namespace MWRender { mOverlayTexture->load(); mOverlayTexture->getBuffer()->blit(localMapTexture->getBuffer(), Ogre::Image::Box(0,0,512,512), - Ogre::Image::Box(originX,originY,originX+size,originY+size)); + Ogre::Image::Box(originX,originY,originX+mCellSize,originY+mCellSize)); Ogre::Image backup; std::vector data; - data.resize(size*size*4, 0); - backup.loadDynamicImage(&data[0], size, size, Ogre::PF_A8B8G8R8); + data.resize(mCellSize*mCellSize*4, 0); + backup.loadDynamicImage(&data[0], mCellSize, mCellSize, Ogre::PF_A8B8G8R8); localMapTexture->getBuffer()->blitToMemory(Ogre::Image::Box(0,0,512,512), backup.getPixelBox()); - for (int x=0; x no need to blit anything if (bounds.mMaxX < mMinX diff --git a/apps/openmw/mwrender/globalmap.hpp b/apps/openmw/mwrender/globalmap.hpp index 66fe89f73..b3ae85b11 100644 --- a/apps/openmw/mwrender/globalmap.hpp +++ b/apps/openmw/mwrender/globalmap.hpp @@ -26,8 +26,10 @@ namespace MWRender void render(Loading::Listener* loadingListener); - int getWidth() { return mWidth; } - int getHeight() { return mHeight; } + int getWidth() const { return mWidth; } + int getHeight() const { return mHeight; } + + int getCellSize() const { return mCellSize; } void worldPosToImageSpace(float x, float z, float& imageX, float& imageY); @@ -46,6 +48,8 @@ namespace MWRender private: std::string mCacheDir; + int mCellSize; + std::vector< std::pair > mExploredCells; Ogre::TexturePtr mOverlayTexture; diff --git a/files/settings-default.cfg b/files/settings-default.cfg index fc651f463..67fd5ee8c 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -108,6 +108,10 @@ num lights = 8 # Use static geometry for static objects. Improves rendering speed. use static geometry = true +[Map] +# Adjusts the scale of the global map +global map cell size = 18 + [Viewing distance] # Limit the rendering distance of small objects limit small object distance = false