1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-02-07 13:08:09 +02:00

Merge pull request #2934 from Laserlicht/hotseat_hide

This commit is contained in:
Nordsoft91 2023-09-24 14:12:19 +02:00 committed by GitHub
commit ed2e5c6fd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -50,7 +50,8 @@ AdventureMapInterface::AdventureMapInterface():
mapAudio(new MapAudioPlayer()),
spellBeingCasted(nullptr),
scrollingWasActive(false),
scrollingWasBlocked(false)
scrollingWasBlocked(false),
backgroundDimLevel(settings["adventure"]["backgroundDimLevel"].Integer())
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
pos.x = pos.y = 0;
@ -171,7 +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();
Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y);
ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255));
if(backgroundDimLevel > 0)
@ -335,6 +335,8 @@ void AdventureMapInterface::onMapTilesChanged(boost::optional<std::unordered_set
void AdventureMapInterface::onHotseatWaitStarted(PlayerColor playerID)
{
backgroundDimLevel = 255;
onCurrentPlayerChanged(playerID);
setState(EAdventureState::HOTSEAT_WAIT);
}
@ -379,6 +381,8 @@ void AdventureMapInterface::onCurrentPlayerChanged(PlayerColor playerID)
void AdventureMapInterface::onPlayerTurnStarted(PlayerColor playerID)
{
backgroundDimLevel = settings["adventure"]["backgroundDimLevel"].Integer();
onCurrentPlayerChanged(playerID);
setState(EAdventureState::MAKING_TURN);

View File

@ -59,6 +59,9 @@ private:
/// if true, then scrolling was blocked via ctrl and should not restart until player move cursor outside scrolling area
bool scrollingWasBlocked;
/// 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;