1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);

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
bool scrollingWasBlocked;
/// if true, the hotseat next player is opened
bool isHotseatMessage;
/// how much should the background dimmed, when windows are on the top
int backgroundDimLevel;
/// spell for which player is selecting target, or nullptr if none
const CSpell *spellBeingCasted;