mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Merge pull request #1878 from IvanSavenko/fix_battle_ui
Fix visual glitches in battle UI
This commit is contained in:
@@ -89,6 +89,7 @@ void BattleWindow::createQueue()
|
|||||||
|
|
||||||
//create stack queue and adjust our own position
|
//create stack queue and adjust our own position
|
||||||
bool embedQueue;
|
bool embedQueue;
|
||||||
|
bool showQueue = settings["battle"]["showQueue"].Bool();
|
||||||
std::string queueSize = settings["battle"]["queueSize"].String();
|
std::string queueSize = settings["battle"]["queueSize"].String();
|
||||||
|
|
||||||
if(queueSize == "auto")
|
if(queueSize == "auto")
|
||||||
@@ -97,13 +98,16 @@ void BattleWindow::createQueue()
|
|||||||
embedQueue = GH.screenDimensions().y < 700 || queueSize == "small";
|
embedQueue = GH.screenDimensions().y < 700 || queueSize == "small";
|
||||||
|
|
||||||
queue = std::make_shared<StackQueue>(embedQueue, owner);
|
queue = std::make_shared<StackQueue>(embedQueue, owner);
|
||||||
if(!embedQueue && settings["battle"]["showQueue"].Bool())
|
if(!embedQueue && showQueue)
|
||||||
{
|
{
|
||||||
//re-center, taking into account stack queue position
|
//re-center, taking into account stack queue position
|
||||||
pos.y -= queue->pos.h;
|
pos.y -= queue->pos.h;
|
||||||
pos.h += queue->pos.h;
|
pos.h += queue->pos.h;
|
||||||
pos = center();
|
pos = center();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!showQueue)
|
||||||
|
queue->disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
BattleWindow::~BattleWindow()
|
BattleWindow::~BattleWindow()
|
||||||
@@ -143,8 +147,8 @@ void BattleWindow::hideQueue()
|
|||||||
pos.y += queue->pos.h;
|
pos.y += queue->pos.h;
|
||||||
pos.h -= queue->pos.h;
|
pos.h -= queue->pos.h;
|
||||||
pos = center();
|
pos = center();
|
||||||
GH.totalRedraw();
|
|
||||||
}
|
}
|
||||||
|
GH.totalRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleWindow::showQueue()
|
void BattleWindow::showQueue()
|
||||||
@@ -213,9 +217,12 @@ void BattleWindow::tacticPhaseStarted()
|
|||||||
auto menuTactics = widget<CIntObject>("menuTactics");
|
auto menuTactics = widget<CIntObject>("menuTactics");
|
||||||
auto tacticNext = widget<CIntObject>("tacticNext");
|
auto tacticNext = widget<CIntObject>("tacticNext");
|
||||||
auto tacticEnd = widget<CIntObject>("tacticEnd");
|
auto tacticEnd = widget<CIntObject>("tacticEnd");
|
||||||
|
auto alternativeAction = widget<CIntObject>("alternativeAction");
|
||||||
|
|
||||||
menuBattle->disable();
|
menuBattle->disable();
|
||||||
console->disable();
|
console->disable();
|
||||||
|
if (alternativeAction)
|
||||||
|
alternativeAction->disable();
|
||||||
|
|
||||||
menuTactics->enable();
|
menuTactics->enable();
|
||||||
tacticNext->enable();
|
tacticNext->enable();
|
||||||
@@ -231,9 +238,12 @@ void BattleWindow::tacticPhaseEnded()
|
|||||||
auto menuTactics = widget<CIntObject>("menuTactics");
|
auto menuTactics = widget<CIntObject>("menuTactics");
|
||||||
auto tacticNext = widget<CIntObject>("tacticNext");
|
auto tacticNext = widget<CIntObject>("tacticNext");
|
||||||
auto tacticEnd = widget<CIntObject>("tacticEnd");
|
auto tacticEnd = widget<CIntObject>("tacticEnd");
|
||||||
|
auto alternativeAction = widget<CIntObject>("alternativeAction");
|
||||||
|
|
||||||
menuBattle->enable();
|
menuBattle->enable();
|
||||||
console->enable();
|
console->enable();
|
||||||
|
if (alternativeAction)
|
||||||
|
alternativeAction->enable();
|
||||||
|
|
||||||
menuTactics->disable();
|
menuTactics->disable();
|
||||||
tacticNext->disable();
|
tacticNext->disable();
|
||||||
|
@@ -84,14 +84,19 @@ int BattleOptionsTab::getAnimSpeed() const
|
|||||||
|
|
||||||
int BattleOptionsTab::getQueueSizeId() const
|
int BattleOptionsTab::getQueueSizeId() const
|
||||||
{
|
{
|
||||||
std::string text = settings["battle"]["queueSize"].String();
|
std::string sizeText = settings["battle"]["queueSize"].String();
|
||||||
if(text == "none")
|
bool visible = settings["battle"]["showQueue"].Bool();
|
||||||
|
|
||||||
|
if(!visible)
|
||||||
return -1;
|
return -1;
|
||||||
if(text == "auto")
|
|
||||||
|
if(sizeText == "none")
|
||||||
|
return -1;
|
||||||
|
if(sizeText == "auto")
|
||||||
return 0;
|
return 0;
|
||||||
if(text == "small")
|
if(sizeText == "small")
|
||||||
return 1;
|
return 1;
|
||||||
if(text == "big")
|
if(sizeText == "big")
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user