mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Allow placing unused tiles from other layers (#fixes 3794)
This commit is contained in:
parent
646a4c9fcd
commit
ea08601435
|
@ -1190,7 +1190,7 @@ bool CLayerTele::IsEmpty(CLayerTiles *pLayer)
|
||||||
{
|
{
|
||||||
for(int y = 0; y < pLayer->m_Height; y++)
|
for(int y = 0; y < pLayer->m_Height; y++)
|
||||||
for(int x = 0; x < pLayer->m_Width; x++)
|
for(int x = 0; x < pLayer->m_Width; x++)
|
||||||
if(IsValidTeleTile(pLayer->GetTile(x, y).m_Index))
|
if(m_pEditor->m_AllowPlaceUnusedTiles || IsValidTeleTile(pLayer->GetTile(x, y).m_Index))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1221,7 +1221,7 @@ void CLayerTele::BrushDraw(CLayer *pBrush, float wx, float wy)
|
||||||
if(!Destructive && GetTile(fx, fy).m_Index)
|
if(!Destructive && GetTile(fx, fy).m_Index)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(IsValidTeleTile(l->m_pTiles[y * l->m_Width + x].m_Index))
|
if((m_pEditor->m_AllowPlaceUnusedTiles || IsValidTeleTile(l->m_pTiles[y * l->m_Width + x].m_Index)) && l->m_pTiles[y * l->m_Width + x].m_Index != TILE_AIR)
|
||||||
{
|
{
|
||||||
if(m_pEditor->m_TeleNumber != l->m_TeleNum)
|
if(m_pEditor->m_TeleNumber != l->m_TeleNum)
|
||||||
{
|
{
|
||||||
|
@ -1348,7 +1348,7 @@ void CLayerTele::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
|
||||||
if(!Destructive && GetTile(fx, fy).m_Index)
|
if(!Destructive && GetTile(fx, fy).m_Index)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(Empty || !IsValidTeleTile((pLt->m_pTiles[(y * pLt->m_Width + x % pLt->m_Width) % (pLt->m_Width * pLt->m_Height)]).m_Index))
|
if(Empty || (!m_pEditor->m_AllowPlaceUnusedTiles && !IsValidTeleTile((pLt->m_pTiles[(y * pLt->m_Width + x % pLt->m_Width) % (pLt->m_Width * pLt->m_Height)]).m_Index)))
|
||||||
{
|
{
|
||||||
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
||||||
m_pTeleTile[fy * m_Width + fx].m_Type = 0;
|
m_pTeleTile[fy * m_Width + fx].m_Type = 0;
|
||||||
|
@ -1478,7 +1478,7 @@ bool CLayerSpeedup::IsEmpty(CLayerTiles *pLayer)
|
||||||
{
|
{
|
||||||
for(int y = 0; y < pLayer->m_Height; y++)
|
for(int y = 0; y < pLayer->m_Height; y++)
|
||||||
for(int x = 0; x < pLayer->m_Width; x++)
|
for(int x = 0; x < pLayer->m_Width; x++)
|
||||||
if(IsValidSpeedupTile(pLayer->GetTile(x, y).m_Index))
|
if(m_pEditor->m_AllowPlaceUnusedTiles || IsValidSpeedupTile(pLayer->GetTile(x, y).m_Index))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1513,7 +1513,7 @@ void CLayerSpeedup::BrushDraw(CLayer *pBrush, float wx, float wy)
|
||||||
if(!Destructive && GetTile(fx, fy).m_Index)
|
if(!Destructive && GetTile(fx, fy).m_Index)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(IsValidSpeedupTile(l->m_pTiles[y * l->m_Width + x].m_Index))
|
if((m_pEditor->m_AllowPlaceUnusedTiles || IsValidSpeedupTile(l->m_pTiles[y * l->m_Width + x].m_Index)) && l->m_pTiles[y * l->m_Width + x].m_Index != TILE_AIR)
|
||||||
{
|
{
|
||||||
if(m_pEditor->m_SpeedupAngle != l->m_SpeedupAngle || m_pEditor->m_SpeedupForce != l->m_SpeedupForce || m_pEditor->m_SpeedupMaxSpeed != l->m_SpeedupMaxSpeed)
|
if(m_pEditor->m_SpeedupAngle != l->m_SpeedupAngle || m_pEditor->m_SpeedupForce != l->m_SpeedupForce || m_pEditor->m_SpeedupMaxSpeed != l->m_SpeedupMaxSpeed)
|
||||||
{
|
{
|
||||||
|
@ -1653,7 +1653,7 @@ void CLayerSpeedup::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
|
||||||
if(!Destructive && GetTile(fx, fy).m_Index)
|
if(!Destructive && GetTile(fx, fy).m_Index)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(Empty || !IsValidSpeedupTile((pLt->m_pTiles[(y * pLt->m_Width + x % pLt->m_Width) % (pLt->m_Width * pLt->m_Height)]).m_Index)) // no speed up tile chosen: reset
|
if(Empty || (!m_pEditor->m_AllowPlaceUnusedTiles && !IsValidSpeedupTile((pLt->m_pTiles[(y * pLt->m_Width + x % pLt->m_Width) % (pLt->m_Width * pLt->m_Height)]).m_Index))) // no speed up tile chosen: reset
|
||||||
{
|
{
|
||||||
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
||||||
m_pSpeedupTile[fy * m_Width + fx].m_Force = 0;
|
m_pSpeedupTile[fy * m_Width + fx].m_Force = 0;
|
||||||
|
@ -1822,7 +1822,7 @@ bool CLayerSwitch::IsEmpty(CLayerTiles *pLayer)
|
||||||
{
|
{
|
||||||
for(int y = 0; y < pLayer->m_Height; y++)
|
for(int y = 0; y < pLayer->m_Height; y++)
|
||||||
for(int x = 0; x < pLayer->m_Width; x++)
|
for(int x = 0; x < pLayer->m_Width; x++)
|
||||||
if(IsValidSwitchTile(pLayer->GetTile(x, y).m_Index))
|
if(m_pEditor->m_AllowPlaceUnusedTiles || IsValidSwitchTile(pLayer->GetTile(x, y).m_Index))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1856,7 +1856,7 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy)
|
||||||
if(!Destructive && GetTile(fx, fy).m_Index)
|
if(!Destructive && GetTile(fx, fy).m_Index)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(IsValidSwitchTile(l->m_pTiles[y * l->m_Width + x].m_Index))
|
if((m_pEditor->m_AllowPlaceUnusedTiles || IsValidSwitchTile(l->m_pTiles[y * l->m_Width + x].m_Index)) && l->m_pTiles[y * l->m_Width + x].m_Index != TILE_AIR)
|
||||||
{
|
{
|
||||||
if(m_pEditor->m_SwitchNum != l->m_SwitchNumber || m_pEditor->m_SwitchDelay != l->m_SwitchDelay)
|
if(m_pEditor->m_SwitchNum != l->m_SwitchNumber || m_pEditor->m_SwitchDelay != l->m_SwitchDelay)
|
||||||
{
|
{
|
||||||
|
@ -2000,7 +2000,7 @@ void CLayerSwitch::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
|
||||||
if(!Destructive && GetTile(fx, fy).m_Index)
|
if(!Destructive && GetTile(fx, fy).m_Index)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(Empty || !IsValidSwitchTile((pLt->m_pTiles[(y * pLt->m_Width + x % pLt->m_Width) % (pLt->m_Width * pLt->m_Height)]).m_Index))
|
if(Empty || (!m_pEditor->m_AllowPlaceUnusedTiles && !IsValidSwitchTile((pLt->m_pTiles[(y * pLt->m_Width + x % pLt->m_Width) % (pLt->m_Width * pLt->m_Height)]).m_Index)))
|
||||||
{
|
{
|
||||||
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
||||||
m_pSwitchTile[fy * m_Width + fx].m_Type = 0;
|
m_pSwitchTile[fy * m_Width + fx].m_Type = 0;
|
||||||
|
@ -2138,7 +2138,7 @@ bool CLayerTune::IsEmpty(CLayerTiles *pLayer)
|
||||||
{
|
{
|
||||||
for(int y = 0; y < pLayer->m_Height; y++)
|
for(int y = 0; y < pLayer->m_Height; y++)
|
||||||
for(int x = 0; x < pLayer->m_Width; x++)
|
for(int x = 0; x < pLayer->m_Width; x++)
|
||||||
if(IsValidTuneTile(pLayer->GetTile(x, y).m_Index))
|
if(m_pEditor->m_AllowPlaceUnusedTiles || IsValidTuneTile(pLayer->GetTile(x, y).m_Index))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -2171,7 +2171,7 @@ void CLayerTune::BrushDraw(CLayer *pBrush, float wx, float wy)
|
||||||
if(!Destructive && GetTile(fx, fy).m_Index)
|
if(!Destructive && GetTile(fx, fy).m_Index)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(IsValidTuneTile(l->m_pTiles[y * l->m_Width + x].m_Index))
|
if((m_pEditor->m_AllowPlaceUnusedTiles || IsValidTuneTile(l->m_pTiles[y * l->m_Width + x].m_Index)) && l->m_pTiles[y * l->m_Width + x].m_Index != TILE_AIR)
|
||||||
{
|
{
|
||||||
if(m_pEditor->m_TuningNum != l->m_TuningNumber)
|
if(m_pEditor->m_TuningNum != l->m_TuningNumber)
|
||||||
{
|
{
|
||||||
|
@ -2296,7 +2296,7 @@ void CLayerTune::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect)
|
||||||
if(!Destructive && GetTile(fx, fy).m_Index)
|
if(!Destructive && GetTile(fx, fy).m_Index)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(Empty || !IsValidTuneTile((pLt->m_pTiles[(y * pLt->m_Width + x % pLt->m_Width) % (pLt->m_Width * pLt->m_Height)]).m_Index)) // \o/ this fixes editor bug; TODO: use IsUsedInThisLayer here
|
if(Empty || (!m_pEditor->m_AllowPlaceUnusedTiles && !IsValidTuneTile((pLt->m_pTiles[(y * pLt->m_Width + x % pLt->m_Width) % (pLt->m_Width * pLt->m_Height)]).m_Index))) // \o/ this fixes editor bug; TODO: use IsUsedInThisLayer here
|
||||||
{
|
{
|
||||||
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
m_pTiles[fy * m_Width + fx].m_Index = 0;
|
||||||
m_pTuneTile[fy * m_Width + fx].m_Type = 0;
|
m_pTuneTile[fy * m_Width + fx].m_Type = 0;
|
||||||
|
|
Loading…
Reference in a new issue