From ccbd0572554c4478dba8f53ac295030351bf9dd4 Mon Sep 17 00:00:00 2001 From: GreYFoXGTi Date: Sun, 19 Dec 2010 04:02:59 +0200 Subject: [PATCH] Revert merge branch 14.11 converter merged by noother --- src/game/editor/ed_editor.cpp | 7 -- src/game/editor/ed_editor.h | 16 --- src/game/editor/ed_io.cpp | 23 +---- src/game/editor/ed_layer_tiles.cpp | 156 ----------------------------- 4 files changed, 1 insertion(+), 201 deletions(-) diff --git a/src/game/editor/ed_editor.cpp b/src/game/editor/ed_editor.cpp index de4528010..09f88b1ff 100644 --- a/src/game/editor/ed_editor.cpp +++ b/src/game/editor/ed_editor.cpp @@ -3234,13 +3234,6 @@ void CEditorMap::MakeSwitchLayer(CLayer *pLayer) m_pSwitchLayer->m_TexId = m_pEditor->ms_SwitchTexture; } -void CEditorMap::MakeSwitchLayerOlder(CLayer *pLayer) -{ - m_pSwitchLayerOlder = (CLayerSwitchOlder *)pLayer; - m_pSwitchLayerOlder->m_pEditor = m_pEditor; - m_pSwitchLayerOlder->m_TexId = m_pEditor->ms_SwitchTexture; -} - void CEditorMap::MakeGameGroup(CLayerGroup *pGroup) { m_pGameGroup = pGroup; diff --git a/src/game/editor/ed_editor.h b/src/game/editor/ed_editor.h index 75df87b53..dd94d5ba1 100644 --- a/src/game/editor/ed_editor.h +++ b/src/game/editor/ed_editor.h @@ -275,7 +275,6 @@ public: class CLayerSpeedup *m_pSpeedupLayer; class CLayerFront *m_pFrontLayer; class CLayerSwitch *m_pSwitchLayer; - class CLayerSwitchOlder *m_pSwitchLayerOlder; CLayerGroup *m_pGameGroup; CEnvelope *NewEnvelope(int Channels) @@ -333,7 +332,6 @@ public: void MakeSpeedupLayer(CLayer *pLayer); void MakeFrontLayer(CLayer *pLayer); void MakeSwitchLayer(CLayer *pLayer); - void MakeSwitchLayerOlder(CLayer *pLayer); }; @@ -505,20 +503,6 @@ public: virtual void FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect); }; -class CLayerSwitchOlder : public CLayerTiles -{ -public: - CLayerSwitchOlder(int w, int h); - ~CLayerSwitchOlder(); - - CTeleTile *m_pSwitchTile; - - virtual void Resize(int NewW, int NewH); - virtual void Shift(int Direction); - virtual void BrushDraw(CLayer *pBrush, float wx, float wy); - virtual void FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect); -}; - class CEditor : public IEditor { class IInput *m_pInput; diff --git a/src/game/editor/ed_io.cpp b/src/game/editor/ed_io.cpp index 593d5b3d0..b6b6b0b16 100644 --- a/src/game/editor/ed_io.cpp +++ b/src/game/editor/ed_io.cpp @@ -539,7 +539,6 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag { CMapItemLayerTilemap *pTilemapItem = (CMapItemLayerTilemap *)pLayerItem; CLayerTiles *pTiles = 0; - CLayerTiles *pTilesTemp = 0; if(pTilemapItem->m_Flags&1) { @@ -566,8 +565,6 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag { pTiles = new CLayerSwitch(pTilemapItem->m_Width, pTilemapItem->m_Height); MakeSwitchLayer(pTiles); - pTilesTemp = new CLayerSwitchOlder(pTilemapItem->m_Width, pTilemapItem->m_Height); - MakeSwitchLayerOlder(pTilesTemp); } else { @@ -644,25 +641,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag else if(pTiles->m_Switch) { void *pSwitchData = DataFile.GetData(pTilemapItem->m_Switch); - mem_copy(((CLayerSwitchOlder*)pTilesTemp)->m_pSwitchTile, pSwitchData, pTiles->m_Width*pTiles->m_Height*sizeof(CTeleTile)); - for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++) - { - if(((CLayerSwitchOlder*)pTilesTemp)->m_pSwitchTile[i].m_Type) - { - if(((CLayerSwitchOlder*)pTilesTemp)->m_pSwitchTile[i].m_Type == ENTITY_DOOR+1+ENTITY_OFFSET) - ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type = TILE_SWITCHTIMEDCLOSE; - else - ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type = ((CLayerSwitchOlder*)pTilesTemp)->m_pSwitchTile[i].m_Type; - ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Number = ((CLayerSwitchOlder*)pTilesTemp)->m_pSwitchTile[i].m_Number; - } - else - { - ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Type = 0; - ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Number = 0; - } - ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Flags = 0; - ((CLayerSwitch*)pTiles)->m_pSwitchTile[i].m_Delay = 0; - } + mem_copy(((CLayerSwitch*)pTiles)->m_pSwitchTile, pSwitchData, pTiles->m_Width*pTiles->m_Height*sizeof(CSwitchTile)); for(int i = 0; i < pTiles->m_Width*pTiles->m_Height; i++) { diff --git a/src/game/editor/ed_layer_tiles.cpp b/src/game/editor/ed_layer_tiles.cpp index 46b1c4a33..84096dc42 100644 --- a/src/game/editor/ed_layer_tiles.cpp +++ b/src/game/editor/ed_layer_tiles.cpp @@ -1142,159 +1142,3 @@ void CLayerSwitch::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect) } } } - - -CLayerSwitchOlder::CLayerSwitchOlder(int w, int h) -: CLayerTiles(w, h) -{ - m_pTypeName = "Switch"; - m_Switch = 1; - - m_pSwitchTile = new CTeleTile[w*h]; - mem_zero(m_pSwitchTile, w*h*sizeof(CTeleTile)); -} - -CLayerSwitchOlder::~CLayerSwitchOlder() -{ - delete[] m_pSwitchTile; -} - -void CLayerSwitchOlder::Resize(int NewW, int NewH) -{ - // resize switch data - CTeleTile *pNewSwitchData = new CTeleTile[NewW*NewH]; - mem_zero(pNewSwitchData, NewW*NewH*sizeof(CTeleTile)); - - // copy old data - for(int y = 0; y < min(NewH, m_Height); y++) - mem_copy(&pNewSwitchData[y*NewW], &m_pSwitchTile[y*m_Width], min(m_Width, NewW)*sizeof(CTeleTile)); - - // replace old - delete [] m_pSwitchTile; - m_pSwitchTile = pNewSwitchData; - - // resize tile data - CLayerTiles::Resize(NewW, NewH); - - // resize gamelayer too - if(m_pEditor->m_Map.m_pGameLayer->m_Width != NewW || m_pEditor->m_Map.m_pGameLayer->m_Height != NewH) - m_pEditor->m_Map.m_pGameLayer->Resize(NewW, NewH); -} - -void CLayerSwitchOlder::Shift(int Direction) -{ - CLayerTiles::Shift(Direction); - - switch(Direction) - { - case 1: - { - // left - for(int y = 0; y < m_Height; ++y) - mem_move(&m_pSwitchTile[y*m_Width], &m_pSwitchTile[y*m_Width+1], (m_Width-1)*sizeof(CTeleTile)); - } - break; - case 2: - { - // right - for(int y = 0; y < m_Height; ++y) - mem_move(&m_pSwitchTile[y*m_Width+1], &m_pSwitchTile[y*m_Width], (m_Width-1)*sizeof(CTeleTile)); - } - break; - case 4: - { - // up - for(int y = 0; y < m_Height-1; ++y) - mem_copy(&m_pSwitchTile[y*m_Width], &m_pSwitchTile[(y+1)*m_Width], m_Width*sizeof(CTeleTile)); - } - break; - case 8: - { - // down - for(int y = m_Height-1; y > 0; --y) - mem_copy(&m_pSwitchTile[y*m_Width], &m_pSwitchTile[(y-1)*m_Width], m_Width*sizeof(CTeleTile)); - } - } -} - -void CLayerSwitchOlder::BrushDraw(CLayer *pBrush, float wx, float wy) -{ - CLayerSwitch *l = (CLayerSwitch *)pBrush; - int sx = ConvertX(wx); - int sy = ConvertY(wy); - - for(int y = 0; y < l->m_Height; y++) - for(int x = 0; x < l->m_Width; x++) - { - int fx = x+sx; - int fy = y+sy; - if(fx<0 || fx >= m_Width || fy < 0 || fy >= m_Height) - continue; - - if(l->m_pTiles[y*l->m_Width+x].m_Index >= (ENTITY_ARMOR_1 + ENTITY_OFFSET) && l->m_pTiles[y*l->m_Width+x].m_Index <= (ENTITY_DOOR + ENTITY_OFFSET) || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHCLOSE || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDOPEN || l->m_pTiles[y*l->m_Width+x].m_Index == TILE_SWITCHTIMEDCLOSE) - { - /*if(l->m_pSwitchTile[y*l->m_Width+x].m_Number) - m_pSwitchTile[fy*m_Width+fx].m_Number = l->m_pSwitchTile[y*l->m_Width+x].m_Number; - else*/ - { - if(!m_pEditor->m_SwitchNum) - { - m_pSwitchTile[fy*m_Width+fx].m_Number = 0; - m_pSwitchTile[fy*m_Width+fx].m_Type = 0; - m_pTiles[fy*m_Width+fx].m_Index = 0; - continue; - } - else - m_pSwitchTile[fy*m_Width+fx].m_Number = m_pEditor->m_SwitchNum; - } - - m_pSwitchTile[fy*m_Width+fx].m_Type = 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; - } - else - { - m_pSwitchTile[fy*m_Width+fx].m_Number = 0; - m_pSwitchTile[fy*m_Width+fx].m_Type = 0; - m_pTiles[fy*m_Width+fx].m_Index = 0; - } - } -} - -void CLayerSwitchOlder::FillSelection(bool Empty, CLayer *pBrush, CUIRect Rect) -{ - if(m_Readonly) - return; - - int sx = ConvertX(Rect.x); - int sy = ConvertY(Rect.y); - int w = ConvertX(Rect.w); - int h = ConvertY(Rect.h); - - CLayerSwitch *pLt = static_cast(pBrush); - - for(int y = 0; y <= h; y++) - { - for(int x = 0; x <= w; x++) - { - int fx = x+sx; - int fy = y+sy; - - if(fx < 0 || fx >= m_Width || fy < 0 || fy >= m_Height) - continue; - - if(Empty) - { - m_pTiles[fy*m_Width+fx].m_Index = 0; - m_pSwitchTile[fy*m_Width+fx].m_Number = 0; - } - else - { - m_pTiles[fy*m_Width+fx] = pLt->m_pTiles[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)]; - if(!pLt->m_pSwitchTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number && m_pEditor->m_SwitchNum && m_pTiles[fy*m_Width+fx].m_Index > 0) - m_pSwitchTile[fy*m_Width+fx].m_Number = m_pEditor->m_SwitchNum; - else - m_pSwitchTile[fy*m_Width+fx].m_Number = pLt->m_pSwitchTile[(y*pLt->m_Width + x%pLt->m_Width) % (pLt->m_Width*pLt->m_Height)].m_Number; - } - } - } -}