Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Toggle main menu visibility
Loading...
Searching...
No Matches
worldlocal.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
23
#include "
./worldlocal.h
"
24
#include "
../../savefile.h
"
25
#include "
../../savefiletoolset.h
"
26
#include "
../../savefileiterator.h
"
27
28
WorldLocal::WorldLocal
(
SaveFile
* saveFile)
29
{
30
load
(saveFile);
31
}
32
33
WorldLocal::~WorldLocal
() {}
34
35
void
WorldLocal::load
(
SaveFile
* saveFile)
36
{
37
reset
();
38
39
if
(saveFile ==
nullptr
)
40
return
;
41
42
auto
toolset = saveFile->
toolset
;
43
44
lock1
= toolset->getByte(0x29EF);
45
lock1Changed
();
46
47
lock2
= toolset->getByte(0x29F0);
48
lock2Changed
();
49
50
quizOpp
= toolset->getByte(0x2CE4);
51
quizOppChanged
();
52
53
safariSteps
= toolset->getWord(0x29B9);
54
safariStepsChanged
();
55
56
safariGameOver
= toolset->getBit(0x2CF2, 1, 0);
57
safariGameOverChanged
();
58
59
safariBallCount
= toolset->getByte(0x2CF3);
60
safariBallCountChanged
();
61
}
62
63
void
WorldLocal::save
(
SaveFile
* saveFile)
64
{
65
auto
toolset = saveFile->
toolset
;
66
67
toolset->
setByte
(0x29EF,
lock1
);
68
toolset->setByte(0x29F0,
lock2
);
69
toolset->setByte(0x2CE4,
quizOpp
);
70
toolset->setWord(0x29B9,
safariSteps
);
71
toolset->setBit(0x2CF2, 1, 0,
safariGameOver
);
72
toolset->setByte(0x2CF3,
safariBallCount
);
73
}
74
75
void
WorldLocal::reset
()
76
{
77
lock1
= 0;
78
lock1Changed
();
79
80
lock2
= 0;
81
lock2Changed
();
82
83
quizOpp
= 0;
84
quizOppChanged
();
85
86
safariGameOver
=
false
;
87
safariGameOverChanged
();
88
89
safariBallCount
= 0;
90
safariBallCountChanged
();
91
92
safariSteps
= 0;
93
safariStepsChanged
();
94
}
95
96
// Don't know the range to randomize
97
void
WorldLocal::randomize
() {
98
reset
();
99
}
SaveFileToolset::setByte
void setByte(var16 addr, var8 val)
Simply sets a byte.
Definition
savefiletoolset.cpp:237
SaveFile
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition
savefile.h:46
SaveFile::toolset
SaveFileToolset * toolset
Tools to operate directly on the raw sav file data.
Definition
savefile.h:117
WorldLocal::safariGameOver
bool safariGameOver
Definition
worldlocal.h:72
WorldLocal::randomize
void randomize()
Randomize these values.
Definition
worldlocal.cpp:97
WorldLocal::safariGameOverChanged
void safariGameOverChanged()
WorldLocal::safariStepsChanged
void safariStepsChanged()
WorldLocal::load
void load(SaveFile *saveFile=nullptr)
Expand these values from the save.
Definition
worldlocal.cpp:35
WorldLocal::quizOppChanged
void quizOppChanged()
WorldLocal::lock2
int lock2
Definition
worldlocal.h:66
WorldLocal::~WorldLocal
virtual ~WorldLocal()
Definition
worldlocal.cpp:33
WorldLocal::safariBallCount
int safariBallCount
Definition
worldlocal.h:73
WorldLocal::lock2Changed
void lock2Changed()
WorldLocal::lock1
int lock1
Definition
worldlocal.h:65
WorldLocal::save
void save(SaveFile *saveFile)
Flatten these values to the save.
Definition
worldlocal.cpp:63
WorldLocal::safariBallCountChanged
void safariBallCountChanged()
WorldLocal::lock1Changed
protected::void lock1Changed()
WorldLocal::safariSteps
int safariSteps
Definition
worldlocal.h:74
WorldLocal::quizOpp
int quizOpp
Definition
worldlocal.h:69
WorldLocal::reset
void reset()
Blank these values.
Definition
worldlocal.cpp:75
WorldLocal::WorldLocal
WorldLocal(SaveFile *saveFile=nullptr)
< Lt.
Definition
worldlocal.cpp:28
savefile.h
savefileiterator.h
savefiletoolset.h
worldlocal.h
projects
savefile
src
pse-savefile
expanded
world
worldlocal.cpp
Generated by
1.17.0