Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
MapDBEntrySprite Struct Reference

A map's sprite definition – base class for the four sprite kinds. More...

#include <mapdbentrysprite.h>

Inheritance diagram for MapDBEntrySprite:
Collaboration diagram for MapDBEntrySprite:

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
MissableDBEntrygetToMissable () const
SpriteDBEntrygetToSprite () const
MapDBEntrygetParent () 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.
MissableDBEntrytoMissable = nullptr
 Resolved missable (deepLink).
SpriteDBEntrytoSprite = nullptr
 Resolved sprite picture (deepLink).
MapDBEntryparent = nullptr
 Owning map.

Friends

class MapsDB
class MapDBEntry

Detailed Description

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.

See also
MapDBEntry (parent), SpriteData (the save-side sprite), the four subclasses.

Definition at line 43 of file mapdbentrysprite.h.

Member Enumeration Documentation

◆ SpriteType

< 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.

Constructor & Destructor Documentation

◆ MapDBEntrySprite() [1/2]

◆ MapDBEntrySprite() [2/2]

MapDBEntrySprite::MapDBEntrySprite ( const QJsonValue & data,
MapDBEntry *const parent )
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.

Member Function Documentation

◆ adjustedX()

int MapDBEntrySprite::adjustedX ( ) const
See also
adjustedX property.

Definition at line 157 of file mapdbentrysprite.cpp.

References x.

Referenced by SpriteData::load().

◆ adjustedY()

int MapDBEntrySprite::adjustedY ( ) const
See also
adjustedY property.

Definition at line 162 of file mapdbentrysprite.cpp.

References y.

Referenced by SpriteData::load().

◆ deepLink()

◆ getFace()

const QString MapDBEntrySprite::getFace ( ) const
See also
getFace property.

Definition at line 113 of file mapdbentrysprite.cpp.

References face.

Referenced by SpriteData::load().

◆ getMissable()

int MapDBEntrySprite::getMissable ( ) const
See also
getMissable property.

Definition at line 108 of file mapdbentrysprite.cpp.

References missable.

Referenced by SpriteData::load().

◆ getMove()

const QString MapDBEntrySprite::getMove ( ) const
See also
getMove property.

Definition at line 128 of file mapdbentrysprite.cpp.

References move.

Referenced by SpriteData::load().

◆ getParent()

MapDBEntry * MapDBEntrySprite::getParent ( ) const
See also
getParent property.

Definition at line 88 of file mapdbentrysprite.cpp.

References MapDBEntry, and parent.

◆ getRange()

int MapDBEntrySprite::getRange ( ) const
See also
getRange property.

Definition at line 118 of file mapdbentrysprite.cpp.

References range.

Referenced by SpriteData::load().

◆ getSprite()

const QString MapDBEntrySprite::getSprite ( ) const
See also
getSprite property.

Definition at line 143 of file mapdbentrysprite.cpp.

References sprite.

◆ getText()

int MapDBEntrySprite::getText ( ) const
See also
getText property.

Definition at line 123 of file mapdbentrysprite.cpp.

References text.

Referenced by SpriteData::load().

◆ getToMissable()

MissableDBEntry * MapDBEntrySprite::getToMissable ( ) const
See also
getToMissable property.

Definition at line 103 of file mapdbentrysprite.cpp.

References toMissable.

◆ getToSprite()

SpriteDBEntry * MapDBEntrySprite::getToSprite ( ) const
See also
getToSprite property.

Definition at line 98 of file mapdbentrysprite.cpp.

References toSprite.

Referenced by SpriteData::load().

◆ getX()

int MapDBEntrySprite::getX ( ) const
See also
getX property.

Definition at line 138 of file mapdbentrysprite.cpp.

References x.

◆ getY()

int MapDBEntrySprite::getY ( ) const
See also
getY property.

Definition at line 133 of file mapdbentrysprite.cpp.

References y.

◆ qmlProtect()

void MapDBEntrySprite::qmlProtect ( const QQmlEngine *const engine) const

Pin to C++ ownership.

Definition at line 93 of file mapdbentrysprite.cpp.

References Utility::qmlProtectUtil().

◆ qmlRegister()

void MapDBEntrySprite::qmlRegister ( ) const
protectedvirtual

Register with QML.

Reimplemented in MapDBEntrySpriteItem, MapDBEntrySpriteNPC, MapDBEntrySpritePokemon, and MapDBEntrySpriteTrainer.

Definition at line 77 of file mapdbentrysprite.cpp.

Referenced by MapDBEntrySprite(), and MapDBEntrySprite().

◆ type()

MapDBEntrySprite::SpriteType MapDBEntrySprite::type ( ) const
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().

◆ MapDBEntry

friend class MapDBEntry
friend

Definition at line 143 of file mapdbentrysprite.h.

References MapDBEntry.

Referenced by getParent(), MapDBEntry, and MapDBEntrySprite().

◆ MapsDB

friend class MapsDB
friend

Definition at line 142 of file mapdbentrysprite.h.

References MapsDB.

Referenced by MapsDB.

Member Data Documentation

◆ face

QString MapDBEntrySprite::face = ""
protected

Static facing (exclusive with range).

Definition at line 130 of file mapdbentrysprite.h.

Referenced by deepLink(), getFace(), and MapDBEntrySprite().

◆ missable

int MapDBEntrySprite::missable = -1
protected

Missable index, or -1.

Definition at line 133 of file mapdbentrysprite.h.

Referenced by deepLink(), getMissable(), and MapDBEntrySprite().

◆ move

QString MapDBEntrySprite::move = ""
protected

Movement mode (see note).

Definition at line 121 of file mapdbentrysprite.h.

Referenced by deepLink(), getMove(), and MapDBEntrySprite().

◆ parent

◆ range

int MapDBEntrySprite::range = -1
protected

Wander range (exclusive with face).

Definition at line 129 of file mapdbentrysprite.h.

Referenced by deepLink(), getRange(), and MapDBEntrySprite().

◆ sprite

QString MapDBEntrySprite::sprite
protected

Sprite name (read via getSprite()).

Definition at line 111 of file mapdbentrysprite.h.

Referenced by deepLink(), getSprite(), and MapDBEntrySprite().

◆ text

int MapDBEntrySprite::text = -1
protected

Interaction text id.

Definition at line 124 of file mapdbentrysprite.h.

Referenced by deepLink(), getText(), and MapDBEntrySprite().

◆ toMissable

MissableDBEntry* MapDBEntrySprite::toMissable = nullptr
protected

Resolved missable (deepLink).

Definition at line 134 of file mapdbentrysprite.h.

Referenced by deepLink(), and getToMissable().

◆ toSprite

SpriteDBEntry* MapDBEntrySprite::toSprite = nullptr
protected

Resolved sprite picture (deepLink).

Definition at line 137 of file mapdbentrysprite.h.

Referenced by deepLink(), and getToSprite().

◆ x

int MapDBEntrySprite::x = 0
protected

Raw X.

Definition at line 114 of file mapdbentrysprite.h.

Referenced by adjustedX(), getX(), and MapDBEntrySprite().

◆ y

int MapDBEntrySprite::y = 0
protected

Raw Y.

Definition at line 115 of file mapdbentrysprite.h.

Referenced by adjustedY(), getY(), and MapDBEntrySprite().


The documentation for this struct was generated from the following files: