commit
fe1ca3d329
|
@ -34,6 +34,10 @@ Panel
|
||||||
id: displayHealth
|
id: displayHealth
|
||||||
!text: tr('Display creature health bars')
|
!text: tr('Display creature health bars')
|
||||||
|
|
||||||
|
OptionCheckBox
|
||||||
|
id: displayMana
|
||||||
|
!text: tr('Display player mana bar')
|
||||||
|
|
||||||
OptionCheckBox
|
OptionCheckBox
|
||||||
id: displayText
|
id: displayText
|
||||||
!text: tr('Display text messages')
|
!text: tr('Display text messages')
|
||||||
|
|
|
@ -25,6 +25,7 @@ local defaultOptions = {
|
||||||
ambientLight = 25,
|
ambientLight = 25,
|
||||||
displayNames = true,
|
displayNames = true,
|
||||||
displayHealth = true,
|
displayHealth = true,
|
||||||
|
displayMana = true,
|
||||||
displayText = true,
|
displayText = true,
|
||||||
dontStretchShrink = false,
|
dontStretchShrink = false,
|
||||||
turnDelay = 50,
|
turnDelay = 50,
|
||||||
|
@ -157,15 +158,17 @@ function hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
function toggleDisplays()
|
function toggleDisplays()
|
||||||
if options['displayNames'] and options['displayHealth'] then
|
if options['displayNames'] and options['displayHealth'] and options['displayMana'] then
|
||||||
setOption('displayNames', false)
|
setOption('displayNames', false)
|
||||||
elseif options['displayHealth'] then
|
elseif options['displayHealth'] then
|
||||||
setOption('displayHealth', false)
|
setOption('displayHealth', false)
|
||||||
|
setOption('displayMana', false)
|
||||||
else
|
else
|
||||||
if not options['displayNames'] and not options['displayHealth'] then
|
if not options['displayNames'] and not options['displayHealth'] then
|
||||||
setOption('displayNames', true)
|
setOption('displayNames', true)
|
||||||
else
|
else
|
||||||
setOption('displayHealth', true)
|
setOption('displayHealth', true)
|
||||||
|
setOption('displayMana', true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -224,6 +227,8 @@ function setOption(key, value, force)
|
||||||
gameMapPanel:setDrawNames(value)
|
gameMapPanel:setDrawNames(value)
|
||||||
elseif key == 'displayHealth' then
|
elseif key == 'displayHealth' then
|
||||||
gameMapPanel:setDrawHealthBars(value)
|
gameMapPanel:setDrawHealthBars(value)
|
||||||
|
elseif key == 'displayMana' then
|
||||||
|
gameMapPanel:setDrawManaBar(value)
|
||||||
elseif key == 'displayText' then
|
elseif key == 'displayText' then
|
||||||
gameMapPanel:setDrawTexts(value)
|
gameMapPanel:setDrawTexts(value)
|
||||||
elseif key == 'dontStretchShrink' then
|
elseif key == 'dontStretchShrink' then
|
||||||
|
|
|
@ -60,11 +60,12 @@ namespace Otc
|
||||||
DrawBars = 4096,
|
DrawBars = 4096,
|
||||||
DrawNames = 8192,
|
DrawNames = 8192,
|
||||||
DrawLights = 16384,
|
DrawLights = 16384,
|
||||||
|
DrawManaBar = 32768,
|
||||||
DrawWalls = DrawOnBottom | DrawOnTop,
|
DrawWalls = DrawOnBottom | DrawOnTop,
|
||||||
DrawEverything = DrawGround | DrawGroundBorders | DrawWalls | DrawItems |
|
DrawEverything = DrawGround | DrawGroundBorders | DrawWalls | DrawItems |
|
||||||
DrawCreatures | DrawEffects | DrawMissiles | DrawCreaturesInformation |
|
DrawCreatures | DrawEffects | DrawMissiles | DrawCreaturesInformation |
|
||||||
DrawStaticTexts | DrawAnimatedTexts | DrawAnimations | DrawBars | DrawNames |
|
DrawStaticTexts | DrawAnimatedTexts | DrawAnimations | DrawBars | DrawNames |
|
||||||
DrawLights
|
DrawLights | DrawManaBar
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DatOpts {
|
enum DatOpts {
|
||||||
|
|
|
@ -241,10 +241,15 @@ void Creature::drawInformation(const Point& point, bool useGray, const Rect& par
|
||||||
textRect.bind(parentRect);
|
textRect.bind(parentRect);
|
||||||
|
|
||||||
// distance them
|
// distance them
|
||||||
|
uint32 offset = 12;
|
||||||
|
if(isLocalPlayer()) {
|
||||||
|
offset *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
if(textRect.top() == parentRect.top())
|
if(textRect.top() == parentRect.top())
|
||||||
backgroundRect.moveTop(textRect.top() + 12);
|
backgroundRect.moveTop(textRect.top() + offset);
|
||||||
if(backgroundRect.bottom() == parentRect.bottom())
|
if(backgroundRect.bottom() == parentRect.bottom())
|
||||||
textRect.moveTop(backgroundRect.top() - 12);
|
textRect.moveTop(backgroundRect.top() - offset);
|
||||||
|
|
||||||
// health rect is based on background rect, so no worries
|
// health rect is based on background rect, so no worries
|
||||||
Rect healthRect = backgroundRect.expanded(-1);
|
Rect healthRect = backgroundRect.expanded(-1);
|
||||||
|
@ -260,6 +265,27 @@ void Creature::drawInformation(const Point& point, bool useGray, const Rect& par
|
||||||
|
|
||||||
g_painter->setColor(fillColor);
|
g_painter->setColor(fillColor);
|
||||||
g_painter->drawFilledRect(healthRect);
|
g_painter->drawFilledRect(healthRect);
|
||||||
|
|
||||||
|
if(drawFlags & Otc::DrawManaBar && isLocalPlayer()) {
|
||||||
|
LocalPlayerPtr player = g_game.getLocalPlayer();
|
||||||
|
if(player) {
|
||||||
|
backgroundRect.moveTop(backgroundRect.bottom());
|
||||||
|
|
||||||
|
g_painter->setColor(Color::black);
|
||||||
|
g_painter->drawFilledRect(backgroundRect);
|
||||||
|
|
||||||
|
Rect manaRect = backgroundRect.expanded(-1);
|
||||||
|
double maxMana = player->getMaxMana();
|
||||||
|
if(maxMana == 0) {
|
||||||
|
manaRect.setWidth(25);
|
||||||
|
} else {
|
||||||
|
manaRect.setWidth(player->getMana() / (maxMana * 1.0) * 25);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_painter->setColor(Color::blue);
|
||||||
|
g_painter->drawFilledRect(manaRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(drawFlags & Otc::DrawNames) {
|
if(drawFlags & Otc::DrawNames) {
|
||||||
|
|
|
@ -749,6 +749,7 @@ void Client::registerLuaFunctions()
|
||||||
g_lua.bindClassMemberFunction<UIMap>("setDrawNames", &UIMap::setDrawNames);
|
g_lua.bindClassMemberFunction<UIMap>("setDrawNames", &UIMap::setDrawNames);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("setDrawHealthBars", &UIMap::setDrawHealthBars);
|
g_lua.bindClassMemberFunction<UIMap>("setDrawHealthBars", &UIMap::setDrawHealthBars);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("setDrawLights", &UIMap::setDrawLights);
|
g_lua.bindClassMemberFunction<UIMap>("setDrawLights", &UIMap::setDrawLights);
|
||||||
|
g_lua.bindClassMemberFunction<UIMap>("setDrawManaBar", &UIMap::setDrawManaBar);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("setAnimated", &UIMap::setAnimated);
|
g_lua.bindClassMemberFunction<UIMap>("setAnimated", &UIMap::setAnimated);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("setKeepAspectRatio", &UIMap::setKeepAspectRatio);
|
g_lua.bindClassMemberFunction<UIMap>("setKeepAspectRatio", &UIMap::setKeepAspectRatio);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("setMapShader", &UIMap::setMapShader);
|
g_lua.bindClassMemberFunction<UIMap>("setMapShader", &UIMap::setMapShader);
|
||||||
|
@ -761,6 +762,7 @@ void Client::registerLuaFunctions()
|
||||||
g_lua.bindClassMemberFunction<UIMap>("isDrawingNames", &UIMap::isDrawingNames);
|
g_lua.bindClassMemberFunction<UIMap>("isDrawingNames", &UIMap::isDrawingNames);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("isDrawingHealthBars", &UIMap::isDrawingHealthBars);
|
g_lua.bindClassMemberFunction<UIMap>("isDrawingHealthBars", &UIMap::isDrawingHealthBars);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("isDrawingLights", &UIMap::isDrawingLights);
|
g_lua.bindClassMemberFunction<UIMap>("isDrawingLights", &UIMap::isDrawingLights);
|
||||||
|
g_lua.bindClassMemberFunction<UIMap>("isDrawingManaBar", &UIMap::isDrawingManaBar);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("isLimitVisibleRangeEnabled", &UIMap::isLimitVisibleRangeEnabled);
|
g_lua.bindClassMemberFunction<UIMap>("isLimitVisibleRangeEnabled", &UIMap::isLimitVisibleRangeEnabled);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("isAnimating", &UIMap::isAnimating);
|
g_lua.bindClassMemberFunction<UIMap>("isAnimating", &UIMap::isAnimating);
|
||||||
g_lua.bindClassMemberFunction<UIMap>("isKeepAspectRatioEnabled", &UIMap::isKeepAspectRatioEnabled);
|
g_lua.bindClassMemberFunction<UIMap>("isKeepAspectRatioEnabled", &UIMap::isKeepAspectRatioEnabled);
|
||||||
|
|
|
@ -234,6 +234,7 @@ void MapView::draw(const Rect& rect)
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if(m_drawNames){ flags = Otc::DrawNames; }
|
if(m_drawNames){ flags = Otc::DrawNames; }
|
||||||
if(m_drawHealthBars) { flags |= Otc::DrawBars; }
|
if(m_drawHealthBars) { flags |= Otc::DrawBars; }
|
||||||
|
if(m_drawManaBar) { flags |= Otc::DrawManaBar; }
|
||||||
creature->drawInformation(p, g_map.isCovered(pos, m_cachedFirstVisibleFloor), rect, flags);
|
creature->drawInformation(p, g_map.isCovered(pos, m_cachedFirstVisibleFloor), rect, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,6 +108,9 @@ public:
|
||||||
void setDrawLights(bool enable);
|
void setDrawLights(bool enable);
|
||||||
bool isDrawingLights() { return m_drawLights; }
|
bool isDrawingLights() { return m_drawLights; }
|
||||||
|
|
||||||
|
void setDrawManaBar(bool enable) { m_drawManaBar = enable; }
|
||||||
|
bool isDrawingManaBar() { return m_drawManaBar; }
|
||||||
|
|
||||||
void move(int x, int y);
|
void move(int x, int y);
|
||||||
|
|
||||||
void setAnimated(bool animated) { m_animated = animated; requestVisibleTilesCacheUpdate(); }
|
void setAnimated(bool animated) { m_animated = animated; requestVisibleTilesCacheUpdate(); }
|
||||||
|
@ -153,6 +156,7 @@ private:
|
||||||
stdext::boolean<true> m_drawNames;
|
stdext::boolean<true> m_drawNames;
|
||||||
stdext::boolean<true> m_drawHealthBars;
|
stdext::boolean<true> m_drawHealthBars;
|
||||||
stdext::boolean<false> m_drawLights;
|
stdext::boolean<false> m_drawLights;
|
||||||
|
stdext::boolean<true> m_drawManaBar;
|
||||||
stdext::boolean<true> m_smooth;
|
stdext::boolean<true> m_smooth;
|
||||||
|
|
||||||
stdext::boolean<true> m_follow;
|
stdext::boolean<true> m_follow;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public:
|
||||||
void setDrawNames(bool enable) { m_mapView->setDrawNames(enable); }
|
void setDrawNames(bool enable) { m_mapView->setDrawNames(enable); }
|
||||||
void setDrawHealthBars(bool enable) { m_mapView->setDrawHealthBars(enable); }
|
void setDrawHealthBars(bool enable) { m_mapView->setDrawHealthBars(enable); }
|
||||||
void setDrawLights(bool enable) { m_mapView->setDrawLights(enable); }
|
void setDrawLights(bool enable) { m_mapView->setDrawLights(enable); }
|
||||||
|
void setDrawManaBar(bool enable) { m_mapView->setDrawManaBar(enable); }
|
||||||
void setAnimated(bool enable) { m_mapView->setAnimated(enable); }
|
void setAnimated(bool enable) { m_mapView->setAnimated(enable); }
|
||||||
void setKeepAspectRatio(bool enable);
|
void setKeepAspectRatio(bool enable);
|
||||||
void setMapShader(const PainterShaderProgramPtr& shader, float fadeout, float fadein) { m_mapView->setShader(shader, fadein, fadeout); }
|
void setMapShader(const PainterShaderProgramPtr& shader, float fadeout, float fadein) { m_mapView->setShader(shader, fadein, fadeout); }
|
||||||
|
@ -70,6 +71,7 @@ public:
|
||||||
bool isDrawingNames() { return m_mapView->isDrawingNames(); }
|
bool isDrawingNames() { return m_mapView->isDrawingNames(); }
|
||||||
bool isDrawingHealthBars() { return m_mapView->isDrawingHealthBars(); }
|
bool isDrawingHealthBars() { return m_mapView->isDrawingHealthBars(); }
|
||||||
bool isDrawingLights() { return m_mapView->isDrawingLights(); }
|
bool isDrawingLights() { return m_mapView->isDrawingLights(); }
|
||||||
|
bool isDrawingManaBar() { return m_mapView->isDrawingManaBar(); }
|
||||||
bool isAnimating() { return m_mapView->isAnimating(); }
|
bool isAnimating() { return m_mapView->isAnimating(); }
|
||||||
bool isKeepAspectRatioEnabled() { return m_keepAspectRatio; }
|
bool isKeepAspectRatioEnabled() { return m_keepAspectRatio; }
|
||||||
bool isLimitVisibleRangeEnabled() { return m_limitVisibleRange; }
|
bool isLimitVisibleRangeEnabled() { return m_limitVisibleRange; }
|
||||||
|
|
Loading…
Reference in New Issue