mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge #1227
1227: Allow multiple layers to be selected and edited at the same time. r=heinrich5991 a=bojidar-bg Resolves #486. Please test, I'm still not completely sure it won't crash or mess up a map from time to time. Co-authored-by: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
This commit is contained in:
commit
b82930b56a
|
@ -184,12 +184,30 @@ void CLayerGroup::Render()
|
|||
|
||||
for(int i = 0; i < m_lLayers.size(); i++)
|
||||
{
|
||||
if(m_lLayers[i]->m_Visible && m_lLayers[i] != m_pMap->m_pGameLayer
|
||||
if(m_lLayers[i]->m_Visible)
|
||||
{
|
||||
if(m_lLayers[i]->m_Type == LAYERTYPE_TILES)
|
||||
{
|
||||
CLayerTiles *pTiles = static_cast<CLayerTiles *>(m_lLayers[i]);
|
||||
if(pTiles->m_Game || pTiles->m_Front || pTiles->m_Tele || pTiles->m_Speedup || pTiles->m_Tune || pTiles->m_Switch)
|
||||
continue;
|
||||
}
|
||||
if(m_pMap->m_pEditor->m_ShowDetail || !(m_lLayers[i]->m_Flags&LAYERFLAG_DETAIL))
|
||||
m_lLayers[i]->Render();
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < m_lLayers.size(); i++)
|
||||
{
|
||||
if(m_lLayers[i]->m_Visible && m_lLayers[i]->m_Type == LAYERTYPE_TILES && m_lLayers[i] != m_pMap->m_pGameLayer
|
||||
&& m_lLayers[i] != m_pMap->m_pFrontLayer && m_lLayers[i] != m_pMap->m_pTeleLayer
|
||||
&& m_lLayers[i] != m_pMap->m_pSpeedupLayer && m_lLayers[i] != m_pMap->m_pSwitchLayer && m_lLayers[i] != m_pMap->m_pTuneLayer)
|
||||
{
|
||||
if(m_pMap->m_pEditor->m_ShowDetail || !(m_lLayers[i]->m_Flags&LAYERFLAG_DETAIL))
|
||||
CLayerTiles *pTiles = static_cast<CLayerTiles *>(m_lLayers[i]);
|
||||
if(pTiles->m_Game || pTiles->m_Front || pTiles->m_Tele || pTiles->m_Speedup || pTiles->m_Tune || pTiles->m_Switch)
|
||||
{
|
||||
m_lLayers[i]->Render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -842,8 +860,13 @@ CLayer *CEditor::GetSelectedLayer(int Index)
|
|||
if(!pGroup)
|
||||
return 0x0;
|
||||
|
||||
if(m_SelectedLayer >= 0 && m_SelectedLayer < m_Map.m_lGroups[m_SelectedGroup]->m_lLayers.size())
|
||||
return pGroup->m_lLayers[m_SelectedLayer];
|
||||
if(Index < 0 || Index >= m_lSelectedLayers.size())
|
||||
return 0x0;
|
||||
|
||||
int LayerIndex = m_lSelectedLayers[Index];
|
||||
|
||||
if(LayerIndex >= 0 && LayerIndex < m_Map.m_lGroups[m_SelectedGroup]->m_lLayers.size())
|
||||
return pGroup->m_lLayers[LayerIndex];
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
|
@ -875,6 +898,12 @@ CSoundSource *CEditor::GetSelectedSource()
|
|||
return 0;
|
||||
}
|
||||
|
||||
void CEditor::SelectLayer(int Index)
|
||||
{
|
||||
m_lSelectedLayers.clear();
|
||||
m_lSelectedLayers.add(Index);
|
||||
}
|
||||
|
||||
void CEditor::CallbackOpenMap(const char *pFileName, int StorageType, void *pUser)
|
||||
{
|
||||
CEditor *pEditor = (CEditor*)pUser;
|
||||
|
@ -1399,11 +1428,14 @@ void CEditor::DoSoundSource(CSoundSource *pSource, int Index)
|
|||
{
|
||||
if(!UI()->MouseButton(1))
|
||||
{
|
||||
m_Map.m_UndoModified++;
|
||||
if(m_lSelectedLayers.size() == 1)
|
||||
{
|
||||
m_Map.m_UndoModified++;
|
||||
|
||||
static int s_SourcePopupID = 0;
|
||||
UiInvokePopupMenu(&s_SourcePopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 200, PopupSource);
|
||||
m_LockMouse = false;
|
||||
static int s_SourcePopupID = 0;
|
||||
UiInvokePopupMenu(&s_SourcePopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 200, PopupSource);
|
||||
m_LockMouse = false;
|
||||
}
|
||||
s_Operation = OP_NONE;
|
||||
UI()->SetActiveItem(0);
|
||||
}
|
||||
|
@ -1592,11 +1624,14 @@ void CEditor::DoQuad(CQuad *q, int Index)
|
|||
{
|
||||
if(!UI()->MouseButton(1))
|
||||
{
|
||||
m_Map.m_UndoModified++;
|
||||
if(m_lSelectedLayers.size() == 1)
|
||||
{
|
||||
m_Map.m_UndoModified++;
|
||||
|
||||
static int s_QuadPopupID = 0;
|
||||
UiInvokePopupMenu(&s_QuadPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 180, PopupQuad);
|
||||
m_LockMouse = false;
|
||||
static int s_QuadPopupID = 0;
|
||||
UiInvokePopupMenu(&s_QuadPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 180, PopupQuad);
|
||||
m_LockMouse = false;
|
||||
}
|
||||
s_Operation = OP_NONE;
|
||||
UI()->SetActiveItem(0);
|
||||
}
|
||||
|
@ -1605,12 +1640,15 @@ void CEditor::DoQuad(CQuad *q, int Index)
|
|||
{
|
||||
if(!UI()->MouseButton(1))
|
||||
{
|
||||
m_Map.m_UndoModified++;
|
||||
m_LockMouse = false;
|
||||
m_Map.m_Modified = true;
|
||||
CLayerQuads *pLayer = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
if(pLayer)
|
||||
pLayer->m_lQuads.remove_index(m_SelectedQuad);
|
||||
if(m_lSelectedLayers.size() == 1)
|
||||
{
|
||||
m_Map.m_UndoModified++;
|
||||
m_LockMouse = false;
|
||||
m_Map.m_Modified = true;
|
||||
CLayerQuads *pLayer = (CLayerQuads *)GetSelectedLayerType(0, LAYERTYPE_QUADS);
|
||||
if(pLayer)
|
||||
pLayer->m_lQuads.remove_index(m_SelectedQuad);
|
||||
}
|
||||
s_Operation = OP_NONE;
|
||||
UI()->SetActiveItem(0);
|
||||
}
|
||||
|
@ -1798,10 +1836,13 @@ void CEditor::DoQuadPoint(CQuad *pQuad, int QuadIndex, int V)
|
|||
{
|
||||
if(!UI()->MouseButton(1))
|
||||
{
|
||||
m_Map.m_UndoModified++;
|
||||
if(m_lSelectedLayers.size() == 1)
|
||||
{
|
||||
m_Map.m_UndoModified++;
|
||||
|
||||
static int s_PointPopupID = 0;
|
||||
UiInvokePopupMenu(&s_PointPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 150, PopupPoint);
|
||||
static int s_PointPopupID = 0;
|
||||
UiInvokePopupMenu(&s_PointPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 150, PopupPoint);
|
||||
}
|
||||
UI()->SetActiveItem(0);
|
||||
}
|
||||
}
|
||||
|
@ -2241,9 +2282,8 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
static int s_Operation = OP_NONE;
|
||||
|
||||
// draw layer borders
|
||||
CLayer *pEditLayers[16];
|
||||
CLayer *pEditLayers[128];
|
||||
int NumEditLayers = 0;
|
||||
NumEditLayers = 0;
|
||||
|
||||
if(m_ShowPicker && GetSelectedLayer(0) && GetSelectedLayer(0)->m_Type == LAYERTYPE_TILES)
|
||||
{
|
||||
|
@ -2257,9 +2297,26 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
}
|
||||
else
|
||||
{
|
||||
pEditLayers[0] = GetSelectedLayer(0);
|
||||
if(pEditLayers[0])
|
||||
NumEditLayers++;
|
||||
// pick a type of layers to edit, prefering Tiles layers.
|
||||
int EditingType = -1;
|
||||
for (int i = 0; i < m_lSelectedLayers.size(); i++)
|
||||
{
|
||||
CLayer *Layer = GetSelectedLayer(i);
|
||||
if(EditingType == -1 || Layer->m_Type == LAYERTYPE_TILES)
|
||||
{
|
||||
EditingType = Layer->m_Type;
|
||||
if(EditingType == LAYERTYPE_TILES)
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < m_lSelectedLayers.size() && NumEditLayers < 128; i++)
|
||||
{
|
||||
pEditLayers[NumEditLayers] = GetSelectedLayerType(i, EditingType);
|
||||
if(pEditLayers[NumEditLayers])
|
||||
{
|
||||
NumEditLayers++;
|
||||
}
|
||||
}
|
||||
|
||||
CLayerGroup *g = GetSelectedGroup();
|
||||
if(g)
|
||||
|
@ -2345,8 +2402,10 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
// draw with brush
|
||||
for(int k = 0; k < NumEditLayers; k++)
|
||||
{
|
||||
if(pEditLayers[k]->m_Type == m_Brush.m_lLayers[0]->m_Type)
|
||||
pEditLayers[k]->BrushDraw(m_Brush.m_lLayers[0], wx, wy);
|
||||
int BrushIndex = k;
|
||||
if(m_Brush.m_lLayers.size() != NumEditLayers) BrushIndex = 0;
|
||||
if(pEditLayers[k]->m_Type == m_Brush.m_lLayers[BrushIndex]->m_Type)
|
||||
pEditLayers[k]->BrushDraw(m_Brush.m_lLayers[BrushIndex], wx, wy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2379,7 +2438,11 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
if(!UI()->MouseButton(0))
|
||||
{
|
||||
for(int k = 0; k < NumEditLayers; k++)
|
||||
pEditLayers[k]->FillSelection(m_Brush.IsEmpty(), m_Brush.m_lLayers[0], r);
|
||||
{
|
||||
int BrushIndex = k;
|
||||
if(m_Brush.m_lLayers.size() != NumEditLayers) BrushIndex = 0;
|
||||
pEditLayers[k]->FillSelection(m_Brush.IsEmpty(), m_Brush.m_lLayers[BrushIndex], r);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2406,8 +2469,10 @@ void CEditor::DoMapEditor(CUIRect View)
|
|||
s_Operation = OP_BRUSH_DRAW;
|
||||
for(int k = 0; k < NumEditLayers; k++)
|
||||
{
|
||||
if(pEditLayers[k]->m_Type == m_Brush.m_lLayers[0]->m_Type)
|
||||
pEditLayers[k]->BrushPlace(m_Brush.m_lLayers[0], wx, wy);
|
||||
int BrushIndex = k;
|
||||
if(m_Brush.m_lLayers.size() != NumEditLayers) BrushIndex = 0;
|
||||
if(pEditLayers[k]->m_Type == m_Brush.m_lLayers[BrushIndex]->m_Type)
|
||||
pEditLayers[k]->BrushPlace(m_Brush.m_lLayers[BrushIndex], wx, wy);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2996,10 +3061,17 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
|
|||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Slot.w)
|
||||
FontSize--;
|
||||
if(int Result = DoButton_Ex(&m_Map.m_lGroups[g], aBuf, g==m_SelectedGroup, &Slot,
|
||||
BUTTON_CONTEXT, m_Map.m_lGroups[g]->m_Collapse ? "Select group. Double click to expand." : "Select group. Double click to collapse.", 0, FontSize))
|
||||
BUTTON_CONTEXT, m_Map.m_lGroups[g]->m_Collapse ? "Select group. Shift click to select all layers. Double click to expand." : "Select group. Shift click to select all layers. Double click to collapse.", 0, FontSize))
|
||||
{
|
||||
m_SelectedGroup = g;
|
||||
m_SelectedLayer = 0;
|
||||
SelectLayer(0);
|
||||
if ((Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT)) && m_SelectedGroup == g)
|
||||
{
|
||||
for(int i = 1; i < m_Map.m_lGroups[g]->m_lLayers.size(); i++)
|
||||
{
|
||||
m_lSelectedLayers.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
static int s_GroupPopupId = 0;
|
||||
if(Result == 2)
|
||||
|
@ -3048,7 +3120,18 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
|
|||
float FontSize = 10.0f;
|
||||
while(TextRender()->TextWidth(0, FontSize, aBuf, -1) > Button.w)
|
||||
FontSize--;
|
||||
int Checked = g == m_SelectedGroup && i == m_SelectedLayer;
|
||||
int Checked = 0;
|
||||
if (g == m_SelectedGroup)
|
||||
{
|
||||
for(int j = 0; j < m_lSelectedLayers.size(); j++)
|
||||
{
|
||||
if (m_lSelectedLayers[j] == i)
|
||||
{
|
||||
Checked = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(m_Map.m_lGroups[g]->m_lLayers[i] == m_Map.m_pGameLayer ||
|
||||
m_Map.m_lGroups[g]->m_lLayers[i] == m_Map.m_pFrontLayer ||
|
||||
m_Map.m_lGroups[g]->m_lLayers[i] == m_Map.m_pSwitchLayer ||
|
||||
|
@ -3059,10 +3142,18 @@ void CEditor::RenderLayers(CUIRect ToolBox, CUIRect View)
|
|||
Checked += 6;
|
||||
}
|
||||
if(int Result = DoButton_Ex(m_Map.m_lGroups[g]->m_lLayers[i], aBuf, Checked, &Button,
|
||||
BUTTON_CONTEXT, "Select layer.", 0, FontSize))
|
||||
BUTTON_CONTEXT, "Select layer. Shift click to select multiple.", 0, FontSize))
|
||||
{
|
||||
m_SelectedLayer = i;
|
||||
m_SelectedGroup = g;
|
||||
if ((Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT)) && m_SelectedGroup == g)
|
||||
{
|
||||
if(!m_lSelectedLayers.remove(i))
|
||||
m_lSelectedLayers.add(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_SelectedGroup = g;
|
||||
SelectLayer(i);
|
||||
}
|
||||
static int s_LayerPopupID = 0;
|
||||
if(Result == 2)
|
||||
UiInvokePopupMenu(&s_LayerPopupID, 0, UI()->MouseX(), UI()->MouseY(), 120, 280, PopupLayer);
|
||||
|
@ -5107,7 +5198,7 @@ void CEditor::Render()
|
|||
RenderBackground(View, ms_CheckerTexture, 32.0f, 1.0f);
|
||||
|
||||
CUIRect MenuBar, CModeBar, ToolBar, StatusBar, ExtraEditor, UndoList, ToolBox;
|
||||
m_ShowPicker = Input()->KeyIsPressed(KEY_SPACE) != 0 && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && UI()->LastActiveItem() != &m_CommandBox;
|
||||
m_ShowPicker = Input()->KeyIsPressed(KEY_SPACE) != 0 && m_Dialog == DIALOG_NONE && m_EditBoxActive == 0 && UI()->LastActiveItem() != &m_CommandBox && m_lSelectedLayers.size() == 1;
|
||||
|
||||
if(m_GuiActive)
|
||||
{
|
||||
|
@ -5319,7 +5410,7 @@ void CEditor::Reset(bool CreateDefault)
|
|||
if(CreateDefault)
|
||||
m_Map.CreateDefault(ms_EntitiesTexture);
|
||||
|
||||
m_SelectedLayer = 0;
|
||||
SelectLayer(0);
|
||||
m_SelectedGroup = 0;
|
||||
m_SelectedQuad = -1;
|
||||
m_SelectedPoints = 0;
|
||||
|
|
|
@ -767,6 +767,7 @@ public:
|
|||
CLayer *GetSelectedLayer(int Index);
|
||||
CLayerGroup *GetSelectedGroup();
|
||||
CSoundSource *GetSelectedSource();
|
||||
void SelectLayer(int Index);
|
||||
|
||||
int DoProperties(CUIRect *pToolbox, CProperty *pProps, int *pIDs, int *pNewVal, vec4 Color = vec4(1,1,1,0.5f));
|
||||
|
||||
|
@ -877,7 +878,7 @@ public:
|
|||
bool m_ShowServerSettingsEditor;
|
||||
bool m_ShowPicker;
|
||||
|
||||
int m_SelectedLayer;
|
||||
array<int> m_lSelectedLayers;
|
||||
int m_SelectedGroup;
|
||||
int m_SelectedQuad;
|
||||
int m_SelectedPoints;
|
||||
|
|
|
@ -172,7 +172,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
return 0;
|
||||
|
||||
// create new layers
|
||||
if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pTeleLayer)
|
||||
if(this == m_pEditor->m_Map.m_pTeleLayer)
|
||||
{
|
||||
CLayerTele *pGrabbed = new CLayerTele(r.w, r.h);
|
||||
pGrabbed->m_pEditor = m_pEditor;
|
||||
|
@ -199,7 +199,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
pGrabbed->m_TeleNum = m_pEditor->m_TeleNumber;
|
||||
str_copy(pGrabbed->m_aFileName, m_pEditor->m_aFileName, sizeof(pGrabbed->m_aFileName));
|
||||
}
|
||||
else if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pSpeedupLayer)
|
||||
else if(this == m_pEditor->m_Map.m_pSpeedupLayer)
|
||||
{
|
||||
CLayerSpeedup *pGrabbed = new CLayerSpeedup(r.w, r.h);
|
||||
pGrabbed->m_pEditor = m_pEditor;
|
||||
|
@ -232,7 +232,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
pGrabbed->m_SpeedupAngle = m_pEditor->m_SpeedupAngle;
|
||||
str_copy(pGrabbed->m_aFileName, m_pEditor->m_aFileName, sizeof(pGrabbed->m_aFileName));
|
||||
}
|
||||
else if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pSwitchLayer)
|
||||
else if(this == m_pEditor->m_Map.m_pSwitchLayer)
|
||||
{
|
||||
CLayerSwitch *pGrabbed = new CLayerSwitch(r.w, r.h);
|
||||
pGrabbed->m_pEditor = m_pEditor;
|
||||
|
@ -264,7 +264,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
str_copy(pGrabbed->m_aFileName, m_pEditor->m_aFileName, sizeof(pGrabbed->m_aFileName));
|
||||
}
|
||||
|
||||
else if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pTuneLayer)
|
||||
else if(this == m_pEditor->m_Map.m_pTuneLayer)
|
||||
{
|
||||
CLayerTune *pGrabbed = new CLayerTune(r.w, r.h);
|
||||
pGrabbed->m_pEditor = m_pEditor;
|
||||
|
@ -292,7 +292,7 @@ int CLayerTiles::BrushGrab(CLayerGroup *pBrush, CUIRect Rect)
|
|||
pGrabbed->m_TuningNumber = m_pEditor->m_TuningNum;
|
||||
str_copy(pGrabbed->m_aFileName, m_pEditor->m_aFileName, sizeof(pGrabbed->m_aFileName));
|
||||
}
|
||||
else if(m_pEditor->GetSelectedLayer(0) == m_pEditor->m_Map.m_pFrontLayer)
|
||||
else if(this == m_pEditor->m_Map.m_pFrontLayer)
|
||||
{
|
||||
CLayerFront *pGrabbed = new CLayerFront(r.w, r.h);
|
||||
pGrabbed->m_pEditor = m_pEditor;
|
||||
|
@ -1576,7 +1576,7 @@ void CLayerSwitch::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
|
|||
CLayerTune::CLayerTune(int w, int h)
|
||||
: CLayerTiles(w, h)
|
||||
{
|
||||
//m_Type = LAYERTYPE_SWITCH;
|
||||
//m_Type = LAYERTYPE_TUNE;
|
||||
str_copy(m_aName, "Tune", sizeof(m_aName));
|
||||
m_Tune = 1;
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
|
|||
CLayer *l = new CLayerTele(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeTeleLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
|
|||
CLayer *l = new CLayerSpeedup(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeSpeedupLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
|
|||
CLayer *l = new CLayerTune(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeTuneLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
|
|||
CLayer *l = new CLayerFront(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeFrontLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
|
|||
CLayer *l = new CLayerSwitch(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
pEditor->m_Map.MakeSwitchLayer(l);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1);
|
||||
pEditor->m_Brush.Clear();
|
||||
return 1;
|
||||
}
|
||||
|
@ -251,7 +251,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
|
|||
CLayer *l = new CLayerQuads;
|
||||
l->m_pEditor = pEditor;
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
||||
return 1;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
|
|||
CLayer *l = new CLayerTiles(pEditor->m_Map.m_pGameLayer->m_Width, pEditor->m_Map.m_pGameLayer->m_Height);
|
||||
l->m_pEditor = pEditor;
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
||||
return 1;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ int CEditor::PopupGroup(CEditor *pEditor, CUIRect View)
|
|||
CLayer *l = new CLayerSounds;
|
||||
l->m_pEditor = pEditor;
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_lLayers.size()-1);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->m_Collapse = false;
|
||||
return 1;
|
||||
}
|
||||
|
@ -378,7 +378,7 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View)
|
|||
pEditor->m_Map.m_pSwitchLayer = 0x0;
|
||||
if(pEditor->GetSelectedLayer(0) == pEditor->m_Map.m_pTuneLayer)
|
||||
pEditor->m_Map.m_pTuneLayer = 0x0;
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->DeleteLayer(pEditor->m_SelectedLayer);
|
||||
pEditor->m_Map.m_lGroups[pEditor->m_SelectedGroup]->DeleteLayer(pEditor->m_lSelectedLayers[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View)
|
|||
|
||||
CProperty aProps[] = {
|
||||
{"Group", pEditor->m_SelectedGroup, PROPTYPE_INT_STEP, 0, pEditor->m_Map.m_lGroups.size()-1},
|
||||
{"Order", pEditor->m_SelectedLayer, PROPTYPE_INT_STEP, 0, pCurrentGroup->m_lLayers.size()},
|
||||
{"Order", pEditor->m_lSelectedLayers[0], PROPTYPE_INT_STEP, 0, pCurrentGroup->m_lLayers.size()},
|
||||
{"Detail", pCurrentLayer->m_Flags&LAYERFLAG_DETAIL, PROPTYPE_BOOL, 0, 1},
|
||||
{0},
|
||||
};
|
||||
|
@ -429,7 +429,7 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View)
|
|||
pEditor->m_Map.m_Modified = true;
|
||||
|
||||
if(Prop == PROP_ORDER)
|
||||
pEditor->m_SelectedLayer = pCurrentGroup->SwapLayers(pEditor->m_SelectedLayer, NewVal);
|
||||
pEditor->SelectLayer(pCurrentGroup->SwapLayers(pEditor->m_lSelectedLayers[0], NewVal));
|
||||
else if(Prop == PROP_GROUP && pCurrentLayer->m_Type != LAYERTYPE_GAME)
|
||||
{
|
||||
if(NewVal >= 0 && NewVal < pEditor->m_Map.m_lGroups.size())
|
||||
|
@ -437,7 +437,7 @@ int CEditor::PopupLayer(CEditor *pEditor, CUIRect View)
|
|||
pCurrentGroup->m_lLayers.remove(pCurrentLayer);
|
||||
pEditor->m_Map.m_lGroups[NewVal]->m_lLayers.add(pCurrentLayer);
|
||||
pEditor->m_SelectedGroup = NewVal;
|
||||
pEditor->m_SelectedLayer = pEditor->m_Map.m_lGroups[NewVal]->m_lLayers.size()-1;
|
||||
pEditor->SelectLayer(pEditor->m_Map.m_lGroups[NewVal]->m_lLayers.size()-1);
|
||||
}
|
||||
}
|
||||
else if(Prop == PROP_HQ)
|
||||
|
|
Loading…
Reference in a new issue