32#include <QRandomGenerator>
81 if(saveFile ==
nullptr)
84 auto toolset = saveFile->
toolset;
86 curMap = toolset->getByte(0x260A);
89 height = toolset->getByte(0x2614);
92 width = toolset->getByte(0x2615);
95 dataPtr = toolset->getWord(0x2616,
true);
98 txtPtr = toolset->getWord(0x2618,
true);
101 scriptPtr = toolset->getWord(0x261A,
true);
107 width2x2 = toolset->getByte(0x27D1);
117 if(toolset->getBit(0x261C, 1, 0)) {
123 if(toolset->getBit(0x261C, 1, 1)) {
129 if(toolset->getBit(0x261C, 1, 2)) {
135 if(toolset->getBit(0x261C, 1, 3)) {
164 auto toolset = saveFile->
toolset;
167 toolset->setByte(0x2614,
height);
168 toolset->setByte(0x2615,
width);
169 toolset->setWord(0x2616,
dataPtr,
true);
170 toolset->setWord(0x2618,
txtPtr,
true);
171 toolset->setWord(0x261A,
scriptPtr,
true);
constexpr var16 VramBGPtr
Fixed GB VRAM background-tilemap pointer (never changes).
void forceBikeRideChanged()
void setTo(MapDBEntry *map, int x, int y)
Configure to map with the player at (x,y).
void mapViewVRAMPointerChanged()
void cardKeyDoorYChanged()
int height
Map Size including it's double size.
int mapViewVRAMPointer
<- Unused, reset at start of gameplay
void blackoutDestChanged()
protected::void curMapChanged()
void cardKeyDoorXChanged()
int connCount()
Number of edge connections.
int currentTileBlockMapViewPointer
<- Player coords converted to a ptr
bool forceBikeRide
Flags that may not be used, unknown.
void connRemove(int dir)
Remove the connection in dir.
int cardKeyDoorX
Unknown ???
MapDBEntry * toCurMap()
The current map's DB entry.
int coordsToPtr(int x, int y, int width)
Converts X & Y values to a pointer for currentTileBlockMapViewPointer.
void load(SaveFile *saveFile=nullptr)
Expand the map block from the save.
void curMapScriptChanged()
void connNew(int dir)
Add a connection in dir.
int outOfBoundsBlock
This is not a tile, it's a block.
void outOfBoundsBlockChanged()
QHash< var8, MapConnData * > connections
Edge connections by direction (see the IDE note above).
int curMap
Current Map ID.
void save(SaveFile *saveFile)
Flatten the map block to the save.
void curMapNextFrameChanged()
void currentTileBlockMapViewPointerChanged()
AreaMap(SaveFile *saveFile=nullptr)
< Current map id.
MapConnData * connAt(int dir)
Connection in direction dir (GC-protected return).
void reset()
Blank the map block.
int curMapScript
Current map script index.
void randomize(MapDBEntry *map, int x, int y)
Randomize to map with the player at (x,y).
void connectionsChanged()
int dataPtr
Map basic pointers.
One edge connection of the current map (the seam to a neighbouring map).
void loadFromData(MapDBEntryConnect *connect)
Populate from a map-defined connection.
static MapsDB * inst()
< Number of maps.
MapDBEntry * getIndAt(const QString val) const
Map by name key (for QML).
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
SaveFileToolset * toolset
Tools to operate directly on the raw sav file data.
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
qmlCppOwned() – protect Q_INVOKABLE QObject returns from QML's GC.
static T * qmlCppOwned(T *obj)
Hand QML CppOwnership of a C++-owned QObject returned from a Q_INVOKABLE.
static const constexpr int worldMapPtr
< Strip source pointer.
One map's complete static definition – the root of the MapDBEntry family.
int height2X2() const
Height x2 (derived; see note).
int width2X2() const
Width x2 (derived; see note).
const QHash< int, MapDBEntryConnect * > getConnect() const
Edge connections by direction.