Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
worldother.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;
22
23// Counts playtime up to
24// 10 days, 15 hours, 59 minutes, 59 seconds, and 59 frames
36class SAVEFILE_AUTOPORT Playtime : public QObject {
37 Q_OBJECT
38
39 Q_PROPERTY(int days READ getDays WRITE setDays NOTIFY hoursChanged)
40 Q_PROPERTY(int hours MEMBER hours NOTIFY hoursChanged)
41 Q_PROPERTY(int hoursAdjusted READ getHoursAdjusted WRITE setHoursAdjusted NOTIFY hoursChanged)
42 Q_PROPERTY(int minutes MEMBER minutes NOTIFY minutesChanged)
43 Q_PROPERTY(int seconds MEMBER seconds NOTIFY secondsChanged)
44 Q_PROPERTY(int frames MEMBER frames NOTIFY framesChanged)
45 Q_PROPERTY(bool clockMaxed MEMBER clockMaxed NOTIFY clockMaxedChanged)
46
47 // Converts hours into days and allows converting back from days
48 Q_INVOKABLE int getDays();
49 Q_INVOKABLE void setDays(int val);
50
51 // Gets hours within the day,
52 Q_INVOKABLE int getHoursAdjusted();
53 Q_INVOKABLE void setHoursAdjusted(int val);
54
55signals:
56 void hoursChanged();
57 void minutesChanged();
58 void secondsChanged();
59 void framesChanged();
60 void clockMaxedChanged();
61
62public:
63 int hours;
64 int minutes;
65 int seconds;
66 int frames;
67
68 // Any value, it just stops the clock completely
70};
71
82class SAVEFILE_AUTOPORT WorldOther : public QObject
83{
84 Q_OBJECT
85
86 Q_PROPERTY(bool debugMode MEMBER debugMode NOTIFY debugModeChanged)
87 Q_PROPERTY(Playtime* playtime MEMBER playtime NOTIFY playtimeChanged)
88 Q_PROPERTY(int fossilItemGiven MEMBER fossilItemGiven NOTIFY fossilItemGivenChanged)
89 Q_PROPERTY(int fossilPkmnResult MEMBER fossilPkmnResult NOTIFY fossilPkmnResultChanged)
90
91public:
92 WorldOther(SaveFile* saveFile = nullptr);
93 virtual ~WorldOther();
94
95 void load(SaveFile* saveFile = nullptr);
96 void save(SaveFile* saveFile);
97
98signals:
103
104public slots:
105 void reset();
106 void randomize();
107 void randomizePlaytime();
108 void clearPlaytime();
109
110public:
111 // Hold B to avoid wild battles
112 // It also skips most of Prof Oaks speech and sets default names however the
113 // latter two don't apply since loading a saveFile means all that is over with
114 // anyways
116
117 // Playtime
119
120 // Fossils
123};
The save's playtime clock, surfaced to QML as days/hours/minutes/seconds/frames.
Definition worldother.h:36
int hours
Max 255.
Definition worldother.h:63
int minutes
Max 59, any higher will reset to zero and increment hr by 1.
Definition worldother.h:64
int frames
Max 59, any higher will reset to zero and increment sec by 1.
Definition worldother.h:66
bool clockMaxed
Any value; it just stops the clock completely.
Definition worldother.h:69
int seconds
Max 59, any higher will reset to zero and increment min by 1.
Definition worldother.h:65
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
int fossilItemGiven
Definition worldother.h:121
void fossilItemGivenChanged()
int fossilPkmnResult
Definition worldother.h:122
void load(SaveFile *saveFile=nullptr)
Expand this region from the save.
void randomize()
Randomize this region.
void playtimeChanged()
bool debugMode
Definition worldother.h:115
WorldOther(SaveFile *saveFile=nullptr)
< In-game debug mode flag (see field note).
void save(SaveFile *saveFile)
Flatten this region to the save.
Playtime * playtime
Definition worldother.h:118
protected::void debugModeChanged()
void reset()
Blank this region.
void clearPlaytime()
Zero the playtime clock.
void randomizePlaytime()
Randomize just the playtime clock.
void fossilPkmnResultChanged()
Project-wide fixed-width integer aliases (var8, var16, ...).
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.