2020-09-13 23:37:55 +01:00
|
|
|
#pragma once
|
2018-09-23 00:47:28 +01:00
|
|
|
#ifndef METATILE_H
|
|
|
|
#define METATILE_H
|
|
|
|
|
|
|
|
#include "tile.h"
|
2022-02-03 23:10:50 +00:00
|
|
|
#include "config.h"
|
2018-09-23 00:47:28 +01:00
|
|
|
#include <QImage>
|
2020-09-27 17:17:12 +01:00
|
|
|
#include <QPoint>
|
2019-04-04 06:44:31 +01:00
|
|
|
#include <QString>
|
2018-09-23 00:47:28 +01:00
|
|
|
|
2021-11-23 21:11:07 +00:00
|
|
|
enum {
|
|
|
|
METATILE_LAYER_MIDDLE_TOP,
|
|
|
|
METATILE_LAYER_BOTTOM_MIDDLE,
|
|
|
|
METATILE_LAYER_BOTTOM_TOP,
|
|
|
|
NUM_METATILE_LAYER_TYPES
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
ENCOUNTER_NONE,
|
|
|
|
ENCOUNTER_LAND,
|
|
|
|
ENCOUNTER_WATER,
|
|
|
|
NUM_METATILE_ENCOUNTER_TYPES
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
TERRAIN_NONE,
|
|
|
|
TERRAIN_GRASS,
|
|
|
|
TERRAIN_WATER,
|
|
|
|
TERRAIN_WATERFALL,
|
|
|
|
NUM_METATILE_TERRAIN_TYPES
|
|
|
|
};
|
|
|
|
|
2018-09-23 00:47:28 +01:00
|
|
|
class Metatile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Metatile();
|
2021-02-16 18:22:41 +00:00
|
|
|
Metatile(const Metatile &other) = default;
|
|
|
|
Metatile &operator=(const Metatile &other) = default;
|
|
|
|
|
2018-09-23 00:47:28 +01:00
|
|
|
public:
|
2021-02-16 17:14:27 +00:00
|
|
|
QList<Tile> tiles;
|
2020-03-16 20:31:08 +00:00
|
|
|
uint16_t behavior; // 8 bits RSE, 9 bits FRLG
|
2018-10-03 01:01:09 +01:00
|
|
|
uint8_t layerType;
|
2020-03-16 20:31:08 +00:00
|
|
|
uint8_t encounterType; // FRLG only
|
|
|
|
uint8_t terrainType; // FRLG only
|
2022-02-03 23:10:50 +00:00
|
|
|
uint32_t unusedAttributes;
|
2019-04-04 06:44:31 +01:00
|
|
|
QString label;
|
2018-09-23 00:47:28 +01:00
|
|
|
|
2022-02-03 23:10:50 +00:00
|
|
|
void setAttributes(uint32_t data, BaseGameVersion version);
|
|
|
|
uint32_t getAttributes(BaseGameVersion version);
|
|
|
|
|
2022-01-04 02:35:15 +00:00
|
|
|
static int getIndexInTileset(int);
|
2020-09-27 17:17:12 +01:00
|
|
|
static QPoint coordFromPixmapCoord(const QPointF &pixelCoord);
|
2022-02-03 23:10:50 +00:00
|
|
|
static int getAttributesSize(BaseGameVersion version);
|
2018-09-23 00:47:28 +01:00
|
|
|
};
|
|
|
|
|
2022-06-29 19:53:14 +01:00
|
|
|
inline bool operator==(const Metatile &a, const Metatile &b) {
|
|
|
|
return a.behavior == b.behavior &&
|
|
|
|
a.layerType == b.layerType &&
|
|
|
|
a.encounterType == b.encounterType &&
|
|
|
|
a.terrainType == b.terrainType &&
|
|
|
|
a.unusedAttributes == b.unusedAttributes &&
|
|
|
|
a.label == b.label &&
|
|
|
|
a.tiles == b.tiles;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline bool operator!=(const Metatile &a, const Metatile &b) {
|
|
|
|
return !(operator==(a, b));
|
|
|
|
}
|
|
|
|
|
2018-09-23 00:47:28 +01:00
|
|
|
#endif // METATILE_H
|