Browse Source

Fix battle settings UI labels, add "dont show battle intro" setting

Dydzio 2 years ago
parent
commit
775db89241

+ 2 - 0
Mods/vcmi/config/vcmi/english.json

@@ -71,6 +71,8 @@
 	"vcmi.battleOptions.animationsSpeed5.help": "Sets animation speed to super fast",
 	"vcmi.battleOptions.animationsSpeed6.hover": "6",
 	"vcmi.battleOptions.animationsSpeed6.help": "Sets animation speed to extremely fast",
+	"vcmi.battleOptions.skipBattleIntroMusic.hover": "Skip intro music",
+	"vcmi.battleOptions.skipBattleIntroMusic.help": "{Skip intro music}\n\n Skip short music that plays at beginning of each battle before action starts.",
 
 	"vcmi.otherOptions.availableCreaturesAsDwellingLabel.hover" : "Show available creatures in town summary",
 	"vcmi.otherOptions.availableCreaturesAsDwellingLabel.help" : "{Show available creatures in town summary}\n\n Shows creatures available to purchase instead of their growth in town summary (bottom-left corner).",

+ 10 - 0
client/windows/settings/BattleOptionsTab.cpp

@@ -30,6 +30,7 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner):
 	addCallback("animationSpeedChanged", std::bind(&BattleOptionsTab::animationSpeedChangedCallback, this, _1));
 	addCallback("showQueueChanged", std::bind(&BattleOptionsTab::showQueueChangedCallback, this, _1));
 	addCallback("queueSizeChanged", std::bind(&BattleOptionsTab::queueSizeChangedCallback, this, _1));
+	addCallback("skipBattleIntroMusicChanged", std::bind(&BattleOptionsTab::skipBattleIntroMusicChangedCallback, this, _1));
 	build(config);
 
 	std::shared_ptr<CToggleGroup> animationSpeedToggle = widget<CToggleGroup>("animationSpeedPicker");
@@ -49,6 +50,9 @@ BattleOptionsTab::BattleOptionsTab(BattleInterface * owner):
 
 	std::shared_ptr<CToggleButton> showQueueCheckbox = widget<CToggleButton>("showQueueCheckbox");
 	showQueueCheckbox->setSelected((bool)settings["battle"]["showQueue"].Bool());
+
+	std::shared_ptr<CToggleButton> skipBattleIntroMusicCheckbox = widget<CToggleButton>("skipBattleIntroMusicCheckbox");
+	skipBattleIntroMusicCheckbox->setSelected((bool)settings["gameTweaks"]["skipBattleIntroMusic"].Bool());
 }
 
 int BattleOptionsTab::getAnimSpeed() const
@@ -128,3 +132,9 @@ void BattleOptionsTab::queueSizeChangedCallback(int value)
 	size->String() = stringifiedValue;
 }
 
+void BattleOptionsTab::skipBattleIntroMusicChangedCallback(bool value)
+{
+	Settings musicSkipSettingValue = settings.write["gameTweaks"]["skipBattleIntroMusic"];
+	musicSkipSettingValue->Bool() = value;
+}
+

+ 1 - 0
client/windows/settings/BattleOptionsTab.h

@@ -27,6 +27,7 @@ private:
 	void animationSpeedChangedCallback(int value);
 	void showQueueChangedCallback(bool value);
 	void queueSizeChangedCallback(int value);
+	void skipBattleIntroMusicChangedCallback(bool value);
 public:
 	BattleOptionsTab(BattleInterface * owner = nullptr);
 };

+ 6 - 1
config/schemas/settings.json

@@ -479,7 +479,8 @@
 				"forceMovementInfo",
 				"numericCreaturesQuantities",
 				"availableCreaturesAsDwellingLabel",
-				"compactTownCreatureInfo"
+				"compactTownCreatureInfo",
+				"skipBattleIntroMusic"
 			],
 			"properties": {
 				"showGrid": {
@@ -501,6 +502,10 @@
 				"compactTownCreatureInfo" : {
 					"type" : "boolean",
 					"default" : false
+				},
+				"skipBattleIntroMusic" : {
+					"type" : "boolean",
+					"default" : false
 				}
 			}
 		}

+ 23 - 4
config/widgets/settings/battleOptionsTab.json

@@ -95,7 +95,7 @@
 		},
 
 		{
-			"name": "generalOptionsLabel1",
+			"name": "viewGridLabel",
 			"type": "label",
 			"font": "medium",
 			"alignment": "left",
@@ -104,7 +104,7 @@
 			"position": {"x": 61, "y": 27}
 		},
 		{
-			"name": "generalOptionsLabel2",
+			"name": "showMovementRangeLabel",
 			"type": "label",
 			"font": "medium",
 			"alignment": "left",
@@ -113,7 +113,7 @@
 			"position": {"x": 61, "y": 60}
 		},
 		{
-			"name": "generalOptionsLabel3",
+			"name": "mouseShadowLabel",
 			"type": "label",
 			"font": "medium",
 			"alignment": "left",
@@ -122,7 +122,7 @@
 			"position": {"x": 61, "y": 93}
 		},
 		{
-			"name": "generalOptionsLabel4",
+			"name": "battleCasualtiesLabel",
 			"type": "label",
 			"font": "medium",
 			"alignment": "left",
@@ -334,6 +334,25 @@
 				}
 			],
 			"callback": "queueSizeChanged"
+		},
+
+		{
+			"name": "skipBattleIntroMusicLabel",
+			"type": "label",
+			"font": "medium",
+			"alignment": "left",
+			"color": "white",
+			"text": "vcmi.battleOptions.skipBattleIntroMusic.hover",
+			"position": {"x": 61, "y": 472}
+		},
+
+		{
+			"name": "skipBattleIntroMusicCheckbox",
+			"type": "toggleButton",
+			"image": "sysopchk.def",
+			"help": "vcmi.battleOptions.skipBattleIntroMusic",
+			"position": {"x": 25, "y": 470},
+			"callback": "skipBattleIntroMusicChanged"
 		}
 	]
 }