mirror of
https://github.com/huderlem/porymap.git
synced 2026-10-01 12:26:37 -05:00
Add onBorderMetatileChanged, onBorderResized, implement some basic border API
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
#define DEFAULT_BORDER_WIDTH 2
|
||||
#define DEFAULT_BORDER_HEIGHT 2
|
||||
|
||||
// Maximum based only on data type (u8) of map border width/height
|
||||
#define MAX_BORDER_WIDTH 255
|
||||
#define MAX_BORDER_HEIGHT 255
|
||||
|
||||
// Number of metatiles to draw out from edge of map. Could allow modification of this in the future.
|
||||
// porymap will reflect changes to it, but the value is hard-coded in the projects at the moment
|
||||
#define BORDER_DISTANCE 7
|
||||
@@ -82,6 +86,9 @@ public:
|
||||
bool getBlock(int x, int y, Block *out);
|
||||
void setBlock(int x, int y, Block block, bool enableScriptCallback = false);
|
||||
void setBlockdata(Blockdata blockdata);
|
||||
uint16_t getBorderMetatileId(int x, int y);
|
||||
void setBorderMetatileId(int x, int y, uint16_t metatileId, bool enableScriptCallback = false);
|
||||
void setBorderBlockData(Blockdata blockdata);
|
||||
void floodFillCollisionElevation(int x, int y, uint16_t collision, uint16_t elevation);
|
||||
void _floodFillCollisionElevation(int x, int y, uint16_t collision, uint16_t elevation);
|
||||
void magicFillCollisionElevation(int x, int y, uint16_t collision, uint16_t elevation);
|
||||
@@ -96,6 +103,7 @@ public:
|
||||
void cacheBorder();
|
||||
bool hasUnsavedChanges();
|
||||
bool isWithinBounds(int x, int y);
|
||||
bool isWithinBorderBounds(int x, int y);
|
||||
|
||||
// for memory management
|
||||
QVector<Event *> ownedEvents;
|
||||
|
||||
@@ -46,6 +46,8 @@ 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);
|
||||
|
||||
@@ -12,10 +12,12 @@ enum CallbackType {
|
||||
OnProjectOpened,
|
||||
OnProjectClosed,
|
||||
OnBlockChanged,
|
||||
OnBorderMetatileChanged,
|
||||
OnBlockHoverChanged,
|
||||
OnBlockHoverCleared,
|
||||
OnMapOpened,
|
||||
OnMapResized,
|
||||
OnBorderResized,
|
||||
OnMapShifted,
|
||||
OnTilesetUpdated,
|
||||
OnMainTabChanged,
|
||||
@@ -40,10 +42,12 @@ public:
|
||||
static void cb_ProjectOpened(QString projectPath);
|
||||
static void cb_ProjectClosed(QString projectPath);
|
||||
static void cb_MetatileChanged(int x, int y, Block prevBlock, Block newBlock);
|
||||
static void cb_BorderMetatileChanged(int x, int y, uint16_t prevMetatileId, uint16_t newMetatileId);
|
||||
static void cb_BlockHoverChanged(int x, int y);
|
||||
static void cb_BlockHoverCleared();
|
||||
static void cb_MapOpened(QString mapName);
|
||||
static void cb_MapResized(int oldWidth, int oldHeight, int newWidth, int newHeight);
|
||||
static void cb_BorderResized(int oldWidth, int oldHeight, int newWidth, int newHeight);
|
||||
static void cb_MapShifted(int xDelta, int yDelta);
|
||||
static void cb_TilesetUpdated(QString tilesetName);
|
||||
static void cb_MainTabChanged(int oldTab, int newTab);
|
||||
|
||||
Reference in New Issue
Block a user