mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
hookthrough shortcut now works for game and front
This commit is contained in:
parent
c583e87b90
commit
70ffbbbbf9
|
@ -507,8 +507,8 @@ public:
|
|||
CLayerTiles(int w, int h);
|
||||
~CLayerTiles();
|
||||
|
||||
virtual CTile GetTile(int x, int y, bool force=false);
|
||||
virtual void SetTile(int x, int y, CTile tile, bool force=false);
|
||||
virtual CTile GetTile(int x, int y);
|
||||
virtual void SetTile(int x, int y, CTile tile);
|
||||
|
||||
virtual void Resize(int NewW, int NewH);
|
||||
virtual void Shift(int Direction);
|
||||
|
@ -593,8 +593,8 @@ public:
|
|||
CLayerGame(int w, int h);
|
||||
~CLayerGame();
|
||||
|
||||
virtual CTile GetTile(int x, int y, bool force=false);
|
||||
virtual void SetTile(int x, int y, CTile tile, bool force=false);
|
||||
virtual CTile GetTile(int x, int y);
|
||||
virtual void SetTile(int x, int y, CTile tile);
|
||||
|
||||
virtual int RenderProperties(CUIRect *pToolbox);
|
||||
};
|
||||
|
@ -1088,8 +1088,8 @@ public:
|
|||
|
||||
virtual void Resize(int NewW, int NewH);
|
||||
virtual void Shift(int Direction);
|
||||
virtual CTile GetTile(int x, int y, bool force=false);
|
||||
virtual void SetTile(int x, int y, CTile tile, bool force=false);
|
||||
virtual CTile GetTile(int x, int y);
|
||||
virtual void SetTile(int x, int y, CTile tile);
|
||||
virtual void BrushDraw(CLayer *pBrush, float wx, float wy);
|
||||
};
|
||||
|
||||
|
|
|
@ -14,40 +14,38 @@ CLayerGame::~CLayerGame()
|
|||
{
|
||||
}
|
||||
|
||||
CTile CLayerGame::GetTile(int x, int y, bool force)
|
||||
CTile CLayerGame::GetTile(int x, int y)
|
||||
{
|
||||
if(!force && m_pEditor->m_Map.m_pFrontLayer && GetTile(x, y, true).m_Index == TILE_NOHOOK && m_pEditor->m_Map.m_pFrontLayer->GetTile(x, y, true).m_Index == TILE_THROUGH_CUT)
|
||||
{
|
||||
CTile throughcut = {TILE_THROUGH_CUT, 0, 0, 0};
|
||||
return throughcut;
|
||||
if(m_pEditor->m_Map.m_pFrontLayer && m_pEditor->m_Map.m_pFrontLayer->GetTile(x, y).m_Index == TILE_THROUGH_CUT) {
|
||||
CTile through_cut = {TILE_THROUGH_CUT};
|
||||
return through_cut;
|
||||
} else {
|
||||
return m_pTiles[y*m_Width+x];
|
||||
return CLayerTiles::GetTile(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void CLayerGame::SetTile(int x, int y, CTile tile, bool force)
|
||||
void CLayerGame::SetTile(int x, int y, CTile tile)
|
||||
{
|
||||
if(!force && tile.m_Index == TILE_THROUGH_CUT) {
|
||||
if(tile.m_Index == TILE_THROUGH_CUT) {
|
||||
if(!m_pEditor->m_Map.m_pFrontLayer) {
|
||||
CLayer *l = new CLayerFront(m_Width, m_Height);
|
||||
m_pEditor->m_Map.MakeFrontLayer(l);
|
||||
m_pEditor->m_Map.m_lGroups[m_pEditor->m_SelectedGroup]->AddLayer(l);
|
||||
}
|
||||
CTile nohook = {TILE_NOHOOK, 0, 0, 0};
|
||||
SetTile(x, y, nohook, true);
|
||||
CTile throughcut = {TILE_THROUGH_CUT, 0, 0, 0};
|
||||
m_pEditor->m_Map.m_pFrontLayer->SetTile(x, y, throughcut, true);
|
||||
CTile nohook = {TILE_NOHOOK};
|
||||
CLayerTiles::SetTile(x, y, nohook);
|
||||
CTile through_cut = {TILE_THROUGH_CUT};
|
||||
m_pEditor->m_Map.m_pFrontLayer->CLayerTiles::SetTile(x, y, through_cut);
|
||||
} else {
|
||||
if(!force && m_pEditor->m_Map.m_pFrontLayer && m_pEditor->m_Map.m_pFrontLayer->GetTile(x, y, true).m_Index == TILE_THROUGH_CUT) {
|
||||
CTile air = {TILE_AIR, 0, 0, 0};
|
||||
m_pEditor->m_Map.m_pFrontLayer->SetTile(x, y, air, true);
|
||||
if(m_pEditor->m_Map.m_pFrontLayer && m_pEditor->m_Map.m_pFrontLayer->GetTile(x, y).m_Index == TILE_THROUGH_CUT) {
|
||||
CTile air = {TILE_AIR};
|
||||
m_pEditor->m_Map.m_pFrontLayer->CLayerTiles::SetTile(x, y, air);
|
||||
}
|
||||
// set normal game tile
|
||||
if(m_pEditor->m_AllowPlaceUnusedTiles || IsValidGameTile(tile.m_Index)) {
|
||||
m_pTiles[y*m_Width+x] = tile;
|
||||
CLayerTiles::SetTile(x, y, tile);
|
||||
} else {
|
||||
CTile air = {TILE_AIR, 0, 0, 0};
|
||||
SetTile(x, y, air);
|
||||
CTile air = {TILE_AIR};
|
||||
CLayerTiles::SetTile(x, y, air);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,12 +46,12 @@ CLayerTiles::~CLayerTiles()
|
|||
delete [] m_pTiles;
|
||||
}
|
||||
|
||||
CTile CLayerTiles::GetTile(int x, int y, bool force)
|
||||
CTile CLayerTiles::GetTile(int x, int y)
|
||||
{
|
||||
return m_pTiles[y*m_Width+x];
|
||||
}
|
||||
|
||||
void CLayerTiles::SetTile(int x, int y, CTile tile, bool force)
|
||||
void CLayerTiles::SetTile(int x, int y, CTile tile)
|
||||
{
|
||||
m_pTiles[y*m_Width+x] = tile;
|
||||
}
|
||||
|
@ -1300,26 +1300,25 @@ CLayerFront::CLayerFront(int w, int h)
|
|||
m_Front = 1;
|
||||
}
|
||||
|
||||
CTile CLayerFront::GetTile(int x, int y, bool force)
|
||||
CTile CLayerFront::GetTile(int x, int y)
|
||||
{
|
||||
if(!force && GetTile(x, y, true).m_Index == TILE_THROUGH_CUT) {
|
||||
CTile air = {TILE_AIR, 0, 0, 0};
|
||||
return air;
|
||||
} else {
|
||||
return m_pTiles[y*m_Width+x];
|
||||
}
|
||||
return CLayerTiles::GetTile(x, y);
|
||||
}
|
||||
|
||||
void CLayerFront::SetTile(int x, int y, CTile tile, bool force)
|
||||
void CLayerFront::SetTile(int x, int y, CTile tile)
|
||||
{
|
||||
if(force || (GetTile(x, y, true).m_Index != TILE_THROUGH_CUT && tile.m_Index != TILE_THROUGH_CUT)) {
|
||||
// set normal front tile
|
||||
if(m_pEditor->m_AllowPlaceUnusedTiles || IsValidFrontTile(tile.m_Index)) {
|
||||
m_pTiles[y*m_Width+x] = tile;
|
||||
} else {
|
||||
CTile air = {TILE_AIR, 0, 0, 0};
|
||||
SetTile(x, y, air);
|
||||
if(tile.m_Index == TILE_THROUGH_CUT) {
|
||||
CTile nohook = {TILE_NOHOOK};
|
||||
m_pEditor->m_Map.m_pGameLayer->CLayerTiles::SetTile(x, y, nohook);
|
||||
} else if(tile.m_Index == TILE_AIR && CLayerTiles::GetTile(x, y).m_Index == TILE_THROUGH_CUT) {
|
||||
CTile air = {TILE_AIR};
|
||||
m_pEditor->m_Map.m_pGameLayer->CLayerTiles::SetTile(x, y, air);
|
||||
}
|
||||
if(m_pEditor->m_AllowPlaceUnusedTiles || IsValidFrontTile(tile.m_Index)) {
|
||||
CLayerTiles::SetTile(x, y, tile);
|
||||
} else {
|
||||
CTile air = {TILE_AIR};
|
||||
CLayerTiles::SetTile(x, y, air);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue