Restructure source tree
@@ -1,20 +0,0 @@
|
||||
#ifndef BLOCK_H
|
||||
#define BLOCK_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class Block
|
||||
{
|
||||
public:
|
||||
Block();
|
||||
Block(uint16_t);
|
||||
Block(const Block&);
|
||||
bool operator ==(Block);
|
||||
bool operator !=(Block);
|
||||
uint16_t tile:10;
|
||||
uint16_t collision:2;
|
||||
uint16_t elevation:4;
|
||||
uint16_t rawValue();
|
||||
};
|
||||
|
||||
#endif // BLOCK_H
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef BLOCKDATA_H
|
||||
#define BLOCKDATA_H
|
||||
|
||||
#include "block.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
|
||||
class Blockdata : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Blockdata(QObject *parent = nullptr);
|
||||
~Blockdata() {
|
||||
if (blocks) delete blocks;
|
||||
}
|
||||
|
||||
public:
|
||||
QList<Block> *blocks = nullptr;
|
||||
void addBlock(uint16_t);
|
||||
void addBlock(Block);
|
||||
QByteArray serialize();
|
||||
void copyFrom(Blockdata*);
|
||||
Blockdata* copy();
|
||||
bool equals(Blockdata *);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // BLOCKDATA_H
|
||||
@@ -1,85 +0,0 @@
|
||||
#ifndef EVENT_H
|
||||
#define EVENT_H
|
||||
|
||||
#include <QString>
|
||||
#include <QPixmap>
|
||||
#include <QMap>
|
||||
#include <QDebug>
|
||||
|
||||
class EventType
|
||||
{
|
||||
public:
|
||||
static QString Object;
|
||||
static QString Warp;
|
||||
static QString CoordScript;
|
||||
static QString CoordWeather;
|
||||
static QString Sign;
|
||||
static QString HiddenItem;
|
||||
static QString SecretBase;
|
||||
static QString HealLocation;
|
||||
};
|
||||
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
Event();
|
||||
public:
|
||||
int x() {
|
||||
return getInt("x");
|
||||
}
|
||||
int y() {
|
||||
return getInt("y");
|
||||
}
|
||||
int elevation() {
|
||||
return getInt("elevation");
|
||||
}
|
||||
void setX(int x) {
|
||||
put("x", x);
|
||||
}
|
||||
void setY(int y) {
|
||||
put("y", y);
|
||||
}
|
||||
QString get(QString key) {
|
||||
return values.value(key);
|
||||
}
|
||||
int getInt(QString key) {
|
||||
return values.value(key).toInt(nullptr, 0);
|
||||
}
|
||||
uint16_t getU16(QString key) {
|
||||
return values.value(key).toUShort(nullptr, 0);
|
||||
}
|
||||
void put(QString key, int value) {
|
||||
put(key, QString("%1").arg(value));
|
||||
}
|
||||
void put(QString key, QString value) {
|
||||
values.insert(key, value);
|
||||
}
|
||||
|
||||
static Event* createNewEvent(QString, QString);
|
||||
static Event* createNewObjectEvent();
|
||||
static Event* createNewWarpEvent(QString);
|
||||
static Event* createNewHealLocationEvent(QString);
|
||||
static Event* createNewCoordScriptEvent();
|
||||
static Event* createNewCoordWeatherEvent();
|
||||
static Event* createNewSignEvent();
|
||||
static Event* createNewHiddenItemEvent();
|
||||
static Event* createNewSecretBaseEvent();
|
||||
|
||||
QString buildObjectEventMacro(int);
|
||||
QString buildWarpEventMacro(QMap<QString, QString>*);
|
||||
QString buildCoordScriptEventMacro();
|
||||
QString buildCoordWeatherEventMacro();
|
||||
QString buildSignEventMacro();
|
||||
QString buildHiddenItemEventMacro();
|
||||
QString buildSecretBaseEventMacro();
|
||||
void setPixmapFromSpritesheet(QImage, int, int);
|
||||
int getPixelX();
|
||||
int getPixelY();
|
||||
|
||||
QMap<QString, QString> values;
|
||||
QPixmap pixmap;
|
||||
int spriteWidth;
|
||||
int spriteHeight;
|
||||
};
|
||||
|
||||
#endif // EVENT_H
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef HEALLOCATION_H
|
||||
#define HEALLOCATION_H
|
||||
|
||||
#include "event.h"
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
|
||||
class HealLocation {
|
||||
|
||||
public:
|
||||
HealLocation()=default;
|
||||
HealLocation(QString, int, uint16_t, uint16_t);
|
||||
friend QDebug operator<<(QDebug debug, const HealLocation &hl);
|
||||
|
||||
public:
|
||||
//QString group;
|
||||
QString name;
|
||||
int index;
|
||||
uint16_t x;
|
||||
uint16_t y;
|
||||
static HealLocation fromEvent(Event*);
|
||||
};
|
||||
|
||||
#endif // HEALLOCATION_H
|
||||
@@ -1,58 +0,0 @@
|
||||
#ifndef HISTORY_H
|
||||
#define HISTORY_H
|
||||
|
||||
#include <QList>
|
||||
|
||||
template <typename T>
|
||||
class History {
|
||||
public:
|
||||
History() { }
|
||||
T back() {
|
||||
if (head > 0) {
|
||||
return history.at(--head);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
T next() {
|
||||
if (head + 1 < history.length()) {
|
||||
return history.at(++head);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void push(T commit) {
|
||||
while (head + 1 < history.length()) {
|
||||
T item = history.last();
|
||||
history.removeLast();
|
||||
delete item;
|
||||
}
|
||||
if (saved > head) {
|
||||
saved = -1;
|
||||
}
|
||||
history.append(commit);
|
||||
head++;
|
||||
}
|
||||
|
||||
T current() {
|
||||
if (head < 0 || history.length() == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return history.at(head);
|
||||
}
|
||||
|
||||
void save() {
|
||||
saved = head;
|
||||
}
|
||||
|
||||
bool isSaved() {
|
||||
return saved == head;
|
||||
}
|
||||
|
||||
private:
|
||||
QList<T> history;
|
||||
int head = -1;
|
||||
int saved = -1;
|
||||
};
|
||||
|
||||
#endif // HISTORY_H
|
||||
@@ -1,15 +0,0 @@
|
||||
#ifndef HISTORYITEM_H
|
||||
#define HISTORYITEM_H
|
||||
|
||||
#include "blockdata.h"
|
||||
|
||||
class HistoryItem {
|
||||
public:
|
||||
Blockdata *metatiles;
|
||||
int layoutWidth;
|
||||
int layoutHeight;
|
||||
HistoryItem(Blockdata *metatiles, int layoutWidth, int layoutHeight);
|
||||
~HistoryItem();
|
||||
};
|
||||
|
||||
#endif // HISTORYITEM_H
|
||||
@@ -1,89 +0,0 @@
|
||||
#ifndef MAP_H
|
||||
#define MAP_H
|
||||
|
||||
#include "blockdata.h"
|
||||
#include "history.h"
|
||||
#include "historyitem.h"
|
||||
#include "mapconnection.h"
|
||||
#include "maplayout.h"
|
||||
#include "tileset.h"
|
||||
#include "event.h"
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <math.h>
|
||||
|
||||
class Map : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Map(QObject *parent = nullptr);
|
||||
|
||||
public:
|
||||
QString name;
|
||||
QString constantName;
|
||||
QString group_num;
|
||||
QString layout_label;
|
||||
QString events_label;
|
||||
QString scripts_label;
|
||||
QString connections_label;
|
||||
QString song;
|
||||
QString layout_id;
|
||||
QString location;
|
||||
QString requiresFlash;
|
||||
QString isFlyable; // TODO: implement this
|
||||
QString weather;
|
||||
QString type;
|
||||
QString unknown;
|
||||
QString show_location;
|
||||
QString battle_scene;
|
||||
MapLayout *layout;
|
||||
bool isPersistedToFile = true;
|
||||
QImage collision_image;
|
||||
QPixmap collision_pixmap;
|
||||
QImage image;
|
||||
QPixmap pixmap;
|
||||
History<HistoryItem*> metatileHistory;
|
||||
QMap<QString, QList<Event*>> events;
|
||||
QList<MapConnection*> connections;
|
||||
void setName(QString mapName);
|
||||
static QString mapConstantFromName(QString mapName);
|
||||
static QString objectEventsLabelFromName(QString mapName);
|
||||
static QString warpEventsLabelFromName(QString mapName);
|
||||
static QString coordEventsLabelFromName(QString mapName);
|
||||
static QString bgEventsLabelFromName(QString mapName);
|
||||
int getWidth();
|
||||
int getHeight();
|
||||
QPixmap render(bool ignoreCache);
|
||||
QPixmap renderCollision(bool ignoreCache);
|
||||
bool blockChanged(int, Blockdata*);
|
||||
void cacheBlockdata();
|
||||
void cacheCollision();
|
||||
Block *getBlock(int x, int y);
|
||||
void setBlock(int x, int y, Block block);
|
||||
void _setBlock(int x, int y, Block block);
|
||||
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 undo();
|
||||
void redo();
|
||||
void commit();
|
||||
QList<Event*> getAllEvents();
|
||||
void removeEvent(Event*);
|
||||
void addEvent(Event*);
|
||||
QPixmap renderConnection(MapConnection);
|
||||
QPixmap renderBorder();
|
||||
void setDimensions(int newWidth, int newHeight, bool setNewBlockData = true);
|
||||
void cacheBorder();
|
||||
bool hasUnsavedChanges();
|
||||
|
||||
private:
|
||||
void setNewDimensionsBlockdata(int newWidth, int newHeight);
|
||||
|
||||
signals:
|
||||
void mapChanged(Map *map);
|
||||
void mapNeedsRedrawing();
|
||||
};
|
||||
|
||||
#endif // MAP_H
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef MAPCONNECTION_H
|
||||
#define MAPCONNECTION_H
|
||||
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
|
||||
class MapConnection {
|
||||
public:
|
||||
QString direction;
|
||||
QString offset;
|
||||
QString map_name;
|
||||
};
|
||||
|
||||
#endif // MAPCONNECTION_H
|
||||
@@ -1,41 +0,0 @@
|
||||
#ifndef MAPLAYOUT_H
|
||||
#define MAPLAYOUT_H
|
||||
|
||||
#include "blockdata.h"
|
||||
#include "tileset.h"
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QString>
|
||||
|
||||
class MapLayout {
|
||||
public:
|
||||
MapLayout() {}
|
||||
int index;
|
||||
QString name;
|
||||
QString label;
|
||||
QString width;
|
||||
QString height;
|
||||
QString border_label;
|
||||
QString border_path;
|
||||
QString blockdata_label;
|
||||
QString blockdata_path;
|
||||
QString tileset_primary_label;
|
||||
QString tileset_secondary_label;
|
||||
Tileset *tileset_primary = nullptr;
|
||||
Tileset *tileset_secondary = nullptr;
|
||||
Blockdata* blockdata = nullptr;
|
||||
QImage border_image;
|
||||
QPixmap border_pixmap;
|
||||
Blockdata *border = nullptr;
|
||||
Blockdata *cached_blockdata = nullptr;
|
||||
Blockdata *cached_collision = nullptr;
|
||||
Blockdata *cached_border = nullptr;
|
||||
bool has_unsaved_changes = false;
|
||||
public:
|
||||
static QString getNameFromLabel(QString label) {
|
||||
// ASSUMPTION: strip off "_Layout" from layout label. Directories in 'data/layouts/' must be well-formed.
|
||||
return label.replace(label.lastIndexOf("_Layout"), label.length(), "");
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MAPLAYOUT_H
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef METATILE_H
|
||||
#define METATILE_H
|
||||
|
||||
#include "tile.h"
|
||||
#include <QImage>
|
||||
|
||||
class Metatile
|
||||
{
|
||||
public:
|
||||
Metatile();
|
||||
public:
|
||||
QList<Tile> *tiles = nullptr;
|
||||
|
||||
static int getBlockIndex(int);
|
||||
};
|
||||
|
||||
#endif // METATILE_H
|
||||
@@ -1,47 +0,0 @@
|
||||
#ifndef PARSEUTIL_H
|
||||
#define PARSEUTIL_H
|
||||
|
||||
#include "heallocation.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
||||
enum TokenType {
|
||||
Number,
|
||||
Operator,
|
||||
};
|
||||
|
||||
class Token {
|
||||
public:
|
||||
Token(QString value = "", QString type = "") {
|
||||
this->value = value;
|
||||
this->type = TokenType::Operator;
|
||||
if (type == "decimal" || type == "hex") {
|
||||
this->type = TokenType::Number;
|
||||
this->operatorPrecedence = -1;
|
||||
} else if (type == "operator") {
|
||||
this->operatorPrecedence = precedenceMap[value];
|
||||
}
|
||||
}
|
||||
static QMap<QString, int> precedenceMap;
|
||||
QString value;
|
||||
TokenType type;
|
||||
int operatorPrecedence; // only relevant for operator tokens
|
||||
};
|
||||
|
||||
class ParseUtil
|
||||
{
|
||||
public:
|
||||
ParseUtil();
|
||||
void strip_comment(QString*);
|
||||
QList<QStringList>* parseAsm(QString);
|
||||
int evaluateDefine(QString, QMap<QString, int>*);
|
||||
QList<HealLocation>* parseHealLocs(QString);
|
||||
private:
|
||||
QList<Token> tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers);
|
||||
QList<Token> generatePostfix(QList<Token> tokens);
|
||||
int evaluatePostfix(QList<Token> postfix);
|
||||
};
|
||||
|
||||
#endif // PARSEUTIL_H
|
||||
@@ -1,16 +0,0 @@
|
||||
#ifndef TILE_H
|
||||
#define TILE_H
|
||||
|
||||
|
||||
class Tile
|
||||
{
|
||||
public:
|
||||
Tile();
|
||||
public:
|
||||
int tile;
|
||||
int xflip;
|
||||
int yflip;
|
||||
int palette;
|
||||
};
|
||||
|
||||
#endif // TILE_H
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef TILESET_H
|
||||
#define TILESET_H
|
||||
|
||||
#include "metatile.h"
|
||||
#include "tile.h"
|
||||
#include <QImage>
|
||||
|
||||
class Tileset
|
||||
{
|
||||
public:
|
||||
Tileset();
|
||||
public:
|
||||
QString name;
|
||||
QString is_compressed;
|
||||
QString is_secondary;
|
||||
QString padding;
|
||||
QString tiles_label;
|
||||
QString palettes_label;
|
||||
QString metatiles_label;
|
||||
QString callback_label;
|
||||
QString metatile_attrs_label;
|
||||
|
||||
QList<QImage> *tiles = nullptr;
|
||||
QList<Metatile*> *metatiles = nullptr;
|
||||
QList<QList<QRgb>> *palettes = nullptr;
|
||||
|
||||
static Tileset* getBlockTileset(int, Tileset*, Tileset*);
|
||||
static Metatile* getMetatile(int, Tileset*, Tileset*);
|
||||
static QList<QList<QRgb>> getBlockPalettes(Tileset*, Tileset*);
|
||||
};
|
||||
|
||||
#endif // TILESET_H
|
||||
263
src/editor.h
@@ -1,263 +0,0 @@
|
||||
#ifndef EDITOR_H
|
||||
#define EDITOR_H
|
||||
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsItemGroup>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QGraphicsItemAnimation>
|
||||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QCursor>
|
||||
|
||||
#include "mapconnection.h"
|
||||
#include "metatileselector.h"
|
||||
#include "movementpermissionsselector.h"
|
||||
#include "project.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "bordermetatilespixmapitem.h"
|
||||
#include "connectionpixmapitem.h"
|
||||
#include "currentselectedmetatilespixmapitem.h"
|
||||
#include "collisionpixmapitem.h"
|
||||
#include "mappixmapitem.h"
|
||||
#include "settings.h"
|
||||
|
||||
class DraggablePixmapItem;
|
||||
class MetatilesPixmapItem;
|
||||
|
||||
class Editor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Editor(Ui::MainWindow* ui);
|
||||
public:
|
||||
Ui::MainWindow* ui;
|
||||
QObject *parent = nullptr;
|
||||
Project *project = nullptr;
|
||||
Map *map = nullptr;
|
||||
Settings *settings;
|
||||
void saveProject();
|
||||
void save();
|
||||
void undo();
|
||||
void redo();
|
||||
void setMap(QString map_name);
|
||||
void displayMap();
|
||||
void displayMetatileSelector();
|
||||
void displayMapMetatiles();
|
||||
void displayMapMovementPermissions();
|
||||
void displayBorderMetatiles();
|
||||
void displayCurrentMetatilesSelection();
|
||||
void redrawCurrentMetatilesSelection();
|
||||
void displayMovementPermissionSelector();
|
||||
void displayElevationMetatiles();
|
||||
void displayMapEvents();
|
||||
void displayMapConnections();
|
||||
void displayMapBorder();
|
||||
void displayMapGrid();
|
||||
|
||||
void setEditingMap();
|
||||
void setEditingCollision();
|
||||
void setEditingObjects();
|
||||
void setEditingConnections();
|
||||
void setCurrentConnectionDirection(QString curDirection);
|
||||
void updateCurrentConnectionDirection(QString curDirection);
|
||||
void setConnectionsVisibility(bool visible);
|
||||
void updateConnectionOffset(int offset);
|
||||
void setConnectionMap(QString mapName);
|
||||
void addNewConnection();
|
||||
void removeCurrentConnection();
|
||||
void updateDiveMap(QString mapName);
|
||||
void updateEmergeMap(QString mapName);
|
||||
void setSelectedConnectionFromMap(QString mapName);
|
||||
void updatePrimaryTileset(QString tilesetLabel);
|
||||
void updateSecondaryTileset(QString tilesetLabel);
|
||||
void toggleBorderVisibility(bool visible);
|
||||
|
||||
DraggablePixmapItem *addMapEvent(Event *event);
|
||||
void selectMapEvent(DraggablePixmapItem *object);
|
||||
void selectMapEvent(DraggablePixmapItem *object, bool toggle);
|
||||
DraggablePixmapItem *addNewEvent(QString event_type);
|
||||
Event* createNewEvent(QString event_type);
|
||||
void deleteEvent(Event *);
|
||||
void updateSelectedEvents();
|
||||
void redrawObject(DraggablePixmapItem *item);
|
||||
QList<DraggablePixmapItem *> *getObjects();
|
||||
|
||||
QGraphicsScene *scene = nullptr;
|
||||
QGraphicsPixmapItem *current_view = nullptr;
|
||||
MapPixmapItem *map_item = nullptr;
|
||||
ConnectionPixmapItem* selected_connection_item = nullptr;
|
||||
QList<QGraphicsPixmapItem*> connection_items;
|
||||
QList<ConnectionPixmapItem*> connection_edit_items;
|
||||
CollisionPixmapItem *collision_item = nullptr;
|
||||
QGraphicsItemGroup *events_group = nullptr;
|
||||
QList<QGraphicsPixmapItem*> borderItems;
|
||||
QList<QGraphicsLineItem*> gridLines;
|
||||
|
||||
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;
|
||||
CurrentSelectedMetatilesPixmapItem *scene_current_metatile_selection_item = nullptr;
|
||||
MovementPermissionsSelector *movement_permissions_selector_item = nullptr;
|
||||
|
||||
QList<DraggablePixmapItem*> *events = nullptr;
|
||||
QList<DraggablePixmapItem*> *selected_events = nullptr;
|
||||
|
||||
QString map_edit_mode;
|
||||
QString prev_edit_mode;
|
||||
|
||||
int scale_exp = 0;
|
||||
double scale_base = sqrt(2); // adjust scale factor with this
|
||||
|
||||
void objectsView_onMousePress(QMouseEvent *event);
|
||||
void objectsView_onMouseMove(QMouseEvent *event);
|
||||
void objectsView_onMouseRelease(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
void setConnectionItemsVisible(bool);
|
||||
void setBorderItemsVisible(bool, qreal = 1);
|
||||
void setConnectionEditControlValues(MapConnection*);
|
||||
void setConnectionEditControlsEnabled(bool);
|
||||
void createConnectionItem(MapConnection* connection, bool hide);
|
||||
void populateConnectionMapPickers();
|
||||
void setDiveEmergeControls();
|
||||
void updateDiveEmergeMap(QString mapName, QString direction);
|
||||
void onConnectionOffsetChanged(int newOffset);
|
||||
void removeMirroredConnection(MapConnection*);
|
||||
void updateMirroredConnectionOffset(MapConnection*);
|
||||
void updateMirroredConnectionDirection(MapConnection*, QString);
|
||||
void updateMirroredConnectionMap(MapConnection*, QString);
|
||||
void updateMirroredConnection(MapConnection*, QString, QString, bool isDelete = false);
|
||||
Event* createNewObjectEvent();
|
||||
Event* createNewWarpEvent();
|
||||
Event* createNewHealLocationEvent();
|
||||
Event* createNewCoordScriptEvent();
|
||||
Event* createNewCoordWeatherEvent();
|
||||
Event* createNewSignEvent();
|
||||
Event* createNewHiddenItemEvent();
|
||||
Event* createNewSecretBaseEvent();
|
||||
QString getMovementPermissionText(uint16_t collision, uint16_t elevation);
|
||||
|
||||
private slots:
|
||||
void mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item);
|
||||
void mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item);
|
||||
void onConnectionMoved(MapConnection*);
|
||||
void onConnectionItemSelected(ConnectionPixmapItem* connectionItem);
|
||||
void onConnectionItemDoubleClicked(ConnectionPixmapItem* connectionItem);
|
||||
void onConnectionDirectionChanged(QString newDirection);
|
||||
void onBorderMetatilesChanged();
|
||||
void onHoveredMovementPermissionChanged(uint16_t, uint16_t);
|
||||
void onHoveredMovementPermissionCleared();
|
||||
void onHoveredMetatileSelectionChanged(uint16_t);
|
||||
void onHoveredMetatileSelectionCleared();
|
||||
void onHoveredMapMetatileChanged(int, int);
|
||||
void onHoveredMapMetatileCleared();
|
||||
void onHoveredMapMovementPermissionChanged(int, int);
|
||||
void onHoveredMapMovementPermissionCleared();
|
||||
void onSelectedMetatilesChanged();
|
||||
|
||||
signals:
|
||||
void objectsChanged();
|
||||
void selectedObjectsChanged();
|
||||
void loadMapRequested(QString, QString);
|
||||
void tilesetChanged(QString);
|
||||
void warpEventDoubleClicked(QString mapName, QString warpNum);
|
||||
void currentMetatilesSelectionChanged();
|
||||
void wheelZoom(int delta);
|
||||
};
|
||||
|
||||
|
||||
|
||||
class DraggablePixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
DraggablePixmapItem(QPixmap pixmap): QGraphicsPixmapItem(pixmap) {
|
||||
}
|
||||
Editor *editor = nullptr;
|
||||
Event *event = nullptr;
|
||||
QGraphicsItemAnimation *pos_anim = nullptr;
|
||||
DraggablePixmapItem(Event *event_, Editor *editor_) : QGraphicsPixmapItem(event_->pixmap) {
|
||||
event = event_;
|
||||
editor = editor_;
|
||||
updatePosition();
|
||||
}
|
||||
bool active;
|
||||
int last_x;
|
||||
int last_y;
|
||||
void updatePosition() {
|
||||
int x = event->getPixelX();
|
||||
int y = event->getPixelY();
|
||||
setX(x);
|
||||
setY(y);
|
||||
setZValue(event->y());
|
||||
}
|
||||
void move(int x, int y);
|
||||
void emitPositionChanged() {
|
||||
emit xChanged(event->x());
|
||||
emit yChanged(event->y());
|
||||
emit elevationChanged(event->elevation());
|
||||
}
|
||||
void updatePixmap() {
|
||||
QList<Event*> objects;
|
||||
objects.append(event);
|
||||
event->pixmap = QPixmap();
|
||||
editor->project->loadEventPixmaps(objects);
|
||||
this->updatePosition();
|
||||
editor->redrawObject(this);
|
||||
emit spriteChanged(event->pixmap);
|
||||
}
|
||||
void bind(QComboBox *combo, QString key) {
|
||||
connect(combo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::currentTextChanged),
|
||||
this, [this, key](QString value){
|
||||
this->event->put(key, value);
|
||||
});
|
||||
connect(this, &DraggablePixmapItem::onPropertyChanged,
|
||||
this, [combo, key](QString key2, QString value){
|
||||
if (key2 == key) {
|
||||
combo->addItem(value);
|
||||
combo->setCurrentText(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
signals:
|
||||
void positionChanged(Event *event);
|
||||
void xChanged(int);
|
||||
void yChanged(int);
|
||||
void elevationChanged(int);
|
||||
void spriteChanged(QPixmap pixmap);
|
||||
void onPropertyChanged(QString key, QString value);
|
||||
|
||||
public slots:
|
||||
void set_x(const QString &text) {
|
||||
event->put("x", text);
|
||||
updatePosition();
|
||||
}
|
||||
void set_y(const QString &text) {
|
||||
event->put("y", text);
|
||||
updatePosition();
|
||||
}
|
||||
void set_elevation(const QString &text) {
|
||||
event->put("elevation", text);
|
||||
updatePosition();
|
||||
}
|
||||
void set_sprite(const QString &text) {
|
||||
event->put("sprite", text);
|
||||
updatePixmap();
|
||||
}
|
||||
void set_script(const QString &text) {
|
||||
event->put("script_label", text);
|
||||
}
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
|
||||
};
|
||||
|
||||
#endif // EDITOR_H
|
||||
@@ -1,286 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EventPropertiesFrame</class>
|
||||
<widget class="QFrame" name="EventPropertiesFrame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>284</width>
|
||||
<height>146</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>284</width>
|
||||
<height>90</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Frame</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_spritePixmap">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>64</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="indent">
|
||||
<number>-1</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="text">
|
||||
<string>Object 1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="x">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_x">
|
||||
<property name="text">
|
||||
<string>X</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="NoScrollSpinBox" name="spinBox_x">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The X coordinate of this object.</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-32768</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>32767</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="y">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_y">
|
||||
<property name="text">
|
||||
<string>Y</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="NoScrollSpinBox" name="spinBox_y">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The Y coordinate of this object.</p></body></html></string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>-32768</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>32767</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="z">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Z</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="NoScrollSpinBox" name="spinBox_z">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The elevation of this object.</p></body></html></string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>15</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="sprite" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_sprite">
|
||||
<property name="leftMargin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_sprite">
|
||||
<property name="text">
|
||||
<string>Sprite</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>comboBox_sprite</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="NoScrollComboBox" name="comboBox_sprite">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The sprite graphics to use for this object.</p></body></html></string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="currentText">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maxVisibleItems">
|
||||
<number>25</number>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>NoScrollComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header>noscrollcombobox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>NoScrollSpinBox</class>
|
||||
<extends>QSpinBox</extends>
|
||||
<header>noscrollspinbox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>spinBox_x</tabstop>
|
||||
<tabstop>spinBox_y</tabstop>
|
||||
<tabstop>spinBox_z</tabstop>
|
||||
<tabstop>comboBox_sprite</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
161
src/mainwindow.h
@@ -1,161 +0,0 @@
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QString>
|
||||
#include <QModelIndex>
|
||||
#include <QMainWindow>
|
||||
#include <QStandardItemModel>
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QGraphicsItemGroup>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QAbstractItemModel>
|
||||
#include "project.h"
|
||||
#include "map.h"
|
||||
#include "editor.h"
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
public slots:
|
||||
void scaleMapView(int);
|
||||
|
||||
private slots:
|
||||
void on_action_Open_Project_triggered();
|
||||
void on_mapList_activated(const QModelIndex &index);
|
||||
void on_action_Save_Project_triggered();
|
||||
void openWarpMap(QString map_name, QString warp_num);
|
||||
|
||||
void undo();
|
||||
void redo();
|
||||
|
||||
void openInTextEditor();
|
||||
|
||||
void onLoadMapRequested(QString, QString);
|
||||
void onMapChanged(Map *map);
|
||||
void onMapNeedsRedrawing();
|
||||
|
||||
void on_action_Save_triggered();
|
||||
void on_tabWidget_2_currentChanged(int index);
|
||||
void on_action_Exit_triggered();
|
||||
void on_comboBox_Song_activated(const QString &arg1);
|
||||
void on_comboBox_Location_activated(const QString &arg1);
|
||||
void on_comboBox_Visibility_activated(const QString &arg1);
|
||||
void on_comboBox_Weather_activated(const QString &arg1);
|
||||
void on_comboBox_Type_activated(const QString &arg1);
|
||||
void on_comboBox_BattleScene_activated(const QString &arg1);
|
||||
void on_checkBox_ShowLocation_clicked(bool checked);
|
||||
|
||||
void on_tabWidget_currentChanged(int index);
|
||||
|
||||
void on_actionUndo_triggered();
|
||||
|
||||
void on_actionRedo_triggered();
|
||||
|
||||
void on_actionZoom_In_triggered();
|
||||
void on_actionZoom_Out_triggered();
|
||||
void on_actionBetter_Cursors_triggered();
|
||||
void on_actionPencil_triggered();
|
||||
void on_actionPointer_triggered();
|
||||
void on_actionFlood_Fill_triggered();
|
||||
void on_actionEyedropper_triggered();
|
||||
void on_actionMove_triggered();
|
||||
void on_actionMap_Shift_triggered();
|
||||
|
||||
void on_toolButton_deleteObject_clicked();
|
||||
void on_toolButton_Open_Scripts_clicked();
|
||||
|
||||
void addNewEvent(QString);
|
||||
void updateSelectedObjects();
|
||||
|
||||
void on_toolButton_Paint_clicked();
|
||||
|
||||
void on_toolButton_Select_clicked();
|
||||
|
||||
void on_toolButton_Fill_clicked();
|
||||
|
||||
void on_toolButton_Dropper_clicked();
|
||||
|
||||
void on_toolButton_Move_clicked();
|
||||
|
||||
void on_toolButton_Shift_clicked();
|
||||
|
||||
void onOpenMapListContextMenu(const QPoint &point);
|
||||
void onAddNewMapToGroupClick(QAction* triggeredAction);
|
||||
void onTilesetChanged(QString);
|
||||
void currentMetatilesSelectionChanged();
|
||||
|
||||
void on_action_Export_Map_Image_triggered();
|
||||
|
||||
void on_comboBox_ConnectionDirection_currentIndexChanged(const QString &arg1);
|
||||
|
||||
void on_spinBox_ConnectionOffset_valueChanged(int offset);
|
||||
|
||||
void on_comboBox_ConnectedMap_currentTextChanged(const QString &mapName);
|
||||
|
||||
void on_pushButton_AddConnection_clicked();
|
||||
|
||||
void on_pushButton_RemoveConnection_clicked();
|
||||
|
||||
void on_comboBox_DiveMap_currentTextChanged(const QString &mapName);
|
||||
|
||||
void on_comboBox_EmergeMap_currentTextChanged(const QString &mapName);
|
||||
|
||||
void on_comboBox_PrimaryTileset_activated(const QString &arg1);
|
||||
|
||||
void on_comboBox_SecondaryTileset_activated(const QString &arg1);
|
||||
|
||||
void on_pushButton_clicked();
|
||||
|
||||
void on_checkBox_smartPaths_stateChanged(int selected);
|
||||
|
||||
void on_checkBox_Visibility_clicked(bool checked);
|
||||
|
||||
void on_checkBox_ToggleBorder_stateChanged(int arg1);
|
||||
|
||||
void resetMapViewScale();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
QStandardItemModel *mapListModel;
|
||||
QList<QStandardItem*> *mapGroupsModel;
|
||||
Editor *editor = nullptr;
|
||||
QIcon* mapIcon;
|
||||
void setMap(QString);
|
||||
void redrawMapScene();
|
||||
void loadDataStructures();
|
||||
void populateMapList();
|
||||
QString getExistingDirectory(QString);
|
||||
void openProject(QString dir);
|
||||
QString getDefaultMap();
|
||||
void setRecentMap(QString map_name);
|
||||
QStandardItem* createMapItem(QString mapName, int groupNum, int inGroupNum);
|
||||
|
||||
void markAllEdited(QAbstractItemModel *model);
|
||||
void markEdited(QModelIndex index);
|
||||
void updateMapList();
|
||||
|
||||
void displayMapProperties();
|
||||
void checkToolButtons();
|
||||
|
||||
void initExtraShortcuts();
|
||||
void initExtraSignals();
|
||||
void initEditor();
|
||||
void loadUserSettings();
|
||||
void openRecentProject();
|
||||
};
|
||||
|
||||
enum MapListUserRoles {
|
||||
GroupRole = Qt::UserRole + 1, // Used to hold the map group number.
|
||||
TypeRole = Qt::UserRole + 2, // Used to differentiate between the different layers of the map list tree view.
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
2294
src/mainwindow.ui
@@ -1,89 +0,0 @@
|
||||
#-------------------------------------------------
|
||||
#
|
||||
# Project created by QtCreator 2016-08-31T15:19:13
|
||||
#
|
||||
#-------------------------------------------------
|
||||
|
||||
QT += core gui
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
TARGET = porymap
|
||||
TEMPLATE = app
|
||||
RC_ICONS = resources/icons/porymap-icon-1.ico
|
||||
ICON = resources/icons/porymap-icon-1.ico
|
||||
|
||||
|
||||
SOURCES += core/block.cpp \
|
||||
core/blockdata.cpp \
|
||||
core/event.cpp \
|
||||
core/heallocation.cpp \
|
||||
core/historyitem.cpp \
|
||||
core/map.cpp \
|
||||
core/maplayout.cpp \
|
||||
core/metatile.cpp \
|
||||
core/parseutil.cpp \
|
||||
core/tile.cpp \
|
||||
core/tileset.cpp \
|
||||
ui/bordermetatilespixmapitem.cpp \
|
||||
ui/collisionpixmapitem.cpp \
|
||||
ui/connectionpixmapitem.cpp \
|
||||
ui/currentselectedmetatilespixmapitem.cpp \
|
||||
ui/eventpropertiesframe.cpp \
|
||||
ui/graphicsview.cpp \
|
||||
ui/imageproviders.cpp \
|
||||
ui/mappixmapitem.cpp \
|
||||
ui/metatileselector.cpp \
|
||||
ui/movementpermissionsselector.cpp \
|
||||
ui/neweventtoolbutton.cpp \
|
||||
ui/noscrollcombobox.cpp \
|
||||
ui/noscrollspinbox.cpp \
|
||||
ui/selectablepixmapitem.cpp \
|
||||
editor.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
project.cpp \
|
||||
settings.cpp \
|
||||
ui/mapsceneeventfilter.cpp
|
||||
|
||||
HEADERS += core/block.h \
|
||||
core/blockdata.h \
|
||||
core/event.h \
|
||||
core/heallocation.h \
|
||||
core/history.h \
|
||||
core/historyitem.h \
|
||||
core/map.h \
|
||||
core/mapconnection.h \
|
||||
core/maplayout.h \
|
||||
core/metatile.h \
|
||||
core/parseutil.h \
|
||||
core/tile.h \
|
||||
core/tileset.h \
|
||||
ui/bordermetatilespixmapitem.h \
|
||||
ui/collisionpixmapitem.h \
|
||||
ui/connectionpixmapitem.h \
|
||||
ui/currentselectedmetatilespixmapitem.h \
|
||||
ui/eventpropertiesframe.h \
|
||||
ui/graphicsview.h \
|
||||
ui/imageproviders.h \
|
||||
ui/mappixmapitem.h \
|
||||
ui/metatileselector.h \
|
||||
ui/movementpermissionsselector.h \
|
||||
ui/neweventtoolbutton.h \
|
||||
ui/noscrollcombobox.h \
|
||||
ui/noscrollspinbox.h \
|
||||
ui/selectablepixmapitem.h \
|
||||
editor.h \
|
||||
mainwindow.h \
|
||||
project.h \
|
||||
settings.h \
|
||||
ui/mapsceneeventfilter.h
|
||||
|
||||
FORMS += mainwindow.ui \
|
||||
eventpropertiesframe.ui
|
||||
|
||||
RESOURCES += \
|
||||
resources/images.qrc
|
||||
|
||||
INCLUDEPATH += core
|
||||
INCLUDEPATH += ui
|
||||
152
src/project.h
@@ -1,152 +0,0 @@
|
||||
#ifndef PROJECT_H
|
||||
#define PROJECT_H
|
||||
|
||||
#include "map.h"
|
||||
#include "blockdata.h"
|
||||
#include "heallocation.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QList>
|
||||
#include <QStandardItem>
|
||||
|
||||
static QString NONE_MAP_CONSTANT = "MAP_NONE";
|
||||
static QString NONE_MAP_NAME = "None";
|
||||
|
||||
class Project
|
||||
{
|
||||
public:
|
||||
Project();
|
||||
QString root;
|
||||
QStringList *groupNames = nullptr;
|
||||
QMap<QString, int> *map_groups;
|
||||
QList<QStringList> groupedMapNames;
|
||||
QStringList *mapNames = nullptr;
|
||||
QList<HealLocation> flyableMaps;
|
||||
QMap<QString, QString>* mapConstantsToMapNames;
|
||||
QMap<QString, QString>* mapNamesToMapConstants;
|
||||
QList<QString> mapLayoutsTable;
|
||||
QList<QString> mapLayoutsTableMaster;
|
||||
QMap<QString, MapLayout*> mapLayouts;
|
||||
QMap<QString, MapLayout*> mapLayoutsMaster;
|
||||
QStringList *regionMapSections = nullptr;
|
||||
QStringList *itemNames = nullptr;
|
||||
QStringList *flagNames = nullptr;
|
||||
QStringList *varNames = nullptr;
|
||||
QStringList *movementTypes = nullptr;
|
||||
QStringList *mapTypes = nullptr;
|
||||
QStringList *mapBattleScenes = nullptr;
|
||||
QStringList *weatherNames = nullptr;
|
||||
QStringList *coordEventWeatherNames = nullptr;
|
||||
QStringList *secretBaseIds = nullptr;
|
||||
QStringList *bgEventFacingDirections = nullptr;
|
||||
QStringList mapsWithConnections;
|
||||
|
||||
QMap<QString, Map*> *map_cache;
|
||||
Map* loadMap(QString);
|
||||
Map* getMap(QString);
|
||||
|
||||
QMap<QString, Tileset*> *tileset_cache = nullptr;
|
||||
Tileset* loadTileset(QString);
|
||||
Tileset* getTileset(QString);
|
||||
|
||||
Blockdata* readBlockdata(QString);
|
||||
void loadBlockdata(Map*);
|
||||
|
||||
QString readTextFile(QString path);
|
||||
void saveTextFile(QString path, QString text);
|
||||
void appendTextFile(QString path, QString text);
|
||||
void deleteFile(QString path);
|
||||
|
||||
void readMapGroups();
|
||||
Map* addNewMapToGroup(QString mapName, int groupNum);
|
||||
QString getNewMapName();
|
||||
QString getProjectTitle();
|
||||
|
||||
QList<QStringList>* getLabelMacros(QList<QStringList>*, QString);
|
||||
QStringList* getLabelValues(QList<QStringList>*, QString);
|
||||
void readMapHeader(Map*);
|
||||
void readMapLayoutsTable();
|
||||
void readAllMapLayouts();
|
||||
QStringList* readLayoutValues(QString layoutName);
|
||||
void readMapLayout(Map*);
|
||||
void readMapsWithConnections();
|
||||
void loadMapTilesets(Map*);
|
||||
void loadTilesetAssets(Tileset*);
|
||||
|
||||
void saveBlockdata(Map*);
|
||||
void saveMapBorder(Map*);
|
||||
void writeBlockdata(QString, Blockdata*);
|
||||
void saveAllMaps();
|
||||
void saveMap(Map*);
|
||||
void saveAllDataStructures();
|
||||
void saveAllMapLayouts();
|
||||
void saveMapGroupsTable();
|
||||
void saveMapConstantsHeader();
|
||||
void saveHealLocationStruct(Map*);
|
||||
|
||||
QList<QStringList>* parseAsm(QString text);
|
||||
QStringList getSongNames();
|
||||
QStringList getVisibilities();
|
||||
QMap<QString, QStringList> getTilesets();
|
||||
void readTilesetProperties();
|
||||
void readRegionMapSections();
|
||||
void readItemNames();
|
||||
void readFlagNames();
|
||||
void readVarNames();
|
||||
void readMovementTypes();
|
||||
void readMapTypes();
|
||||
void readMapBattleScenes();
|
||||
void readWeatherNames();
|
||||
void readCoordEventWeatherNames();
|
||||
void readSecretBaseIds();
|
||||
void readBgEventFacingDirections();
|
||||
|
||||
void loadEventPixmaps(QList<Event*> objects);
|
||||
QMap<QString, int> getEventObjGfxConstants();
|
||||
QString fixGraphicPath(QString path);
|
||||
|
||||
void readMapEvents(Map *map);
|
||||
void loadMapConnections(Map *map);
|
||||
|
||||
void loadMapBorder(Map *map);
|
||||
|
||||
void saveMapEvents(Map *map);
|
||||
|
||||
QStringList readCArray(QString text, QString label);
|
||||
QString readCIncbin(QString text, QString label);
|
||||
QMap<QString, int> readCDefines(QString text, QStringList prefixes);
|
||||
|
||||
static int getNumTilesPrimary();
|
||||
static int getNumTilesTotal();
|
||||
static int getNumMetatilesPrimary();
|
||||
static int getNumMetatilesTotal();
|
||||
static int getNumPalettesPrimary();
|
||||
static int getNumPalettesTotal();
|
||||
private:
|
||||
QString getMapLayoutsTableFilepath();
|
||||
QString getMapLayoutFilepath(QString);
|
||||
void saveMapHeader(Map*);
|
||||
void saveMapConnections(Map*);
|
||||
void updateMapsWithConnections(Map*);
|
||||
void saveMapsWithConnections();
|
||||
void saveMapLayoutsTable();
|
||||
void updateMapLayout(Map*);
|
||||
void readCDefinesSorted(QString, QStringList, QStringList*);
|
||||
void readCDefinesSorted(QString, QStringList, QStringList*, QString, int);
|
||||
|
||||
void setNewMapHeader(Map* map, int mapIndex);
|
||||
void setNewMapLayout(Map* map);
|
||||
void setNewMapBlockdata(Map* map);
|
||||
void setNewMapBorder(Map *map);
|
||||
void setNewMapEvents(Map *map);
|
||||
void setNewMapConnections(Map *map);
|
||||
|
||||
static int num_tiles_primary;
|
||||
static int num_tiles_total;
|
||||
static int num_metatiles_primary;
|
||||
static int num_metatiles_total;
|
||||
static int num_pals_primary;
|
||||
static int num_pals_total;
|
||||
};
|
||||
|
||||
#endif // PROJECT_H
|
||||
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 5.3 KiB |
@@ -1,27 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>icons/folder.ico</file>
|
||||
<file>icons/folder_closed.ico</file>
|
||||
<file>icons/folder_closed_map.ico</file>
|
||||
<file>icons/folder_image.ico</file>
|
||||
<file>icons/folder_map.ico</file>
|
||||
<file>icons/image.ico</file>
|
||||
<file>icons/map.ico</file>
|
||||
<file>icons/cursor.ico</file>
|
||||
<file>icons/fill_color.ico</file>
|
||||
<file>icons/move.ico</file>
|
||||
<file>icons/pencil.ico</file>
|
||||
<file>icons/pipette.ico</file>
|
||||
<file>images/Entities_16x16.png</file>
|
||||
<file>icons/add.ico</file>
|
||||
<file>icons/delete.ico</file>
|
||||
<file>icons/viewsprites.ico</file>
|
||||
<file>images/collisions.png</file>
|
||||
<file>icons/fill_color_cursor.ico</file>
|
||||
<file>icons/pencil_cursor.ico</file>
|
||||
<file>icons/pipette_cursor.ico</file>
|
||||
<file>icons/shift.ico</file>
|
||||
<file>icons/shift_cursor.ico</file>
|
||||
<file>icons/porymap-icon-1.ico</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Before Width: | Height: | Size: 490 B |
|
Before Width: | Height: | Size: 2.0 KiB |
@@ -1,15 +0,0 @@
|
||||
#ifndef SETTINGS_H
|
||||
#define SETTINGS_H
|
||||
|
||||
#include <QCursor>
|
||||
|
||||
class Settings
|
||||
{
|
||||
public:
|
||||
Settings();
|
||||
bool smartPathsEnabled;
|
||||
bool betterCursors;
|
||||
QCursor mapCursor;
|
||||
};
|
||||
|
||||
#endif // SETTINGS_H
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef BORDERMETATILESPIXMAPITEM_H
|
||||
#define BORDERMETATILESPIXMAPITEM_H
|
||||
|
||||
#include "map.h"
|
||||
#include "metatileselector.h"
|
||||
#include <QGraphicsPixmapItem>
|
||||
|
||||
class BorderMetatilesPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
BorderMetatilesPixmapItem(Map *map_, MetatileSelector *metatileSelector) {
|
||||
this->map = map_;
|
||||
this->metatileSelector = metatileSelector;
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
MetatileSelector *metatileSelector;
|
||||
Map* map;
|
||||
void draw();
|
||||
signals:
|
||||
void borderMetatilesChanged();
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
};
|
||||
|
||||
#endif // BORDERMETATILESPIXMAPITEM_H
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef COLLISIONPIXMAPITEM_H
|
||||
#define COLLISIONPIXMAPITEM_H
|
||||
|
||||
#include "metatileselector.h"
|
||||
#include "movementpermissionsselector.h"
|
||||
#include "mappixmapitem.h"
|
||||
#include "map.h"
|
||||
#include "settings.h"
|
||||
|
||||
class CollisionPixmapItem : public MapPixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CollisionPixmapItem(Map *map, MovementPermissionsSelector *movementPermissionsSelector, MetatileSelector *metatileSelector, Settings *settings)
|
||||
: MapPixmapItem(map, metatileSelector, settings){
|
||||
this->movementPermissionsSelector = movementPermissionsSelector;
|
||||
}
|
||||
MovementPermissionsSelector *movementPermissionsSelector;
|
||||
void updateMovementPermissionSelection(QGraphicsSceneMouseEvent *event);
|
||||
virtual void paint(QGraphicsSceneMouseEvent*);
|
||||
virtual void floodFill(QGraphicsSceneMouseEvent*);
|
||||
virtual void pick(QGraphicsSceneMouseEvent*);
|
||||
virtual void draw(bool ignoreCache = false);
|
||||
|
||||
signals:
|
||||
void mouseEvent(QGraphicsSceneMouseEvent *, CollisionPixmapItem *);
|
||||
void hoveredMapMovementPermissionChanged(int, int);
|
||||
void hoveredMapMovementPermissionCleared();
|
||||
|
||||
protected:
|
||||
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
||||
};
|
||||
|
||||
#endif // COLLISIONPIXMAPITEM_H
|
||||
@@ -1,44 +0,0 @@
|
||||
#ifndef CONNECTIONPIXMAPITEM_H
|
||||
#define CONNECTIONPIXMAPITEM_H
|
||||
|
||||
#include "mapconnection.h"
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QPainter>
|
||||
|
||||
class ConnectionPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConnectionPixmapItem(QPixmap pixmap, MapConnection* connection, int x, int y, int baseMapWidth, int baseMapHeight): QGraphicsPixmapItem(pixmap) {
|
||||
this->basePixmap = pixmap;
|
||||
this->connection = connection;
|
||||
setFlag(ItemIsMovable);
|
||||
setFlag(ItemSendsGeometryChanges);
|
||||
this->initialX = x;
|
||||
this->initialY = y;
|
||||
this->initialOffset = connection->offset.toInt();
|
||||
this->baseMapWidth = baseMapWidth;
|
||||
this->baseMapHeight = baseMapHeight;
|
||||
}
|
||||
QPixmap basePixmap;
|
||||
MapConnection* connection;
|
||||
int initialX;
|
||||
int initialY;
|
||||
int initialOffset;
|
||||
int baseMapWidth;
|
||||
int baseMapHeight;
|
||||
void render(qreal opacity = 1);
|
||||
int getMinOffset();
|
||||
int getMaxOffset();
|
||||
|
||||
protected:
|
||||
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
|
||||
|
||||
signals:
|
||||
void connectionItemSelected(ConnectionPixmapItem* connectionItem);
|
||||
void connectionItemDoubleClicked(ConnectionPixmapItem* connectionItem);
|
||||
void connectionMoved(MapConnection*);
|
||||
};
|
||||
|
||||
#endif // CONNECTIONPIXMAPITEM_H
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef CURRENTSELECTEDMETATILESPIXMAPITEM_H
|
||||
#define CURRENTSELECTEDMETATILESPIXMAPITEM_H
|
||||
|
||||
#include "map.h"
|
||||
#include "metatileselector.h"
|
||||
#include <QGraphicsPixmapItem>
|
||||
|
||||
class CurrentSelectedMetatilesPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
CurrentSelectedMetatilesPixmapItem(Map *map, MetatileSelector *metatileSelector) {
|
||||
this->map = map;
|
||||
this->metatileSelector = metatileSelector;
|
||||
}
|
||||
Map* map = nullptr;
|
||||
MetatileSelector *metatileSelector;
|
||||
void draw();
|
||||
};
|
||||
|
||||
#endif // CURRENTSELECTEDMETATILESPIXMAPITEM_H
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef EVENTPROPERTIESFRAME_H
|
||||
#define EVENTPROPERTIESFRAME_H
|
||||
|
||||
#include <QFrame>
|
||||
|
||||
namespace Ui {
|
||||
class EventPropertiesFrame;
|
||||
}
|
||||
|
||||
class EventPropertiesFrame : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit EventPropertiesFrame(QWidget *parent = nullptr);
|
||||
~EventPropertiesFrame();
|
||||
|
||||
public:
|
||||
Ui::EventPropertiesFrame *ui;
|
||||
};
|
||||
|
||||
#endif // EVENTPROPERTIESFRAME_H
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef GRAPHICSVIEW_H
|
||||
#define GRAPHICSVIEW_H
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QMouseEvent>
|
||||
|
||||
class Editor;
|
||||
|
||||
class GraphicsView : public QGraphicsView
|
||||
{
|
||||
public:
|
||||
GraphicsView() : QGraphicsView() {}
|
||||
GraphicsView(QWidget *parent) : QGraphicsView(parent) {}
|
||||
|
||||
public:
|
||||
// GraphicsView_Object object;
|
||||
Editor *editor;
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
};
|
||||
|
||||
//Q_DECLARE_METATYPE(GraphicsView)
|
||||
|
||||
#endif // GRAPHICSVIEW_H
|
||||
@@ -1,14 +0,0 @@
|
||||
#ifndef IMAGEPROVIDERS_H
|
||||
#define IMAGEPROVIDERS_H
|
||||
|
||||
#include "block.h"
|
||||
#include "tileset.h"
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
|
||||
QImage getCollisionMetatileImage(Block);
|
||||
QImage getCollisionMetatileImage(int, int);
|
||||
QImage getMetatileImage(int, Tileset*, Tileset*);
|
||||
QImage getTileImage(int, Tileset*, Tileset*);
|
||||
|
||||
#endif // IMAGEPROVIDERS_H
|
||||
@@ -1,55 +0,0 @@
|
||||
#ifndef MAPPIXMAPITEM_H
|
||||
#define MAPPIXMAPITEM_H
|
||||
|
||||
#include "map.h"
|
||||
#include "settings.h"
|
||||
#include "metatileselector.h"
|
||||
#include <QGraphicsPixmapItem>
|
||||
|
||||
class MapPixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MapPixmapItem(Map *map_, MetatileSelector *metatileSelector, Settings *settings) {
|
||||
this->map = map_;
|
||||
this->metatileSelector = metatileSelector;
|
||||
this->settings = settings;
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
Map *map;
|
||||
MetatileSelector *metatileSelector;
|
||||
Settings *settings;
|
||||
bool active;
|
||||
bool right_click;
|
||||
int paint_tile_initial_x;
|
||||
int paint_tile_initial_y;
|
||||
QPoint selection_origin;
|
||||
QList<QPoint> selection;
|
||||
virtual void paint(QGraphicsSceneMouseEvent*);
|
||||
virtual void floodFill(QGraphicsSceneMouseEvent*);
|
||||
void _floodFill(int x, int y);
|
||||
void _floodFillSmartPath(int initialX, int initialY);
|
||||
virtual void pick(QGraphicsSceneMouseEvent*);
|
||||
virtual void select(QGraphicsSceneMouseEvent*);
|
||||
virtual void shift(QGraphicsSceneMouseEvent*);
|
||||
virtual void draw(bool ignoreCache = false);
|
||||
void updateMetatileSelection(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
private:
|
||||
void paintNormal(int x, int y);
|
||||
void paintSmartPath(int x, int y);
|
||||
static QList<int> smartPathTable;
|
||||
|
||||
signals:
|
||||
void mouseEvent(QGraphicsSceneMouseEvent *, MapPixmapItem *);
|
||||
void hoveredMapMetatileChanged(int x, int y);
|
||||
void hoveredMapMetatileCleared();
|
||||
|
||||
protected:
|
||||
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
||||
};
|
||||
|
||||
#endif // MAPPIXMAPITEM_H
|
||||
@@ -7,7 +7,7 @@ MapSceneEventFilter::MapSceneEventFilter(QObject *parent) : QObject(parent)
|
||||
|
||||
}
|
||||
|
||||
bool MapSceneEventFilter::eventFilter(QObject *obj, QEvent *event)
|
||||
bool MapSceneEventFilter::eventFilter(QObject*, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::GraphicsSceneWheel)
|
||||
{
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifndef MAPSCENEEVENTFILTER_H
|
||||
#define MAPSCENEEVENTFILTER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class MapSceneEventFilter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
public:
|
||||
explicit MapSceneEventFilter(QObject *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void wheelZoom(int delta);
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // MAPSCENEEVENTFILTER_H
|
||||
@@ -1,51 +0,0 @@
|
||||
#ifndef METATILESELECTOR_H
|
||||
#define METATILESELECTOR_H
|
||||
|
||||
#include "selectablepixmapitem.h"
|
||||
#include "tileset.h"
|
||||
|
||||
class MetatileSelector: public SelectablePixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MetatileSelector(int numMetatilesWide, Tileset *primaryTileset, Tileset *secondaryTileset): SelectablePixmapItem(16, 16) {
|
||||
this->externalSelection = false;
|
||||
this->numMetatilesWide = numMetatilesWide;
|
||||
this->primaryTileset = primaryTileset;
|
||||
this->secondaryTileset = secondaryTileset;
|
||||
this->selectedMetatiles = new QList<uint16_t>();
|
||||
this->externalSelectedMetatiles = new QList<uint16_t>();
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
QPoint getSelectionDimensions();
|
||||
void draw();
|
||||
void select(uint16_t metatile);
|
||||
void setTilesets(Tileset*, Tileset*);
|
||||
QList<uint16_t>* getSelectedMetatiles();
|
||||
void setExternalSelection(int, int, QList<uint16_t>*);
|
||||
protected:
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
||||
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
|
||||
private:
|
||||
bool externalSelection;
|
||||
int numMetatilesWide;
|
||||
Tileset *primaryTileset;
|
||||
Tileset *secondaryTileset;
|
||||
QList<uint16_t> *selectedMetatiles;
|
||||
int externalSelectionWidth;
|
||||
int externalSelectionHeight;
|
||||
QList<uint16_t> *externalSelectedMetatiles;
|
||||
|
||||
void updateSelectedMetatiles();
|
||||
uint16_t getMetatileId(int x, int y);
|
||||
QPoint getMetatileIdCoords(uint16_t);
|
||||
|
||||
signals:
|
||||
void hoveredMetatileSelectionChanged(uint16_t);
|
||||
void hoveredMetatileSelectionCleared();
|
||||
void selectedMetatilesChanged();
|
||||
};
|
||||
|
||||
#endif // METATILESELECTOR_H
|
||||
@@ -1,29 +0,0 @@
|
||||
#ifndef MOVEMENTPERMISSIONSSELECTOR_H
|
||||
#define MOVEMENTPERMISSIONSSELECTOR_H
|
||||
|
||||
#include "selectablepixmapitem.h"
|
||||
|
||||
class MovementPermissionsSelector: public SelectablePixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
MovementPermissionsSelector(): SelectablePixmapItem(32, 32, 1, 1) {
|
||||
setAcceptHoverEvents(true);
|
||||
}
|
||||
void draw();
|
||||
uint16_t getSelectedCollision();
|
||||
uint16_t getSelectedElevation();
|
||||
void select(uint16_t collision, uint16_t elevation);
|
||||
|
||||
protected:
|
||||
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
|
||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
|
||||
|
||||
private:
|
||||
void setSelectedMovementPermissions(QPointF);
|
||||
|
||||
signals:
|
||||
void hoveredMovementPermissionChanged(uint16_t, uint16_t);
|
||||
void hoveredMovementPermissionCleared();
|
||||
};
|
||||
|
||||
#endif // MOVEMENTPERMISSIONSSELECTOR_H
|
||||
@@ -1,37 +0,0 @@
|
||||
#ifndef NEWEVENTTOOLBUTTON_H
|
||||
#define NEWEVENTTOOLBUTTON_H
|
||||
|
||||
#include "event.h"
|
||||
#include <QToolButton>
|
||||
|
||||
class NewEventToolButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NewEventToolButton(QWidget *parent = nullptr);
|
||||
QString getSelectedEventType();
|
||||
public slots:
|
||||
void newObject();
|
||||
void newWarp();
|
||||
void newHealLocation();
|
||||
void newCoordScript();
|
||||
void newCoordWeather();
|
||||
void newSign();
|
||||
void newHiddenItem();
|
||||
void newSecretBase();
|
||||
signals:
|
||||
void newEventAdded(QString);
|
||||
private:
|
||||
QString selectedEventType;
|
||||
QAction *newObjectAction;
|
||||
QAction *newWarpAction;
|
||||
QAction *newHealLocationAction;
|
||||
QAction *newCoordScriptAction;
|
||||
QAction *newCoordWeatherAction;
|
||||
QAction *newSignAction;
|
||||
QAction *newHiddenItemAction;
|
||||
QAction *newSecretBaseAction;
|
||||
void init();
|
||||
};
|
||||
|
||||
#endif // NEWEVENTTOOLBUTTON_H
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef NOSCROLLCOMBOBOX_H
|
||||
#define NOSCROLLCOMBOBOX_H
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
class NoScrollComboBox : public QComboBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NoScrollComboBox(QWidget *parent = nullptr);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif // NOSCROLLCOMBOBOX_H
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef NOSCROLLSPINBOX_H
|
||||
#define NOSCROLLSPINBOX_H
|
||||
|
||||
#include <QSpinBox>
|
||||
|
||||
class NoScrollSpinBox : public QSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit NoScrollSpinBox(QWidget *parent = nullptr);
|
||||
void wheelEvent(QWheelEvent *event);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
#endif // NOSCROLLSPINBOX_H
|
||||
@@ -1,40 +0,0 @@
|
||||
#ifndef SELECTABLEPIXMAPITEM_H
|
||||
#define SELECTABLEPIXMAPITEM_H
|
||||
|
||||
#include <QGraphicsPixmapItem>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
|
||||
class SelectablePixmapItem : public QObject, public QGraphicsPixmapItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
SelectablePixmapItem(int cellWidth, int cellHeight): SelectablePixmapItem(cellWidth, cellHeight, INT_MAX, INT_MAX) {}
|
||||
SelectablePixmapItem(int cellWidth, int cellHeight, int maxSelectionWidth, int maxSelectionHeight) {
|
||||
this->cellWidth = cellWidth;
|
||||
this->cellHeight = cellHeight;
|
||||
this->maxSelectionWidth = maxSelectionWidth;
|
||||
this->maxSelectionHeight = maxSelectionHeight;
|
||||
}
|
||||
virtual QPoint getSelectionDimensions();
|
||||
virtual void draw() = 0;
|
||||
|
||||
protected:
|
||||
int cellWidth;
|
||||
int cellHeight;
|
||||
int maxSelectionWidth;
|
||||
int maxSelectionHeight;
|
||||
int selectionInitialX;
|
||||
int selectionInitialY;
|
||||
int selectionOffsetX;
|
||||
int selectionOffsetY;
|
||||
|
||||
QPoint getSelectionStart();
|
||||
void select(int, int, int, int);
|
||||
void updateSelection(int, int);
|
||||
QPoint getCellPos(QPointF);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
|
||||
virtual void drawSelection();
|
||||
};
|
||||
|
||||
#endif // SELECTABLEPIXMAPITEM_H
|
||||