mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-20 01:24:18 +00:00
Fix rotating rotatable tiles in switch layer
This commit is contained in:
parent
f24369b8f6
commit
82ac6091eb
|
@ -508,10 +508,10 @@ void CLayerTiles::BrushFlipX()
|
||||||
m_pTiles[y*m_Width+m_Width-1-x] = Tmp;
|
m_pTiles[y*m_Width+m_Width-1-x] = Tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_Tele || m_Switch || m_Speedup || m_Tune)
|
if(m_Tele || m_Speedup || m_Tune)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool Rotate = !(m_Game || m_Front) || m_pEditor->m_AllowPlaceUnusedTiles;
|
bool Rotate = !(m_Game || m_Front || m_Switch) || m_pEditor->m_AllowPlaceUnusedTiles;
|
||||||
for(int y = 0; y < m_Height; y++)
|
for(int y = 0; y < m_Height; y++)
|
||||||
for(int x = 0; x < m_Width; x++)
|
for(int x = 0; x < m_Width; x++)
|
||||||
if(!Rotate && !IsRotatableTile(m_pTiles[y*m_Width+x].m_Index))
|
if(!Rotate && !IsRotatableTile(m_pTiles[y*m_Width+x].m_Index))
|
||||||
|
@ -530,10 +530,10 @@ void CLayerTiles::BrushFlipY()
|
||||||
m_pTiles[(m_Height-1-y)*m_Width+x] = Tmp;
|
m_pTiles[(m_Height-1-y)*m_Width+x] = Tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_Tele || m_Switch || m_Speedup || m_Tune)
|
if(m_Tele || m_Speedup || m_Tune)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool Rotate = !(m_Game || m_Front) || m_pEditor->m_AllowPlaceUnusedTiles;
|
bool Rotate = !(m_Game || m_Front || m_Switch) || m_pEditor->m_AllowPlaceUnusedTiles;
|
||||||
for(int y = 0; y < m_Height; y++)
|
for(int y = 0; y < m_Height; y++)
|
||||||
for(int x = 0; x < m_Width; x++)
|
for(int x = 0; x < m_Width; x++)
|
||||||
if(!Rotate && !IsRotatableTile(m_pTiles[y*m_Width+x].m_Index))
|
if(!Rotate && !IsRotatableTile(m_pTiles[y*m_Width+x].m_Index))
|
||||||
|
@ -1731,6 +1731,7 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy)
|
||||||
m_pSwitchTile[fy*m_Width+fx].m_Type = l->m_pTiles[y*l->m_Width+x].m_Index;
|
m_pSwitchTile[fy*m_Width+fx].m_Type = l->m_pTiles[y*l->m_Width+x].m_Index;
|
||||||
m_pSwitchTile[fy*m_Width+fx].m_Flags = l->m_pTiles[y*l->m_Width+x].m_Flags;
|
m_pSwitchTile[fy*m_Width+fx].m_Flags = l->m_pTiles[y*l->m_Width+x].m_Flags;
|
||||||
m_pTiles[fy*m_Width+fx].m_Index = l->m_pTiles[y*l->m_Width+x].m_Index;
|
m_pTiles[fy*m_Width+fx].m_Index = l->m_pTiles[y*l->m_Width+x].m_Index;
|
||||||
|
m_pTiles[fy*m_Width+fx].m_Flags = l->m_pTiles[y*l->m_Width+x].m_Flags;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1800,6 +1801,12 @@ void CLayerSwitch::BrushRotate(float Amount)
|
||||||
{
|
{
|
||||||
*pDst1 = pTempData1[y*m_Width+x];
|
*pDst1 = pTempData1[y*m_Width+x];
|
||||||
*pDst2 = pTempData2[y*m_Width+x];
|
*pDst2 = pTempData2[y*m_Width+x];
|
||||||
|
if(IsRotatableTile(pDst2->m_Index))
|
||||||
|
{
|
||||||
|
if(pDst2->m_Flags&TILEFLAG_ROTATE)
|
||||||
|
pDst2->m_Flags ^= (TILEFLAG_HFLIP|TILEFLAG_VFLIP);
|
||||||
|
pDst2->m_Flags ^= TILEFLAG_ROTATE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int Temp = m_Width;
|
int Temp = m_Width;
|
||||||
|
|
Loading…
Reference in a new issue