소스 검색

possibility to disable dimming of small windows

Laserlicht 1 년 전
부모
커밋
19b75c3d88
2개의 변경된 파일9개의 추가작업 그리고 3개의 파일을 삭제
  1. 4 2
      client/adventureMap/AdventureMapInterface.cpp
  2. 5 1
      config/schemas/settings.json

+ 4 - 2
client/adventureMap/AdventureMapInterface.cpp

@@ -171,10 +171,12 @@ void AdventureMapInterface::show(Canvas & to)
 
 void AdventureMapInterface::dim(Canvas & to)
 {
+	auto const isBigWindow = [&](std::shared_ptr<IShowActivatable> window) { return std::dynamic_pointer_cast<CIntObject>(window)->pos.w >= 800 && std::dynamic_pointer_cast<CIntObject>(window)->pos.w >= 600; }; // OH3 fullscreen
+
 	if(settings["adventure"]["hideBackground"].Bool())
 		for (auto window : GH.windows().findWindows<IShowActivatable>())
 		{
-			if(!std::dynamic_pointer_cast<AdventureMapInterface>(window) && std::dynamic_pointer_cast<CIntObject>(window) && std::dynamic_pointer_cast<CIntObject>(window)->pos.w >= 800 && std::dynamic_pointer_cast<CIntObject>(window)->pos.w >= 600)
+			if(!std::dynamic_pointer_cast<AdventureMapInterface>(window) && std::dynamic_pointer_cast<CIntObject>(window) && isBigWindow(window))
 			{
 				to.fillTexture(GH.renderHandler().loadImage(ImagePath::builtin("DiBoxBck")));
 				return;
@@ -182,7 +184,7 @@ void AdventureMapInterface::dim(Canvas & to)
 		}
 	for (auto window : GH.windows().findWindows<IShowActivatable>())
 	{
-		if (!std::dynamic_pointer_cast<AdventureMapInterface>(window) && !std::dynamic_pointer_cast<RadialMenu>(window) && !window->isPopupWindow())
+		if (!std::dynamic_pointer_cast<AdventureMapInterface>(window) && !std::dynamic_pointer_cast<RadialMenu>(window) && !window->isPopupWindow() && (settings["adventure"]["backgroundDimSmallWindows"].Bool() || isBigWindow(window)))
 		{
 			Rect targetRect(0, 0, GH.screenDimensions().x, GH.screenDimensions().y);
 			ColorRGBA colorToFill(0, 0, 0, std::clamp<int>(backgroundDimLevel, 0, 255));

+ 5 - 1
config/schemas/settings.json

@@ -252,7 +252,7 @@
 			"type" : "object",
 			"additionalProperties" : false,
 			"default" : {},
-			"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "smoothDragging", "backgroundDimLevel", "hideBackground" ],
+			"required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation", "forceQuickCombat", "borderScroll", "leftButtonDrag", "smoothDragging", "backgroundDimLevel", "hideBackground", "backgroundDimSmallWindows" ],
 			"properties" : {
 				"heroMoveTime" : {
 					"type" : "number",
@@ -308,6 +308,10 @@
 				"hideBackground" : {
 					"type" : "boolean",
 					"default" : false
+				},
+				"backgroundDimSmallWindows" : {
+					"type" : "boolean",
+					"default" : true
 				}
 			}
 		},