1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-19 00:17:56 +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), spellBeingCasted(nullptr),
scrollingWasActive(false), scrollingWasActive(false),
scrollingWasBlocked(false), scrollingWasBlocked(false),
isHotseatMessage(false) backgroundDimLevel(settings["adventure"]["backgroundDimLevel"].Integer())
{ {
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
pos.x = pos.y = 0; 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); std::shared_ptr<AdventureMapInterface> casted = std::dynamic_pointer_cast<AdventureMapInterface>(window);
if (!casted && !window->isPopupWindow()) if (!casted && !window->isPopupWindow())
{ {
int backgroundDimLevel = settings["adventure"]["backgroundDimLevel"].Integer();
if(isHotseatMessage)
backgroundDimLevel = 255;
Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y); Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y);
ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255)); ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255));
if(backgroundDimLevel > 0) if(backgroundDimLevel > 0)
@ -338,7 +335,8 @@ void AdventureMapInterface::onMapTilesChanged(boost::optional<std::unordered_set
void AdventureMapInterface::onHotseatWaitStarted(PlayerColor playerID) void AdventureMapInterface::onHotseatWaitStarted(PlayerColor playerID)
{ {
isHotseatMessage = true; backgroundDimLevel = 255;
onCurrentPlayerChanged(playerID); onCurrentPlayerChanged(playerID);
setState(EAdventureState::HOTSEAT_WAIT); setState(EAdventureState::HOTSEAT_WAIT);
} }
@ -383,7 +381,7 @@ void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID)
void AdventureMapInterface::onPlayerTurnStarted(PlayerColor playerID) void AdventureMapInterface::onPlayerTurnStarted(PlayerColor playerID)
{ {
isHotseatMessage = false; backgroundDimLevel = settings["adventure"]["backgroundDimLevel"].Integer();
onCurrentPlayerChanged(playerID); onCurrentPlayerChanged(playerID);

View File

@ -59,8 +59,8 @@ private:
/// if true, then scrolling was blocked via ctrl and should not restart until player move cursor outside scrolling area /// if true, then scrolling was blocked via ctrl and should not restart until player move cursor outside scrolling area
bool scrollingWasBlocked; bool scrollingWasBlocked;
/// if true, the hotseat next player is opened /// how much should the background dimmed, when windows are on the top
bool isHotseatMessage; int backgroundDimLevel;
/// spell for which player is selecting target, or nullptr if none /// spell for which player is selecting target, or nullptr if none
const CSpell *spellBeingCasted; const CSpell *spellBeingCasted;