Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
areaplayer.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 <pse-common/types.h>
20
21class SaveFile;
22class MapDBEntry;
23
29struct SAVEFILE_AUTOPORT PlayerDir : public QObject
30{
31 Q_OBJECT
32 Q_ENUMS(PlayerDir_)
33
34public:
42};
43
54class SAVEFILE_AUTOPORT AreaPlayer : public QObject
55{
56 Q_OBJECT
57
58 Q_PROPERTY(int playerMoveDir MEMBER playerMoveDir NOTIFY playerMoveDirChanged)
60 Q_PROPERTY(int playerCurDir MEMBER playerCurDir NOTIFY playerCurDirChanged)
61 Q_PROPERTY(int yCoord MEMBER yCoord NOTIFY yCoordChanged)
62 Q_PROPERTY(int xCoord MEMBER xCoord NOTIFY xCoordChanged)
63 Q_PROPERTY(int yBlockCoord MEMBER yBlockCoord NOTIFY yBlockCoordChanged)
64 Q_PROPERTY(int xBlockCoord MEMBER xBlockCoord NOTIFY xBlockCoordChanged)
67 Q_PROPERTY(bool surfingAllowed MEMBER surfingAllowed NOTIFY surfingAllowedChanged)
68 Q_PROPERTY(bool flyOutofBattle MEMBER flyOutofBattle NOTIFY flyOutofBattleChanged)
69 Q_PROPERTY(bool isBattle MEMBER isBattle NOTIFY isBattleChanged)
70 Q_PROPERTY(bool isTrainerBattle MEMBER isTrainerBattle NOTIFY isTrainerBattleChanged)
71 Q_PROPERTY(bool noBattles MEMBER noBattles NOTIFY noBattlesChanged)
75 Q_PROPERTY(bool standingOnDoor MEMBER standingOnDoor NOTIFY standingOnDoorChanged)
77 Q_PROPERTY(bool standingOnWarp MEMBER standingOnWarp NOTIFY standingOnWarpChanged)
78 Q_PROPERTY(int walkBikeSurf MEMBER walkBikeSurf NOTIFY walkBikeSurfChanged)
80 Q_PROPERTY(bool spinPlayer MEMBER spinPlayer NOTIFY spinPlayerChanged)
81 Q_PROPERTY(bool usedCardKey MEMBER usedCardKey NOTIFY usedCardKeyChanged)
82 Q_PROPERTY(bool usingLinkCable MEMBER usingLinkCable NOTIFY usingLinkCableChanged)
83
84public:
85 AreaPlayer(SaveFile* saveFile = nullptr);
86 virtual ~AreaPlayer();
87
88 void load(SaveFile* saveFile = nullptr);
89 void save(SaveFile* saveFile);
90
91signals:
117
118public slots:
119 void reset();
120 void randomize(int x, int y);
121 void setTo(MapDBEntry* map, int x, int y);
122
123public:
124 // Direction
125 // if the player is moving, the current direction
126 // if the player is not moving, zero
127 // None 0
128 // Right 1
129 // Left 2
130 // Down 4
131 // Up 8
133
136
140
141 // Coords
142 int yCoord;
143 int xCoord;
147
148 // HMs
152
153 // Battle
154 bool isBattle;
158
159 // Warps
165
166 // Misc
167
168 // 0x00 = walking
169 // 0x01 = biking
170 // 0x02 = surfing
176};
void load(SaveFile *saveFile=nullptr)
Expand the player state from the save.
void walkBikeSurfChanged()
void yOffsetSinceLastSpecialWarpChanged()
bool surfingAllowed
Definition areaplayer.h:150
void xCoordChanged()
void standingOnWarpChanged()
bool noBattles
Definition areaplayer.h:156
bool usedCardKey
Definition areaplayer.h:174
void playerLastStopDirChanged()
void noBattlesChanged()
int playerMoveDir
Move direction (raw bits per the table above).
Definition areaplayer.h:132
void playerCurDirChanged()
AreaPlayer(SaveFile *saveFile=nullptr)
< Current move direction (raw bits; see field note).
void xBlockCoordChanged()
void playerJumpingYScrnCoordsChanged()
void standingOnDoorChanged()
protected::void playerMoveDirChanged()
bool finalLedgeJumping
Definition areaplayer.h:172
int yBlockCoord
Definition areaplayer.h:144
void yBlockCoordChanged()
void randomize(int x, int y)
Randomize, placing the player at (x,y).
void xOffsetSinceLastSpecialWarpChanged()
void isBattleChanged()
void reset()
Blank the player state.
bool isBattle
Definition areaplayer.h:154
int yOffsetSinceLastSpecialWarp
Definition areaplayer.h:160
void finalLedgeJumpingChanged()
int walkBikeSurf
Movement mode: 0x00 walking, 0x01 biking, 0x02 surfing.
Definition areaplayer.h:171
void flyOutofBattleChanged()
bool spinPlayer
Definition areaplayer.h:173
bool flyOutofBattle
Definition areaplayer.h:151
void strengthOutsideBattleChanged()
void yCoordChanged()
bool movingThroughDoor
Definition areaplayer.h:163
void surfingAllowedChanged()
void spinPlayerChanged()
int xOffsetSinceLastSpecialWarp
Definition areaplayer.h:161
int playerLastStopDir
the direction in which the player was moving before the player last stopped
Definition areaplayer.h:135
bool battleEndedOrBlackout
Definition areaplayer.h:157
void isTrainerBattleChanged()
void usedCardKeyChanged()
int playerCurDir
if the player is moving, the current direction if the player is not moving, the last the direction in...
Definition areaplayer.h:139
bool usingLinkCable
Definition areaplayer.h:175
int xBlockCoord
Definition areaplayer.h:145
bool strengthOutsideBattle
Definition areaplayer.h:149
bool standingOnWarp
Definition areaplayer.h:164
void save(SaveFile *saveFile)
Flatten the player state to the save.
void setTo(MapDBEntry *map, int x, int y)
Place the player on map at (x,y).
void movingThroughDoorChanged()
void usingLinkCableChanged()
bool standingOnDoor
Definition areaplayer.h:162
void battleEndedOrBlackoutChanged()
int playerJumpingYScrnCoords
Definition areaplayer.h:146
bool isTrainerBattle
Definition areaplayer.h:155
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
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
Player facing/movement directions, QML-visible.
Definition areaplayer.h:30