From c89aff236f2c6a31690b5d0db4e8eb6205954429 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 30 Jan 2026 03:37:42 -0500 Subject: [PATCH] Add 'onEventSpriteLoading' to API --- include/project.h | 2 +- include/scripting.h | 5 ++++- src/project.cpp | 30 +++++++++++++++----------- src/scriptapi/scripting.cpp | 42 +++++++++++++++++++++++++++++++------ src/ui/mapview.cpp | 1 + 5 files changed, 60 insertions(+), 20 deletions(-) diff --git a/include/project.h b/include/project.h index 7fb864f6..12cdf3f5 100644 --- a/include/project.h +++ b/include/project.h @@ -213,7 +213,6 @@ public: QMap> readObjEventGfxInfo(); QPixmap getEventPixmap(const QString &gfxName, const QString &movementName); - QPixmap getEventPixmap(const QString &gfxName, int frame, bool hFlip); QPixmap getEventPixmap(Event::Group group); void loadEventPixmap(Event *event, bool forceLoad = false); @@ -360,6 +359,7 @@ private: bool appendTextFile(const QString &path, const QString &text); QString findSpeciesIconPath(const QStringList &names) const; + QPixmap getEventPixmap(const QString &gfxName, int frame, bool hFlip); int maxObjectEvents; int maxMapDataSize; diff --git a/include/scripting.h b/include/scripting.h index 15332c51..4c72f811 100644 --- a/include/scripting.h +++ b/include/scripting.h @@ -37,6 +37,7 @@ enum CallbackType { OnMainTabChanged, OnMapViewTabChanged, OnBorderVisibilityToggled, + OnEventSpriteLoading, }; class Scripting @@ -67,6 +68,7 @@ public: static void cb_MainTabChanged(int oldTab, int newTab); static void cb_MapViewTabChanged(int oldTab, int newTab); static void cb_BorderVisibilityToggled(bool visible); + static QImage cb_EventSpriteLoading(const QString &gfxName, const QString &direction); static bool tryErrorJS(QJSValue js); static QJSValue fromBlock(Block block); @@ -127,7 +129,7 @@ private: ScriptUtility *scriptUtility; void loadScript(const QString &filepath); - void invokeCallback(CallbackType type, const QJSValueList &args); + QJSValue invokeCallback(CallbackType type, const QJSValueList &args); QSharedPointer