Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
missabledbentry.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 <QJsonValue>
19#include <QString>
20#include <QHash>
21
22#include "../db_autoport.h"
23
24struct MapDBEntry;
25struct MapDBEntrySprite;
26class QQmlEngine;
27class MissablesDB;
28
29// With amazing help of Quicktype!!!
30// https://app.quicktype.io
31
32// Missable flags set in-game, a missable is simply a script and/or sprite
33// that never loads (Is surpressed). Allows the game to hide things you
34// shouldn't see or encounter yet or show a new map "state" after you progressed
35// in the games.
36
37// The starter you and your rival pick are both missable activated and the
38// guy blocking the path in Pewter City is a missable that's hiden once you beat
39// Brock.
40
51struct DB_AUTOPORT MissableDBEntry : public QObject {
52 Q_OBJECT
53 Q_PROPERTY(QString getName READ getName CONSTANT)
54 Q_PROPERTY(int getInd READ getInd CONSTANT)
55 Q_PROPERTY(QString getMap READ getMap CONSTANT)
56 Q_PROPERTY(int getSprite READ getSprite CONSTANT)
57 Q_PROPERTY(bool getDefShow READ getDefShow CONSTANT)
58 Q_PROPERTY(MapDBEntry* getToMap READ getToMap CONSTANT)
59 Q_PROPERTY(MapDBEntrySprite* getToMapSprite READ getToMapSprite CONSTANT)
60
61public:
62 const QString getName() const;
63 int getInd() const;
64 const QString getMap() const;
65 int getSprite() const;
66 bool getDefShow() const;
67 MapDBEntry* getToMap() const;
69
70public slots:
71 void qmlProtect(const QQmlEngine* const engine) const;
72
73protected:
75 MissableDBEntry(QJsonValue& data);
76 void deepLink();
77 void qmlRegister() const;
78
79 // Missable Name & Index
80 QString name = "";
81 int ind = 0;
82
83 // Map & Sprite on map Missable References
84 QString map = "";
85 int sprite = 0;
86
87 // Is this missable shown or hidden by default
88 bool defShow = false;
89
90 // Deep link to associated map and sprite on map
91 // There are 2 exceptions to this
92 // * There's one missable that references a sprite on an incomplete map with
93 // no sprites
94 // * There's one missable that references an extra sprite which isn't there
95 //
96 // In both cases one or both of these will be nullptr
97 MapDBEntry* toMap = nullptr;
99
100 friend class MissablesDB;
101};
The missables database – metadata for the missable-sprite flags, keyed by name.
Definition missablesdb.h:36
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.
One map's complete static definition – the root of the MapDBEntry family.
Definition mapdbentry.h:56
MissableDBEntry()
Empty entry (built by MissablesDB).
MapDBEntry * toMap
Resolved map (may be null; see note above).
void deepLink()
Resolve the map + map-sprite links.
bool defShow
Backing field (read via getDefShow()).
QString name
Backing field (read via getName()).
void qmlRegister() const
Register with QML.
MapDBEntry * getToMap() const
const QString getName() const
< Missable name.
bool getDefShow() const
int sprite
Backing field (read via getSprite()).
int ind
Backing field (read via getInd()).
friend class MissablesDB
Owning DB constructs/populates entries.
QString map
Backing field (read via getMap()).
const QString getMap() const
MapDBEntrySprite * getToMapSprite() const
void qmlProtect(const QQmlEngine *const engine) const
Pin to C++ ownership.
MapDBEntrySprite * toMapSprite
Resolved map sprite (may be null; see note above).