diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 3a60964f2..cd18b320f 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -1112,15 +1112,10 @@ void CEditor::DoToolbar(CUIRect ToolBar) // tile manipulation { - static int s_BorderBut = 0; CLayerTiles *pT = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES); - - // no border for tele layer, speedup, front and switch - if(pT && (pT->m_Tele || pT->m_Speedup || pT->m_Switch || pT->m_Front || pT->m_Tune)) - pT = nullptr; - - if(pT) + if(pT && !pT->m_Tele && !pT->m_Speedup && !pT->m_Switch && !pT->m_Front && !pT->m_Tune) { + static int s_BorderBut = 0; TB_Bottom.VSplitLeft(60.0f, &Button, &TB_Bottom); if(DoButton_Ex(&s_BorderBut, "Border", 0, &Button, 0, "Place tiles in a 2-tile wide border at the edges of the layer", IGraphics::CORNER_ALL)) { @@ -1132,35 +1127,35 @@ void CEditor::DoToolbar(CUIRect ToolBar) // do tele/tune/switch/speedup button { - int (*pPopupFunc)(CEditor * peditor, CUIRect View, void *pContext) = nullptr; - const char *pButtonName = nullptr; - float Height = 0.0f; CLayerTiles *pS = (CLayerTiles *)GetSelectedLayerType(0, LAYERTYPE_TILES); if(pS) { + const char *pButtonName = nullptr; + int (*pfnPopupFunc)(CEditor * pEditor, CUIRect View, void *pContext) = nullptr; + int Rows = 0; if(pS == m_Map.m_pSwitchLayer) { pButtonName = "Switch"; - pPopupFunc = PopupSwitch; - Height = 36; + pfnPopupFunc = PopupSwitch; + Rows = 2; } else if(pS == m_Map.m_pSpeedupLayer) { pButtonName = "Speedup"; - pPopupFunc = PopupSpeedup; - Height = 53; + pfnPopupFunc = PopupSpeedup; + Rows = 3; } else if(pS == m_Map.m_pTuneLayer) { pButtonName = "Tune"; - pPopupFunc = PopupTune; - Height = 23; + pfnPopupFunc = PopupTune; + Rows = 1; } else if(pS == m_Map.m_pTeleLayer) { pButtonName = "Tele"; - pPopupFunc = PopupTele; - Height = 23; + pfnPopupFunc = PopupTele; + Rows = 1; } if(pButtonName != nullptr) @@ -1175,7 +1170,7 @@ void CEditor::DoToolbar(CUIRect ToolBar) static int s_ModifierPopupID = 0; if(!UiPopupExists(&s_ModifierPopupID)) { - UiInvokePopupMenu(&s_ModifierPopupID, 0, Button.x, Button.y + Button.h, 120, Height, pPopupFunc); + UiInvokePopupMenu(&s_ModifierPopupID, 0, Button.x, Button.y + Button.h, 120, 10.0f + Rows * 13.0f, pfnPopupFunc); } } TB_Bottom.VSplitLeft(5.0f, nullptr, &TB_Bottom); diff --git a/src/game/editor/popups.cpp b/src/game/editor/popups.cpp index b1a9125cf..843509761 100644 --- a/src/game/editor/popups.cpp +++ b/src/game/editor/popups.cpp @@ -1508,11 +1508,13 @@ int CEditor::PopupTele(CEditor *pEditor, CUIRect View, void *pContext) View.VSplitRight(15.f, &NumberPicker, &FindEmptySlot); NumberPicker.VSplitRight(2.f, &NumberPicker, nullptr); + FindEmptySlot.HSplitTop(13.0f, &FindEmptySlot, nullptr); + FindEmptySlot.HMargin(1.0f, &FindEmptySlot); // find empty number button { static int s_EmptySlotPid = 0; - if(pEditor->DoButton_Editor(&s_EmptySlotPid, "F", 0, &FindEmptySlot, 0, "[ctrl+f] Find empty slot") || pEditor->Input()->KeyPress(KEY_F)) + if(pEditor->DoButton_Editor(&s_EmptySlotPid, "F", 0, &FindEmptySlot, 0, "[ctrl+f] Find empty slot") || (pEditor->Input()->ModifierIsPressed() && pEditor->Input()->KeyPress(KEY_F))) { int number = -1; for(int i = 1; i <= 255; i++) @@ -1567,9 +1569,6 @@ int CEditor::PopupTele(CEditor *pEditor, CUIRect View, void *pContext) int CEditor::PopupSpeedup(CEditor *pEditor, CUIRect View, void *pContext) { - CUIRect Button; - View.HSplitBottom(12.0f, &View, &Button); - enum { PROP_FORCE = 0, @@ -1606,16 +1605,15 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View, void *pContext) CUIRect NumberPicker; CUIRect FindEmptySlot; - CUIRect DelayPicker; - - View.HSplitMid(&NumberPicker, &DelayPicker); - NumberPicker.VSplitRight(15.f, &NumberPicker, &FindEmptySlot); + View.VSplitRight(15.f, &NumberPicker, &FindEmptySlot); NumberPicker.VSplitRight(2.f, &NumberPicker, nullptr); + FindEmptySlot.HSplitTop(13.0f, &FindEmptySlot, nullptr); + FindEmptySlot.HMargin(1.0f, &FindEmptySlot); // find empty number button { static int s_EmptySlotPid = 0; - if(pEditor->DoButton_Editor(&s_EmptySlotPid, "F", 0, &FindEmptySlot, 0, "[ctrl+f] Find empty slot") || pEditor->Input()->KeyPress(KEY_F)) + if(pEditor->DoButton_Editor(&s_EmptySlotPid, "F", 0, &FindEmptySlot, 0, "[ctrl+f] Find empty slot") || (pEditor->Input()->ModifierIsPressed() && pEditor->Input()->KeyPress(KEY_F))) { int number = -1; for(int i = 1; i <= 255; i++) @@ -1676,9 +1674,6 @@ int CEditor::PopupSwitch(CEditor *pEditor, CUIRect View, void *pContext) int CEditor::PopupTune(CEditor *pEditor, CUIRect View, void *pContext) { - CUIRect Button; - View.HSplitBottom(12.0f, &View, &Button); - enum { PROP_TUNE = 0, @@ -1702,12 +1697,6 @@ int CEditor::PopupTune(CEditor *pEditor, CUIRect View, void *pContext) int CEditor::PopupGoto(CEditor *pEditor, CUIRect View, void *pContext) { - CUIRect CoordXPicker; - CUIRect CoordYPicker; - - View.HSplitMid(&CoordXPicker, &CoordYPicker); - CoordXPicker.VSplitRight(2.f, &CoordXPicker, nullptr); - static ColorRGBA s_Color = ColorRGBA(1, 1, 1, 0.5f); enum @@ -1725,7 +1714,7 @@ int CEditor::PopupGoto(CEditor *pEditor, CUIRect View, void *pContext) static int s_aIds[NUM_PROPS] = {0}; int NewVal = 0; - int Prop = pEditor->DoProperties(&CoordXPicker, aProps, s_aIds, &NewVal, s_Color); + int Prop = pEditor->DoProperties(&View, aProps, s_aIds, &NewVal, s_Color); if(Prop == PROP_CoordX) {