diff options
| author | oy <Tom_Adams@web.de> | 2011-02-12 19:10:45 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-02-12 19:10:45 +0100 |
| commit | d12db45c488bb72558b2baa049abae7abfd9b7f3 (patch) | |
| tree | 5862396448453ec98d5a40db43bab1bc89b78c6c /src/game/editor/ed_layer_tiles.cpp | |
| parent | c2ad73cfe83dfdadd5500bdb909f1d3809a1963f (diff) | |
| download | zcatch-d12db45c488bb72558b2baa049abae7abfd9b7f3.tar.gz zcatch-d12db45c488bb72558b2baa049abae7abfd9b7f3.zip | |
added editor function to construct different game tiles from a layer. Closes #460
Diffstat (limited to 'src/game/editor/ed_layer_tiles.cpp')
| -rw-r--r-- | src/game/editor/ed_layer_tiles.cpp | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/src/game/editor/ed_layer_tiles.cpp b/src/game/editor/ed_layer_tiles.cpp index 71489d7c..6ef2d256 100644 --- a/src/game/editor/ed_layer_tiles.cpp +++ b/src/game/editor/ed_layer_tiles.cpp @@ -333,41 +333,20 @@ int CLayerTiles::RenderProperties(CUIRect *pToolBox) if(InGameGroup) { 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++) - { - 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"), 0, &Button, 0, Localize("Constructs collision from this layer"))) + if(m_pEditor->DoButton_Editor(&s_ColclButton, Localize("Game tiles"), 0, &Button, 0, Localize("Constructs game tiles from this layer"))) + m_pEditor->PopupSelectGametileOpInvoke(m_pEditor->UI()->MouseX(), m_pEditor->UI()->MouseY()); + + int Result = m_pEditor->PopupSelectGameTileOpResult(); + if(Result > -1) { 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++) - { - 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; - } - } + if(gl->m_pTiles[y*gl->m_Width+x].m_Index >= TILE_AIR && gl->m_pTiles[y*gl->m_Width+x].m_Index <= TILE_NOHOOK) + gl->m_pTiles[y*gl->m_Width+x].m_Index = m_pTiles[y*m_Width+x].m_Index?TILE_AIR+Result:TILE_AIR; + return 1; } } |