reorganize some class data
This commit is contained in:
parent
5cf07c7f91
commit
61256d39ca
3 changed files with 72 additions and 17 deletions
include
|
@ -39,6 +39,7 @@ public:
|
||||||
public:
|
public:
|
||||||
QString name;
|
QString name;
|
||||||
QString constantName;
|
QString constantName;
|
||||||
|
|
||||||
QString song;
|
QString song;
|
||||||
QString layoutId;
|
QString layoutId;
|
||||||
QString location;
|
QString location;
|
||||||
|
@ -51,14 +52,20 @@ public:
|
||||||
bool allowEscaping;
|
bool allowEscaping;
|
||||||
int floorNumber = 0;
|
int floorNumber = 0;
|
||||||
QString battle_scene;
|
QString battle_scene;
|
||||||
|
|
||||||
QString sharedEventsMap = "";
|
QString sharedEventsMap = "";
|
||||||
QString sharedScriptsMap = "";
|
QString sharedScriptsMap = "";
|
||||||
|
|
||||||
QMap<QString, QJsonValue> customHeaders;
|
QMap<QString, QJsonValue> customHeaders;
|
||||||
|
|
||||||
MapLayout *layout;
|
MapLayout *layout;
|
||||||
|
|
||||||
bool isPersistedToFile = true;
|
bool isPersistedToFile = true;
|
||||||
bool hasUnsavedDataChanges = false;
|
bool hasUnsavedDataChanges = false;
|
||||||
|
|
||||||
bool needsLayoutDir = true;
|
bool needsLayoutDir = true;
|
||||||
bool needsHealLocation = false;
|
bool needsHealLocation = false;
|
||||||
|
|
||||||
QImage collision_image;
|
QImage collision_image;
|
||||||
QPixmap collision_pixmap;
|
QPixmap collision_pixmap;
|
||||||
QImage image;
|
QImage image;
|
||||||
|
@ -68,42 +75,62 @@ public:
|
||||||
QList<Event *> ownedEvents; // for memory management
|
QList<Event *> ownedEvents; // for memory management
|
||||||
|
|
||||||
QList<MapConnection*> connections;
|
QList<MapConnection*> connections;
|
||||||
|
|
||||||
QList<int> metatileLayerOrder;
|
QList<int> metatileLayerOrder;
|
||||||
QList<float> metatileLayerOpacity;
|
QList<float> metatileLayerOpacity;
|
||||||
|
|
||||||
void setName(QString mapName);
|
void setName(QString mapName);
|
||||||
static QString mapConstantFromName(QString mapName);
|
static QString mapConstantFromName(QString mapName);
|
||||||
|
|
||||||
|
/// !HERE /* layout related stuff */
|
||||||
int getWidth();
|
int getWidth();
|
||||||
int getHeight();
|
int getHeight();
|
||||||
int getBorderWidth();
|
int getBorderWidth();
|
||||||
int getBorderHeight();
|
int getBorderHeight();
|
||||||
|
|
||||||
|
QUndoStack editHistory;
|
||||||
|
void modify();
|
||||||
|
void clean();
|
||||||
|
|
||||||
QPixmap render(bool ignoreCache = false, MapLayout *fromLayout = nullptr, QRect bounds = QRect(0, 0, -1, -1));
|
QPixmap render(bool ignoreCache = false, MapLayout *fromLayout = nullptr, QRect bounds = QRect(0, 0, -1, -1));
|
||||||
QPixmap renderCollision(bool ignoreCache);
|
QPixmap renderCollision(bool ignoreCache);
|
||||||
|
QPixmap renderConnection(MapConnection, MapLayout *);
|
||||||
|
QPixmap renderBorder(bool ignoreCache = false);
|
||||||
|
|
||||||
bool mapBlockChanged(int i, const Blockdata &cache);
|
bool mapBlockChanged(int i, const Blockdata &cache);
|
||||||
bool borderBlockChanged(int i, const Blockdata &cache);
|
bool borderBlockChanged(int i, const Blockdata &cache);
|
||||||
|
|
||||||
void cacheBlockdata();
|
void cacheBlockdata();
|
||||||
void cacheCollision();
|
void cacheCollision();
|
||||||
|
|
||||||
bool getBlock(int x, int y, Block *out);
|
bool getBlock(int x, int y, Block *out);
|
||||||
void setBlock(int x, int y, Block block, bool enableScriptCallback = false);
|
void setBlock(int x, int y, Block block, bool enableScriptCallback = false);
|
||||||
void setBlockdata(Blockdata blockdata, bool enableScriptCallback = false);
|
void setBlockdata(Blockdata blockdata, bool enableScriptCallback = false);
|
||||||
|
|
||||||
uint16_t getBorderMetatileId(int x, int y);
|
uint16_t getBorderMetatileId(int x, int y);
|
||||||
void setBorderMetatileId(int x, int y, uint16_t metatileId, bool enableScriptCallback = false);
|
void setBorderMetatileId(int x, int y, uint16_t metatileId, bool enableScriptCallback = false);
|
||||||
void setBorderBlockData(Blockdata blockdata, bool enableScriptCallback = false);
|
void setBorderBlockData(Blockdata blockdata, bool enableScriptCallback = false);
|
||||||
|
|
||||||
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 _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);
|
void magicFillCollisionElevation(int x, int y, uint16_t collision, uint16_t elevation);
|
||||||
|
|
||||||
QList<Event *> getAllEvents() const;
|
QList<Event *> getAllEvents() const;
|
||||||
QStringList eventScriptLabels(Event::Group group = Event::Group::None) const;
|
QStringList eventScriptLabels(Event::Group group = Event::Group::None) const;
|
||||||
void removeEvent(Event *);
|
void removeEvent(Event *);
|
||||||
void addEvent(Event *);
|
void addEvent(Event *);
|
||||||
QPixmap renderConnection(MapConnection, MapLayout *);
|
|
||||||
QPixmap renderBorder(bool ignoreCache = false);
|
|
||||||
void setDimensions(int newWidth, int newHeight, bool setNewBlockdata = true, bool enableScriptCallback = false);
|
void setDimensions(int newWidth, int newHeight, bool setNewBlockdata = true, bool enableScriptCallback = false);
|
||||||
void setBorderDimensions(int newWidth, int newHeight, bool setNewBlockdata = true, bool enableScriptCallback = false);
|
void setBorderDimensions(int newWidth, int newHeight, bool setNewBlockdata = true, bool enableScriptCallback = false);
|
||||||
|
|
||||||
void clearBorderCache();
|
void clearBorderCache();
|
||||||
void cacheBorder();
|
void cacheBorder();
|
||||||
|
|
||||||
bool hasUnsavedChanges();
|
bool hasUnsavedChanges();
|
||||||
|
|
||||||
bool isWithinBounds(int x, int y);
|
bool isWithinBounds(int x, int y);
|
||||||
bool isWithinBorderBounds(int x, int y);
|
bool isWithinBorderBounds(int x, int y);
|
||||||
|
|
||||||
void openScript(QString label);
|
void openScript(QString label);
|
||||||
|
|
||||||
MapPixmapItem *mapItem = nullptr;
|
MapPixmapItem *mapItem = nullptr;
|
||||||
|
@ -115,10 +142,6 @@ public:
|
||||||
BorderMetatilesPixmapItem *borderItem = nullptr;
|
BorderMetatilesPixmapItem *borderItem = nullptr;
|
||||||
void setBorderItem(BorderMetatilesPixmapItem *item) { borderItem = item; }
|
void setBorderItem(BorderMetatilesPixmapItem *item) { borderItem = item; }
|
||||||
|
|
||||||
QUndoStack editHistory;
|
|
||||||
void modify();
|
|
||||||
void clean();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setNewDimensionsBlockdata(int newWidth, int newHeight);
|
void setNewDimensionsBlockdata(int newWidth, int newHeight);
|
||||||
void setNewBorderDimensionsBlockdata(int newWidth, int newHeight);
|
void setNewBorderDimensionsBlockdata(int newWidth, int newHeight);
|
||||||
|
|
|
@ -8,25 +8,40 @@
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
|
class Map;
|
||||||
|
|
||||||
class MapLayout {
|
class MapLayout {
|
||||||
public:
|
public:
|
||||||
MapLayout() {}
|
MapLayout() {}
|
||||||
|
|
||||||
static QString layoutConstantFromName(QString mapName);
|
static QString layoutConstantFromName(QString mapName);
|
||||||
|
|
||||||
|
/// !TODO
|
||||||
|
/* NEW */
|
||||||
|
QList<Map *> maps;
|
||||||
|
|
||||||
QString id;
|
QString id;
|
||||||
QString name;
|
QString name;
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
int border_width;
|
int border_width;
|
||||||
int border_height;
|
int border_height;
|
||||||
|
|
||||||
QString border_path;
|
QString border_path;
|
||||||
QString blockdata_path;
|
QString blockdata_path;
|
||||||
|
|
||||||
QString tileset_primary_label;
|
QString tileset_primary_label;
|
||||||
QString tileset_secondary_label;
|
QString tileset_secondary_label;
|
||||||
|
|
||||||
Tileset *tileset_primary = nullptr;
|
Tileset *tileset_primary = nullptr;
|
||||||
Tileset *tileset_secondary = nullptr;
|
Tileset *tileset_secondary = nullptr;
|
||||||
|
|
||||||
Blockdata blockdata;
|
Blockdata blockdata;
|
||||||
|
|
||||||
QImage border_image;
|
QImage border_image;
|
||||||
QPixmap border_pixmap;
|
QPixmap border_pixmap;
|
||||||
|
|
||||||
Blockdata border;
|
Blockdata border;
|
||||||
Blockdata cached_blockdata;
|
Blockdata cached_blockdata;
|
||||||
Blockdata cached_collision;
|
Blockdata cached_collision;
|
||||||
|
|
|
@ -43,15 +43,26 @@ public:
|
||||||
public:
|
public:
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
QObject *parent = nullptr;
|
QObject *parent = nullptr;
|
||||||
|
|
||||||
Project *project = nullptr;
|
Project *project = nullptr;
|
||||||
Map *map = nullptr;
|
Map *map = nullptr;
|
||||||
|
MapLayout *layout = nullptr; /* NEW */
|
||||||
|
|
||||||
|
QUndoGroup editGroup; // Manages the undo history for each map
|
||||||
|
|
||||||
Settings *settings;
|
Settings *settings;
|
||||||
void saveProject();
|
|
||||||
void save();
|
void save();
|
||||||
void closeProject();
|
void saveProject();
|
||||||
bool setMap(QString map_name);
|
|
||||||
void saveUiFields();
|
void saveUiFields();
|
||||||
void saveEncounterTabData();
|
void saveEncounterTabData();
|
||||||
|
|
||||||
|
void closeProject();
|
||||||
|
|
||||||
|
bool setMap(QString map_name);
|
||||||
|
|
||||||
|
Tileset *getCurrentMapPrimaryTileset();
|
||||||
|
|
||||||
bool displayMap();
|
bool displayMap();
|
||||||
void displayMetatileSelector();
|
void displayMetatileSelector();
|
||||||
void displayMapMetatiles();
|
void displayMapMetatiles();
|
||||||
|
@ -74,6 +85,7 @@ public:
|
||||||
void setEditingObjects();
|
void setEditingObjects();
|
||||||
void setEditingConnections();
|
void setEditingConnections();
|
||||||
void setMapEditingButtonsEnabled(bool enabled);
|
void setMapEditingButtonsEnabled(bool enabled);
|
||||||
|
|
||||||
void setCurrentConnectionDirection(QString curDirection);
|
void setCurrentConnectionDirection(QString curDirection);
|
||||||
void updateCurrentConnectionDirection(QString curDirection);
|
void updateCurrentConnectionDirection(QString curDirection);
|
||||||
void setConnectionsVisibility(bool visible);
|
void setConnectionsVisibility(bool visible);
|
||||||
|
@ -81,19 +93,21 @@ public:
|
||||||
void setConnectionMap(QString mapName);
|
void setConnectionMap(QString mapName);
|
||||||
void addNewConnection();
|
void addNewConnection();
|
||||||
void removeCurrentConnection();
|
void removeCurrentConnection();
|
||||||
void addNewWildMonGroup(QWidget *window);
|
|
||||||
void deleteWildMonGroup();
|
|
||||||
void updateDiveMap(QString mapName);
|
void updateDiveMap(QString mapName);
|
||||||
void updateEmergeMap(QString mapName);
|
void updateEmergeMap(QString mapName);
|
||||||
void setSelectedConnectionFromMap(QString mapName);
|
void setSelectedConnectionFromMap(QString mapName);
|
||||||
|
|
||||||
|
void addNewWildMonGroup(QWidget *window);
|
||||||
|
void deleteWildMonGroup();
|
||||||
|
void configureEncounterJSON(QWidget *);
|
||||||
|
|
||||||
void updatePrimaryTileset(QString tilesetLabel, bool forceLoad = false);
|
void updatePrimaryTileset(QString tilesetLabel, bool forceLoad = false);
|
||||||
void updateSecondaryTileset(QString tilesetLabel, bool forceLoad = false);
|
void updateSecondaryTileset(QString tilesetLabel, bool forceLoad = false);
|
||||||
void toggleBorderVisibility(bool visible, bool enableScriptCallback = true);
|
void toggleBorderVisibility(bool visible, bool enableScriptCallback = true);
|
||||||
void updateCustomMapHeaderValues(QTableWidget *);
|
void updateCustomMapHeaderValues(QTableWidget *);
|
||||||
void configureEncounterJSON(QWidget *);
|
|
||||||
Tileset *getCurrentMapPrimaryTileset();
|
|
||||||
|
|
||||||
DraggablePixmapItem *addMapEvent(Event *event);
|
DraggablePixmapItem *addMapEvent(Event *event);
|
||||||
|
bool eventLimitReached(Map *, Event::Type);
|
||||||
void selectMapEvent(DraggablePixmapItem *object);
|
void selectMapEvent(DraggablePixmapItem *object);
|
||||||
void selectMapEvent(DraggablePixmapItem *object, bool toggle);
|
void selectMapEvent(DraggablePixmapItem *object, bool toggle);
|
||||||
DraggablePixmapItem *addNewEvent(Event::Type type);
|
DraggablePixmapItem *addNewEvent(Event::Type type);
|
||||||
|
@ -101,10 +115,11 @@ public:
|
||||||
void duplicateSelectedEvents();
|
void duplicateSelectedEvents();
|
||||||
void redrawObject(DraggablePixmapItem *item);
|
void redrawObject(DraggablePixmapItem *item);
|
||||||
QList<DraggablePixmapItem *> getObjects();
|
QList<DraggablePixmapItem *> getObjects();
|
||||||
|
|
||||||
void updateCursorRectPos(int x, int y);
|
void updateCursorRectPos(int x, int y);
|
||||||
void setCursorRectVisible(bool visible);
|
void setCursorRectVisible(bool visible);
|
||||||
|
|
||||||
bool eventLimitReached(Map *, Event::Type);
|
|
||||||
|
|
||||||
QGraphicsScene *scene = nullptr;
|
QGraphicsScene *scene = nullptr;
|
||||||
QGraphicsPixmapItem *current_view = nullptr;
|
QGraphicsPixmapItem *current_view = nullptr;
|
||||||
|
@ -114,17 +129,20 @@ public:
|
||||||
QGraphicsPathItem *connection_mask = nullptr;
|
QGraphicsPathItem *connection_mask = nullptr;
|
||||||
CollisionPixmapItem *collision_item = nullptr;
|
CollisionPixmapItem *collision_item = nullptr;
|
||||||
QGraphicsItemGroup *events_group = nullptr;
|
QGraphicsItemGroup *events_group = nullptr;
|
||||||
|
|
||||||
QList<QGraphicsPixmapItem*> borderItems;
|
QList<QGraphicsPixmapItem*> borderItems;
|
||||||
QList<QGraphicsLineItem*> gridLines;
|
QList<QGraphicsLineItem*> gridLines;
|
||||||
|
MapRuler *map_ruler = nullptr;
|
||||||
|
|
||||||
MovableRect *playerViewRect = nullptr;
|
MovableRect *playerViewRect = nullptr;
|
||||||
CursorTileRect *cursorMapTileRect = nullptr;
|
CursorTileRect *cursorMapTileRect = nullptr;
|
||||||
MapRuler *map_ruler = nullptr;
|
|
||||||
|
|
||||||
QGraphicsScene *scene_metatiles = nullptr;
|
QGraphicsScene *scene_metatiles = nullptr;
|
||||||
QGraphicsScene *scene_current_metatile_selection = nullptr;
|
QGraphicsScene *scene_current_metatile_selection = nullptr;
|
||||||
QGraphicsScene *scene_selected_border_metatiles = nullptr;
|
QGraphicsScene *scene_selected_border_metatiles = nullptr;
|
||||||
QGraphicsScene *scene_collision_metatiles = nullptr;
|
QGraphicsScene *scene_collision_metatiles = nullptr;
|
||||||
QGraphicsScene *scene_elevation_metatiles = nullptr;
|
QGraphicsScene *scene_elevation_metatiles = nullptr;
|
||||||
|
|
||||||
MetatileSelector *metatile_selector_item = nullptr;
|
MetatileSelector *metatile_selector_item = nullptr;
|
||||||
|
|
||||||
BorderMetatilesPixmapItem *selected_border_metatiles_item = nullptr;
|
BorderMetatilesPixmapItem *selected_border_metatiles_item = nullptr;
|
||||||
|
@ -133,6 +151,7 @@ public:
|
||||||
|
|
||||||
QList<DraggablePixmapItem *> *selected_events = nullptr;
|
QList<DraggablePixmapItem *> *selected_events = nullptr;
|
||||||
|
|
||||||
|
/// !TODO this
|
||||||
QString map_edit_mode = "paint";
|
QString map_edit_mode = "paint";
|
||||||
QString obj_edit_mode = "select";
|
QString obj_edit_mode = "select";
|
||||||
|
|
||||||
|
@ -143,8 +162,6 @@ public:
|
||||||
|
|
||||||
int getBorderDrawDistance(int dimension);
|
int getBorderDrawDistance(int dimension);
|
||||||
|
|
||||||
QUndoGroup editGroup; // Manages the undo history for each map
|
|
||||||
|
|
||||||
bool selectingEvent = false;
|
bool selectingEvent = false;
|
||||||
|
|
||||||
void shouldReselectEvents();
|
void shouldReselectEvents();
|
||||||
|
|
Loading…
Reference in a new issue