Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
arealoadedsprites.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 <QVector>
19
20#include <pse-common/types.h>
22
23class SaveFile;
24struct MapDBEntry;
25struct SpriteSetDBEntry;
26
27constexpr var8 maxLoadedSprites = 11;
28
40{
41 Q_OBJECT
42
43 Q_PROPERTY(int loadedSetId MEMBER loadedSetId NOTIFY loadedSetIdChanged)
44
45public:
46 AreaLoadedSprites(SaveFile* saveFile = nullptr);
47 virtual ~AreaLoadedSprites();
48
49 void load(SaveFile* saveFile = nullptr);
50 void save(SaveFile* saveFile);
51 void loadSpriteSet(SpriteSetDBEntry* entry, int x, int y);
52
53 // Loaded sprites are a fixed size and cannot be moved, created, modified, or destroyed
54 // They can be swapped
55 Q_INVOKABLE int lSpriteCount();
56 Q_INVOKABLE int lSpriteAt(int ind);
57 Q_INVOKABLE void lSpriteSwap(int from, int to);
58
59signals:
62
63public slots:
64 void reset();
65 void randomize(MapDBEntry* map, int x, int y);
66 void setTo(MapDBEntry* map, int x, int y);
67
68public:
71};
constexpr var8 maxLoadedSprites
Fixed number of sprite slots the game keeps loaded.
void load(SaveFile *saveFile=nullptr)
Expand the loaded-sprite slots from the save.
protected::void loadedSpritesChanged()
void save(SaveFile *saveFile)
Flatten the loaded-sprite slots to the save.
AreaLoadedSprites(SaveFile *saveFile=nullptr)
< Which sprite set is loaded.
void lSpriteSwap(int from, int to)
Swap two loaded-sprite slots.
void loadedSetIdChanged()
void reset()
Blank the loaded-sprite slots.
int lSpriteCount()
Number of loaded-sprite slots (fixed).
var8 loadedSprites[maxLoadedSprites]
The fixed loaded-sprite picture-ids.
void setTo(MapDBEntry *map, int x, int y)
Set to map's sprite set at (x,y).
int lSpriteAt(int ind)
Picture-id in slot ind.
void loadSpriteSet(SpriteSetDBEntry *entry, int x, int y)
Populate from a sprite-set definition.
void randomize(MapDBEntry *map, int x, int y)
Randomize for map at (x,y).
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
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
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.
One map's complete static definition – the root of the MapDBEntry family.
Definition mapdbentry.h:56
One sprite-set: the pre-loaded sprite group for an outdoor area.
Definition spriteSet.h:47