forked from mirror/openmw-tes3mp
first attempt at map window
This commit is contained in:
parent
2edd7e59f4
commit
91d2031eb7
6 changed files with 94 additions and 21 deletions
|
@ -67,7 +67,7 @@ namespace MWGui
|
|||
{
|
||||
setCoord(500,0,320,300);
|
||||
setText("WorldButton", "World");
|
||||
setImage("Compass", "compass.dds");
|
||||
setImage("Compass", "textures\\compass.dds");
|
||||
|
||||
// Obviously you should override this later on
|
||||
setCellName("No Cell Loaded");
|
||||
|
@ -77,6 +77,32 @@ namespace MWGui
|
|||
{
|
||||
mMainWidget->setCaption(cellName);
|
||||
}
|
||||
|
||||
// for interiors: cell name, for exteriors: "Cell"
|
||||
void setCellPrefix(const std::string& prefix)
|
||||
{
|
||||
mPrefix = prefix;
|
||||
}
|
||||
|
||||
void setActiveCell(const int x, const int y)
|
||||
{
|
||||
for (int mx=0; mx<3; ++mx)
|
||||
{
|
||||
for (int my=0; my<3; ++my)
|
||||
{
|
||||
std::string name = "Map_" + boost::lexical_cast<std::string>(mx) + "_"
|
||||
+ boost::lexical_cast<std::string>(my);
|
||||
|
||||
std::string image = mPrefix+"_"+ boost::lexical_cast<std::string>(x + (mx-1)) + "_"
|
||||
+ boost::lexical_cast<std::string>(y - (my-1));
|
||||
setImage(name, image);
|
||||
setImage(name+"_fog", image+"_fog");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::string mPrefix;
|
||||
};
|
||||
|
||||
class MainMenu : public OEngine::GUI::Layout
|
||||
|
|
|
@ -402,7 +402,21 @@ const ESMS::ESMStore& WindowManager::getStore() const
|
|||
return environment.mWorld->getStore();
|
||||
}
|
||||
|
||||
void WindowManager::setCellName(const std::string& cellName)
|
||||
void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell)
|
||||
{
|
||||
map->setCellName(cellName);
|
||||
if (!(cell->cell->data.flags & ESM::Cell::Interior))
|
||||
{
|
||||
if (cell->cell->name != "")
|
||||
map->setCellName( cell->cell->name );
|
||||
else
|
||||
map->setCellName( cell->cell->region );
|
||||
map->setCellPrefix("Cell");
|
||||
map->setActiveCell( cell->cell->data.gridX, cell->cell->data.gridY );
|
||||
}
|
||||
else
|
||||
{
|
||||
map->setCellName( cell->cell->name );
|
||||
map->setCellPrefix( cell->cell->name );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <openengine/ogre/renderer.hpp>
|
||||
#include <openengine/gui/manager.hpp>
|
||||
#include "../mwmechanics/stat.hpp"
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "mode.hpp"
|
||||
|
||||
namespace MyGUI
|
||||
|
@ -150,8 +151,7 @@ namespace MWGui
|
|||
void setBounty (int bounty); ///< set the current bounty value
|
||||
void updateSkillArea(); ///< update display of skills, factions, birth sign, reputation and bounty
|
||||
|
||||
|
||||
void setCellName(const std::string& cellName); ///< set the cell name to display in the map window
|
||||
void changeCell(MWWorld::Ptr::CellStore* cell); ///< change the active cell
|
||||
|
||||
template<typename T>
|
||||
void removeDialog(T*& dialog); ///< Casts to OEngine::GUI::Layout and calls removeDialog, then resets pointer to nullptr.
|
||||
|
|
|
@ -58,7 +58,7 @@ LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend)
|
|||
overlay_panel->setMaterialName( "testMaterial" );
|
||||
overlay_panel->show();
|
||||
mOverlay->add2D(overlay_panel);
|
||||
mOverlay->show();
|
||||
//mOverlay->show();
|
||||
|
||||
Overlay* mOverlay2 = ovm.create( "testOverlay2" );
|
||||
mOverlay2->setZOrder(1);
|
||||
|
@ -72,7 +72,7 @@ LocalMap::LocalMap(OEngine::Render::OgreRenderer* rend)
|
|||
overlay_panel2->show();
|
||||
mOverlay2->add2D(overlay_panel2);
|
||||
|
||||
mOverlay2->show();
|
||||
//mOverlay2->show();
|
||||
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@ void LocalMap::render(const float x, const float y,
|
|||
xw*FOGOFWAR_RESOLUTION/SIZE, yw*FOGOFWAR_RESOLUTION/SIZE,
|
||||
0,
|
||||
PF_A8R8G8B8,
|
||||
TU_DYNAMIC_WRITE_ONLY);
|
||||
TU_DYNAMIC_WRITE_ONLY_DISCARDABLE);
|
||||
|
||||
// create a buffer to use for dynamic operations
|
||||
uint32* buffer = new uint32[FOGOFWAR_RESOLUTION*FOGOFWAR_RESOLUTION];
|
||||
|
|
|
@ -121,16 +121,7 @@ namespace MWWorld
|
|||
mEnvironment.mMechanicsManager->addActor (mWorld->getPlayer().getPlayer());
|
||||
mEnvironment.mMechanicsManager->watchActor (mWorld->getPlayer().getPlayer());
|
||||
|
||||
// set map window cell name
|
||||
if (!(mCurrentCell->cell->data.flags & ESM::Cell::Interior))
|
||||
{
|
||||
if (mCurrentCell->cell->name != "")
|
||||
mEnvironment.mWindowManager->setCellName( mCurrentCell->cell->name );
|
||||
else
|
||||
mEnvironment.mWindowManager->setCellName( mCurrentCell->cell->region );
|
||||
}
|
||||
else
|
||||
mEnvironment.mWindowManager->setCellName( mCurrentCell->cell->name );
|
||||
mEnvironment.mWindowManager->changeCell( mCurrentCell );
|
||||
}
|
||||
|
||||
void Scene::changeCell (int X, int Y, const ESM::Position& position, bool adjustPlayerPos)
|
||||
|
|
|
@ -2,8 +2,50 @@
|
|||
|
||||
<MyGUI type="Layout">
|
||||
<Widget type="Window" skin="MW_Window" layer="Windows" position="0 0 300 300" name="_Main">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 284 264" align="ALIGN_STRETCH" name="Map"/>
|
||||
<Widget type="StaticImage" skin="StaticImage" position="126 116 32 32" align="Center" name="Compass"/>
|
||||
<Widget type="Button" skin="MW_Button" position="213 233 61 22" align="ALIGN_BOTTOM ALIGN_RIGHT" name="WorldButton"/>
|
||||
<Widget type="ScrollView" skin="ScrollView" position="0 0 284 264" align="ALIGN_STRETCH" name="Map">
|
||||
<Property key="ScrollView_CanvasSize" value="1536 1536"/>
|
||||
<!-- positioned and rotated in code -->
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 32 32" align="ALIGN_TOP ALIGN_LEFT" name="Compass"/>
|
||||
|
||||
<Widget type="Button" skin="MW_Button" position="213 233 61 22" align="ALIGN_BOTTOM ALIGN_RIGHT" name="WorldButton"/>
|
||||
|
||||
<!-- 3x3 maps, 1024x1024 each, but we will downsample to 512 to antialias them -->
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_0_0">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP_ALIGN_LEFT" name="Map_0_0_fog"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="StaticImage" skin="StaticImage" position="512 0 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_1_0">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP_ALIGN_LEFT" name="Map_1_0_fog"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="StaticImage" skin="StaticImage" position="1024 0 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_2_0">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP_ALIGN_LEFT" name="Map_2_0_fog"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 512 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_0_1">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP_ALIGN_LEFT" name="Map_0_1_fog"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="StaticImage" skin="StaticImage" position="512 512 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_1_1">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP_ALIGN_LEFT" name="Map_1_1_fog"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="StaticImage" skin="StaticImage" position="1024 512 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_2_1">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP_ALIGN_LEFT" name="Map_2_1_fog"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 1024 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_0_2">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP_ALIGN_LEFT" name="Map_0_2_fog"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="StaticImage" skin="StaticImage" position="512 1024 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_1_2">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP_ALIGN_LEFT" name="Map_1_2_fog"/>
|
||||
</Widget>
|
||||
|
||||
<Widget type="StaticImage" skin="StaticImage" position="1024 1024 512 512" align="ALIGN_TOP ALIGN_LEFT" name="Map_2_2">
|
||||
<Widget type="StaticImage" skin="StaticImage" position="0 0 512 512" align="ALIGN_TOP_ALIGN_LEFT" name="Map_2_2_fog"/>
|
||||
</Widget>
|
||||
|
||||
</Widget>
|
||||
</Widget>
|
||||
</MyGUI>
|
||||
|
|
Loading…
Reference in a new issue