Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
world.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 "
./world.h
"
23
#include "
./worldcompleted.h
"
24
#include "
./worldevents.h
"
25
#include "
./worldgeneral.h
"
26
#include "
./worldhidden.h
"
27
#include "
./worldmissables.h
"
28
#include "
./worldother.h
"
29
#include "
./worldscripts.h
"
30
#include "
./worldtowns.h
"
31
#include "
./worldtrades.h
"
32
#include "
./worldlocal.h
"
33
#include "
../../savefile.h
"
34
35
World::World
(
SaveFile
* saveFile)
36
{
37
completed
=
new
WorldCompleted
;
38
events
=
new
WorldEvents
;
39
general
=
new
WorldGeneral
;
40
hidden
=
new
WorldHidden
;
41
missables
=
new
WorldMissables
;
42
other
=
new
WorldOther
;
43
scripts
=
new
WorldScripts
;
44
towns
=
new
WorldTowns
;
45
trades
=
new
WorldTrades
;
46
local
=
new
WorldLocal
;
47
48
load
(saveFile);
49
}
50
51
World::~World
()
52
{
53
completed
->deleteLater();
54
events
->deleteLater();
55
general
->deleteLater();
56
hidden
->deleteLater();
57
missables
->deleteLater();
58
other
->deleteLater();
59
scripts
->deleteLater();
60
towns
->deleteLater();
61
trades
->deleteLater();
62
local
->deleteLater();
63
}
64
65
void
World::load
(
SaveFile
* saveFile)
66
{
67
if
(saveFile ==
nullptr
)
68
return
reset
();
69
70
completed
->load(saveFile);
71
events
->load(saveFile);
72
general
->load(saveFile);
73
hidden
->load(saveFile);
74
missables
->load(saveFile);
75
other
->load(saveFile);
76
scripts
->load(saveFile);
77
towns
->load(saveFile);
78
trades
->load(saveFile);
79
local
->load(saveFile);
80
}
81
82
void
World::save
(
SaveFile
* saveFile)
83
{
84
completed
->save(saveFile);
85
events
->save(saveFile);
86
general
->save(saveFile);
87
hidden
->save(saveFile);
88
missables
->save(saveFile);
89
other
->save(saveFile);
90
scripts
->save(saveFile);
91
towns
->save(saveFile);
92
trades
->save(saveFile);
93
local
->save(saveFile);
94
}
95
96
void
World::reset
()
97
{
98
completed
->reset();
99
events
->reset();
100
general
->reset();
101
hidden
->reset();
102
missables
->reset();
103
other
->reset();
104
scripts
->reset();
105
towns
->reset();
106
trades
->reset();
107
local
->reset();
108
}
109
110
void
World::randomize
()
111
{
112
completed
->randomize();
113
events
->randomize();
114
general
->randomize();
115
hidden
->randomize();
116
missables
->randomize();
117
other
->randomize();
118
scripts
->randomize();
119
towns
->randomize();
120
trades
->randomize();
121
local
->randomize();
122
}
SaveFile
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition
savefile.h:46
WorldCompleted
A handful of one-off "have you done X yet" milestone flags.
Definition
worldcompleted.h:35
WorldEvents
The game's story-event flags – a flat array of 508 booleans.
Definition
worldevents.h:39
WorldGeneral
General world settings: last maps plus the Options / LetterDelay objects.
Definition
worldgeneral.h:75
WorldHidden
"Already collected" flags for hidden items and hidden Game Corner coins.
Definition
worldhidden.h:42
WorldLocal
A few map-specific puzzle/minigame state values.
Definition
worldlocal.h:34
WorldMissables
Visibility flags for "missable" sprites (one-time NPCs/items on maps).
Definition
worldmissables.h:40
WorldOther
Odds-and-ends world state: debug mode, the playtime clock, fossil results.
Definition
worldother.h:83
WorldScripts
Per-map script progress values (the in-progress state of each map's script).
Definition
worldscripts.h:38
WorldTowns
"Visited" flags for towns – which fly destinations are unlocked.
Definition
worldtowns.h:36
WorldTrades
"Done" flags for the game's in-game (NPC) trades.
Definition
worldtrades.h:36
World::other
WorldOther * other
Definition
world.h:93
World::scripts
WorldScripts * scripts
Definition
world.h:94
World::missables
WorldMissables * missables
Definition
world.h:92
World::completed
WorldCompleted * completed
Definition
world.h:88
World::local
WorldLocal * local
Definition
world.h:97
World::load
void load(SaveFile *saveFile=nullptr)
Expand all world regions from the save.
Definition
world.cpp:65
World::~World
virtual ~World()
Definition
world.cpp:51
World::randomize
void randomize()
Randomize all world regions (constrained).
Definition
world.cpp:110
World::trades
WorldTrades * trades
Definition
world.h:96
World::towns
WorldTowns * towns
Definition
world.h:95
World::reset
void reset()
Blank all world regions.
Definition
world.cpp:96
World::general
WorldGeneral * general
Definition
world.h:90
World::save
void save(SaveFile *saveFile)
Flatten all world regions to the save.
Definition
world.cpp:82
World::events
WorldEvents * events
Definition
world.h:89
World::World
World(SaveFile *saveFile=nullptr)
< Completion milestones.
Definition
world.cpp:35
World::hidden
WorldHidden * hidden
Definition
world.h:91
savefile.h
world.h
worldcompleted.h
worldevents.h
worldgeneral.h
worldhidden.h
worldlocal.h
worldmissables.h
worldother.h
worldscripts.h
worldtowns.h
worldtrades.h
projects
savefile
src
pse-savefile
expanded
world
world.cpp
Generated by
1.17.0