|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
A map's sprite definition – base class for the four sprite kinds. More...
#include <mapdbentrysprite.h>
Public Types | |
| enum | SpriteType { NPC , ITEM , POKEMON , TRAINER , ERROR } |
| < X adjusted for Gen 1 placement. More... | |
Public Member Functions | |
| int | adjustedX () const |
| int | adjustedY () const |
| virtual SpriteType | type () const |
| The sprite kind (overridden by subclasses). | |
| const QString | getSprite () const |
| int | getX () const |
| int | getY () const |
| const QString | getMove () const |
| int | getText () const |
| int | getRange () const |
| const QString | getFace () const |
| int | getMissable () const |
| MissableDBEntry * | getToMissable () const |
| SpriteDBEntry * | getToSprite () const |
| MapDBEntry * | getParent () const |
| void | qmlProtect (const QQmlEngine *const engine) const |
| Pin to C++ ownership. | |
Protected Member Functions | |
| MapDBEntrySprite () | |
| Empty entry. | |
| MapDBEntrySprite (const QJsonValue &data, MapDBEntry *const parent) | |
Build from JSON under parent. | |
| virtual void | deepLink () |
| Resolve sprite/missable links. | |
| virtual void | qmlRegister () const |
| Register with QML. | |
Protected Attributes | |
| QString | sprite |
| Sprite name (read via getSprite()). | |
| int | x = 0 |
| Raw X. | |
| int | y = 0 |
| Raw Y. | |
| QString | move = "" |
| Movement mode (see note). | |
| int | text = -1 |
| Interaction text id. | |
| int | range = -1 |
| Wander range (exclusive with face). | |
| QString | face = "" |
| Static facing (exclusive with range). | |
| int | missable = -1 |
| Missable index, or -1. | |
| MissableDBEntry * | toMissable = nullptr |
| Resolved missable (deepLink). | |
| SpriteDBEntry * | toSprite = nullptr |
| Resolved sprite picture (deepLink). | |
| MapDBEntry * | parent = nullptr |
| Owning map. | |
Friends | |
| class | MapsDB |
| class | MapDBEntry |
A map's sprite definition – base class for the four sprite kinds.
Carries the fields common to every on-map sprite (position, movement, facing, text, missable link, and the resolved toSprite). The SpriteType distinguishes NPC / ITEM / POKEMON / TRAINER; the four subclasses (MapDBEntrySpriteNpc/Item/Pokemon/Trainer) override type() and add their extra data. The base comment above is Twilight's note on why this is messy. See db.md.
Definition at line 43 of file mapdbentrysprite.h.
< X adjusted for Gen 1 placement.
Y adjusted for Gen 1 placement. Which kind of sprite this is. Sprite name. Raw X. Raw Y. Movement (walk/stay/...). Interaction text id. Wander range (mutually exclusive with face). Static facing (mutually exclusive with range). Missable index, if any. Resolved missable. Resolved sprite picture. Owning map. The four sprite kinds (plus an ERROR sentinel for the type-less base).
| Enumerator | |
|---|---|
| NPC | |
| ITEM | |
| POKEMON | |
| TRAINER | |
| ERROR | |
Definition at line 65 of file mapdbentrysprite.h.
|
protected |
Empty entry.
Definition at line 31 of file mapdbentrysprite.cpp.
References qmlRegister().
Referenced by MapDBEntrySpriteItem::MapDBEntrySpriteItem(), MapDBEntrySpriteNPC::MapDBEntrySpriteNPC(), MapDBEntrySpritePokemon::MapDBEntrySpritePokemon(), and MapDBEntrySpriteTrainer::MapDBEntrySpriteTrainer().
|
protected |
Build from JSON under parent.
Definition at line 35 of file mapdbentrysprite.cpp.
References face, MapDBEntry, missable, move, parent, qmlRegister(), range, sprite, text, x, and y.
| int MapDBEntrySprite::adjustedX | ( | ) | const |
Definition at line 157 of file mapdbentrysprite.cpp.
References x.
Referenced by SpriteData::load().
| int MapDBEntrySprite::adjustedY | ( | ) | const |
Definition at line 162 of file mapdbentrysprite.cpp.
References y.
Referenced by SpriteData::load().
|
protectedvirtual |
Resolve sprite/missable links.
Reimplemented in MapDBEntrySpriteItem, MapDBEntrySpritePokemon, and MapDBEntrySpriteTrainer.
Definition at line 55 of file mapdbentrysprite.cpp.
References face, MissablesDB::getIndAt(), SpritesDB::getIndAt(), MissablesDB::inst(), SpritesDB::inst(), missable, move, range, sprite, text, toMissable, and toSprite.
Referenced by MapDBEntrySpriteItem::deepLink(), MapDBEntrySpritePokemon::deepLink(), and MapDBEntrySpriteTrainer::deepLink().
| const QString MapDBEntrySprite::getFace | ( | ) | const |
Definition at line 113 of file mapdbentrysprite.cpp.
References face.
Referenced by SpriteData::load().
| int MapDBEntrySprite::getMissable | ( | ) | const |
Definition at line 108 of file mapdbentrysprite.cpp.
References missable.
Referenced by SpriteData::load().
| const QString MapDBEntrySprite::getMove | ( | ) | const |
Definition at line 128 of file mapdbentrysprite.cpp.
References move.
Referenced by SpriteData::load().
| MapDBEntry * MapDBEntrySprite::getParent | ( | ) | const |
Definition at line 88 of file mapdbentrysprite.cpp.
References MapDBEntry, and parent.
| int MapDBEntrySprite::getRange | ( | ) | const |
Definition at line 118 of file mapdbentrysprite.cpp.
References range.
Referenced by SpriteData::load().
| const QString MapDBEntrySprite::getSprite | ( | ) | const |
| int MapDBEntrySprite::getText | ( | ) | const |
Definition at line 123 of file mapdbentrysprite.cpp.
References text.
Referenced by SpriteData::load().
| MissableDBEntry * MapDBEntrySprite::getToMissable | ( | ) | const |
Definition at line 103 of file mapdbentrysprite.cpp.
References toMissable.
| SpriteDBEntry * MapDBEntrySprite::getToSprite | ( | ) | const |
Definition at line 98 of file mapdbentrysprite.cpp.
References toSprite.
Referenced by SpriteData::load().
| int MapDBEntrySprite::getX | ( | ) | const |
| int MapDBEntrySprite::getY | ( | ) | const |
| void MapDBEntrySprite::qmlProtect | ( | const QQmlEngine *const | engine | ) | const |
Pin to C++ ownership.
Definition at line 93 of file mapdbentrysprite.cpp.
References Utility::qmlProtectUtil().
|
protectedvirtual |
Register with QML.
Reimplemented in MapDBEntrySpriteItem, MapDBEntrySpriteNPC, MapDBEntrySpritePokemon, and MapDBEntrySpriteTrainer.
Definition at line 77 of file mapdbentrysprite.cpp.
Referenced by MapDBEntrySprite(), and MapDBEntrySprite().
|
virtual |
The sprite kind (overridden by subclasses).
Reimplemented in MapDBEntrySpriteItem, MapDBEntrySpriteNPC, MapDBEntrySpritePokemon, and MapDBEntrySpriteTrainer.
Definition at line 149 of file mapdbentrysprite.cpp.
References ERROR.
Referenced by SpriteData::load().
|
friend |
Definition at line 143 of file mapdbentrysprite.h.
References MapDBEntry.
Referenced by getParent(), MapDBEntry, and MapDBEntrySprite().
|
friend |
|
protected |
Static facing (exclusive with range).
Definition at line 130 of file mapdbentrysprite.h.
Referenced by deepLink(), getFace(), and MapDBEntrySprite().
|
protected |
Missable index, or -1.
Definition at line 133 of file mapdbentrysprite.h.
Referenced by deepLink(), getMissable(), and MapDBEntrySprite().
|
protected |
Movement mode (see note).
Definition at line 121 of file mapdbentrysprite.h.
Referenced by deepLink(), getMove(), and MapDBEntrySprite().
|
protected |
Owning map.
Definition at line 140 of file mapdbentrysprite.h.
Referenced by getParent(), MapDBEntrySprite(), MapDBEntrySpriteItem::MapDBEntrySpriteItem(), MapDBEntrySpriteNPC::MapDBEntrySpriteNPC(), MapDBEntrySpritePokemon::MapDBEntrySpritePokemon(), and MapDBEntrySpriteTrainer::MapDBEntrySpriteTrainer().
|
protected |
Wander range (exclusive with face).
Definition at line 129 of file mapdbentrysprite.h.
Referenced by deepLink(), getRange(), and MapDBEntrySprite().
|
protected |
Sprite name (read via getSprite()).
Definition at line 111 of file mapdbentrysprite.h.
Referenced by deepLink(), getSprite(), and MapDBEntrySprite().
|
protected |
Interaction text id.
Definition at line 124 of file mapdbentrysprite.h.
Referenced by deepLink(), getText(), and MapDBEntrySprite().
|
protected |
Resolved missable (deepLink).
Definition at line 134 of file mapdbentrysprite.h.
Referenced by deepLink(), and getToMissable().
|
protected |
Resolved sprite picture (deepLink).
Definition at line 137 of file mapdbentrysprite.h.
Referenced by deepLink(), and getToSprite().
|
protected |
Raw X.
Definition at line 114 of file mapdbentrysprite.h.
Referenced by adjustedX(), getX(), and MapDBEntrySprite().
|
protected |
Raw Y.
Definition at line 115 of file mapdbentrysprite.h.
Referenced by adjustedY(), getY(), and MapDBEntrySprite().