mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-25 01:56:34 -05:00
Add edit history for border edits via script
This commit is contained in:
@@ -343,12 +343,14 @@ public:
|
||||
|
||||
|
||||
/// Implements a command to commit map edits from the scripting API.
|
||||
/// The scripting api can edit metatiles and map dimensions.
|
||||
/// The scripting api can edit map/border blocks and dimensions.
|
||||
class ScriptEditMap : public QUndoCommand {
|
||||
public:
|
||||
ScriptEditMap(Map *map,
|
||||
QSize oldMapDimensions, QSize newMapDimensions,
|
||||
const Blockdata &oldMetatiles, const Blockdata &newMetatiles,
|
||||
QSize oldBorderDimensions, QSize newBorderDimensions,
|
||||
const Blockdata &oldBorder, const Blockdata &newBorder,
|
||||
QUndoCommand *parent = nullptr);
|
||||
|
||||
void undo() override;
|
||||
@@ -363,10 +365,18 @@ private:
|
||||
Blockdata newMetatiles;
|
||||
Blockdata oldMetatiles;
|
||||
|
||||
Blockdata newBorder;
|
||||
Blockdata oldBorder;
|
||||
|
||||
int oldMapWidth;
|
||||
int oldMapHeight;
|
||||
int newMapWidth;
|
||||
int newMapHeight;
|
||||
|
||||
int oldBorderWidth;
|
||||
int oldBorderHeight;
|
||||
int newBorderWidth;
|
||||
int newBorderHeight;
|
||||
};
|
||||
|
||||
#endif // EDITCOMMANDS_H
|
||||
|
||||
@@ -33,8 +33,10 @@ public:
|
||||
Blockdata cached_border;
|
||||
struct {
|
||||
Blockdata blocks;
|
||||
QSize dimensions;
|
||||
} lastCommitMapBlocks; // to track map changes
|
||||
QSize mapDimensions;
|
||||
Blockdata border;
|
||||
QSize borderDimensions;
|
||||
} lastCommitBlocks; // to track map changes
|
||||
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
|
||||
@@ -157,6 +157,7 @@ public slots:
|
||||
void openScript(const QString &scriptLabel) const;
|
||||
void openProjectInTextEditor() const;
|
||||
void maskNonVisibleConnectionTiles();
|
||||
void onBorderMetatilesChanged();
|
||||
|
||||
private:
|
||||
void setConnectionItemsVisible(bool);
|
||||
@@ -192,7 +193,6 @@ private slots:
|
||||
void onConnectionItemSelected(ConnectionPixmapItem* connectionItem);
|
||||
void onConnectionItemDoubleClicked(ConnectionPixmapItem* connectionItem);
|
||||
void onConnectionDirectionChanged(QString newDirection);
|
||||
void onBorderMetatilesChanged();
|
||||
void onHoveredMovementPermissionChanged(uint16_t, uint16_t);
|
||||
void onHoveredMovementPermissionCleared();
|
||||
void onHoveredMetatileSelectionChanged(uint16_t);
|
||||
|
||||
@@ -46,8 +46,6 @@ public:
|
||||
Q_INVOKABLE QJSValue getBlock(int x, int y);
|
||||
void tryRedrawMapArea(bool forceRedraw);
|
||||
void tryCommitMapChanges(bool commitChanges);
|
||||
void tryRedrawBorder(bool forceRedraw);
|
||||
void tryCommitBorderChanges(bool commitChanges);
|
||||
Q_INVOKABLE void setBlock(int x, int y, int tile, int collision, int elevation, bool forceRedraw = true, bool commitChanges = true);
|
||||
Q_INVOKABLE void setBlocksFromSelection(int x, int y, bool forceRedraw = true, bool commitChanges = true);
|
||||
Q_INVOKABLE int getMetatileId(int x, int y);
|
||||
|
||||
Reference in New Issue
Block a user