Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
worldhidden.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// There's actually significantly more hidden item bits, 112 in total forming
24// 14 bytes. But given they are all unused it makes no sense to load entire
25// unused bytes
26constexpr var8 hiddenItemCount = 54;
27constexpr var8 hiddenCoinCount = 12;
30
41class SAVEFILE_AUTOPORT WorldHidden : public QObject
42{
43 Q_OBJECT
44
45public:
46 WorldHidden(SaveFile* saveFile = nullptr);
47 virtual ~WorldHidden();
48
49 void load(SaveFile* saveFile = nullptr);
50 void save(SaveFile* saveFile);
51
52 Q_INVOKABLE int hItemsCount();
53 Q_INVOKABLE bool hItemsAt(int ind);
54 Q_INVOKABLE void hItemsSet(int ind, bool val);
55
56 Q_INVOKABLE int hCoinsCount();
57 Q_INVOKABLE bool hCoinsAt(int ind);
58 Q_INVOKABLE void hCoinsSet(int ind, bool val);
59
60signals:
63
64public slots:
65 void reset();
66 void randomize();
67
68public:
71};
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
void reset()
Clear all hidden flags.
int hItemsCount()
Number of hidden-item flags.
bool hiddenCoins[hiddenCoinCount]
Hidden-coin collected flags.
Definition worldhidden.h:70
void randomize()
Randomize the hidden flags.
protected::void hiddenItemsChanged()
void load(SaveFile *saveFile=nullptr)
Expand the hidden-item/coin flags from the save.
int hCoinsCount()
Number of hidden-coin flags.
void hItemsSet(int ind, bool val)
Set/clear hidden item ind.
bool hiddenItems[hiddenItemCount]
Hidden-item collected flags.
Definition worldhidden.h:69
bool hCoinsAt(int ind)
Is hidden coin ind collected?
bool hItemsAt(int ind)
Is hidden item ind collected?
WorldHidden(SaveFile *saveFile=nullptr)
void hCoinsSet(int ind, bool val)
Set/clear hidden coin ind.
void hiddenCoinsChanged()
void save(SaveFile *saveFile)
Flatten the hidden-item/coin flags to the save.
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.
constexpr var8 hiddenCoinCount
Hidden-coin collected flags actually used.
Definition worldhidden.h:27
constexpr var8 hiddenCoinByteCount
4 Bits of 16 unused
Definition worldhidden.h:29
constexpr var8 hiddenItemByteCount
2 Bits of 56 unused
Definition worldhidden.h:28
constexpr var8 hiddenItemCount
Hidden-item collected flags actually used.
Definition worldhidden.h:26