diff --git a/apps/openmw/mwgui/layouts.cpp b/apps/openmw/mwgui/layouts.cpp index 57004906e..34d0cf1b6 100644 --- a/apps/openmw/mwgui/layouts.cpp +++ b/apps/openmw/mwgui/layouts.cpp @@ -61,6 +61,8 @@ HUD::HUD(int width, int height, int fpsLevel) setSpellIcon("icons\\s\\b_tx_s_rstor_health.dds"); setSpellStatus(65, 100); setEffect("icons\\s\\tx_s_chameleon.dds"); + + LocalMapBase::init(minimap, this); } void HUD::setFPS(float fps) @@ -152,6 +154,17 @@ void HUD::setPlayerDir(const float x, const float y) rotatingSubskin->setAngle(angle); } +void HUD::setPlayerPos(const float x, const float y) +{ + MyGUI::IntSize size = minimap->getCanvasSize(); + MyGUI::IntPoint middle = MyGUI::IntPoint((1/3.f + x/3.f)*size.width,(1/3.f + y/3.f)*size.height); + MyGUI::IntCoord viewsize = minimap->getCoord(); + MyGUI::IntPoint pos(0.5*viewsize.width - middle.left, 0.5*viewsize.height - middle.top); + + minimap->setViewOffset(pos); + compass->setPosition(MyGUI::IntPoint(x*512-16, y*512-16)); +} + MapWindow::MapWindow() : Layout("openmw_map_window_layout.xml"), mGlobal(false) { diff --git a/apps/openmw/mwgui/layouts.hpp b/apps/openmw/mwgui/layouts.hpp index 8029dabe7..6601850ca 100644 --- a/apps/openmw/mwgui/layouts.hpp +++ b/apps/openmw/mwgui/layouts.hpp @@ -63,13 +63,14 @@ namespace MWGui void setTriangleCount(size_t count); void setBatchCount(size_t count); void setPlayerDir(const float x, const float y); + void setPlayerPos(const float x, const float y); MyGUI::ProgressPtr health, magicka, stamina; MyGUI::ImageBox *weapImage, *spellImage; MyGUI::ProgressPtr weapStatus, spellStatus; MyGUI::WidgetPtr effectBox; MyGUI::ImageBox* effect1; - MyGUI::ImageBox* minimap; + MyGUI::ScrollView* minimap; MyGUI::ImageBox* compass; MyGUI::ImageBox* crosshair; diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index 5137a109f..fa6dedc77 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -405,17 +405,24 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell) { if (!(cell->cell->data.flags & ESM::Cell::Interior)) { + std::string name; if (cell->cell->name != "") - map->setCellName( cell->cell->name ); + name = cell->cell->name; else - map->setCellName( cell->cell->region ); + name = cell->cell->region; + + map->setCellName( name ); + map->setCellPrefix("Cell"); + hud->setCellPrefix("Cell"); map->setActiveCell( cell->cell->data.gridX, cell->cell->data.gridY ); + hud->setActiveCell( cell->cell->data.gridX, cell->cell->data.gridY ); } else { map->setCellName( cell->cell->name ); map->setCellPrefix( cell->cell->name ); + hud->setCellPrefix( cell->cell->name ); } } @@ -423,11 +430,13 @@ void WindowManager::changeCell(MWWorld::Ptr::CellStore* cell) void WindowManager::setInteriorMapTexture(const int x, const int y) { map->setActiveCell(x,y, true); + hud->setActiveCell(x,y, true); } void WindowManager::setPlayerPos(const float x, const float y) { map->setPlayerPos(x,y); + hud->setPlayerPos(x,y); } void WindowManager::setPlayerDir(const float x, const float y) diff --git a/files/mygui/openmw_hud_layout.xml b/files/mygui/openmw_hud_layout.xml index 56708eb18..20370770e 100644 --- a/files/mygui/openmw_hud_layout.xml +++ b/files/mygui/openmw_hud_layout.xml @@ -38,10 +38,48 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +