Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
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
36{
38 events = new WorldEvents;
40 hidden = new WorldHidden;
42 other = new WorldOther;
44 towns = new WorldTowns;
45 trades = new WorldTrades;
46 local = new WorldLocal;
47
48 load(saveFile);
49}
50
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
65void 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
82void 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
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
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}
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
A handful of one-off "have you done X yet" milestone flags.
The game's story-event flags – a flat array of 508 booleans.
Definition worldevents.h:39
General world settings: last maps plus the Options / LetterDelay objects.
"Already collected" flags for hidden items and hidden Game Corner coins.
Definition worldhidden.h:42
A few map-specific puzzle/minigame state values.
Definition worldlocal.h:34
Visibility flags for "missable" sprites (one-time NPCs/items on maps).
Odds-and-ends world state: debug mode, the playtime clock, fossil results.
Definition worldother.h:83
Per-map script progress values (the in-progress state of each map's script).
"Visited" flags for towns – which fly destinations are unlocked.
Definition worldtowns.h:36
"Done" flags for the game's in-game (NPC) trades.
Definition worldtrades.h:36
WorldOther * other
Definition world.h:93
WorldScripts * scripts
Definition world.h:94
WorldMissables * missables
Definition world.h:92
WorldCompleted * completed
Definition world.h:88
WorldLocal * local
Definition world.h:97
void load(SaveFile *saveFile=nullptr)
Expand all world regions from the save.
Definition world.cpp:65
virtual ~World()
Definition world.cpp:51
void randomize()
Randomize all world regions (constrained).
Definition world.cpp:110
WorldTrades * trades
Definition world.h:96
WorldTowns * towns
Definition world.h:95
void reset()
Blank all world regions.
Definition world.cpp:96
WorldGeneral * general
Definition world.h:90
void save(SaveFile *saveFile)
Flatten all world regions to the save.
Definition world.cpp:82
WorldEvents * events
Definition world.h:89
World(SaveFile *saveFile=nullptr)
< Completion milestones.
Definition world.cpp:35
WorldHidden * hidden
Definition world.h:91