Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
player.cpp
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
22
#include "
player.h
"
23
#include "
../../savefile.h
"
24
#include "
./playerbasics.h
"
25
#include "
./playerpokedex.h
"
26
#include "
./playerpokemon.h
"
27
#include "
../fragments/itemstoragebox.h
"
28
29
Player::Player
(
SaveFile
* saveFile)
30
{
31
basics
=
new
PlayerBasics
;
32
items
=
new
ItemStorageBox
(
true
, 20);
// Max 20 items, mark this is a bag
33
pokedex
=
new
PlayerPokedex
;
34
pokemon
=
new
PlayerPokemon
;
35
36
load
(saveFile);
37
}
38
39
Player::~Player
()
40
{
41
basics
->deleteLater();
42
items
->deleteLater();
43
pokedex
->deleteLater();
44
pokemon
->deleteLater();
45
}
46
47
void
Player::load
(
SaveFile
* saveFile)
48
{
49
if
(saveFile ==
nullptr
)
50
return
reset
();
51
52
basics
->load(saveFile);
53
items
->load(saveFile, 0x25C9);
54
pokedex
->load(saveFile);
55
pokemon
->load(saveFile);
56
}
57
58
void
Player::save
(
SaveFile
* saveFile)
59
{
60
basics
->save(saveFile);
61
items
->save(saveFile, 0x25C9);
62
pokedex
->save(saveFile);
63
pokemon
->save(saveFile);
64
}
65
66
void
Player::reset
()
67
{
68
basics
->reset();
69
items
->reset();
70
pokedex
->reset();
71
pokemon
->reset();
72
}
73
74
void
Player::randomize
()
75
{
76
basics
->randomize();
77
items
->randomize();
78
pokedex
->randomize();
79
pokemon
->randomize(
basics
);
80
}
ItemStorageBox
A container of Items – either the trainer's bag or a PC item box.
Definition
itemstoragebox.h:36
PlayerBasics
The trainer's headline values: name, ID, money, coins, badges, starter.
Definition
playerbasics.h:67
PlayerPokedex
The player's Pokedex: a seen flag and an owned flag per species.
Definition
playerpokedex.h:37
PlayerPokemon
The player's active party – a specialized PokemonStorageBox.
Definition
playerpokemon.h:42
Player::basics
PlayerBasics * basics
Definition
player.h:68
Player::load
void load(SaveFile *saveFile=nullptr)
Expand the player regions from the save.
Definition
player.cpp:47
Player::reset
void reset()
Blank all player regions.
Definition
player.cpp:66
Player::pokemon
PlayerPokemon * pokemon
Definition
player.h:71
Player::Player
Player(SaveFile *saveFile=nullptr)
< Name, ID, money, coins, badges, starter.
Definition
player.cpp:29
Player::randomize
void randomize()
Randomize all player regions (constrained).
Definition
player.cpp:74
Player::save
void save(SaveFile *saveFile)
Flatten the player regions back to the save.
Definition
player.cpp:58
Player::~Player
virtual ~Player()
Definition
player.cpp:39
Player::items
ItemStorageBox * items
Definition
player.h:69
Player::pokedex
PlayerPokedex * pokedex
Definition
player.h:70
SaveFile
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition
savefile.h:46
itemstoragebox.h
player.h
playerbasics.h
playerpokedex.h
playerpokemon.h
savefile.h
projects
savefile
src
pse-savefile
expanded
player
player.cpp
Generated by
1.17.0