Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
areasprites.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#include <pse-common/types.h>
21
22class SaveFile;
23class SpriteData;
24class MapDBEntry;
26
27constexpr var8 maxSprites = 16;
28
38class SAVEFILE_AUTOPORT AreaSprites : public QObject
39{
40 Q_OBJECT
41
42public:
43 AreaSprites(SaveFile* saveFile = nullptr);
44 virtual ~AreaSprites();
45
46 void load(SaveFile* saveFile = nullptr);
47 void save(SaveFile* saveFile);
48
49 Q_INVOKABLE int spriteCount();
50 Q_INVOKABLE int spriteMax();
51 Q_INVOKABLE SpriteData* spriteAt(int ind);
52 Q_INVOKABLE void spriteSwap(int from, int to);
53 Q_INVOKABLE void spriteRemove(int ind);
54 Q_INVOKABLE void spriteNew();
55
56signals:
58
59public slots:
60 void reset();
61 void randomize(QVector<MapDBEntrySprite*> spriteData);
62 void setTo(MapDBEntry* map);
63
64public:
65 QVector<SpriteData*> sprites;
66};
constexpr var8 maxSprites
Maximum sprites/NPCs on a map.
Definition areasprites.h:27
AreaSprites(SaveFile *saveFile=nullptr)
void spriteNew()
Add a fresh sprite.
void load(SaveFile *saveFile=nullptr)
Expand the sprite list from the save.
void setTo(MapDBEntry *map)
Rebuild the list from map's sprites.
void reset()
Empty the sprite list.
void spriteSwap(int from, int to)
Reorder sprites.
protected::void spritesChanged()
QVector< SpriteData * > sprites
The map's sprites/NPCs.
Definition areasprites.h:65
int spriteMax()
Capacity (maxSprites).
void save(SaveFile *saveFile)
Flatten the sprite list to the save.
void randomize(QVector< MapDBEntrySprite * > spriteData)
Randomize sprites from spriteData.
int spriteCount()
Number of sprites.
void spriteRemove(int ind)
Remove sprite ind.
SpriteData * spriteAt(int ind)
Sprite ind (GC-protected return).
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
One on-map sprite/NPC – the most byte-level object in the area.
Definition spritedata.h:139
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.
A map's sprite definition – base class for the four sprite kinds.
One map's complete static definition – the root of the MapDBEntry family.
Definition mapdbentry.h:56