1#ifndef GAME_EDITOR_MAPITEMS_LAYER_TELE_H
2#define GAME_EDITOR_MAPITEMS_LAYER_TELE_H
3
4#include "layer_tiles.h"
5
6struct STeleTileStateChange
7{
8 bool m_Changed;
9 struct SData
10 {
11 int m_Number;
12 int m_Type;
13 int m_Index;
14 } m_Previous, m_Current;
15};
16
17class CLayerTele : public CLayerTiles
18{
19public:
20 CLayerTele(CEditor *pEditor, int w, int h);
21 CLayerTele(const CLayerTele &Other);
22 ~CLayerTele();
23
24 CTeleTile *m_pTeleTile;
25 unsigned char m_TeleNum;
26 unsigned char m_TeleCheckpointNum;
27
28 void Resize(int NewW, int NewH) override;
29 void Shift(int Direction) override;
30 bool IsEmpty(const std::shared_ptr<CLayerTiles> &pLayer) override;
31 void BrushDraw(std::shared_ptr<CLayer> pBrush, float wx, float wy) override;
32 void BrushFlipX() override;
33 void BrushFlipY() override;
34 void BrushRotate(float Amount) override;
35 void FillSelection(bool Empty, std::shared_ptr<CLayer> pBrush, CUIRect Rect) override;
36 virtual bool ContainsElementWithId(int Id, bool Checkpoint);
37 virtual void GetPos(int Number, int Offset, int &TeleX, int &TeleY);
38
39 int m_GotoTeleOffset;
40 ivec2 m_GotoTeleLastPos;
41
42 EditorTileStateChangeHistory<STeleTileStateChange> m_History;
43 inline void ClearHistory() override
44 {
45 CLayerTiles::ClearHistory();
46 m_History.clear();
47 }
48
49 std::shared_ptr<CLayer> Duplicate() const override;
50 const char *TypeName() const override;
51
52private:
53 void RecordStateChange(int x, int y, STeleTileStateChange::SData Previous, STeleTileStateChange::SData Current);
54
55 friend class CLayerTiles;
56};
57
58#endif
59