58 name = data[
"name"].toString();
59 ind = data[
"ind"].toDouble();
62 if(data[
"special"].isBool())
63 special = data[
"special"].toBool();
65 if(data[
"glitch"].isBool())
66 glitch = data[
"glitch"].toBool();
68 if(data[
"bank"].isDouble())
69 bank = data[
"bank"].toDouble();
71 if(data[
"dataPtr"].isDouble())
72 dataPtr = data[
"dataPtr"].toDouble();
74 if(data[
"scriptPtr"].isDouble())
77 if(data[
"textPtr"].isDouble())
78 textPtr = data[
"textPtr"].toDouble();
80 if(data[
"width"].isDouble())
81 width = data[
"width"].toDouble();
83 if(data[
"height"].isDouble())
84 height = data[
"height"].toDouble();
86 if(data[
"music"].isString())
87 music = data[
"music"].toString();
89 if(data[
"tileset"].isString())
90 tileset = data[
"tileset"].toString();
92 if(data[
"modernName"].isString())
95 if(data[
"incomplete"].isString())
98 if(data[
"border"].isDouble())
99 border = data[
"border"].toDouble();
101 if(data[
"spriteSet"].isDouble())
102 spriteSet = data[
"spriteSet"].toDouble();
104 if(data[
"warpOut"].isArray())
106 for(QJsonValue warpEntry : data[
"warpOut"].toArray()) {
112 if(data[
"warpIn"].isArray())
114 for(QJsonValue warpEntry : data[
"warpIn"].toArray()) {
120 if(data[
"signs"].isArray())
122 for(QJsonValue signEntry : data[
"signs"].toArray()) {
128 if(data[
"redMons"].isArray())
130 for(QJsonValue monEntry : data[
"redMons"].toArray()) {
136 if(data[
"blueMons"].isArray())
138 for(QJsonValue monEntry : data[
"blueMons"].toArray()) {
144 if(data[
"waterMons"].isArray())
146 for(QJsonValue monEntry : data[
"waterMons"].toArray()) {
152 if(data[
"monRate"].isDouble())
153 monRate = data[
"monRate"].toDouble();
155 if(data[
"monRateWater"].isDouble())
158 if(data[
"sprites"].isArray())
160 for(QJsonValue spriteEntry : data[
"sprites"].toArray()) {
164 if(spriteEntry[
"item"].isString()) {
168 else if(spriteEntry[
"class"].isString()) {
172 else if(spriteEntry[
"pokemon"].isString()) {
185 if(data[
"connect"].isObject())
187 QJsonValue conVal = data[
"connect"].toObject();
189 if(conVal[
"north"].isObject()) {
190 QJsonValue tmp = conVal[
"north"].toObject();
195 if(conVal[
"east"].isObject()) {
196 QJsonValue tmp = conVal[
"east"].toObject();
201 if(conVal[
"south"].isObject()) {
202 QJsonValue tmp = conVal[
"south"].toObject();
207 if(conVal[
"west"].isObject()) {
208 QJsonValue tmp = conVal[
"west"].toObject();
238 warpEntry->deepLink();
241 for(
auto spriteEntry :
sprites)
242 spriteEntry->deepLink();
246 monEntry->deepLink();
250 monEntry->deepLink();
254 monEntry->deepLink();
262 qCritical() <<
"Map: " <<
name <<
", could not be deep linked to music" <<
music;
265 qCritical() <<
"Map: " <<
name <<
", could not be deep linked to tileset" <<
tileset;
268 qCritical() <<
"Map: " <<
name <<
", could not be deep linked to complete" <<
incomplete;
271 qCritical() <<
"Map: " <<
name <<
", could not be deep linked to sprite set" <<
spriteSet;
286 static bool once =
false;
290 qmlRegisterUncreatableType<MapDBEntry>(
291 "PSE.DB.MapDBEntry", 1, 0,
"MapDBEntry",
"Can't instantiate in QML");
497 return connect.value(val,
nullptr);
static MapsDB * inst()
< Number of maps.
const QHash< QString, MapDBEntry * > getInd() const
Name->map index.
MusicDBEntry * getIndAt(const QString &key) const
Track by name key (for QML).
static MusicDB * inst()
< Number of tracks.
static SpriteSetDB * inst()
< Number of sprite-sets.
SpriteSetDBEntry * getIndAt(const QString &key) const
Set by name key (for QML).
TilesetDBEntry * getIndAt(const QString &key) const
Tileset by name key (for QML).
static TilesetDB * inst()
< Number of tilesets.
static void qmlProtectUtil(const QObject *const obj, const QQmlEngine *const engine)
Pin obj to C++ ownership so the QML engine never garbage-collects it.
One edge connection of a map (the seam to a neighbouring map).
One sign defined on a map: its position and text id.
A map sprite that is a pick-up item (type ITEM).
A map sprite that is a plain NPC (type NPC).
A map sprite that is a static, battleable Pokemon (type POKEMON).
A map sprite that is a battleable trainer (type TRAINER).
A map's sprite definition – base class for the four sprite kinds.
A warp-in point: a destination spot other maps' warp-outs land on.
A warp-out point: a tile that warps the player to another map.
One wild-encounter slot in a map's encounter table: species + level.
const QVector< EventDBEntry * > getToEvents() const
Events associated with this map.
const QVector< MapDBEntryWarpOut * > getWarpOut() const
Outgoing warps.
const QString getTileset() const
ScriptDBEntry * getToScript() const
const QString getIncomplete() const
void deepLink()
Resolve the full cross-reference web.
QVector< HiddenItemDBEntry * > toHiddenItems
int textPtr
Map text pointer.
QVector< MapDBEntryWildMon * > monsBlue
Blue-version land encounters.
const MapDBEntryWildMon * getMonsRedAt(const int ind) const
Red wild ind (for QML).
int border
Border block number.
SpriteSetDBEntry * toSpriteSet
Resolved sprite set (deepLink).
QVector< MapDBEntryWildMon * > monsWater
Water encounters (shared; see note).
int scriptPtr
Map script pointer.
FlyDBEntry * toFlyDestination
const QString getName() const
TilesetDBEntry * getToTileset() const
int getWarpInSize() const
int getWarpOutSize() const
SpriteSetDBEntry * getToSpriteSet() const
QString tileset
Tileset name.
const MapDBEntryConnect * getConnectAt(const int val) const
Connection in direction val (for QML).
int height
Height (blocks).
friend struct ScriptDBEntry
MapDBEntry()
Empty entry (built by MapsDB).
QVector< MapDBEntryWarpOut * > warpOut
Outgoing warps.
int spriteSet
Sprite-set index.
bool glitch
Backing field (read via getGlitch()).
int getToEventsSize() const
friend struct EventDBEntry
int dataPtr
Map data pointer.
int getToHiddenItemsSize() const
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
int getMonsWaterSize() const
bool special
Backing field (read via getSpecial()).
QVector< MapDBEntryWildMon * > monsRed
Red-version land encounters.
const QVector< MapDBEntrySprite * > getSprites() const
Sprites on the map.
int getMonsBlueSize() const
const QVector< MapDBEntryWildMon * > getMonsBlue() const
Blue-version wild encounters.
friend struct HiddenItemDBEntry
void qmlRegister() const
Register with QML.
TilesetDBEntry * toTileset
const QVector< MapDBEntryWarpIn * > getWarpIn() const
Incoming warps.
const QVector< MapDBEntryWildMon * > getMonsWater() const
Water wild encounters.
QVector< MapDBEntryWarpIn * > warpIn
Incoming warps.
QVector< MapDBEntrySprite * > sprites
Sprites.
const QVector< MapDBEntrySign * > getSigns() const
Signs on the map.
int getMonRateWater() const
const QVector< MapDBEntryWildMon * > getMonsRed() const
Red-version wild encounters.
const MapDBEntrySprite * getSpritesAt(const int ind) const
Sprite ind (for QML).
const MapDBEntryWarpIn * getWarpInAt(const int ind) const
Incoming warp ind (for QML).
FlyDBEntry * getToFlyDestination() const
const MapDBEntryWildMon * getMonsWaterAt(const int ind) const
Water wild ind (for QML).
int getSpritesSize() const
QVector< MapDBEntrySign * > signs
Signs.
int getMonsRedSize() const
const QString getModernName() const
const QString getMusic() const
const MapDBEntryWarpOut * getWarpOutAt(const int ind) const
Outgoing warp ind (for QML).
const MapDBEntrySign * getSignsAt(const int ind) const
Sign ind (for QML).
const QString bestName() const
< Best display name (modern/internal).
ScriptDBEntry * toScript
Resolved script (deepLink).
int monRate
Land encounter rate.
QVector< EventDBEntry * > toEvents
QHash< int, MapDBEntryConnect * > connect
Edge connections by direction.
QString modernName
Modern display name.
MusicDBEntry * getToMusic() const
const EventDBEntry * getToEventsAt(const int ind) const
Associated event ind (for QML).
const HiddenItemDBEntry * getToHiddenItemsAt(const int ind) const
Hidden item ind (for QML).
int monRateWater
Water encounter rate.
int height2X2() const
Height x2 (derived; see note).
QString name
Backing field (read via getName()).
int width2X2() const
Width x2 (derived; see note).
MapDBEntry * getToComplete() const
const MapDBEntryWildMon * getMonsBlueAt(const int ind) const
Blue wild ind (for QML).
const QVector< HiddenItemDBEntry * > getToHiddenItems() const
Hidden items on this map.
const QHash< int, MapDBEntryConnect * > getConnect() const
Edge connections by direction.
QString incomplete
Incomplete-map marker.
int ind
Backing field (read via getInd()).
One music track: its name and bank/id, plus the maps that use it.
One sprite-set: the pre-loaded sprite group for an outdoor area.
One tileset definition: its type, graphics/block/collision pointers, etc.