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