Michael пре 2 година
родитељ
комит
e650f0100b
2 измењених фајлова са 15 додато и 7 уклоњено
  1. 9 5
      client/adventureMap/AdventureMapInterface.cpp
  2. 6 2
      config/schemas/settings.json

+ 9 - 5
client/adventureMap/AdventureMapInterface.cpp

@@ -170,11 +170,15 @@ void AdventureMapInterface::show(Canvas & to)
 
 void AdventureMapInterface::dim(Canvas & to)
 {
-	if(!GH.windows().findWindows<CCastleInterface>().empty() ||
-			!GH.windows().findWindows<CHeroWindow>().empty() ||
-			!GH.windows().findWindows<CKingdomInterface>().empty() ||
-			!GH.windows().findWindows<BattleWindow>().empty())
-		to.drawColor(Rect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y), ColorRGBA(0, 0, 0, 128));
+	for (auto window : GH.windows().findWindows<IShowActivatable>())
+	{
+		std::shared_ptr<AdventureMapInterface> casted = std::dynamic_pointer_cast<AdventureMapInterface>(window);
+		if (!casted && !window->isPopupWindow())
+		{
+			to.drawColor(Rect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y), ColorRGBA(0, 0, 0, std::clamp<int>(settings["adventure"]["backgroundDimLevel"].Integer(), 0, 255)));
+			return;
+		}
+	}
 }
 
 void AdventureMapInterface::tick(uint32_t msPassed)

+ 6 - 2
config/schemas/settings.json

@@ -226,7 +226,7 @@
 			"type" : "object",
 			"additionalProperties" : false,
 			"default" : {},
-			"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "smoothDragging" ],
+			"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "smoothDragging", "backgroundDimLevel" ],
 			"properties" : {
 				"heroMoveTime" : {
 					"type" : "number",
@@ -274,7 +274,11 @@
 				"smoothDragging" : {
 					"type" : "boolean",
 					"default" : true
-				}
+				},
+				"backgroundDimLevel" : {
+					"type" : "number",
+					"default" : 128
+				},
 			}
 		},
 		"battle" : {