From c4eca1a0bac203f7310196424ded41bd616c6888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 4 Mar 2023 12:22:18 +0100 Subject: [PATCH] Always set number `0` for switch tiles that don't use the number And use the new `IsSwitchTile(Flags|Number|Delay)Used` functions accordingly. --- src/game/editor/layer_tiles.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/game/editor/layer_tiles.cpp b/src/game/editor/layer_tiles.cpp index 16b52bd45..42afda57f 100644 --- a/src/game/editor/layer_tiles.cpp +++ b/src/game/editor/layer_tiles.cpp @@ -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_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; + + 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 { @@ -1730,16 +1743,6 @@ void CLayerSwitch::BrushDraw(CLayer *pBrush, float wx, float wy) m_pSwitchTile[fy * m_Width + fx].m_Delay = 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); }