From cda78fb30ffadf5d951ad1a4350d32897fbebaa0 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 21 Feb 2023 23:16:24 +0200 Subject: [PATCH] Added option to disable animations for very low-end systems --- client/mapRenderer/MapRendererContext.cpp | 6 ++++++ config/schemas/settings.json | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/mapRenderer/MapRendererContext.cpp b/client/mapRenderer/MapRendererContext.cpp index 37d1421af..e79926663 100644 --- a/client/mapRenderer/MapRendererContext.cpp +++ b/client/mapRenderer/MapRendererContext.cpp @@ -90,6 +90,9 @@ size_t MapRendererContext::objectImageIndex(ObjectInstanceID objectID, size_t gr if(groupSize == 0) return 0; + if (!settings["adventure"]["objectAnimation"].Bool()) + return 0; + // H3 timing for adventure map objects animation is 180 ms // Terrain animations also use identical interval, however those are only present in HotA and/or HD Mod size_t baseFrameTime = 180; @@ -106,6 +109,9 @@ size_t MapRendererContext::objectImageIndex(ObjectInstanceID objectID, size_t gr size_t MapRendererContext::terrainImageIndex(size_t groupSize) const { + if (!settings["adventure"]["terrainAnimation"].Bool()) + return 0; + size_t baseFrameTime = 180; size_t frameCounter = animationTime / baseFrameTime; size_t frameIndex = frameCounter % groupSize; diff --git a/config/schemas/settings.json b/config/schemas/settings.json index 494533751..cde6f852d 100644 --- a/config/schemas/settings.json +++ b/config/schemas/settings.json @@ -161,7 +161,7 @@ "type" : "object", "additionalProperties" : false, "default": {}, - "required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat" ], + "required" : [ "heroMoveTime", "enemyMoveTime", "scrollSpeedPixels", "heroReminder", "quickCombat", "objectAnimation", "terrainAnimation" ], "properties" : { "heroMoveTime" : { "type" : "number", @@ -182,6 +182,14 @@ "quickCombat" : { "type" : "boolean", "default" : false + }, + "objectAnimation" : { + "type" : "boolean", + "default" : true + }, + "terrainAnimation" : { + "type" : "boolean", + "default" : true } } },