forked from teamnwah/openmw-tes3coop
Change global map cell size from 24 to 18 and make it configurable
This commit is contained in:
parent
764c6287e1
commit
4f0fc79ea4
4 changed files with 32 additions and 24 deletions
|
@ -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<MyGUI::Button>("ButtonImage",
|
||||
|
|
|
@ -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<cellSize; ++cellY)
|
||||
for (int cellY=0; cellY<mCellSize; ++cellY)
|
||||
{
|
||||
for (int cellX=0; cellX<cellSize; ++cellX)
|
||||
for (int cellX=0; cellX<mCellSize; ++cellX)
|
||||
{
|
||||
int vertexX = float(cellX)/float(cellSize) * ESM::Land::LAND_SIZE;
|
||||
int vertexY = float(cellY)/float(cellSize) * ESM::Land::LAND_SIZE;
|
||||
int vertexX = float(cellX)/float(mCellSize) * ESM::Land::LAND_SIZE;
|
||||
int vertexY = float(cellY)/float(mCellSize) * ESM::Land::LAND_SIZE;
|
||||
|
||||
|
||||
int texelX = (x-mMinX) * cellSize + cellX;
|
||||
int texelY = (mHeight-1) - ((y-mMinY) * cellSize + cellY);
|
||||
int texelX = (x-mMinX) * mCellSize + cellX;
|
||||
int texelY = (mHeight-1) - ((y-mMinY) * mCellSize + cellY);
|
||||
|
||||
unsigned char r,g,b;
|
||||
|
||||
|
@ -197,11 +197,9 @@ namespace MWRender
|
|||
|
||||
void GlobalMap::exploreCell(int cellX, int cellY)
|
||||
{
|
||||
const int size = 24;
|
||||
|
||||
float originX = (cellX - mMinX) * size;
|
||||
float originX = (cellX - mMinX) * mCellSize;
|
||||
// NB y + 1, because we want the top left corner, not bottom left where the origin of the cell is
|
||||
float originY = mHeight - (cellY+1 - mMinY) * size;
|
||||
float originY = mHeight - (cellY+1 - mMinY) * mCellSize;
|
||||
|
||||
if (cellX > 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<Ogre::uchar> 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<size; ++x)
|
||||
for (int y=0; y<size; ++y)
|
||||
for (int x=0; x<mCellSize; ++x)
|
||||
for (int y=0; y<mCellSize; ++y)
|
||||
{
|
||||
assert (originX+x < mOverlayImage.getWidth());
|
||||
assert (originY+y < mOverlayImage.getHeight());
|
||||
|
@ -292,7 +290,7 @@ namespace MWRender
|
|||
// If cell bounds of the currently loaded content and the loaded savegame do not match,
|
||||
// we need to resize source/dest boxes to accommodate
|
||||
// This means nonexisting cells will be dropped silently
|
||||
int cellImageSizeDst = 24;
|
||||
int cellImageSizeDst = mCellSize;
|
||||
|
||||
// Completely off-screen? -> no need to blit anything
|
||||
if (bounds.mMaxX < mMinX
|
||||
|
|
|
@ -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<int,int> > mExploredCells;
|
||||
|
||||
Ogre::TexturePtr mOverlayTexture;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue