mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
fixed so Make/Clear Collision buttons are hidden on game layer
This commit is contained in:
parent
a72848e780
commit
b565d4ab18
|
@ -324,38 +324,47 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox)
|
|||
bool InGameGroup = !find_linear(m_pEditor->m_Map.m_pGameGroup->m_lLayers.all(), this).empty();
|
||||
if(m_pEditor->m_Map.m_pGameLayer == this)
|
||||
InGameGroup = false;
|
||||
static int s_ColclButton = 0;
|
||||
if(m_pEditor->DoButton_Editor(&s_ColclButton, Localize("Clear collision"), InGameGroup?0:-1, &Button, 0, Localize("Removes collision from this layer")))
|
||||
|
||||
if(InGameGroup)
|
||||
{
|
||||
CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer;
|
||||
int w = min(gl->m_Width, m_Width);
|
||||
int h = min(gl->m_Height, m_Height);
|
||||
for(int y = 0; y < h; y++)
|
||||
for(int x = 0; x < w; x++)
|
||||
static int s_ColclButton = 0;
|
||||
if(m_pEditor->DoButton_Editor(&s_ColclButton, Localize("Clear collision"), 0, &Button, 0, Localize("Removes collision from this layer")))
|
||||
{
|
||||
CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer;
|
||||
int w = min(gl->m_Width, m_Width);
|
||||
int h = min(gl->m_Height, m_Height);
|
||||
for(int y = 0; y < h; y++)
|
||||
{
|
||||
if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID)
|
||||
if(m_pTiles[y*m_Width+x].m_Index)
|
||||
gl->m_pTiles[y*gl->m_Width+x].m_Index = TILE_AIR;
|
||||
for(int x = 0; x < w; x++)
|
||||
{
|
||||
if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID)
|
||||
{
|
||||
if(m_pTiles[y*m_Width+x].m_Index)
|
||||
gl->m_pTiles[y*gl->m_Width+x].m_Index = TILE_AIR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
static int s_ColButton = 0;
|
||||
pToolBox->HSplitBottom(5.0f, pToolBox, &Button);
|
||||
pToolBox->HSplitBottom(12.0f, pToolBox, &Button);
|
||||
if(m_pEditor->DoButton_Editor(&s_ColButton, Localize("Make collision"), InGameGroup?0:-1, &Button, 0, Localize("Constructs collision from this layer")))
|
||||
{
|
||||
CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer;
|
||||
int w = min(gl->m_Width, m_Width);
|
||||
int h = min(gl->m_Height, m_Height);
|
||||
for(int y = 0; y < h; y++)
|
||||
for(int x = 0; x < w; x++)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int s_ColButton = 0;
|
||||
pToolBox->HSplitBottom(5.0f, pToolBox, &Button);
|
||||
pToolBox->HSplitBottom(12.0f, pToolBox, &Button);
|
||||
if(m_pEditor->DoButton_Editor(&s_ColButton, Localize("Make collision"), 0, &Button, 0, Localize("Constructs collision from this layer")))
|
||||
{
|
||||
CLayerTiles *gl = m_pEditor->m_Map.m_pGameLayer;
|
||||
int w = min(gl->m_Width, m_Width);
|
||||
int h = min(gl->m_Height, m_Height);
|
||||
for(int y = 0; y < h; y++)
|
||||
{
|
||||
if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID)
|
||||
gl->m_pTiles[y*gl->m_Width+x].m_Index = m_pTiles[y*m_Width+x].m_Index?TILE_SOLID:TILE_AIR;
|
||||
for(int x = 0; x < w; x++)
|
||||
{
|
||||
if(gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_SOLID)
|
||||
gl->m_pTiles[y*gl->m_Width+x].m_Index = m_pTiles[y*m_Width+x].m_Index?TILE_SOLID:TILE_AIR;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
enum
|
||||
|
|
Loading…
Reference in a new issue