Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
worldcompleted.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 <QRandomGenerator>
23
24#include "./worldcompleted.h"
25#include "../../savefile.h"
28
30{
31 load(saveFile);
32}
33
35
37{
38 reset();
39
40 if(saveFile == nullptr)
41 return;
42
43 auto toolset = saveFile->toolset;
44
45 obtainedOldRod = toolset->getBit(0x29D4, 1, 3);
47
48 obtainedGoodRod = toolset->getBit(0x29D4, 1, 4);
50
51 obtainedSuperRod = toolset->getBit(0x29D4, 1, 5);
53
54 satisfiedSaffronGuards = toolset->getBit(0x29D4, 1, 6);
56
57 obtainedLapras = toolset->getBit(0x29DA, 1, 0);
59
60 everHealedPokemon = toolset->getBit(0x29DA, 1, 2);
62
63 obtainedStarterPokemon = toolset->getBit(0x29DA, 1, 3);
65
66 defeatedLorelei = toolset->getBit(0x29E0, 1, 1);
68}
69
71{
72 auto toolset = saveFile->toolset;
73
74 toolset->setBit(0x29D4, 1, 3, obtainedOldRod);
75 toolset->setBit(0x29D4, 1, 4, obtainedGoodRod);
76 toolset->setBit(0x29D4, 1, 5, obtainedSuperRod);
77 toolset->setBit(0x29D4, 1, 6, satisfiedSaffronGuards);
78 toolset->setBit(0x29DA, 1, 0, obtainedLapras);
79 toolset->setBit(0x29DA, 1, 2, everHealedPokemon);
80 toolset->setBit(0x29DA, 1, 3, obtainedStarterPokemon);
81 toolset->setBit(0x29E0, 1, 1, defeatedLorelei);
82}
83
110
111// For now mark these as false, randomize wants you to play a random game
112// from the start so it's a matter of how much will randomize complete for
113// you
115{
116 reset();
117}
void setBit(var16 addr, var8 size, var8 bit, bool value, bool reverse=false)
Set a bit into a value.
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
void obtainedLaprasChanged()
bool satisfiedSaffronGuards
protected::void obtainedOldRodChanged()
virtual ~WorldCompleted()
void obtainedGoodRodChanged()
void save(SaveFile *saveFile)
Flatten these flags to the save.
void obtainedStarterPokemonChanged()
void randomize()
Randomize these milestones.
bool obtainedStarterPokemon
void defeatedLoreleiChanged()
void reset()
Blank these milestones.
WorldCompleted(SaveFile *saveFile=nullptr)
< Got the Old Rod.
void obtainedSuperRodChanged()
void load(SaveFile *saveFile=nullptr)
Expand these flags from the save.
void everHealedPokemonChanged()
void satisfiedSaffronGuardsChanged()