improve minimap
This commit is contained in:
parent
aed779a2c8
commit
d39cf361ab
|
@ -25,7 +25,10 @@ local skin = {
|
||||||
'spinboxes.otui',
|
'spinboxes.otui',
|
||||||
'messageboxes.otui',
|
'messageboxes.otui',
|
||||||
'scrollbars.otui',
|
'scrollbars.otui',
|
||||||
'splitters.otui'
|
'splitters.otui',
|
||||||
|
'miniwindow.otui',
|
||||||
|
'items.otui',
|
||||||
|
'creatures.otui'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ function HealthBar.onMiniWindowClose()
|
||||||
end
|
end
|
||||||
|
|
||||||
function HealthBar.offline()
|
function HealthBar.offline()
|
||||||
healthBarWindow:recursiveGetChildById('conditions_content'):destroyChildren()
|
healthBarWindow:recursiveGetChildById('conditionPanel'):destroyChildren()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hooked events
|
-- hooked events
|
||||||
|
@ -121,7 +121,7 @@ function HealthBar.onStatesChange(localPlayer, now, old)
|
||||||
end
|
end
|
||||||
|
|
||||||
function HealthBar.toggleIcon(bitChanged)
|
function HealthBar.toggleIcon(bitChanged)
|
||||||
local content = healthBarWindow:recursiveGetChildById('conditions_content')
|
local content = healthBarWindow:recursiveGetChildById('conditionPanel')
|
||||||
|
|
||||||
local icon = content:getChildById(Icons[bitChanged].id)
|
local icon = content:getChildById(Icons[bitChanged].id)
|
||||||
if icon then
|
if icon then
|
||||||
|
|
|
@ -36,10 +36,10 @@ ManaLabel < GameLabel
|
||||||
|
|
||||||
ConditionWidget < UIWidget
|
ConditionWidget < UIWidget
|
||||||
size: 18 18
|
size: 18 18
|
||||||
|
|
||||||
$!first:
|
$!first:
|
||||||
margin-left: 5
|
margin-left: 5
|
||||||
|
|
||||||
MiniWindow
|
MiniWindow
|
||||||
icon: healthbar.png
|
icon: healthbar.png
|
||||||
id: healthBarWindow
|
id: healthBarWindow
|
||||||
|
@ -53,11 +53,11 @@ MiniWindow
|
||||||
ManaBar
|
ManaBar
|
||||||
ManaLabel
|
ManaLabel
|
||||||
Panel
|
Panel
|
||||||
id: conditions_content
|
id: conditionPanel
|
||||||
layout:
|
layout:
|
||||||
type: horizontalBox
|
type: horizontalBox
|
||||||
fit-children: true
|
fit-children: true
|
||||||
height: 18
|
height: 18
|
||||||
margin-top: 5
|
margin-top: 5
|
||||||
anchors.top: prev.bottom
|
anchors.top: prev.bottom
|
||||||
anchors.horizontalcenter: parent.horizontalcenter
|
anchors.horizontalcenter: parent.horizontalcenter
|
||||||
|
|
|
@ -65,6 +65,15 @@ function GameInterface.init()
|
||||||
Keyboard.bindKeyDown('Ctrl+L', GameInterface.tryLogout, gameRootPanel)
|
Keyboard.bindKeyDown('Ctrl+L', GameInterface.tryLogout, gameRootPanel)
|
||||||
Keyboard.bindKeyDown('Ctrl+W', function() g_map.cleanTexts() TextMessage.clearMessages() end, gameRootPanel)
|
Keyboard.bindKeyDown('Ctrl+W', function() g_map.cleanTexts() TextMessage.clearMessages() end, gameRootPanel)
|
||||||
|
|
||||||
|
Keyboard.bindKeyDown('Ctrl+.', function()
|
||||||
|
if gameMapPanel:isKeepAspectRatioEnabled() then
|
||||||
|
gameMapPanel:setKeepAspectRatio(false)
|
||||||
|
else
|
||||||
|
gameMapPanel:setKeepAspectRatio(true)
|
||||||
|
gameMapPanel:setVisibleDimension({ width = 15, height = 11 })
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
if g_game.isOnline() then
|
if g_game.isOnline() then
|
||||||
GameInterface.show()
|
GameInterface.show()
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,9 +5,6 @@ Module
|
||||||
website: www.otclient.info
|
website: www.otclient.info
|
||||||
|
|
||||||
@onLoad: |
|
@onLoad: |
|
||||||
importStyle 'styles/items.otui'
|
|
||||||
importStyle 'styles/creatures.otui'
|
|
||||||
importStyle 'styles/miniwindow.otui'
|
|
||||||
importStyle 'styles/countwindow.otui'
|
importStyle 'styles/countwindow.otui'
|
||||||
|
|
||||||
dofile 'widgets/uigamemap'
|
dofile 'widgets/uigamemap'
|
||||||
|
|
|
@ -3,7 +3,9 @@ Minimap = {}
|
||||||
-- private variables
|
-- private variables
|
||||||
local minimapWidget
|
local minimapWidget
|
||||||
local minimapButton
|
local minimapButton
|
||||||
|
local minimapWindow
|
||||||
local DEFAULT_ZOOM = 45
|
local DEFAULT_ZOOM = 45
|
||||||
|
minimapFirstLoad = true
|
||||||
|
|
||||||
-- private functions
|
-- private functions
|
||||||
function onMinimapMouseRelease(self, mousePosition, mouseButton)
|
function onMinimapMouseRelease(self, mousePosition, mouseButton)
|
||||||
|
@ -37,30 +39,58 @@ function Minimap.init()
|
||||||
minimapButton = TopMenu.addGameToggleButton('minimapButton', tr('Minimap') .. ' (Ctrl+M)', 'minimap.png', Minimap.toggle)
|
minimapButton = TopMenu.addGameToggleButton('minimapButton', tr('Minimap') .. ' (Ctrl+M)', 'minimap.png', Minimap.toggle)
|
||||||
minimapButton:setOn(false)
|
minimapButton:setOn(false)
|
||||||
|
|
||||||
minimapWidget = loadUI('minimap.otui', GameInterface.getMapPanel())
|
minimapWindow = loadUI('minimap.otui', GameInterface.getRightPanel())
|
||||||
|
minimapWindow:setOn(true)
|
||||||
|
|
||||||
|
minimapWidget = minimapWindow:recursiveGetChildById('minimap')
|
||||||
|
minimapWidget:setAutoViewMode(false)
|
||||||
|
minimapWidget:setViewMode(1) -- mid view
|
||||||
|
minimapWidget:setDrawMinimapColors(true)
|
||||||
|
minimapWidget:setMultifloor(false)
|
||||||
|
minimapWidget:setKeepAspectRatio(false)
|
||||||
minimapWidget.onMouseRelease = onMinimapMouseRelease
|
minimapWidget.onMouseRelease = onMinimapMouseRelease
|
||||||
minimapWidget.onMouseWheel = onMinimapMouseWheel
|
minimapWidget.onMouseWheel = onMinimapMouseWheel
|
||||||
minimapWidget:hide()
|
|
||||||
|
|
||||||
Minimap.reset()
|
Minimap.reset()
|
||||||
|
|
||||||
|
-- load only the first time (avoid load/save between reloads)
|
||||||
|
if minimapFirstLoad then
|
||||||
|
minimapFirstLoad = false
|
||||||
|
if g_resources.fileExists('/minimap.otcm') then
|
||||||
|
if g_game.isOnline() then
|
||||||
|
perror('cannot load minimap while online')
|
||||||
|
else
|
||||||
|
g_map.loadOtcm('/minimap.otcm')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- save only when closing the client
|
||||||
|
connect(g_app, { onTerminate = function()
|
||||||
|
g_map.saveOtcm('/minimap.otcm')
|
||||||
|
end})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Minimap.terminate()
|
function Minimap.terminate()
|
||||||
disconnect(g_game, { onGameStart = Minimap.reset })
|
disconnect(g_game, { onGameStart = Minimap.reset })
|
||||||
Keyboard.unbindKeyDown('Ctrl+M')
|
Keyboard.unbindKeyDown('Ctrl+M')
|
||||||
|
|
||||||
minimapWidget:destroy()
|
minimapWindow:destroy()
|
||||||
|
minimapWindow = nil
|
||||||
minimapWidget = nil
|
minimapWidget = nil
|
||||||
minimapButton:destroy()
|
|
||||||
minimapButton = nil
|
minimapButton = nil
|
||||||
|
|
||||||
Minimap = nil
|
Minimap = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function Minimap.toggle()
|
function Minimap.toggle()
|
||||||
local visible = not minimapWidget:isExplicitlyVisible()
|
local visible = not minimapWindow:isExplicitlyVisible()
|
||||||
minimapWidget:setVisible(visible)
|
if visible then
|
||||||
minimapButton:setOn(visible)
|
minimapWindow:open()
|
||||||
|
minimapButton:setOn(true)
|
||||||
|
else
|
||||||
|
minimapWindow:close()
|
||||||
|
minimapButton:setOn(false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Minimap.reset()
|
function Minimap.reset()
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
UIMap
|
MiniWindow
|
||||||
id: minimap
|
id: minimapWindow
|
||||||
anchors.top: parent.top
|
!text: tr('Minimap')
|
||||||
anchors.right: parent.right
|
height: 150
|
||||||
size: 256 192
|
icon: minimap.png
|
||||||
margin-top: 2
|
|
||||||
margin-right: 2
|
|
||||||
border-width: 1
|
|
||||||
border-color: #888888
|
|
||||||
padding: 1
|
|
||||||
//draw-minimap-colors: true
|
|
||||||
multifloor: false
|
|
||||||
draw-texts: false
|
|
||||||
|
|
||||||
CheckBox
|
MiniWindowContents
|
||||||
anchors.top: parent.top
|
padding: 3
|
||||||
anchors.right: parent.right
|
UIMap
|
||||||
margin-top: 2
|
id: minimap
|
||||||
margin-right: 2
|
anchors.fill: parent
|
||||||
size: 16 16
|
|
||||||
@onCheckChange: self:getParent():setDrawMinimapColors(self:isChecked())
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ void main()
|
||||||
int j;
|
int j;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = -2 ;i <= 2; i++)
|
for(i = -4 ;i <= 4; i++)
|
||||||
for(j = -2; j <= 2; j++)
|
for(j = -4; j <= 4; j++)
|
||||||
color += texture2D(u_Tex0, v_TexCoord + vec2(i, j)*0.0025) * 0.025;
|
color += texture2D(u_Tex0, v_TexCoord + vec2(i, j)*0.003) * 0.008;
|
||||||
|
|
||||||
gl_FragColor = color;
|
gl_FragColor = color;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ void FrameBuffer::resize(const Size& size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_texture = TexturePtr(new Texture(size));
|
m_texture = TexturePtr(new Texture(size));
|
||||||
m_texture->setSmooth(true);
|
m_texture->setSmooth(m_smooth);
|
||||||
m_texture->setUpsideDown(true);
|
m_texture->setUpsideDown(true);
|
||||||
|
|
||||||
if(m_fbo) {
|
if(m_fbo) {
|
||||||
|
|
|
@ -44,10 +44,12 @@ public:
|
||||||
void draw(const Rect& dest, const Rect& src);
|
void draw(const Rect& dest, const Rect& src);
|
||||||
|
|
||||||
void setBackuping(bool enabled) { m_backuping = enabled; }
|
void setBackuping(bool enabled) { m_backuping = enabled; }
|
||||||
|
void setSmooth(bool enabled) { m_smooth = enabled; }
|
||||||
|
|
||||||
TexturePtr getTexture() { return m_texture; }
|
TexturePtr getTexture() { return m_texture; }
|
||||||
Size getSize();
|
Size getSize();
|
||||||
bool isBackuping() { return m_backuping; }
|
bool isBackuping() { return m_backuping; }
|
||||||
|
bool isSmooth() { return m_smooth; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void internalCreate();
|
void internalCreate();
|
||||||
|
@ -60,6 +62,7 @@ private:
|
||||||
uint m_fbo;
|
uint m_fbo;
|
||||||
uint m_prevBoundFbo;
|
uint m_prevBoundFbo;
|
||||||
Boolean<true> m_backuping;
|
Boolean<true> m_backuping;
|
||||||
|
Boolean<true> m_smooth;
|
||||||
|
|
||||||
static uint boundFbo;
|
static uint boundFbo;
|
||||||
};
|
};
|
||||||
|
|
|
@ -556,6 +556,9 @@ void Map::setCentralPosition(const Position& centralPosition)
|
||||||
g_game.processCreatureTeleport(localPlayer);
|
g_game.processCreatureTeleport(localPlayer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
for(const MapViewPtr& mapView : m_mapViews)
|
||||||
|
mapView->onMapCenterChange(centralPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CreaturePtr> Map::getSpectators(const Position& centerPos, bool multiFloor)
|
std::vector<CreaturePtr> Map::getSpectators(const Position& centerPos, bool multiFloor)
|
||||||
|
|
|
@ -101,7 +101,11 @@ void MapView::draw(const Rect& rect)
|
||||||
if(!m_drawMinimapColors)
|
if(!m_drawMinimapColors)
|
||||||
tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags);
|
tile->draw(transformPositionTo2D(tilePos, cameraPosition), scaleFactor, drawFlags);
|
||||||
else {
|
else {
|
||||||
g_painter->setColor(tile->getMinimapColor());
|
uint8 c = tile->getMinimapColorByte();
|
||||||
|
if(c == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
g_painter->setColor(Color::from8bit(c));
|
||||||
g_painter->drawFilledRect(Rect(transformPositionTo2D(tilePos, cameraPosition), tileSize));
|
g_painter->drawFilledRect(Rect(transformPositionTo2D(tilePos, cameraPosition), tileSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -399,22 +403,28 @@ void MapView::updateVisibleTilesCache(int start)
|
||||||
|
|
||||||
void MapView::updateGeometry(const Size& visibleDimension, const Size& optimizedSize)
|
void MapView::updateGeometry(const Size& visibleDimension, const Size& optimizedSize)
|
||||||
{
|
{
|
||||||
int possiblesTileSizes[] = {1,2,4,8,16,32};
|
|
||||||
int tileSize = 0;
|
int tileSize = 0;
|
||||||
Size bufferSize;
|
Size bufferSize;
|
||||||
for(int candidateTileSize : possiblesTileSizes) {
|
|
||||||
bufferSize = (visibleDimension + Size(3,3)) * candidateTileSize;
|
|
||||||
if(bufferSize.width() > g_graphics.getMaxTextureSize() || bufferSize.height() > g_graphics.getMaxTextureSize())
|
|
||||||
break;
|
|
||||||
|
|
||||||
tileSize = candidateTileSize;
|
if(!m_drawMinimapColors) {
|
||||||
if(optimizedSize.width() < bufferSize.width() - 3*candidateTileSize && optimizedSize.height() < bufferSize.height() - 3*candidateTileSize)
|
int possiblesTileSizes[] = {1,2,4,8,16,32};
|
||||||
break;
|
for(int candidateTileSize : possiblesTileSizes) {
|
||||||
}
|
bufferSize = (visibleDimension + Size(3,3)) * candidateTileSize;
|
||||||
|
if(bufferSize.width() > g_graphics.getMaxTextureSize() || bufferSize.height() > g_graphics.getMaxTextureSize())
|
||||||
|
break;
|
||||||
|
|
||||||
if(tileSize == 0) {
|
tileSize = candidateTileSize;
|
||||||
g_logger.traceError("reached max zoom out");
|
if(optimizedSize.width() < bufferSize.width() - 3*candidateTileSize && optimizedSize.height() < bufferSize.height() - 3*candidateTileSize)
|
||||||
return;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tileSize == 0) {
|
||||||
|
g_logger.traceError("reached max zoom out");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tileSize = 1;
|
||||||
|
bufferSize = visibleDimension + Size(3,3);
|
||||||
}
|
}
|
||||||
|
|
||||||
Size drawDimension = visibleDimension + Size(3,3);
|
Size drawDimension = visibleDimension + Size(3,3);
|
||||||
|
@ -456,10 +466,15 @@ void MapView::updateGeometry(const Size& visibleDimension, const Size& optimized
|
||||||
|
|
||||||
void MapView::onTileUpdate(const Position& pos)
|
void MapView::onTileUpdate(const Position& pos)
|
||||||
{
|
{
|
||||||
//if(m_viewMode <= FAR_VIEW)
|
if(!m_drawMinimapColors)
|
||||||
requestVisibleTilesCacheUpdate();
|
requestVisibleTilesCacheUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapView::onMapCenterChange(const Position& pos)
|
||||||
|
{
|
||||||
|
requestVisibleTilesCacheUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
void MapView::lockFirstVisibleFloor(int firstVisibleFloor)
|
void MapView::lockFirstVisibleFloor(int firstVisibleFloor)
|
||||||
{
|
{
|
||||||
m_lockedFirstVisibleFloor = firstVisibleFloor;
|
m_lockedFirstVisibleFloor = firstVisibleFloor;
|
||||||
|
@ -656,3 +671,14 @@ TilePtr MapView::getTile(const Point& mousePos, const Rect& mapRect)
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapView::setDrawMinimapColors(bool enable)
|
||||||
|
{
|
||||||
|
if(m_drawMinimapColors == enable)
|
||||||
|
return;
|
||||||
|
m_drawMinimapColors = enable;
|
||||||
|
updateGeometry(m_visibleDimension, m_optimizedSize);
|
||||||
|
requestVisibleTilesCacheUpdate();
|
||||||
|
m_smooth = !enable;
|
||||||
|
m_framebuffer->setSmooth(m_smooth);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,7 @@ private:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onTileUpdate(const Position& pos);
|
void onTileUpdate(const Position& pos);
|
||||||
|
void onMapCenterChange(const Position& pos);
|
||||||
|
|
||||||
friend class Map;
|
friend class Map;
|
||||||
|
|
||||||
|
@ -99,7 +100,7 @@ public:
|
||||||
void setDrawTexts(bool enable) { m_drawTexts = enable; }
|
void setDrawTexts(bool enable) { m_drawTexts = enable; }
|
||||||
bool isDrawingTexts() { return m_drawTexts; }
|
bool isDrawingTexts() { return m_drawTexts; }
|
||||||
|
|
||||||
void setDrawMinimapColors(bool enable) { m_drawMinimapColors = enable; requestVisibleTilesCacheUpdate(); }
|
void setDrawMinimapColors(bool enable);
|
||||||
bool isDrawingMinimapColors() { return m_drawMinimapColors; }
|
bool isDrawingMinimapColors() { return m_drawMinimapColors; }
|
||||||
|
|
||||||
void setAnimated(bool animated) { m_animated = animated; requestVisibleTilesCacheUpdate(); }
|
void setAnimated(bool animated) { m_animated = animated; requestVisibleTilesCacheUpdate(); }
|
||||||
|
@ -138,6 +139,7 @@ private:
|
||||||
Boolean<true> m_animated;
|
Boolean<true> m_animated;
|
||||||
Boolean<true> m_autoViewMode;
|
Boolean<true> m_autoViewMode;
|
||||||
Boolean<true> m_drawTexts;
|
Boolean<true> m_drawTexts;
|
||||||
|
Boolean<true> m_smooth;
|
||||||
Boolean<false> m_drawMinimapColors;
|
Boolean<false> m_drawMinimapColors;
|
||||||
std::vector<TilePtr> m_cachedVisibleTiles;
|
std::vector<TilePtr> m_cachedVisibleTiles;
|
||||||
std::vector<CreaturePtr> m_cachedFloorVisibleCreatures;
|
std::vector<CreaturePtr> m_cachedFloorVisibleCreatures;
|
||||||
|
|
|
@ -34,6 +34,7 @@ Tile::Tile(const Position& position)
|
||||||
{
|
{
|
||||||
m_drawElevation = 0;
|
m_drawElevation = 0;
|
||||||
m_position = position;
|
m_position = position;
|
||||||
|
m_minimapColorByte = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tile::draw(const Point& dest, float scaleFactor, int drawFlags)
|
void Tile::draw(const Point& dest, float scaleFactor, int drawFlags)
|
||||||
|
@ -192,6 +193,7 @@ ThingPtr Tile::addThing(const ThingPtr& thing, int stackPos)
|
||||||
if(m_things.size() > MAX_THINGS)
|
if(m_things.size() > MAX_THINGS)
|
||||||
removeThing(m_things[MAX_THINGS]);
|
removeThing(m_things[MAX_THINGS]);
|
||||||
|
|
||||||
|
update();
|
||||||
return oldObject;
|
return oldObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,10 +219,8 @@ bool Tile::removeThing(ThingPtr thing)
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset values managed by this tile
|
// reset values managed by this tile
|
||||||
if(removed) {
|
if(removed)
|
||||||
//thing->setDrawOffset(0);
|
update();
|
||||||
//thing->setStackpos(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return removed;
|
return removed;
|
||||||
}
|
}
|
||||||
|
@ -281,19 +281,6 @@ int Tile::getGroundSpeed()
|
||||||
return groundSpeed;
|
return groundSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color Tile::getMinimapColor()
|
|
||||||
{
|
|
||||||
Color color = Color::black;
|
|
||||||
for(const ThingPtr& thing : m_things) {
|
|
||||||
if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop())
|
|
||||||
break;
|
|
||||||
int c = thing->getMinimapColor();
|
|
||||||
if(c != 0)
|
|
||||||
color = Color::from8bit(c);
|
|
||||||
}
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
ThingPtr Tile::getTopLookThing()
|
ThingPtr Tile::getTopLookThing()
|
||||||
{
|
{
|
||||||
if(isEmpty())
|
if(isEmpty())
|
||||||
|
@ -493,3 +480,14 @@ bool Tile::canErase()
|
||||||
return m_walkingCreatures.empty() && m_effects.empty() && m_things.empty();
|
return m_walkingCreatures.empty() && m_effects.empty() && m_things.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Tile::update()
|
||||||
|
{
|
||||||
|
m_minimapColorByte = 0;
|
||||||
|
for(const ThingPtr& thing : m_things) {
|
||||||
|
if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom() && !thing->isOnTop())
|
||||||
|
break;
|
||||||
|
uint8 c = thing->getMinimapColor();
|
||||||
|
if(c != 0)
|
||||||
|
m_minimapColorByte = c;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public:
|
||||||
const std::vector<ThingPtr>& getThings() { return m_things; }
|
const std::vector<ThingPtr>& getThings() { return m_things; }
|
||||||
ItemPtr getGround();
|
ItemPtr getGround();
|
||||||
int getGroundSpeed();
|
int getGroundSpeed();
|
||||||
Color getMinimapColor();
|
uint8 getMinimapColorByte() { return m_minimapColorByte; }
|
||||||
int getThingCount() { return m_things.size() + m_effects.size(); }
|
int getThingCount() { return m_things.size() + m_effects.size(); }
|
||||||
bool isPathable();
|
bool isPathable();
|
||||||
bool isWalkable();
|
bool isWalkable();
|
||||||
|
@ -101,12 +101,15 @@ public:
|
||||||
void setFlags(tileflags_t flags) { m_flags |= (uint32)flags; }
|
void setFlags(tileflags_t flags) { m_flags |= (uint32)flags; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void update();
|
||||||
|
|
||||||
std::vector<CreaturePtr> m_walkingCreatures;
|
std::vector<CreaturePtr> m_walkingCreatures;
|
||||||
std::vector<EffectPtr> m_effects; // leave this outside m_things because it has no stackpos.
|
std::vector<EffectPtr> m_effects; // leave this outside m_things because it has no stackpos.
|
||||||
std::vector<ThingPtr> m_things;
|
std::vector<ThingPtr> m_things;
|
||||||
Position m_position;
|
Position m_position;
|
||||||
uint8 m_drawElevation;
|
uint8 m_drawElevation;
|
||||||
uint32 m_flags;
|
uint32 m_flags;
|
||||||
|
uint8 m_minimapColorByte;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -101,8 +101,10 @@ void UIMap::setVisibleDimension(const Size& visibleDimension)
|
||||||
{
|
{
|
||||||
m_mapView->setVisibleDimension(visibleDimension);
|
m_mapView->setVisibleDimension(visibleDimension);
|
||||||
|
|
||||||
if(m_aspectRatio != 0.0f)
|
if(m_aspectRatio != 0.0f) {
|
||||||
m_aspectRatio = visibleDimension.ratio();
|
m_aspectRatio = visibleDimension.ratio();
|
||||||
|
updateMapSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIMap::setKeepAspectRatio(bool enable)
|
void UIMap::setKeepAspectRatio(bool enable)
|
||||||
|
@ -111,6 +113,7 @@ void UIMap::setKeepAspectRatio(bool enable)
|
||||||
m_aspectRatio = getVisibleDimension().ratio();
|
m_aspectRatio = getVisibleDimension().ratio();
|
||||||
else
|
else
|
||||||
m_aspectRatio = 0.0f;
|
m_aspectRatio = 0.0f;
|
||||||
|
updateMapSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
TilePtr UIMap::getTile(const Point& mousePos)
|
TilePtr UIMap::getTile(const Point& mousePos)
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
bool isDrawingTexts() { return m_mapView->isDrawingTexts(); }
|
bool isDrawingTexts() { return m_mapView->isDrawingTexts(); }
|
||||||
bool isDrawingMinimapColors() { return m_mapView->isDrawingMinimapColors(); }
|
bool isDrawingMinimapColors() { return m_mapView->isDrawingMinimapColors(); }
|
||||||
bool isAnimating() { return m_mapView->isAnimating(); }
|
bool isAnimating() { return m_mapView->isAnimating(); }
|
||||||
float isKeepAspectRatioEnabled() { return m_aspectRatio != 0.0f; }
|
bool isKeepAspectRatioEnabled() { return m_aspectRatio != 0.0f; }
|
||||||
|
|
||||||
Size getVisibleDimension() { return m_mapView->getVisibleDimension(); }
|
Size getVisibleDimension() { return m_mapView->getVisibleDimension(); }
|
||||||
MapView::ViewMode getViewMode() { return m_mapView->getViewMode(); }
|
MapView::ViewMode getViewMode() { return m_mapView->getViewMode(); }
|
||||||
|
|
Loading…
Reference in New Issue