Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
area.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>
19
20class SaveFile;
21class Player;
22class AreaAudio;
24class AreaGeneral;
25class AreaMap;
26class AreaNPC;
27class AreaPlayer;
28class AreaPokemon;
29class AreaSign;
30class AreaSprites;
31class AreaTileset;
32class AreaWarps;
33
34// Only `area.general` is traversed in QML (the playtime "countPlaytime" helper),
35// so include ONLY that child as a full type. The other 10 area children stay
36// forward-declared + Q_DECLARE_OPAQUE_POINTER below. Pulling all 11 in dragged
37// the heavy area subtree (whose .cpp's include db headers) into the global
38// include path and ballooned build time. See notes/reference/qt6-patterns.md.
39#include "./areageneral.h"
40
41class AreaAudio;
43class AreaMap;
44class AreaNPC;
45class AreaPlayer;
46class AreaPokemon;
47class AreaSign;
48class AreaSprites;
49class AreaTileset;
50class AreaWarps;
51
52Q_DECLARE_OPAQUE_POINTER(AreaAudio*)
53Q_DECLARE_OPAQUE_POINTER(AreaLoadedSprites*)
54Q_DECLARE_OPAQUE_POINTER(AreaMap*)
55Q_DECLARE_OPAQUE_POINTER(AreaNPC*)
56Q_DECLARE_OPAQUE_POINTER(AreaPlayer*)
57Q_DECLARE_OPAQUE_POINTER(AreaPokemon*)
58Q_DECLARE_OPAQUE_POINTER(AreaSign*)
59Q_DECLARE_OPAQUE_POINTER(AreaSprites*)
60Q_DECLARE_OPAQUE_POINTER(AreaTileset*)
61Q_DECLARE_OPAQUE_POINTER(AreaWarps*)
62
63class MapDBEntry;
64
81class SAVEFILE_AUTOPORT Area : public QObject
82{
83 Q_OBJECT
84
85 Q_PROPERTY(AreaAudio* audio MEMBER audio NOTIFY audioChanged)
87 Q_PROPERTY(AreaGeneral* general MEMBER general NOTIFY generalChanged)
88 Q_PROPERTY(AreaMap* map MEMBER map NOTIFY mapChanged)
89 Q_PROPERTY(AreaNPC* npc MEMBER npc NOTIFY npcChanged)
90 Q_PROPERTY(AreaPlayer* player MEMBER player NOTIFY playerChanged)
91 Q_PROPERTY(AreaPokemon* pokemon MEMBER pokemon NOTIFY pokemonChanged)
92 Q_PROPERTY(AreaSign* signs MEMBER signs NOTIFY signsChanged)
93 Q_PROPERTY(AreaSprites* sprites MEMBER sprites NOTIFY spritesChanged)
94 Q_PROPERTY(AreaTileset* tileset MEMBER tileset NOTIFY tilesetChanged)
95 Q_PROPERTY(AreaWarps* warps MEMBER warps NOTIFY warpsChanged)
96
97public:
98 Area(SaveFile* saveFile = nullptr);
99 virtual ~Area();
100
101 void load(SaveFile* saveFile = nullptr);
102 void save(SaveFile* saveFile);
103
104signals:
105 // There's actually no need for these, Q_PROPERTY requires them
106 void audioChanged();
117
118public slots:
119 void reset();
120 void randomize();
121 void setTo(MapDBEntry* map);
122
123public:
124 AreaAudio* audio = nullptr;
126 AreaGeneral* general = nullptr;
127 AreaMap* map = nullptr;
128 AreaNPC* npc = nullptr;
129 AreaPlayer* player = nullptr;
130 AreaPokemon* pokemon = nullptr;
131 AreaSign* signs = nullptr;
132 AreaSprites* sprites = nullptr;
133 AreaTileset* tileset = nullptr;
134 AreaWarps* warps = nullptr;
135};
The current map's audio: which track plays, and a couple of music flags.
Definition areaaudio.h:35
Miscellaneous per-area flags: contrast, letter delay, playtime counting.
Definition areageneral.h:64
The fixed set of sprite picture-ids currently loaded into the map's VRAM.
Identity, size, pointers, and edge connections of the current map.
Definition areamap.h:44
Transient NPC/control/battle flags for the current map.
Definition areanpc.h:35
The player's position and movement/HM/battle/warp state on the map.
Definition areaplayer.h:55
Rate is how likely to encounter Pokemon higher number = higher chance A rate of 0 means no wild pokem...
Definition areapokemon.h:97
The current map's list of signs.
Definition areasign.h:38
The current map's list of sprites/NPCs.
Definition areasprites.h:39
The current map's tileset: which set, its behaviour type, and pointers.
Definition areatileset.h:38
The current map's warps, plus the live warp-transition state.
Definition areawarps.h:40
void mapChanged()
AreaPokemon * pokemon
Definition area.h:130
AreaNPC * npc
Definition area.h:128
void npcChanged()
void preloadedSpritesChanged()
AreaTileset * tileset
Definition area.h:133
void save(SaveFile *saveFile)
Flatten the whole area to the save.
Definition area.cpp:93
void signsChanged()
void reset()
Blank the whole area.
Definition area.cpp:108
AreaSprites * sprites
Definition area.h:132
AreaPlayer * player
Definition area.h:129
AreaAudio * audio
Definition area.h:124
void pokemonChanged()
AreaLoadedSprites * preloadedSprites
Definition area.h:125
AreaMap * map
Definition area.h:127
void spritesChanged()
Area(SaveFile *saveFile=nullptr)
< Map music/audio settings.
Definition area.cpp:43
AreaSign * signs
Definition area.h:131
void setTo(MapDBEntry *map)
Reconfigure the area to map (the "place on any map" feature).
Definition area.cpp:155
void load(SaveFile *saveFile=nullptr)
Expand the whole area from the save.
Definition area.cpp:75
void randomize()
Randomize the area (constrained, playable).
Definition area.cpp:123
void warpsChanged()
AreaGeneral * general
Definition area.h:126
void generalChanged()
void tilesetChanged()
AreaWarps * warps
Definition area.h:134
void playerChanged()
The trainer: their basics, bag, pokedex, and party.
Definition player.h:42
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
Import/export macro for the savefile library, plus the central list of QObject types kept deliberatel...
#define SAVEFILE_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
One map's complete static definition – the root of the MapDBEntry family.
Definition mapdbentry.h:56