Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
worldscripts.h
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#pragma once
17#include <QObject>
18#include <pse-common/types.h>
20
21class SaveFile;
22
23// Can't have a total byte count given scripts are a bit more complicated to
24// read
25constexpr var8 scriptCount = 97;
26
37class SAVEFILE_AUTOPORT WorldScripts : public QObject
38{
39 Q_OBJECT
40
41public:
42 WorldScripts(SaveFile* saveFile = nullptr);
43 virtual ~WorldScripts();
44
45 void load(SaveFile* saveFile = nullptr);
46 void save(SaveFile* saveFile);
47
48 Q_INVOKABLE int scriptsCount();
49 Q_INVOKABLE int scriptsAt(int ind);
50 Q_INVOKABLE void scriptsSet(int ind, int val);
51
52signals:
54
55public slots:
56 void reset();
57 void randomize();
58
59public:
61};
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
int scriptsAt(int ind)
Script value for map index ind.
protected::void curScriptsChanged()
void reset()
Zero all script values.
var16 curScripts[scriptCount]
Per-map script-progress values.
void load(SaveFile *saveFile=nullptr)
Expand the script values from the save.
void randomize()
Randomize the script values.
void save(SaveFile *saveFile)
Flatten the script values to the save.
int scriptsCount()
Number of script values (scriptCount).
void scriptsSet(int ind, int val)
Set the script value for ind.
WorldScripts(SaveFile *saveFile=nullptr)
Project-wide fixed-width integer aliases (var8, var16, ...).
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
Definition types.h:124
var16e var16
Everyday 16-bit alias. Exact width to avoid the "fastest" widening bug.
Definition types.h:125
Import/export macro for the savefile library, plus the central list of QObject types kept deliberatel...
#define SAVEFILE_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.
constexpr var8 scriptCount
Number of per-map script-progress values.