1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

dimlevel as class variable

This commit is contained in:
Laserlicht
2023-09-24 12:08:27 +02:00
committed by GitHub
parent b143c2786f
commit 72e4941982
2 changed files with 6 additions and 8 deletions

View File

@ -51,7 +51,7 @@ AdventureMapInterface::AdventureMapInterface():
spellBeingCasted(nullptr),
scrollingWasActive(false),
scrollingWasBlocked(false),
isHotseatMessage(false)
backgroundDimLevel(settings["adventure"]["backgroundDimLevel"].Integer())
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
pos.x = pos.y = 0;
@ -172,9 +172,6 @@ void AdventureMapInterface::dim(Canvas & to)
std::shared_ptr<AdventureMapInterface> casted = std::dynamic_pointer_cast<AdventureMapInterface>(window);
if (!casted && !window->isPopupWindow())
{
int backgroundDimLevel = settings["adventure"]["backgroundDimLevel"].Integer();
if(isHotseatMessage)
backgroundDimLevel = 255;
Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y);
ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255));
if(backgroundDimLevel > 0)
@ -338,7 +335,8 @@ void AdventureMapInterface::onMapTilesChanged(boost::optional<std::unordered_set
void AdventureMapInterface::onHotseatWaitStarted(PlayerColor playerID)
{
isHotseatMessage = true;
backgroundDimLevel = 255;
onCurrentPlayerChanged(playerID);
setState(EAdventureState::HOTSEAT_WAIT);
}
@ -383,7 +381,7 @@ void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID)
void AdventureMapInterface::onPlayerTurnStarted(PlayerColor playerID)
{
isHotseatMessage = false;
backgroundDimLevel = settings["adventure"]["backgroundDimLevel"].Integer();
onCurrentPlayerChanged(playerID);