-
Notifications
You must be signed in to change notification settings - Fork 9
/
classtilemap.h
88 lines (82 loc) · 3.85 KB
/
classtilemap.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
This file is part of Retro Graphics Toolkit
Retro Graphics Toolkit is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or any later version.
Retro Graphics Toolkit is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Retro Graphics Toolkit. If not, see <http://www.gnu.org/licenses/>.
Copyright Sega16 (or whatever you wish to call me) (2012-2017)
*/
#pragma once
#define TileMapSizePerEntry 4
#include <boost/endian/conversion.hpp>
#include <string>
#include <FL/Fl_Progress.H>
#include "project.h"
#include "filemisc.h"
#include "compressionWrapper.h"
class tileMap {
private:
boost::endian::order getEndianBySystem();
public:
tileMap(struct Project*prj)noexcept;
tileMap(uint32_t w, uint32_t h, Project*prj)noexcept;
tileMap(tileMap&& other)noexcept;
tileMap& operator=(tileMap&& other)noexcept;
tileMap& operator=(const tileMap&other)noexcept;
tileMap(const tileMap&other, Project*prj)noexcept;
tileMap(const tileMap&other)noexcept;
~tileMap();
std::string planeName;
struct Project*prj;
uint8_t*tileMapDat;/*!< Holds tilemap data*/
int32_t offset;
uint32_t mapSizeW, mapSizeH, mapSizeHA;
uint32_t getNumElms(void)const {
return mapSizeW * mapSizeHA;
}
bool isBlock;
uint32_t amt;
void ditherAsImage(bool entire);
bool pickTileRowQuantChoice(unsigned rows);
bool inRange(uint32_t x, uint32_t y)const;
void setRaw(uint32_t x, uint32_t y, uint32_t val);
uint32_t getRaw(uint32_t x, uint32_t y)const;
void blockAmt(uint32_t newAmt);
void resizeBlocks(uint32_t wn, uint32_t hn);
void toggleBlocks(bool set);
bool get_hflip(uint32_t x, uint32_t y)const;
bool get_vflip(uint32_t x, uint32_t y)const;
bool get_prio(uint32_t x, uint32_t y)const;
int32_t get_tile(uint32_t x, uint32_t y)const;
int32_t get_tileRow(uint32_t x, uint32_t y, unsigned useRow)const;
unsigned getPalRow(uint32_t x, uint32_t y)const;
void set_hflip(uint32_t x, uint32_t y, bool hflip_set);
void set_vflip(uint32_t x, uint32_t y, bool vflip_set);
void set_pal_row(uint32_t x, uint32_t y, unsigned row);
void set_tile_full(uint32_t x, uint32_t y, uint32_t tile, unsigned palette_row, bool use_hflip, bool use_vflip, bool highorlow_prio);
void set_tile(uint32_t x, uint32_t y, uint32_t tile);
void set_prio(uint32_t x, uint32_t y, bool prio_set);
void allRowSet(unsigned row);
bool saveToFile(const char*fname, fileType_t type, int clipboard, CompressionType compression, const char*label = "mapDat", const char*nesFname = nullptr, const char*labelNES = "attrMapDat");
bool saveToFile(void);
bool loadFromFile();
void swapTile(uint32_t oldTile, uint32_t newTile);
void sub_tile_map(uint32_t oldTile, uint32_t newTile, bool hflip, bool vflip);
void pickRow(unsigned amount, int type = -1, int method = -1);
void pickRowDelta(bool showProgress = false, Fl_Progress *progress = nullptr, int alg = -1, int order = -1);
void ScrollUpdate(void);
void resize_tile_map(uint32_t new_x, uint32_t new_y);
bool truecolor_to_image(uint8_t * the_image, int useRow = -1, bool useAlpha = true);
void truecolorimageToTiles(uint8_t * image, int rowusage, bool useAlpha = true, bool copyToTruecolor = false, bool convert = true, bool isIndexArray = false);
void drawBlock(unsigned block, unsigned xoo, unsigned yo, unsigned flags, unsigned zoom);
void drawPart(unsigned offx, unsigned offy, unsigned x, unsigned y, unsigned w, unsigned h, int rowSolo, unsigned zoom, bool trueCol);
void findFirst(int&x, int&y, unsigned tile)const;
void pickExtAttrs(void);
void removeBlock(unsigned id);
void fixPaletteRows(unsigned num, unsigned dom);
};