mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-08 17:05:43 -05:00
Merge branch 'dev' of https://github.com/huderlem/porymap into status-bar-log
This commit is contained in:
@@ -335,6 +335,7 @@ public:
|
||||
this->filePaths.clear();
|
||||
this->eventIconPaths.clear();
|
||||
this->pokemonIconPaths.clear();
|
||||
this->eventsTabIconPath = QString();
|
||||
this->collisionSheetPath = QString();
|
||||
this->collisionSheetSize = QSize(2, 16);
|
||||
this->playerViewDistance = QMargins(GBA_H_DIST_TO_CENTER, GBA_V_DIST_TO_CENTER, GBA_H_DIST_TO_CENTER, GBA_V_DIST_TO_CENTER);
|
||||
@@ -345,6 +346,7 @@ public:
|
||||
this->unusedTileCovered = 0x0000;
|
||||
this->unusedTileSplit = 0x0000;
|
||||
this->maxEventsPerGroup = 255;
|
||||
this->forcedMajorVersion = 0;
|
||||
this->globalConstantsFilepaths.clear();
|
||||
this->globalConstants.clear();
|
||||
this->identifiers.clear();
|
||||
@@ -355,6 +357,9 @@ public:
|
||||
static const QStringList versionStrings;
|
||||
static BaseGameVersion stringToBaseGameVersion(const QString &string);
|
||||
|
||||
static QString getPlayerIconPath(BaseGameVersion baseGameVersion, int character);
|
||||
static QIcon getPlayerIcon(BaseGameVersion baseGameVersion, int character);
|
||||
|
||||
void reset(BaseGameVersion baseGameVersion);
|
||||
void setFilePath(ProjectFilePath pathId, const QString &path);
|
||||
void setFilePath(const QString &pathId, const QString &path);
|
||||
@@ -414,11 +419,13 @@ public:
|
||||
uint16_t unusedTileCovered;
|
||||
uint16_t unusedTileSplit;
|
||||
bool mapAllowFlagsEnabled;
|
||||
QString eventsTabIconPath;
|
||||
QString collisionSheetPath;
|
||||
QSize collisionSheetSize;
|
||||
QMargins playerViewDistance;
|
||||
QList<uint32_t> warpBehaviors;
|
||||
int maxEventsPerGroup;
|
||||
int forcedMajorVersion;
|
||||
QStringList globalConstantsFilepaths;
|
||||
QMap<QString,QString> globalConstants;
|
||||
|
||||
|
||||
@@ -34,15 +34,6 @@ class HiddenItemEvent;
|
||||
class SecretBaseEvent;
|
||||
class HealLocationEvent;
|
||||
|
||||
class EventVisitor {
|
||||
public:
|
||||
virtual void nothing() { }
|
||||
virtual void visitObject(ObjectEvent *) = 0;
|
||||
virtual void visitTrigger(TriggerEvent *) = 0;
|
||||
virtual void visitSign(SignEvent *) = 0;
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
/// Event base class -- purely virtual
|
||||
///
|
||||
@@ -121,8 +112,6 @@ public:
|
||||
|
||||
void modify();
|
||||
|
||||
virtual void accept(EventVisitor *) { }
|
||||
|
||||
void setX(int newX) { this->x = newX; }
|
||||
void setY(int newY) { this->y = newY; }
|
||||
void setZ(int newZ) { this->elevation = newZ; }
|
||||
@@ -150,6 +139,8 @@ public:
|
||||
|
||||
virtual QSet<QString> getExpectedFields() = 0;
|
||||
|
||||
virtual QStringList getScripts() const { return QStringList(); }
|
||||
|
||||
QJsonObject getCustomAttributes() const { return this->customAttributes; }
|
||||
void setCustomAttributes(const QJsonObject &newCustomAttributes) { this->customAttributes = newCustomAttributes; }
|
||||
|
||||
@@ -222,8 +213,6 @@ public:
|
||||
|
||||
virtual Event *duplicate() const override;
|
||||
|
||||
virtual void accept(EventVisitor *visitor) override { visitor->visitObject(this); }
|
||||
|
||||
virtual EventFrame *createEventFrame() override;
|
||||
|
||||
virtual OrderedJson::object buildEventJson(Project *project) override;
|
||||
@@ -233,6 +222,8 @@ public:
|
||||
|
||||
virtual QSet<QString> getExpectedFields() override;
|
||||
|
||||
virtual QStringList getScripts() const override { return {getScript()}; }
|
||||
|
||||
virtual QPixmap loadPixmap(Project *project) override;
|
||||
|
||||
void setGfx(QString newGfx) { this->gfx = newGfx; }
|
||||
@@ -392,8 +383,6 @@ public:
|
||||
|
||||
virtual Event *duplicate() const override;
|
||||
|
||||
virtual void accept(EventVisitor *visitor) override { visitor->visitTrigger(this); }
|
||||
|
||||
virtual EventFrame *createEventFrame() override;
|
||||
|
||||
virtual OrderedJson::object buildEventJson(Project *project) override;
|
||||
@@ -403,6 +392,8 @@ public:
|
||||
|
||||
virtual QSet<QString> getExpectedFields() override;
|
||||
|
||||
virtual QStringList getScripts() const override { return {getScriptLabel()}; }
|
||||
|
||||
void setScriptVar(QString newScriptVar) { this->scriptVar = newScriptVar; }
|
||||
QString getScriptVar() const { return this->scriptVar; }
|
||||
|
||||
@@ -490,8 +481,6 @@ public:
|
||||
|
||||
virtual Event *duplicate() const override;
|
||||
|
||||
virtual void accept(EventVisitor *visitor) override { visitor->visitSign(this); }
|
||||
|
||||
virtual EventFrame *createEventFrame() override;
|
||||
|
||||
virtual OrderedJson::object buildEventJson(Project *project) override;
|
||||
@@ -501,6 +490,8 @@ public:
|
||||
|
||||
virtual QSet<QString> getExpectedFields() override;
|
||||
|
||||
virtual QStringList getScripts() const override { return {getScriptLabel()}; }
|
||||
|
||||
void setFacingDirection(QString newFacingDirection) { this->facingDirection = newFacingDirection; }
|
||||
QString getFacingDirection() const { return this->facingDirection; }
|
||||
|
||||
@@ -633,21 +624,4 @@ inline uint qHash(const Event::Group &key, uint seed = 0) {
|
||||
return qHash(static_cast<int>(key), seed);
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Keeps track of scripts
|
||||
///
|
||||
class ScriptTracker : public EventVisitor {
|
||||
public:
|
||||
virtual void visitObject(ObjectEvent *object) override { this->scripts << object->getScript(); };
|
||||
virtual void visitTrigger(TriggerEvent *trigger) override { this->scripts << trigger->getScriptLabel(); };
|
||||
virtual void visitSign(SignEvent *sign) override { this->scripts << sign->getScriptLabel(); };
|
||||
|
||||
QStringList getScripts() const { return this->scripts; }
|
||||
|
||||
private:
|
||||
QStringList scripts;
|
||||
};
|
||||
|
||||
|
||||
#endif // EVENTS_H
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <QPixmap>
|
||||
#include <QObject>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <math.h>
|
||||
|
||||
#define DEFAULT_BORDER_WIDTH 2
|
||||
@@ -56,7 +57,7 @@ public:
|
||||
MapHeader* header() const { return m_header; }
|
||||
|
||||
void setSharedEventsMap(const QString &sharedEventsMap) { m_sharedEventsMap = sharedEventsMap; }
|
||||
void setSharedScriptsMap(const QString &sharedScriptsMap) { m_sharedScriptsMap = sharedScriptsMap; }
|
||||
void setSharedScriptsMap(const QString &sharedScriptsMap);
|
||||
|
||||
QString sharedEventsMap() const { return m_sharedEventsMap; }
|
||||
QString sharedScriptsMap() const { return m_sharedScriptsMap; }
|
||||
@@ -75,14 +76,15 @@ public:
|
||||
Event* getEvent(Event::Group group, const QString &idName) const;
|
||||
QStringList getEventIdNames(Event::Group group) const;
|
||||
int getNumEvents(Event::Group group = Event::Group::None) const;
|
||||
QStringList getScriptLabels(Event::Group group = Event::Group::None);
|
||||
QString getScriptsFilePath() const;
|
||||
void openScript(QString label);
|
||||
void removeEvent(Event *);
|
||||
void addEvent(Event *);
|
||||
int getIndexOfEvent(Event *) const;
|
||||
bool hasEvent(Event *) const;
|
||||
|
||||
QStringList getScriptLabels(Event::Group group = Event::Group::None);
|
||||
QString getScriptsFilePath() const;
|
||||
void openScript(const QString &label);
|
||||
|
||||
void deleteConnections();
|
||||
QList<MapConnection*> getConnections() const { return m_connections; }
|
||||
MapConnection* getConnection(const QString &direction) const;
|
||||
@@ -108,7 +110,7 @@ private:
|
||||
QString m_sharedEventsMap = "";
|
||||
QString m_sharedScriptsMap = "";
|
||||
|
||||
QStringList m_scriptsFileLabels;
|
||||
QStringList m_scriptLabels;
|
||||
QJsonObject m_customAttributes;
|
||||
|
||||
MapHeader *m_header = nullptr;
|
||||
@@ -131,10 +133,14 @@ private:
|
||||
QList<MapConnection*> m_connections;
|
||||
QSet<MapConnection*> m_ownedConnections;
|
||||
|
||||
QUndoStack *m_editHistory = nullptr;
|
||||
QPointer<QUndoStack> m_editHistory;
|
||||
QPointer<QFileSystemWatcher> m_scriptFileWatcher;
|
||||
|
||||
void invalidateScripts();
|
||||
|
||||
signals:
|
||||
void modified();
|
||||
void scriptsModified();
|
||||
void mapDimensionsChanged(const QSize &size);
|
||||
void openScriptRequested(QString label);
|
||||
void connectionAdded(MapConnection*);
|
||||
|
||||
@@ -351,7 +351,9 @@ private:
|
||||
void refreshCollisionSelector();
|
||||
void setLayoutOnlyMode(bool layoutOnly);
|
||||
|
||||
bool checkProjectSanity();
|
||||
bool isInvalidProject(Project *project);
|
||||
bool checkProjectSanity(Project *project);
|
||||
bool checkProjectVersion(Project *project);
|
||||
bool loadProjectData();
|
||||
bool setProjectUI();
|
||||
void clearProjectUI();
|
||||
|
||||
@@ -85,6 +85,7 @@ public:
|
||||
void clearHealLocations();
|
||||
|
||||
bool sanityCheck();
|
||||
int getSupportedMajorVersion(QString *errorOut = nullptr);
|
||||
bool load();
|
||||
|
||||
Map* loadMap(const QString &mapName);
|
||||
|
||||
@@ -56,9 +56,11 @@ protected:
|
||||
bool populated = false;
|
||||
bool initialized = false;
|
||||
bool connected = false;
|
||||
QPointer<Project> project;
|
||||
|
||||
void populateDropdown(NoScrollComboBox * combo, const QStringList &items);
|
||||
void populateScriptDropdown(NoScrollComboBox * combo, Project * project);
|
||||
void populateMapNameDropdown(NoScrollComboBox * combo, Project * project);
|
||||
void populateIdNameDropdown(NoScrollComboBox * combo, Project * project, const QString &mapName, Event::Group group);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user