Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
mapdbentrysprite.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Twilight
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15*/
16#pragma once
17#include <QObject>
18#include "../db_autoport.h"
19
20class MapDBEntry;
21class MissableDBEntry;
22class SpriteDBEntry;
23class QQmlEngine;
24class MapsDB;
25
26// Sprites are a tad complicated only becuase there are different kinds of
27// sprites having different set of options and all rolled into one data set.
28// Sprites are the 2nd most complicated data structure mainly because sprite
29// data is all over the place and in so many different forms and variables
30// it's actually a very messy system because it feels like this is one area
31// the developers were most trying to figure out through development.
43struct DB_AUTOPORT MapDBEntrySprite : public QObject
44{
45 Q_OBJECT
46 Q_PROPERTY(int adjustedX READ adjustedX CONSTANT)
47 Q_PROPERTY(int adjustedY READ adjustedY CONSTANT)
48 Q_PROPERTY(SpriteType type READ type CONSTANT)
49 Q_PROPERTY(QString getSprite READ getSprite CONSTANT)
50 Q_PROPERTY(int getX READ getX CONSTANT)
51 Q_PROPERTY(int getY READ getY CONSTANT)
52 Q_PROPERTY(QString getMove READ getMove CONSTANT)
53 Q_PROPERTY(int getText READ getText CONSTANT)
54 Q_PROPERTY(int getRange READ getRange CONSTANT)
55 Q_PROPERTY(QString getFace READ getFace CONSTANT)
56 Q_PROPERTY(int getMissable READ getMissable CONSTANT)
57 Q_PROPERTY(MissableDBEntry* getToMissable READ getToMissable CONSTANT)
58 Q_PROPERTY(SpriteDBEntry* getToSprite READ getToSprite CONSTANT)
59 Q_PROPERTY(MapDBEntry* getParent READ getParent CONSTANT)
60
61public:
62 // Details on all the maps in the game
63
66 {
67 // The sprite is a simple NPC
69
70 // The sprite is an item that can be obtained
72
73 // The sprite is a one-time Pokemon that can be battled and beaten
75
76 // The sprite is a trainer which has a team that can be battled and beaten
78
79 // There's no child class for some reason, your asking the parent who doesn't
80 // know
82 };
83 Q_ENUM(SpriteType)
84
85 // X & Y Coordinates adjusted for the gen 1 games
86 int adjustedX() const;
87 int adjustedY() const;
88 virtual SpriteType type() const;
89 const QString getSprite() const;
90 int getX() const;
91 int getY() const;
92 const QString getMove() const;
93 int getText() const;
94 int getRange() const;
95 const QString getFace() const;
96 int getMissable() const;
97 MissableDBEntry* getToMissable() const;
98 SpriteDBEntry* getToSprite() const;
99 MapDBEntry* getParent() const;
100
101public slots:
102 void qmlProtect(const QQmlEngine* const engine) const;
103
104protected:
106 MapDBEntrySprite(const QJsonValue& data, MapDBEntry* const parent);
107 virtual void deepLink();
108 virtual void qmlRegister() const;
109
110 // Name of sprite
111 QString sprite;
112
113 // X & Y position on map
114 int x = 0;
115 int y = 0;
116
117 // Whether the sprite is moving or remaining still
118 // Walk, Stay
119 // The game only uses those 2 options but if a 3rd value is present it will
120 // move without collision detection
121 QString move = "";
122
123 // Text when interacting with sprite
124 int text = -1;
125
126 // Is the sprite allowed room to move?
127 // Or is it given a static facing position
128 // Only one or the other can be filled in, not both
129 int range = -1;
130 QString face = "";
131
132 // Is this sprite a missable, if so to which missable?
133 int missable = -1;
135
136 // To Sprite
138
139 // Parent Map Entry
140 MapDBEntry* parent = nullptr;
141
142 friend class MapsDB;
143 friend class MapDBEntry;
144};
The maps database – every map and its full layout, keyed by name.
Definition mapsdb.h:41
Import/export macro for the db library, plus the central list of DB entry pointer types declared opaq...
#define DB_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
Definition db_autoport.h:37
A map's sprite definition – base class for the four sprite kinds.
MissableDBEntry * toMissable
Resolved missable (deepLink).
int text
Interaction text id.
friend class MapDBEntry
int range
Wander range (exclusive with face).
MissableDBEntry * getToMissable() const
MapDBEntrySprite()
Empty entry.
virtual SpriteType type() const
The sprite kind (overridden by subclasses).
const QString getMove() const
QString sprite
Sprite name (read via getSprite()).
MapDBEntry * parent
Owning map.
QString face
Static facing (exclusive with range).
MapDBEntry * getParent() const
const QString getSprite() const
int missable
Missable index, or -1.
SpriteDBEntry * toSprite
Resolved sprite picture (deepLink).
QString move
Movement mode (see note).
const QString getFace() const
SpriteDBEntry * getToSprite() const
SpriteType
< X adjusted for Gen 1 placement.
One map's complete static definition – the root of the MapDBEntry family.
Definition mapdbentry.h:56
One missable definition: a script/sprite that can be hidden or shown.
One sprite definition: its name/picture-id and the maps that use it.
Definition sprites.h:38