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

hide adventuremap

This commit is contained in:
Laserlicht 2024-01-18 00:47:18 +01:00 committed by GitHub
parent d64473b894
commit a1f4fcb78a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 51 additions and 1 deletions

View File

@ -145,6 +145,8 @@
"vcmi.adventureOptions.mapScrollSpeed1.help": "Set the map scrolling speed to very slow.", "vcmi.adventureOptions.mapScrollSpeed1.help": "Set the map scrolling speed to very slow.",
"vcmi.adventureOptions.mapScrollSpeed5.help": "Set the map scrolling speed to very fast.", "vcmi.adventureOptions.mapScrollSpeed5.help": "Set the map scrolling speed to very fast.",
"vcmi.adventureOptions.mapScrollSpeed6.help": "Set the map scrolling speed to instantaneous.", "vcmi.adventureOptions.mapScrollSpeed6.help": "Set the map scrolling speed to instantaneous.",
"vcmi.adventureOptions.hideBackground.hover" : "Hide Background",
"vcmi.adventureOptions.hideBackground.help" : "{Hide Background}\n\nHide the adventuremap in the background and show a texture instead.",
"vcmi.battleOptions.queueSizeLabel.hover": "Show Turn Order Queue", "vcmi.battleOptions.queueSizeLabel.hover": "Show Turn Order Queue",
"vcmi.battleOptions.queueSizeNoneButton.hover": "OFF", "vcmi.battleOptions.queueSizeNoneButton.hover": "OFF",

View File

@ -145,6 +145,8 @@
"vcmi.adventureOptions.mapScrollSpeed1.help": "Geschwindigkeit des Kartenbildlaufs auf sehr langsam einstellen", "vcmi.adventureOptions.mapScrollSpeed1.help": "Geschwindigkeit des Kartenbildlaufs auf sehr langsam einstellen",
"vcmi.adventureOptions.mapScrollSpeed5.help": "Geschwindigkeit des Kartenbildlaufs auf sehr schnell einstellen", "vcmi.adventureOptions.mapScrollSpeed5.help": "Geschwindigkeit des Kartenbildlaufs auf sehr schnell einstellen",
"vcmi.adventureOptions.mapScrollSpeed6.help": "Geschwindigkeit des Kartenbildlaufs auf sofort einstellen", "vcmi.adventureOptions.mapScrollSpeed6.help": "Geschwindigkeit des Kartenbildlaufs auf sofort einstellen",
"vcmi.adventureOptions.hideBackground.hover" : "Hintergrund ausblenden",
"vcmi.adventureOptions.hideBackground.help" : "{Hintergrund ausblenden}\n\nDie Abenteuerkarte im Hintergrund ausblenden und stattdessen eine Textur anzeigen.",
"vcmi.battleOptions.queueSizeLabel.hover": "Reihenfolge der Kreaturen anzeigen", "vcmi.battleOptions.queueSizeLabel.hover": "Reihenfolge der Kreaturen anzeigen",
"vcmi.battleOptions.queueSizeNoneButton.hover": "AUS", "vcmi.battleOptions.queueSizeNoneButton.hover": "AUS",

View File

@ -31,6 +31,7 @@
#include "../gui/Shortcut.h" #include "../gui/Shortcut.h"
#include "../gui/WindowHandler.h" #include "../gui/WindowHandler.h"
#include "../render/Canvas.h" #include "../render/Canvas.h"
#include "../render/IRenderHandler.h"
#include "../CMT.h" #include "../CMT.h"
#include "../PlayerLocalState.h" #include "../PlayerLocalState.h"
#include "../CPlayerInterface.h" #include "../CPlayerInterface.h"
@ -168,6 +169,15 @@ void AdventureMapInterface::show(Canvas & to)
void AdventureMapInterface::dim(Canvas & to) void AdventureMapInterface::dim(Canvas & to)
{ {
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)
{
to.fillTexture(GH.renderHandler().loadImage(ImagePath::builtin("DiBoxBck")));
return;
}
}
for (auto window : GH.windows().findWindows<IShowActivatable>()) 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())

View File

@ -182,6 +182,20 @@ void Canvas::drawColorBlended(const Rect & target, const ColorRGBA & color)
CSDL_Ext::fillRectBlended(surface, realTarget, CSDL_Ext::toSDL(color)); CSDL_Ext::fillRectBlended(surface, realTarget, CSDL_Ext::toSDL(color));
} }
void Canvas::fillTexture(const std::shared_ptr<IImage>& image)
{
assert(image);
if (!image)
return;
Rect imageArea = Rect(Point(0, 0), image->dimensions());
for (int y=0; y < surface->h; y+= imageArea.h)
{
for (int x=0; x < surface->w; x+= imageArea.w)
image->draw(surface, renderArea.x + x, renderArea.y + y);
}
}
SDL_Surface * Canvas::getInternalSurface() SDL_Surface * Canvas::getInternalSurface()
{ {
return surface; return surface;

View File

@ -99,6 +99,9 @@ public:
/// fills selected area with blended color /// fills selected area with blended color
void drawColorBlended(const Rect & target, const ColorRGBA & color); void drawColorBlended(const Rect & target, const ColorRGBA & color);
/// fills canvas with texture
void fillTexture(const std::shared_ptr<IImage>& image);
/// Compatibility method. AVOID USAGE. To be removed once SDL abstraction layer is finished. /// Compatibility method. AVOID USAGE. To be removed once SDL abstraction layer is finished.
SDL_Surface * getInternalSurface(); SDL_Surface * getInternalSurface();

View File

@ -134,6 +134,10 @@ AdventureOptionsTab::AdventureOptionsTab()
{ {
return setBoolSetting("gameTweaks", "skipAdventureMapAnimations", value); return setBoolSetting("gameTweaks", "skipAdventureMapAnimations", value);
}); });
addCallback("hideBackgroundChanged", [](bool value)
{
return setBoolSetting("adventure", "hideBackground", value);
});
build(config); build(config);
std::shared_ptr<CToggleGroup> playerHeroSpeedToggle = widget<CToggleGroup>("heroMovementSpeedPicker"); std::shared_ptr<CToggleGroup> playerHeroSpeedToggle = widget<CToggleGroup>("heroMovementSpeedPicker");
@ -179,4 +183,7 @@ AdventureOptionsTab::AdventureOptionsTab()
std::shared_ptr<CToggleButton> skipAdventureMapAnimationsCheckbox = widget<CToggleButton>("skipAdventureMapAnimationsCheckbox"); std::shared_ptr<CToggleButton> skipAdventureMapAnimationsCheckbox = widget<CToggleButton>("skipAdventureMapAnimationsCheckbox");
skipAdventureMapAnimationsCheckbox->setSelected(settings["gameTweaks"]["skipAdventureMapAnimations"].Bool()); skipAdventureMapAnimationsCheckbox->setSelected(settings["gameTweaks"]["skipAdventureMapAnimations"].Bool());
std::shared_ptr<CToggleButton> hideBackgroundCheckbox = widget<CToggleButton>("hideBackgroundCheckbox");
hideBackgroundCheckbox->setSelected(settings["adventure"]["hideBackground"].Bool());
} }

View File

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

View File

@ -297,6 +297,9 @@
}, },
{ {
"text": "vcmi.adventureOptions.showGrid.hover" "text": "vcmi.adventureOptions.showGrid.hover"
},
{
"text": "vcmi.adventureOptions.hideBackground.hover"
} }
] ]
}, },
@ -324,6 +327,11 @@
"name": "showGridCheckbox", "name": "showGridCheckbox",
"help": "vcmi.adventureOptions.showGrid", "help": "vcmi.adventureOptions.showGrid",
"callback": "showGridChanged" "callback": "showGridChanged"
},
{
"name": "hideBackgroundCheckbox",
"help": "vcmi.adventureOptions.hideBackground",
"callback": "hideBackgroundChanged"
} }
] ]
}, },