Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
pokemonstorageset.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
21// PlayerBasics is used as a slot parameter below; include the full type so its
22// QMetaType resolves now that it is no longer Q_DECLARE_OPAQUE_POINTER'd.
24
25class SaveFile;
27class PlayerBasics;
28
29// Maximum boxes that can fit into a set
30constexpr var8 setMaxBoxes = 6;
31
34
46{
47 Q_OBJECT
48
49public:
51 PokemonStorageSet(SaveFile* saveFile = nullptr, var16 boxesOffset = 0, svar8 skipInd = -1);
52 virtual ~PokemonStorageSet();
53
56 void load(SaveFile* saveFile = nullptr, var16 boxesOffset = 0, svar8 skipInd = -1);
57 void save(SaveFile* saveFile, var16 boxesOffset, svar8 skipInd = -1);
58
60 void loadSpecific(SaveFile* saveFile = nullptr, var16 offset = 0, var8 toBox = 0);
62 void saveSpecific(SaveFile* saveFile = nullptr, var16 offset = 0, var8 fromBox = 0);
63
64 PokemonStorageBox* boxAt(int ind);
65
66signals:
67 void boxesChanged();
68
69public slots:
70 void reset();
71 void randomize(PlayerBasics* basics);
72
73public:
74 // There are never any more or less than exactly a set amount of boxes in a
75 // set, there's no need for this to be a Vector
77};
The trainer's headline values: name, ID, money, coins, badges, starter.
Holds contents of a single Pokemon storage box.
PokemonStorageBox * boxAt(int ind)
Box at ind within this set.
void reset()
Empty all six boxes.
void randomize(PlayerBasics *basics)
Fill the set with constrained random mons.
void loadSpecific(SaveFile *saveFile=nullptr, var16 offset=0, var8 toBox=0)
Load a specific box at a specific address into box toBox, overwriting it.
void save(SaveFile *saveFile, var16 boxesOffset, svar8 skipInd=-1)
Auto load or save boxes 1-6 from a single address and skip a box if it's the current box.
void load(SaveFile *saveFile=nullptr, var16 boxesOffset=0, svar8 skipInd=-1)
Auto load or save boxes 1-6 from a single address and skip a box if it's the current box.
protected::void boxesChanged()
Any box in the set changed.
PokemonStorageSet(SaveFile *saveFile=nullptr, var16 boxesOffset=0, svar8 skipInd=-1)
PokemonStorageBox * boxes[setMaxBoxes]
The six boxes (fixed-size; never grows/shrinks).
void saveSpecific(SaveFile *saveFile=nullptr, var16 offset=0, var8 fromBox=0)
Save box fromBox out to a specific address.
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
var16e var16
Everyday 16-bit alias. Exact width to avoid the "fastest" widening bug.
Definition types.h:125
svar8e svar8
Smaller Shorthand with most default assumptions.
Definition types.h:109
constexpr var8 setMaxBoxes
Boxes per storage set (a save has two sets = 12 boxes).
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.