diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index ccdc95d9f..bfa27a9af 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -109,6 +109,7 @@ MACRO_CONFIG_INT(EdShowkeys, ed_showkeys, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE MACRO_CONFIG_INT(EdAlignQuads, ed_align_quads, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Enable/disable quad alignment. When enabled, red lines appear to show how quad/points are aligned and snapped to other quads/points when moving them") MACRO_CONFIG_INT(EdShowQuadsRect, ed_show_quads_rect, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show the bounds of the selected quad. In case of multiple quads, it shows the bounds of the englobing rect. Can be helpful when aligning a group of quads") MACRO_CONFIG_INT(EdAutoMapReload, ed_auto_map_reload, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Run 'hot_reload' on the local server while rcon authed on map save") +MACRO_CONFIG_INT(EdLayerSelector, ed_layer_selector, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Ctrl+right click tiles to select their layers in the editor") MACRO_CONFIG_INT(ClShowWelcome, cl_show_welcome, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show welcome message indicating the first launch of the client") MACRO_CONFIG_INT(ClMotdTime, cl_motd_time, 10, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "How long to show the server message of the day") diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 39e957dab..d7c180a44 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -3216,7 +3216,12 @@ void CEditor::DoMapEditor(CUIRect View) else if(m_pBrush->IsEmpty() && GetSelectedLayerType(0, LAYERTYPE_QUADS) != nullptr) str_copy(m_aTooltip, "Use left mouse button to drag and create a brush. Hold shift to select multiple quads. Press R to rotate selected quads. Use ctrl+right mouse to select layer."); else if(m_pBrush->IsEmpty()) - str_copy(m_aTooltip, "Use left mouse button to drag and create a brush. Use ctrl+right mouse to select layer."); + { + if(g_Config.m_EdLayerSelector) + str_copy(m_aTooltip, "Use left mouse button to drag and create a brush. Use ctrl+right click to select layer for hovered tile."); + else + str_copy(m_aTooltip, "Use left mouse button to drag and create a brush."); + } else str_copy(m_aTooltip, "Use left mouse button to paint with the brush. Right button clears the brush."); @@ -7666,7 +7671,7 @@ void CEditor::RenderMenubar(CUIRect MenuBar) if(DoButton_Ex(&s_SettingsButton, "Settings", 0, &SettingsButton, 0, nullptr, IGraphics::CORNER_T, EditorFontSizes::MENU, TEXTALIGN_ML)) { static SPopupMenuId s_PopupMenuEntitiesId; - Ui()->DoPopupMenu(&s_PopupMenuEntitiesId, SettingsButton.x, SettingsButton.y + SettingsButton.h - 1.0f, 200.0f, 106.0f, this, PopupMenuSettings, PopupProperties); + Ui()->DoPopupMenu(&s_PopupMenuEntitiesId, SettingsButton.x, SettingsButton.y + SettingsButton.h - 1.0f, 210.0f, 120.0f, this, PopupMenuSettings, PopupProperties); } CUIRect ChangedIndicator, Info, Help, Close; diff --git a/src/game/editor/layer_selector.cpp b/src/game/editor/layer_selector.cpp index f2e3c810e..4db70b67c 100644 --- a/src/game/editor/layer_selector.cpp +++ b/src/game/editor/layer_selector.cpp @@ -1,3 +1,5 @@ +#include + #include "editor.h" #include "layer_selector.h" @@ -16,6 +18,8 @@ bool CLayerSelector::SelectByTile() return false; if(!Input()->ModifierIsPressed() || !Ui()->MouseButtonClicked(1)) return false; + if(!g_Config.m_EdLayerSelector) + return false; int MatchedGroup = -1; int MatchedLayer = -1; diff --git a/src/game/editor/popups.cpp b/src/game/editor/popups.cpp index 6fc4d503c..68dbc74b5 100644 --- a/src/game/editor/popups.cpp +++ b/src/game/editor/popups.cpp @@ -388,6 +388,30 @@ CUi::EPopupMenuFunctionResult CEditor::PopupMenuSettings(void *pContext, CUIRect } } + View.HSplitTop(2.0f, nullptr, &View); + View.HSplitTop(12.0f, &Slot, &View); + { + Slot.VMargin(5.0f, &Slot); + + CUIRect Label, Selector; + Slot.VSplitMid(&Label, &Selector); + CUIRect No, Yes; + Selector.VSplitMid(&No, &Yes); + + pEditor->Ui()->DoLabel(&Label, "Select layers by tile", 10.0f, TEXTALIGN_ML); + + static int s_ButtonNo = 0; + static int s_ButtonYes = 0; + if(pEditor->DoButton_Ex(&s_ButtonNo, "No", !g_Config.m_EdLayerSelector, &No, 0, "Do not select layers when Ctrl+right clicking on a tile", IGraphics::CORNER_L)) + { + g_Config.m_EdLayerSelector = false; + } + if(pEditor->DoButton_Ex(&s_ButtonYes, "Yes", g_Config.m_EdLayerSelector, &Yes, 0, "Select layers when Ctrl+right clicking on a tile", IGraphics::CORNER_R)) + { + g_Config.m_EdLayerSelector = true; + } + } + return CUi::POPUP_KEEP_OPEN; }