2018-09-25 01:12:29 +01:00
|
|
|
#include "metatile.h"
|
|
|
|
#include "tileset.h"
|
2018-09-23 00:47:28 +01:00
|
|
|
#include "project.h"
|
|
|
|
|
2021-02-16 17:14:27 +00:00
|
|
|
Metatile::Metatile() :
|
|
|
|
behavior(0),
|
|
|
|
layerType(0),
|
|
|
|
encounterType(0),
|
|
|
|
terrainType(0)
|
|
|
|
{ }
|
|
|
|
|
2022-01-04 02:35:15 +00:00
|
|
|
int Metatile::getIndexInTileset(int metatileId) {
|
|
|
|
if (metatileId < Project::getNumMetatilesPrimary()) {
|
|
|
|
return metatileId;
|
2018-09-23 00:47:28 +01:00
|
|
|
} else {
|
2022-01-04 02:35:15 +00:00
|
|
|
return metatileId - Project::getNumMetatilesPrimary();
|
2018-09-23 00:47:28 +01:00
|
|
|
}
|
|
|
|
}
|
2020-09-27 17:17:12 +01:00
|
|
|
|
|
|
|
QPoint Metatile::coordFromPixmapCoord(const QPointF &pixelCoord) {
|
|
|
|
int x = static_cast<int>(pixelCoord.x()) / 16;
|
|
|
|
int y = static_cast<int>(pixelCoord.y()) / 16;
|
|
|
|
return QPoint(x, y);
|
|
|
|
}
|