Always set number 0 for switch tiles that don't use the number

And use the new `IsSwitchTile(Flags|Number|Delay)Used` functions accordingly.
This commit is contained in:
Robert Müller 2023-03-04 12:22:18 +01:00
parent 6d23f3e5bd
commit c4eca1a0ba

View file

@ -1721,6 +1721,19 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy)
m_pSwitchTile[fy * m_Width + fx].m_Flags = pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Flags; m_pSwitchTile[fy * m_Width + fx].m_Flags = pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Flags;
m_pTiles[fy * m_Width + fx].m_Index = pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index; m_pTiles[fy * m_Width + fx].m_Index = pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index;
m_pTiles[fy * m_Width + fx].m_Flags = pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Flags; m_pTiles[fy * m_Width + fx].m_Flags = pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Flags;
if(!IsSwitchTileFlagsUsed(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index))
{
m_pSwitchTile[fy * m_Width + fx].m_Flags = 0;
}
if(!IsSwitchTileNumberUsed(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index))
{
m_pSwitchTile[fy * m_Width + fx].m_Number = 0;
}
if(!IsSwitchTileDelayUsed(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index))
{
m_pSwitchTile[fy * m_Width + fx].m_Delay = 0;
}
} }
else else
{ {
@ -1730,16 +1743,6 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy)
m_pSwitchTile[fy * m_Width + fx].m_Delay = 0; m_pSwitchTile[fy * m_Width + fx].m_Delay = 0;
m_pTiles[fy * m_Width + fx].m_Index = 0; m_pTiles[fy * m_Width + fx].m_Index = 0;
} }
if(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index == TILE_FREEZE)
{
m_pSwitchTile[fy * m_Width + fx].m_Flags = 0;
}
else if(pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index == TILE_DFREEZE || pSwitchLayer->m_pTiles[y * pSwitchLayer->m_Width + x].m_Index == TILE_DUNFREEZE)
{
m_pSwitchTile[fy * m_Width + fx].m_Flags = 0;
m_pSwitchTile[fy * m_Width + fx].m_Delay = 0;
}
} }
FlagModified(sx, sy, pSwitchLayer->m_Width, pSwitchLayer->m_Height); FlagModified(sx, sy, pSwitchLayer->m_Width, pSwitchLayer->m_Height);
} }