Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
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"
27
29{
30 load(saveFile);
31}
32
34
36{
37 reset();
38
39 if(saveFile == nullptr)
40 return;
41
42 auto toolset = saveFile->toolset;
43
44 lock1 = toolset->getByte(0x29EF);
46
47 lock2 = toolset->getByte(0x29F0);
49
50 quizOpp = toolset->getByte(0x2CE4);
52
53 safariSteps = toolset->getWord(0x29B9);
55
56 safariGameOver = toolset->getBit(0x2CF2, 1, 0);
58
59 safariBallCount = toolset->getByte(0x2CF3);
61}
62
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
76{
77 lock1 = 0;
79
80 lock2 = 0;
82
83 quizOpp = 0;
85
86 safariGameOver = false;
88
91
92 safariSteps = 0;
94}
95
96// Don't know the range to randomize
98 reset();
99}
void setByte(var16 addr, var8 val)
Simply sets a byte.
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
SaveFileToolset * toolset
Tools to operate directly on the raw sav file data.
Definition savefile.h:117
bool safariGameOver
Definition worldlocal.h:72
void randomize()
Randomize these values.
void safariGameOverChanged()
void safariStepsChanged()
void load(SaveFile *saveFile=nullptr)
Expand these values from the save.
void quizOppChanged()
virtual ~WorldLocal()
int safariBallCount
Definition worldlocal.h:73
void lock2Changed()
void save(SaveFile *saveFile)
Flatten these values to the save.
void safariBallCountChanged()
protected::void lock1Changed()
int safariSteps
Definition worldlocal.h:74
void reset()
Blank these values.
WorldLocal(SaveFile *saveFile=nullptr)
< Lt.