1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

"ForceMovementInfo" support + make other settings tab

This commit is contained in:
Dydzio 2023-02-14 23:45:45 +01:00
parent daa2b63dde
commit 1d153f4ee9
10 changed files with 131 additions and 39 deletions

View File

@ -72,6 +72,11 @@
"vcmi.battleOptions.animationsSpeed6.hover": "6",
"vcmi.battleOptions.animationsSpeed6.help": "Sets animation speed to extremely fast",
"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).",
"vcmi.otherOptions.compactTownCreatureInfo.hover": "More compact creature info in town summary",
"vcmi.otherOptions.compactTownCreatureInfo.help": "{More compact creature info in town summary}\n\n Smaller town creatures information in town summary.",
"vcmi.townHall.missingBase" : "Base building %s must be built first",
"vcmi.townHall.noCreaturesToRecruit" : "There are no creatures to recruit!",
"vcmi.townHall.greetingManaVortex" : "As you near the %s your body is filled with new energy. You have doubled your normal spell points.",

View File

@ -92,7 +92,7 @@ set(client_SRCS
windows/InfoWindows.cpp
windows/QuickRecruitmentWindow.cpp
windows/settings/GeneralOptionsTab.cpp
windows/settings/VcmiSettingsWindow.cpp
windows/settings/OtherOptionsWindow.cpp
windows/settings/SettingsMainContainer.cpp
windows/settings/BattleOptionsTab.cpp
windows/settings/AdventureOptionsTab.cpp
@ -209,7 +209,7 @@ set(client_HEADERS
windows/InfoWindows.h
windows/QuickRecruitmentWindow.h
windows/settings/GeneralOptionsTab.h
windows/settings/VcmiSettingsWindow.h
windows/settings/OtherOptionsWindow.h
windows/settings/SettingsMainContainer.h
windows/settings/BattleOptionsTab.h
windows/settings/AdventureOptionsTab.h

View File

@ -1323,7 +1323,7 @@ void CAdvMapInt::tileHovered(const int3 &mapPos)
const CGPathNode * pathNode = LOCPLINT->cb->getPathsInfo(hero)->getPathInfo(mapPos);
assert(pathNode);
if(GH.isKeyboardAltDown() && pathNode->reachable()) //overwrite status bar text with movement info
if((GH.isKeyboardAltDown() || settings["gameTweaks"]["forceMovementInfo"].Bool()) && pathNode->reachable()) //overwrite status bar text with movement info
{
showMoveDetailsInStatusbar(*hero, *pathNode);
}

View File

@ -0,0 +1,41 @@
/*
* VcmiSettingsWindow.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "OtherOptionsWindow.h"
#include "../../../lib/filesystem/ResourceID.h"
#include "../../gui/CGuiHandler.h"
#include "../../widgets/Buttons.h"
#include "CConfigHandler.h"
static void setBoolSetting(std::string group, std::string field, bool value)
{
Settings fullscreen = settings.write[group][field];
fullscreen->Bool() = value;
}
OtherOptionsWindow::OtherOptionsWindow() : InterfaceObjectConfigurable()
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
const JsonNode config(ResourceID("config/widgets/settings/otherOptionsTab.json"));
addCallback("availableCreaturesAsDwellingLabelChanged", std::bind(&setBoolSetting, "gameTweaks", "availableCreaturesAsDwellingLabel", _1));
addCallback("compactTownCreatureInfoChanged", std::bind(&setBoolSetting, "gameTweaks", "compactTownCreatureInfo", _1));
build(config);
std::shared_ptr<CToggleButton> availableCreaturesAsDwellingLabelCheckbox = widget<CToggleButton>("availableCreaturesAsDwellingLabelCheckbox");
availableCreaturesAsDwellingLabelCheckbox->setSelected((bool)settings["gameTweaks"]["availableCreaturesAsDwellingLabel"].Bool());
std::shared_ptr<CToggleButton> compactTownCreatureInfo = widget<CToggleButton>("compactTownCreatureInfoCheckbox");
compactTownCreatureInfo->setSelected((bool)settings["gameTweaks"]["compactTownCreatureInfo"].Bool());
}

View File

@ -11,10 +11,10 @@
#include "../../gui/InterfaceObjectConfigurable.h"
class VcmiSettingsWindow : public InterfaceObjectConfigurable
class OtherOptionsWindow : public InterfaceObjectConfigurable
{
private:
public:
VcmiSettingsWindow();
OtherOptionsWindow();
};

View File

@ -16,7 +16,7 @@
#include "GeneralOptionsTab.h"
#include "AdventureOptionsTab.h"
#include "BattleOptionsTab.h"
#include "VcmiSettingsWindow.h"
#include "OtherOptionsWindow.h"
#include "filesystem/ResourceID.h"
#include "CGeneralTextHandler.h"
@ -86,7 +86,7 @@ std::shared_ptr<CIntObject> SettingsMainContainer::createTab(size_t index)
case 2:
return std::make_shared<BattleOptionsTab>(parentBattleInterface);
case 3:
return std::make_shared<VcmiSettingsWindow>();
return std::make_shared<OtherOptionsWindow>();
default:
logGlobal->error("Wrong settings tab ID!");
return std::make_shared<GeneralOptionsTab>();

View File

@ -1,25 +0,0 @@
/*
* VcmiSettingsWindow.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#include "StdInc.h"
#include "VcmiSettingsWindow.h"
#include "../../../lib/filesystem/ResourceID.h"
#include "../../gui/CGuiHandler.h"
VcmiSettingsWindow::VcmiSettingsWindow() : InterfaceObjectConfigurable()
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
const JsonNode config(ResourceID("config/widgets/settings/vcmiSettingsTab.json"));
build(config);
}

View File

@ -3,7 +3,7 @@
{
"type" : "object",
"$schema": "http://json-schema.org/draft-04/schema",
"required" : [ "general", "video", "adventure", "pathfinder", "battle", "server", "logging", "launcher" ],
"required" : [ "general", "video", "adventure", "pathfinder", "battle", "server", "logging", "launcher", "gameTweaks" ],
"definitions" : {
"logLevelEnum" : {
"type" : "string",
@ -426,7 +426,7 @@
],
"items" : {
"type" : "string"
},
}
},
"enableInstalledMods" : {
"type" : "boolean",
@ -469,6 +469,40 @@
"default" : 2000
}
}
},
"gameTweaks" : {
"type": "object",
"default": {},
"additionalProperties": false,
"required": [
"showGrid",
"forceMovementInfo",
"numericCreaturesQuantities",
"availableCreaturesAsDwellingLabel",
"compactTownCreatureInfo"
],
"properties": {
"showGrid": {
"type": "boolean",
"default": false
},
"forceMovementInfo": {
"type": "boolean",
"default": false
},
"numericCreaturesQuantities": {
"type": "boolean",
"default": false
},
"availableCreaturesAsDwellingLabel" : {
"type" : "boolean",
"default" : false
},
"compactTownCreatureInfo" : {
"type" : "boolean",
"default" : false
}
}
}
}
}

View File

@ -0,0 +1,42 @@
{
"items":
[
{
"name": "availableCreaturesAsDwellingLabelText",
"type": "label",
"font": "medium",
"alignment": "left",
"color": "white",
"text": "vcmi.otherOptions.availableCreaturesAsDwellingLabel.hover",
"position": {"x": 61, "y": 27}
},
{
"name": "availableCreaturesAsDwellingLabelCheckbox",
"type": "toggleButton",
"image": "sysopchk.def",
"help": "vcmi.otherOptions.availableCreaturesAsDwellingLabel",
"position": {"x": 25, "y": 26},
"callback": "availableCreaturesAsDwellingLabelChanged"
},
{
"name": "compactTownCreatureInfoLabel",
"type": "label",
"font": "medium",
"alignment": "left",
"color": "white",
"text": "vcmi.otherOptions.compactTownCreatureInfo.hover",
"position": {"x": 61, "y": 60}
},
{
"name": "compactTownCreatureInfoCheckbox",
"type": "toggleButton",
"image": "sysopchk.def",
"help": "vcmi.otherOptions.compactTownCreatureInfo",
"position": {"x": 25, "y": 59},
"callback": "compactTownCreatureInfoChanged"
}
]
}

View File

@ -1,5 +0,0 @@
{
"items":
[
]
}