2023-08-27 09:18:10 +00:00
|
|
|
#include <game/editor/editor.h>
|
|
|
|
|
2023-09-05 13:16:41 +00:00
|
|
|
CLayerFront::CLayerFront(CEditor *pEditor, int w, int h) :
|
|
|
|
CLayerTiles(pEditor, w, h)
|
2023-08-27 09:18:10 +00:00
|
|
|
{
|
|
|
|
str_copy(m_aName, "Front");
|
|
|
|
m_Front = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CLayerFront::SetTile(int x, int y, CTile Tile)
|
|
|
|
{
|
|
|
|
if(Tile.m_Index == TILE_THROUGH_CUT)
|
|
|
|
{
|
|
|
|
CTile nohook = {TILE_NOHOOK};
|
|
|
|
m_pEditor->m_Map.m_pGameLayer->CLayerTiles::SetTile(x, y, nohook); // NOLINT(bugprone-parent-virtual-call)
|
|
|
|
}
|
|
|
|
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); // NOLINT(bugprone-parent-virtual-call)
|
|
|
|
}
|
|
|
|
if(m_pEditor->m_AllowPlaceUnusedTiles || IsValidFrontTile(Tile.m_Index))
|
|
|
|
{
|
|
|
|
CLayerTiles::SetTile(x, y, Tile);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CTile air = {TILE_AIR};
|
|
|
|
CLayerTiles::SetTile(x, y, air);
|
|
|
|
if(!m_pEditor->m_PreventUnusedTilesWasWarned)
|
|
|
|
{
|
|
|
|
m_pEditor->m_PopupEventType = CEditor::POPEVENT_PREVENTUNUSEDTILES;
|
|
|
|
m_pEditor->m_PopupEventActivated = true;
|
|
|
|
m_pEditor->m_PreventUnusedTilesWasWarned = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CLayerFront::Resize(int NewW, int NewH)
|
|
|
|
{
|
|
|
|
// 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);
|
|
|
|
}
|