Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
areawarps.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 <QVector>
19#include <pse-common/types.h>
21
22class SaveFile;
23class WarpData;
24class MapDBEntry;
25
26constexpr var8 maxWarps = 32;
27
39class SAVEFILE_AUTOPORT AreaWarps : public QObject
40{
41 Q_OBJECT
42
43 Q_PROPERTY(bool scriptedWarp MEMBER scriptedWarp NOTIFY scriptedWarpChanged)
44 Q_PROPERTY(bool isDungeonWarp MEMBER isDungeonWarp NOTIFY isDungeonWarpChanged)
46 Q_PROPERTY(int warpDest MEMBER warpDest NOTIFY warpDestChanged)
49 Q_PROPERTY(bool flyOrDungeonWarp MEMBER flyOrDungeonWarp NOTIFY flyOrDungeonWarpChanged)
50 Q_PROPERTY(bool flyWarp MEMBER flyWarp NOTIFY flyWarpChanged)
51 Q_PROPERTY(bool dungeonWarp MEMBER dungeonWarp NOTIFY dungeonWarpChanged)
52 Q_PROPERTY(int whichDungeonWarp MEMBER whichDungeonWarp NOTIFY whichDungeonWarpChanged)
53 Q_PROPERTY(int warpedFromWarp MEMBER warpedFromWarp NOTIFY warpedFromWarpChanged)
54 Q_PROPERTY(int warpedfromMap MEMBER warpedfromMap NOTIFY warpedfromMapChanged)
55
56public:
57 AreaWarps(SaveFile* saveFile = nullptr);
58 virtual ~AreaWarps();
59
60 void load(SaveFile* saveFile = nullptr);
61 void save(SaveFile* saveFile);
62
63 Q_INVOKABLE int warpCount();
64 Q_INVOKABLE int warpMax();
65 Q_INVOKABLE WarpData* warpAt(int ind);
66 Q_INVOKABLE void warpSwap(int from, int to);
67 Q_INVOKABLE void warpRemove(int ind);
68 Q_INVOKABLE void warpNew();
69
70signals:
84
85public slots:
86 void reset();
87 void randomize(MapDBEntry* map);
88 void setTo(MapDBEntry* map);
89
90public:
91 // Pre-Warp
95
96 // Warping
101 bool flyWarp;
103
104 // Warped
108
109 QVector<WarpData*> warps;
110};
constexpr var8 maxWarps
Maximum warps on a map.
Definition areawarps.h:26
void warpNew()
Add a fresh warp.
Definition areawarps.cpp:80
protected::void scriptedWarpChanged()
void flyOrDungeonWarpChanged()
bool skipJoypadCheckWarps
Skips check for warp after not collided (Forced Warp)??
Definition areawarps.h:94
int warpedFromWarp
Warped from which warp.
Definition areawarps.h:106
WarpData * warpAt(int ind)
Warp ind (GC-protected return).
Definition areawarps.cpp:54
int whichDungeonWarp
Warped from which dungeon warp.
Definition areawarps.h:105
void dungeonWarpChanged()
int specialWarpDestMap
Destination Map for special warps.
Definition areawarps.h:99
void warpSwap(int from, int to)
Reorder warps.
Definition areawarps.cpp:59
void warpedfromMapChanged()
AreaWarps(SaveFile *saveFile=nullptr)
< Do a scripted warp.
Definition areawarps.cpp:34
bool isDungeonWarp
On a dungeon warp.
Definition areawarps.h:93
void whichDungeonWarpChanged()
void flyWarpChanged()
void warpsChanged()
void randomize(MapDBEntry *map)
Randomize warps for map.
bool flyOrDungeonWarp
Is a fly or dungeon warp.
Definition areawarps.h:100
int warpDest
Warp actively warping to or 0xFF to warp to same position.
Definition areawarps.h:97
int warpedfromMap
Warped from which map.
Definition areawarps.h:107
bool scriptedWarp
Do a scripted warp.
Definition areawarps.h:92
void dungeonWarpDestMapChanged()
int warpMax()
Capacity (maxWarps).
Definition areawarps.cpp:49
int warpCount()
Number of warps.
Definition areawarps.cpp:44
void setTo(MapDBEntry *map)
Rebuild warps from map.
void save(SaveFile *saveFile)
Flatten the warp list + state to the save.
int dungeonWarpDestMap
Destination Map for dungeon warps.
Definition areawarps.h:98
bool dungeonWarp
Is a dungeon warp.
Definition areawarps.h:102
void warpDestChanged()
void warpedFromWarpChanged()
void load(SaveFile *saveFile=nullptr)
Expand the warp list + state from the save.
Definition areawarps.cpp:89
void specialWarpDestMapChanged()
void reset()
Empty warps + clear state.
void isDungeonWarpChanged()
bool flyWarp
Is a fly warp.
Definition areawarps.h:101
void warpRemove(int ind)
Remove warp ind.
Definition areawarps.cpp:70
void skipJoypadCheckWarpsChanged()
QVector< WarpData * > warps
The map's warp points.
Definition areawarps.h:109
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
One warp point on the current map: its tile and where it leads.
Definition warpdata.h:36
Project-wide fixed-width integer aliases (var8, var16, ...).
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
Definition types.h:124
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