Merge remote-tracking branch 'origin/master' into rebranding
165
LICENSE.md
Normal file
|
@ -0,0 +1,165 @@
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
This version of the GNU Lesser General Public License incorporates
|
||||||
|
the terms and conditions of version 3 of the GNU General Public
|
||||||
|
License, supplemented by the additional permissions listed below.
|
||||||
|
|
||||||
|
0. Additional Definitions.
|
||||||
|
|
||||||
|
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||||
|
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||||
|
General Public License.
|
||||||
|
|
||||||
|
"The Library" refers to a covered work governed by this License,
|
||||||
|
other than an Application or a Combined Work as defined below.
|
||||||
|
|
||||||
|
An "Application" is any work that makes use of an interface provided
|
||||||
|
by the Library, but which is not otherwise based on the Library.
|
||||||
|
Defining a subclass of a class defined by the Library is deemed a mode
|
||||||
|
of using an interface provided by the Library.
|
||||||
|
|
||||||
|
A "Combined Work" is a work produced by combining or linking an
|
||||||
|
Application with the Library. The particular version of the Library
|
||||||
|
with which the Combined Work was made is also called the "Linked
|
||||||
|
Version".
|
||||||
|
|
||||||
|
The "Minimal Corresponding Source" for a Combined Work means the
|
||||||
|
Corresponding Source for the Combined Work, excluding any source code
|
||||||
|
for portions of the Combined Work that, considered in isolation, are
|
||||||
|
based on the Application, and not on the Linked Version.
|
||||||
|
|
||||||
|
The "Corresponding Application Code" for a Combined Work means the
|
||||||
|
object code and/or source code for the Application, including any data
|
||||||
|
and utility programs needed for reproducing the Combined Work from the
|
||||||
|
Application, but excluding the System Libraries of the Combined Work.
|
||||||
|
|
||||||
|
1. Exception to Section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
You may convey a covered work under sections 3 and 4 of this License
|
||||||
|
without being bound by section 3 of the GNU GPL.
|
||||||
|
|
||||||
|
2. Conveying Modified Versions.
|
||||||
|
|
||||||
|
If you modify a copy of the Library, and, in your modifications, a
|
||||||
|
facility refers to a function or data to be supplied by an Application
|
||||||
|
that uses the facility (other than as an argument passed when the
|
||||||
|
facility is invoked), then you may convey a copy of the modified
|
||||||
|
version:
|
||||||
|
|
||||||
|
a) under this License, provided that you make a good faith effort to
|
||||||
|
ensure that, in the event an Application does not supply the
|
||||||
|
function or data, the facility still operates, and performs
|
||||||
|
whatever part of its purpose remains meaningful, or
|
||||||
|
|
||||||
|
b) under the GNU GPL, with none of the additional permissions of
|
||||||
|
this License applicable to that copy.
|
||||||
|
|
||||||
|
3. Object Code Incorporating Material from Library Header Files.
|
||||||
|
|
||||||
|
The object code form of an Application may incorporate material from
|
||||||
|
a header file that is part of the Library. You may convey such object
|
||||||
|
code under terms of your choice, provided that, if the incorporated
|
||||||
|
material is not limited to numerical parameters, data structure
|
||||||
|
layouts and accessors, or small macros, inline functions and templates
|
||||||
|
(ten or fewer lines in length), you do both of the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the object code that the
|
||||||
|
Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
4. Combined Works.
|
||||||
|
|
||||||
|
You may convey a Combined Work under terms of your choice that,
|
||||||
|
taken together, effectively do not restrict modification of the
|
||||||
|
portions of the Library contained in the Combined Work and reverse
|
||||||
|
engineering for debugging such modifications, if you also do each of
|
||||||
|
the following:
|
||||||
|
|
||||||
|
a) Give prominent notice with each copy of the Combined Work that
|
||||||
|
the Library is used in it and that the Library and its use are
|
||||||
|
covered by this License.
|
||||||
|
|
||||||
|
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||||
|
document.
|
||||||
|
|
||||||
|
c) For a Combined Work that displays copyright notices during
|
||||||
|
execution, include the copyright notice for the Library among
|
||||||
|
these notices, as well as a reference directing the user to the
|
||||||
|
copies of the GNU GPL and this license document.
|
||||||
|
|
||||||
|
d) Do one of the following:
|
||||||
|
|
||||||
|
0) Convey the Minimal Corresponding Source under the terms of this
|
||||||
|
License, and the Corresponding Application Code in a form
|
||||||
|
suitable for, and under terms that permit, the user to
|
||||||
|
recombine or relink the Application with a modified version of
|
||||||
|
the Linked Version to produce a modified Combined Work, in the
|
||||||
|
manner specified by section 6 of the GNU GPL for conveying
|
||||||
|
Corresponding Source.
|
||||||
|
|
||||||
|
1) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (a) uses at run time
|
||||||
|
a copy of the Library already present on the user's computer
|
||||||
|
system, and (b) will operate properly with a modified version
|
||||||
|
of the Library that is interface-compatible with the Linked
|
||||||
|
Version.
|
||||||
|
|
||||||
|
e) Provide Installation Information, but only if you would otherwise
|
||||||
|
be required to provide such information under section 6 of the
|
||||||
|
GNU GPL, and only to the extent that such information is
|
||||||
|
necessary to install and execute a modified version of the
|
||||||
|
Combined Work produced by recombining or relinking the
|
||||||
|
Application with a modified version of the Linked Version. (If
|
||||||
|
you use option 4d0, the Installation Information must accompany
|
||||||
|
the Minimal Corresponding Source and Corresponding Application
|
||||||
|
Code. If you use option 4d1, you must provide the Installation
|
||||||
|
Information in the manner specified by section 6 of the GNU GPL
|
||||||
|
for conveying Corresponding Source.)
|
||||||
|
|
||||||
|
5. Combined Libraries.
|
||||||
|
|
||||||
|
You may place library facilities that are a work based on the
|
||||||
|
Library side by side in a single library together with other library
|
||||||
|
facilities that are not Applications and are not covered by this
|
||||||
|
License, and convey such a combined library under terms of your
|
||||||
|
choice, if you do both of the following:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work based
|
||||||
|
on the Library, uncombined with any other library facilities,
|
||||||
|
conveyed under the terms of this License.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library that part of it
|
||||||
|
is a work based on the Library, and explaining where to find the
|
||||||
|
accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
6. Revised Versions of the GNU Lesser General Public License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the GNU Lesser General Public License from time to time. Such new
|
||||||
|
versions will be similar in spirit to the present version, but may
|
||||||
|
differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Library as you received it specifies that a certain numbered version
|
||||||
|
of the GNU Lesser General Public License "or any later version"
|
||||||
|
applies to it, you have the option of following the terms and
|
||||||
|
conditions either of that published version or of any later version
|
||||||
|
published by the Free Software Foundation. If the Library as you
|
||||||
|
received it does not specify a version number of the GNU Lesser
|
||||||
|
General Public License, you may choose any version of the GNU Lesser
|
||||||
|
General Public License ever published by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Library as you received it specifies that a proxy can decide
|
||||||
|
whether future versions of the GNU Lesser General Public License shall
|
||||||
|
apply, that proxy's public statement of acceptance of any version is
|
||||||
|
permanent authorization for you to choose that version for the
|
||||||
|
Library.
|
149
editor.cpp
|
@ -50,7 +50,7 @@ void Editor::setEditingMap() {
|
||||||
map_item->draw();
|
map_item->draw();
|
||||||
map_item->setVisible(true);
|
map_item->setVisible(true);
|
||||||
map_item->setEnabled(true);
|
map_item->setEnabled(true);
|
||||||
setConnectionsVisibility(true);
|
setConnectionsVisibility(ui->checkBox_ToggleBorder->isChecked());
|
||||||
}
|
}
|
||||||
if (collision_item) {
|
if (collision_item) {
|
||||||
collision_item->setVisible(false);
|
collision_item->setVisible(false);
|
||||||
|
@ -58,7 +58,7 @@ void Editor::setEditingMap() {
|
||||||
if (events_group) {
|
if (events_group) {
|
||||||
events_group->setVisible(false);
|
events_group->setVisible(false);
|
||||||
}
|
}
|
||||||
setBorderItemsVisible(true);
|
setBorderItemsVisible(ui->checkBox_ToggleBorder->isChecked());
|
||||||
setConnectionItemsVisible(false);
|
setConnectionItemsVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void Editor::setEditingCollision() {
|
||||||
displayMapConnections();
|
displayMapConnections();
|
||||||
collision_item->draw();
|
collision_item->draw();
|
||||||
collision_item->setVisible(true);
|
collision_item->setVisible(true);
|
||||||
setConnectionsVisibility(true);
|
setConnectionsVisibility(ui->checkBox_ToggleBorder->isChecked());
|
||||||
}
|
}
|
||||||
if (map_item) {
|
if (map_item) {
|
||||||
map_item->setVisible(false);
|
map_item->setVisible(false);
|
||||||
|
@ -76,7 +76,7 @@ void Editor::setEditingCollision() {
|
||||||
if (events_group) {
|
if (events_group) {
|
||||||
events_group->setVisible(false);
|
events_group->setVisible(false);
|
||||||
}
|
}
|
||||||
setBorderItemsVisible(true);
|
setBorderItemsVisible(ui->checkBox_ToggleBorder->isChecked());
|
||||||
setConnectionItemsVisible(false);
|
setConnectionItemsVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,12 +88,12 @@ void Editor::setEditingObjects() {
|
||||||
if (map_item) {
|
if (map_item) {
|
||||||
map_item->setVisible(true);
|
map_item->setVisible(true);
|
||||||
map_item->setEnabled(false);
|
map_item->setEnabled(false);
|
||||||
setConnectionsVisibility(true);
|
setConnectionsVisibility(ui->checkBox_ToggleBorder->isChecked());
|
||||||
}
|
}
|
||||||
if (collision_item) {
|
if (collision_item) {
|
||||||
collision_item->setVisible(false);
|
collision_item->setVisible(false);
|
||||||
}
|
}
|
||||||
setBorderItemsVisible(true);
|
setBorderItemsVisible(ui->checkBox_ToggleBorder->isChecked());
|
||||||
setConnectionItemsVisible(false);
|
setConnectionItemsVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,33 +338,54 @@ void Editor::setMap(QString map_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item) {
|
void Editor::mouseEvent_map(QGraphicsSceneMouseEvent *event, MapPixmapItem *item) {
|
||||||
if (event->buttons() & Qt::RightButton) {
|
if (map_edit_mode == "paint") {
|
||||||
item->updateMetatileSelection(event);
|
if (event->buttons() & Qt::RightButton) {
|
||||||
} else {
|
item->updateMetatileSelection(event);
|
||||||
if (map_edit_mode == "paint") {
|
} else if (event->buttons() & Qt::MiddleButton) {
|
||||||
item->paint(event);
|
|
||||||
} else if (map_edit_mode == "fill") {
|
|
||||||
item->floodFill(event);
|
item->floodFill(event);
|
||||||
} else if (map_edit_mode == "pick") {
|
} else {
|
||||||
item->pick(event);
|
item->paint(event);
|
||||||
} else if (map_edit_mode == "select") {
|
|
||||||
item->select(event);
|
|
||||||
}
|
}
|
||||||
|
} else if (map_edit_mode == "select") {
|
||||||
|
item->select(event);
|
||||||
|
} else if (map_edit_mode == "fill") {
|
||||||
|
if (event->buttons() & Qt::RightButton) {
|
||||||
|
item->updateMetatileSelection(event);
|
||||||
|
} else {
|
||||||
|
item->floodFill(event);
|
||||||
|
}
|
||||||
|
} else if (map_edit_mode == "pick") {
|
||||||
|
|
||||||
|
if (event->buttons() & Qt::RightButton) {
|
||||||
|
item->updateMetatileSelection(event);
|
||||||
|
} else {
|
||||||
|
item->pick(event);
|
||||||
|
}
|
||||||
|
} else if (map_edit_mode == "shift") {
|
||||||
|
item->shift(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void Editor::mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item) {
|
void Editor::mouseEvent_collision(QGraphicsSceneMouseEvent *event, CollisionPixmapItem *item) {
|
||||||
if (event->buttons() & Qt::RightButton) {
|
if (map_edit_mode == "paint") {
|
||||||
item->updateMovementPermissionSelection(event);
|
if (event->buttons() & Qt::RightButton) {
|
||||||
} else {
|
item->updateMovementPermissionSelection(event);
|
||||||
if (map_edit_mode == "paint") {
|
} else if (event->buttons() & Qt::MiddleButton) {
|
||||||
item->paint(event);
|
|
||||||
} else if (map_edit_mode == "fill") {
|
|
||||||
item->floodFill(event);
|
item->floodFill(event);
|
||||||
} else if (map_edit_mode == "pick") {
|
} else {
|
||||||
item->pick(event);
|
item->paint(event);
|
||||||
} else if (map_edit_mode == "select") {
|
|
||||||
item->select(event);
|
|
||||||
}
|
}
|
||||||
|
} else if (map_edit_mode == "select") {
|
||||||
|
item->select(event);
|
||||||
|
} else if (map_edit_mode == "fill") {
|
||||||
|
if (event->buttons() & Qt::RightButton) {
|
||||||
|
item->pick(event);
|
||||||
|
} else {
|
||||||
|
item->floodFill(event);
|
||||||
|
}
|
||||||
|
} else if (map_edit_mode == "pick") {
|
||||||
|
item->pick(event);
|
||||||
|
} else if (map_edit_mode == "shift") {
|
||||||
|
item->shift(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -861,6 +882,12 @@ void Editor::updateSecondaryTileset(QString tilesetLabel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::toggleBorderVisibility(bool visible)
|
||||||
|
{
|
||||||
|
this->setBorderItemsVisible(visible);
|
||||||
|
this->setConnectionsVisibility(visible);
|
||||||
|
}
|
||||||
|
|
||||||
void MetatilesPixmapItem::paintTileChanged(Map *map) {
|
void MetatilesPixmapItem::paintTileChanged(Map *map) {
|
||||||
draw();
|
draw();
|
||||||
}
|
}
|
||||||
|
@ -1080,7 +1107,8 @@ void MapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
|
||||||
int y = (int)(pos.y()) / 16;
|
int y = (int)(pos.y()) / 16;
|
||||||
|
|
||||||
// Paint onto the map.
|
// Paint onto the map.
|
||||||
if (map->smart_paths_enabled && map->selected_metatiles_width == 3 && map->selected_metatiles_height == 3) {
|
bool smartPathsEnabled = event->modifiers() & Qt::ShiftModifier;
|
||||||
|
if ((map->smart_paths_enabled || smartPathsEnabled) && map->selected_metatiles_width == 3 && map->selected_metatiles_height == 3) {
|
||||||
paintSmartPath(x, y);
|
paintSmartPath(x, y);
|
||||||
} else {
|
} else {
|
||||||
paintNormal(x, y);
|
paintNormal(x, y);
|
||||||
|
@ -1091,6 +1119,51 @@ void MapPixmapItem::paint(QGraphicsSceneMouseEvent *event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MapPixmapItem::shift(QGraphicsSceneMouseEvent *event) {
|
||||||
|
if (map) {
|
||||||
|
if (event->type() == QEvent::GraphicsSceneMouseRelease) {
|
||||||
|
map->commit();
|
||||||
|
} else {
|
||||||
|
QPointF pos = event->pos();
|
||||||
|
int x = (int)(pos.x()) / 16;
|
||||||
|
int y = (int)(pos.y()) / 16;
|
||||||
|
|
||||||
|
if (event->type() == QEvent::GraphicsSceneMousePress) {
|
||||||
|
selection_origin = QPoint(x, y);
|
||||||
|
selection.clear();
|
||||||
|
} else if (event->type() == QEvent::GraphicsSceneMouseMove) {
|
||||||
|
if (x != selection_origin.x() || y != selection_origin.y()) {
|
||||||
|
int xDelta = x - selection_origin.x();
|
||||||
|
int yDelta = y - selection_origin.y();
|
||||||
|
Blockdata *backupBlockdata = map->layout->blockdata->copy();
|
||||||
|
for (int i = 0; i < map->getWidth(); i++)
|
||||||
|
for (int j = 0; j < map->getHeight(); j++) {
|
||||||
|
int srcX = i;
|
||||||
|
int srcY = j;
|
||||||
|
int destX = i + xDelta;
|
||||||
|
int destY = j + yDelta;
|
||||||
|
if (destX < 0)
|
||||||
|
do { destX += map->getWidth(); } while (destX < 0);
|
||||||
|
if (destY < 0)
|
||||||
|
do { destY += map->getHeight(); } while (destY < 0);
|
||||||
|
destX %= map->getWidth();
|
||||||
|
destY %= map->getHeight();
|
||||||
|
|
||||||
|
int blockIndex = j * map->getWidth() + i;
|
||||||
|
Block srcBlock = backupBlockdata->blocks->at(blockIndex);
|
||||||
|
map->_setBlock(destX, destY, srcBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete backupBlockdata;
|
||||||
|
selection_origin = QPoint(x, y);
|
||||||
|
selection.clear();
|
||||||
|
draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MapPixmapItem::paintNormal(int x, int y) {
|
void MapPixmapItem::paintNormal(int x, int y) {
|
||||||
// Snap the selected position to the top-left of the block boundary.
|
// Snap the selected position to the top-left of the block boundary.
|
||||||
// This allows painting via dragging the mouse to tile the painted region.
|
// This allows painting via dragging the mouse to tile the painted region.
|
||||||
|
@ -1145,8 +1218,8 @@ void MapPixmapItem::paintSmartPath(int x, int y) {
|
||||||
int openTile = map->selected_metatiles->at(4);
|
int openTile = map->selected_metatiles->at(4);
|
||||||
|
|
||||||
// Fill the region with the open tile.
|
// Fill the region with the open tile.
|
||||||
for (int i = -1; i <= 1; i++)
|
for (int i = 0; i <= 1; i++)
|
||||||
for (int j = -1; j <= 1; j++) {
|
for (int j = 0; j <= 1; j++) {
|
||||||
// Check if in map bounds.
|
// Check if in map bounds.
|
||||||
if (!(i + x < map->getWidth() && i + x >= 0 && j + y < map->getHeight() && j + y >= 0))
|
if (!(i + x < map->getWidth() && i + x >= 0 && j + y < map->getHeight() && j + y >= 0))
|
||||||
continue;
|
continue;
|
||||||
|
@ -1160,14 +1233,14 @@ void MapPixmapItem::paintSmartPath(int x, int y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go back and resolve the edge tiles
|
// Go back and resolve the edge tiles
|
||||||
for (int i = -2; i <= 2; i++)
|
for (int i = -1; i <= 2; i++)
|
||||||
for (int j = -2; j <= 2; j++) {
|
for (int j = -1; j <= 2; j++) {
|
||||||
// Check if in map bounds.
|
// Check if in map bounds.
|
||||||
if (!(i + x < map->getWidth() && i + x >= 0 && j + y < map->getHeight() && j + y >= 0))
|
if (!(i + x < map->getWidth() && i + x >= 0 && j + y < map->getHeight() && j + y >= 0))
|
||||||
continue;
|
continue;
|
||||||
// Ignore the corners, which can't possible be affected by the smart path.
|
// Ignore the corners, which can't possible be affected by the smart path.
|
||||||
if ((i == -2 && j == -2) || (i == 2 && j == -2) ||
|
if ((i == -1 && j == -1) || (i == 2 && j == -1) ||
|
||||||
(i == -2 && j == 2) || (i == 2 && j == 2))
|
(i == -1 && j == 2) || (i == 2 && j == 2))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Ignore tiles that aren't part of the smart path set.
|
// Ignore tiles that aren't part of the smart path set.
|
||||||
|
@ -1260,7 +1333,8 @@ void MapPixmapItem::floodFill(QGraphicsSceneMouseEvent *event) {
|
||||||
Block *block = map->getBlock(x, y);
|
Block *block = map->getBlock(x, y);
|
||||||
int tile = map->selected_metatiles->first();
|
int tile = map->selected_metatiles->first();
|
||||||
if (block && block->tile != tile) {
|
if (block && block->tile != tile) {
|
||||||
if (map->smart_paths_enabled && map->selected_metatiles_width == 3 && map->selected_metatiles_height == 3)
|
bool smartPathsEnabled = event->modifiers() & Qt::ShiftModifier;
|
||||||
|
if ((map->smart_paths_enabled || smartPathsEnabled) && map->selected_metatiles_width == 3 && map->selected_metatiles_height == 3)
|
||||||
this->_floodFillSmartPath(x, y);
|
this->_floodFillSmartPath(x, y);
|
||||||
else
|
else
|
||||||
this->_floodFill(x, y);
|
this->_floodFill(x, y);
|
||||||
|
@ -1484,9 +1558,15 @@ void MapPixmapItem::updateCurHoveredTile(QPointF pos) {
|
||||||
|
|
||||||
void MapPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
|
void MapPixmapItem::hoverMoveEvent(QGraphicsSceneHoverEvent *event) {
|
||||||
updateCurHoveredTile(event->pos());
|
updateCurHoveredTile(event->pos());
|
||||||
|
if (editor->ui->actionBetter_Cursors->isChecked()){
|
||||||
|
setCursor(editor->cursor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void MapPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) {
|
void MapPixmapItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) {
|
||||||
map->clearHoveredTile();
|
map->clearHoveredTile();
|
||||||
|
if (editor->ui->actionBetter_Cursors->isChecked()){
|
||||||
|
unsetCursor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void MapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
void MapPixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *event) {
|
||||||
QPointF pos = event->pos();
|
QPointF pos = event->pos();
|
||||||
|
@ -1653,6 +1733,7 @@ QList<DraggablePixmapItem *> *Editor::getObjects() {
|
||||||
void Editor::redrawObject(DraggablePixmapItem *item) {
|
void Editor::redrawObject(DraggablePixmapItem *item) {
|
||||||
if (item) {
|
if (item) {
|
||||||
item->setPixmap(item->event->pixmap);
|
item->setPixmap(item->event->pixmap);
|
||||||
|
item->setShapeMode(QGraphicsPixmapItem::BoundingRectShape);
|
||||||
if (selected_events && selected_events->contains(item)) {
|
if (selected_events && selected_events->contains(item)) {
|
||||||
QImage image = item->pixmap().toImage();
|
QImage image = item->pixmap().toImage();
|
||||||
QPainter painter(&image);
|
QPainter painter(&image);
|
||||||
|
|
13
editor.h
|
@ -7,6 +7,7 @@
|
||||||
#include <QGraphicsItemAnimation>
|
#include <QGraphicsItemAnimation>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
|
#include <QCursor>
|
||||||
|
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
@ -66,6 +67,7 @@ public:
|
||||||
void setSelectedConnectionFromMap(QString mapName);
|
void setSelectedConnectionFromMap(QString mapName);
|
||||||
void updatePrimaryTileset(QString tilesetLabel);
|
void updatePrimaryTileset(QString tilesetLabel);
|
||||||
void updateSecondaryTileset(QString tilesetLabel);
|
void updateSecondaryTileset(QString tilesetLabel);
|
||||||
|
void toggleBorderVisibility(bool visible);
|
||||||
|
|
||||||
DraggablePixmapItem *addMapEvent(Event *event);
|
DraggablePixmapItem *addMapEvent(Event *event);
|
||||||
void selectMapEvent(DraggablePixmapItem *object);
|
void selectMapEvent(DraggablePixmapItem *object);
|
||||||
|
@ -108,6 +110,8 @@ public:
|
||||||
QList<int> *copiedMetatileSelection = new QList<int>;
|
QList<int> *copiedMetatileSelection = new QList<int>;
|
||||||
|
|
||||||
QString map_edit_mode;
|
QString map_edit_mode;
|
||||||
|
QString prev_edit_mode;
|
||||||
|
QCursor cursor;
|
||||||
|
|
||||||
void objectsView_onMousePress(QMouseEvent *event);
|
void objectsView_onMousePress(QMouseEvent *event);
|
||||||
void objectsView_onMouseMove(QMouseEvent *event);
|
void objectsView_onMouseMove(QMouseEvent *event);
|
||||||
|
@ -130,6 +134,7 @@ private:
|
||||||
void updateMirroredConnection(Connection*, QString, QString, bool isDelete = false);
|
void updateMirroredConnection(Connection*, QString, QString, bool isDelete = false);
|
||||||
Event* createNewObjectEvent();
|
Event* createNewObjectEvent();
|
||||||
Event* createNewWarpEvent();
|
Event* createNewWarpEvent();
|
||||||
|
Event* createNewHealLocationEvent();
|
||||||
Event* createNewCoordScriptEvent();
|
Event* createNewCoordScriptEvent();
|
||||||
Event* createNewCoordWeatherEvent();
|
Event* createNewCoordWeatherEvent();
|
||||||
Event* createNewSignEvent();
|
Event* createNewSignEvent();
|
||||||
|
@ -173,10 +178,8 @@ public:
|
||||||
int last_x;
|
int last_x;
|
||||||
int last_y;
|
int last_y;
|
||||||
void updatePosition() {
|
void updatePosition() {
|
||||||
int x = event->x() * 16;
|
int x = event->getPixelX();
|
||||||
int y = event->y() * 16;
|
int y = event->getPixelY();
|
||||||
x -= pixmap().width() / 32 * 16;
|
|
||||||
y -= pixmap().height() - 16;
|
|
||||||
setX(x);
|
setX(x);
|
||||||
setY(y);
|
setY(y);
|
||||||
setZValue(event->y());
|
setZValue(event->y());
|
||||||
|
@ -192,6 +195,7 @@ public:
|
||||||
objects.append(event);
|
objects.append(event);
|
||||||
event->pixmap = QPixmap();
|
event->pixmap = QPixmap();
|
||||||
editor->project->loadEventPixmaps(objects);
|
editor->project->loadEventPixmaps(objects);
|
||||||
|
this->updatePosition();
|
||||||
editor->redrawObject(this);
|
editor->redrawObject(this);
|
||||||
emit spriteChanged(event->pixmap);
|
emit spriteChanged(event->pixmap);
|
||||||
}
|
}
|
||||||
|
@ -270,6 +274,7 @@ public:
|
||||||
void _floodFillSmartPath(int initialX, int initialY);
|
void _floodFillSmartPath(int initialX, int initialY);
|
||||||
virtual void pick(QGraphicsSceneMouseEvent*);
|
virtual void pick(QGraphicsSceneMouseEvent*);
|
||||||
virtual void select(QGraphicsSceneMouseEvent*);
|
virtual void select(QGraphicsSceneMouseEvent*);
|
||||||
|
virtual void shift(QGraphicsSceneMouseEvent*);
|
||||||
virtual void draw(bool ignoreCache = false);
|
virtual void draw(bool ignoreCache = false);
|
||||||
void updateMetatileSelection(QGraphicsSceneMouseEvent *event);
|
void updateMetatileSelection(QGraphicsSceneMouseEvent *event);
|
||||||
|
|
||||||
|
|
50
event.cpp
|
@ -1,4 +1,5 @@
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
#include "map.h"
|
||||||
|
|
||||||
QString EventType::Object = "event_object";
|
QString EventType::Object = "event_object";
|
||||||
QString EventType::Warp = "event_warp";
|
QString EventType::Warp = "event_warp";
|
||||||
|
@ -7,9 +8,12 @@ QString EventType::CoordWeather = "event_trap_weather";
|
||||||
QString EventType::Sign = "event_sign";
|
QString EventType::Sign = "event_sign";
|
||||||
QString EventType::HiddenItem = "event_hidden_item";
|
QString EventType::HiddenItem = "event_hidden_item";
|
||||||
QString EventType::SecretBase = "event_secret_base";
|
QString EventType::SecretBase = "event_secret_base";
|
||||||
|
QString EventType::HealLocation = "event_heal_location";
|
||||||
|
|
||||||
Event::Event()
|
Event::Event()
|
||||||
{
|
{
|
||||||
|
this->spriteWidth = 16;
|
||||||
|
this->spriteHeight = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
Event* Event::createNewEvent(QString event_type, QString map_name)
|
Event* Event::createNewEvent(QString event_type, QString map_name)
|
||||||
|
@ -19,6 +23,8 @@ Event* Event::createNewEvent(QString event_type, QString map_name)
|
||||||
event = createNewObjectEvent();
|
event = createNewObjectEvent();
|
||||||
} else if (event_type == EventType::Warp) {
|
} else if (event_type == EventType::Warp) {
|
||||||
event = createNewWarpEvent(map_name);
|
event = createNewWarpEvent(map_name);
|
||||||
|
} else if (event_type == EventType::HealLocation) {
|
||||||
|
event = createNewHealLocationEvent(map_name);
|
||||||
} else if (event_type == EventType::CoordScript) {
|
} else if (event_type == EventType::CoordScript) {
|
||||||
event = createNewCoordScriptEvent();
|
event = createNewCoordScriptEvent();
|
||||||
} else if (event_type == EventType::CoordWeather) {
|
} else if (event_type == EventType::CoordWeather) {
|
||||||
|
@ -64,6 +70,15 @@ Event* Event::createNewWarpEvent(QString map_name)
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Event* Event::createNewHealLocationEvent(QString map_name)
|
||||||
|
{
|
||||||
|
Event *event = new Event;
|
||||||
|
event->put("event_group_type", "heal_event_group");
|
||||||
|
event->put("event_type", EventType::HealLocation);
|
||||||
|
event->put("loc_name", QString(Map::mapConstantFromName(map_name)).remove(0,4));
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
Event* Event::createNewCoordScriptEvent()
|
Event* Event::createNewCoordScriptEvent()
|
||||||
{
|
{
|
||||||
Event *event = new Event;
|
Event *event = new Event;
|
||||||
|
@ -113,6 +128,16 @@ Event* Event::createNewSecretBaseEvent()
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Event::getPixelX()
|
||||||
|
{
|
||||||
|
return (this->x() * 16) - qMax(0, (this->spriteWidth - 16) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int Event::getPixelY()
|
||||||
|
{
|
||||||
|
return (this->y() * 16) - qMax(0, this->spriteHeight - 16);
|
||||||
|
}
|
||||||
|
|
||||||
QString Event::buildObjectEventMacro(int item_index)
|
QString Event::buildObjectEventMacro(int item_index)
|
||||||
{
|
{
|
||||||
int radius_x = this->getInt("radius_x");
|
int radius_x = this->getInt("radius_x");
|
||||||
|
@ -150,6 +175,21 @@ QString Event::buildWarpEventMacro(QMap<QString, QString> *mapNamesToMapConstant
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HealLocation Event::buildHealLocation()
|
||||||
|
{
|
||||||
|
HealLocation hl;
|
||||||
|
hl.name = this->get("loc_name");
|
||||||
|
try {
|
||||||
|
hl.index = this->get("index").toInt();
|
||||||
|
}
|
||||||
|
catch(...) {
|
||||||
|
hl.index = 0;
|
||||||
|
}
|
||||||
|
hl.x = this->get("x").toInt();
|
||||||
|
hl.y = this->get("y").toInt();
|
||||||
|
return hl;
|
||||||
|
}
|
||||||
|
|
||||||
QString Event::buildCoordScriptEventMacro()
|
QString Event::buildCoordScriptEventMacro()
|
||||||
{
|
{
|
||||||
QString text = "";
|
QString text = "";
|
||||||
|
@ -208,3 +248,13 @@ QString Event::buildSecretBaseEventMacro()
|
||||||
text += "\n";
|
text += "\n";
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Event::setPixmapFromSpritesheet(QImage spritesheet, int spriteWidth, int spriteHeight)
|
||||||
|
{
|
||||||
|
// Set first palette color fully transparent.
|
||||||
|
QImage img = spritesheet.copy(0, 0, spriteWidth, spriteHeight);
|
||||||
|
img.setColor(0, qRgba(0, 0, 0, 0));
|
||||||
|
pixmap = QPixmap::fromImage(img);
|
||||||
|
this->spriteWidth = spriteWidth;
|
||||||
|
this->spriteHeight = spriteHeight;
|
||||||
|
}
|
||||||
|
|
9
event.h
|
@ -1,6 +1,7 @@
|
||||||
#ifndef EVENT_H
|
#ifndef EVENT_H
|
||||||
#define EVENT_H
|
#define EVENT_H
|
||||||
|
|
||||||
|
#include "heallocation.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
@ -16,6 +17,7 @@ public:
|
||||||
static QString Sign;
|
static QString Sign;
|
||||||
static QString HiddenItem;
|
static QString HiddenItem;
|
||||||
static QString SecretBase;
|
static QString SecretBase;
|
||||||
|
static QString HealLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Event
|
class Event
|
||||||
|
@ -54,6 +56,7 @@ public:
|
||||||
static Event* createNewEvent(QString, QString);
|
static Event* createNewEvent(QString, QString);
|
||||||
static Event* createNewObjectEvent();
|
static Event* createNewObjectEvent();
|
||||||
static Event* createNewWarpEvent(QString);
|
static Event* createNewWarpEvent(QString);
|
||||||
|
static Event* createNewHealLocationEvent(QString);
|
||||||
static Event* createNewCoordScriptEvent();
|
static Event* createNewCoordScriptEvent();
|
||||||
static Event* createNewCoordWeatherEvent();
|
static Event* createNewCoordWeatherEvent();
|
||||||
static Event* createNewSignEvent();
|
static Event* createNewSignEvent();
|
||||||
|
@ -62,14 +65,20 @@ public:
|
||||||
|
|
||||||
QString buildObjectEventMacro(int);
|
QString buildObjectEventMacro(int);
|
||||||
QString buildWarpEventMacro(QMap<QString, QString>*);
|
QString buildWarpEventMacro(QMap<QString, QString>*);
|
||||||
|
HealLocation buildHealLocation();
|
||||||
QString buildCoordScriptEventMacro();
|
QString buildCoordScriptEventMacro();
|
||||||
QString buildCoordWeatherEventMacro();
|
QString buildCoordWeatherEventMacro();
|
||||||
QString buildSignEventMacro();
|
QString buildSignEventMacro();
|
||||||
QString buildHiddenItemEventMacro();
|
QString buildHiddenItemEventMacro();
|
||||||
QString buildSecretBaseEventMacro();
|
QString buildSecretBaseEventMacro();
|
||||||
|
void setPixmapFromSpritesheet(QImage, int, int);
|
||||||
|
int getPixelX();
|
||||||
|
int getPixelY();
|
||||||
|
|
||||||
QMap<QString, QString> values;
|
QMap<QString, QString> values;
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
|
int spriteWidth;
|
||||||
|
int spriteHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // EVENT_H
|
#endif // EVENT_H
|
||||||
|
|
19
heallocation.cpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#include "heallocation.h"
|
||||||
|
|
||||||
|
//HealLocation::HealLocation() {}
|
||||||
|
|
||||||
|
HealLocation::HealLocation(QString map, int i, size_t x0, size_t y0) {
|
||||||
|
|
||||||
|
name = map;
|
||||||
|
index = i;
|
||||||
|
x = x0;
|
||||||
|
y = y0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug debug, const HealLocation &hl) {
|
||||||
|
|
||||||
|
debug << "HealLocation_" + hl.name << "(" << hl.x << ',' << hl.y << ")";
|
||||||
|
return debug;
|
||||||
|
|
||||||
|
}
|
23
heallocation.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef HEALLOCATION_H
|
||||||
|
#define HEALLOCATION_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
class HealLocation {
|
||||||
|
|
||||||
|
public:
|
||||||
|
HealLocation()=default;
|
||||||
|
HealLocation(QString, int, size_t, size_t);
|
||||||
|
friend QDebug operator<<(QDebug debug, const HealLocation &hl);
|
||||||
|
|
||||||
|
public:
|
||||||
|
//QString group;
|
||||||
|
QString name;
|
||||||
|
int index;
|
||||||
|
size_t x;
|
||||||
|
size_t y;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HEALLOCATION_H
|
156
mainwindow.cpp
|
@ -15,8 +15,14 @@
|
||||||
#include <QSpacerItem>
|
#include <QSpacerItem>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QPushButton>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
|
#include <QScroller>
|
||||||
|
#include <math.h>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QSysInfo>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
@ -53,6 +59,9 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.contains("cursor_mode") && settings.value("cursor_mode") == "0") {
|
||||||
|
ui->actionBetter_Cursors->setChecked(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -551,6 +560,12 @@ void MainWindow::redo() {
|
||||||
editor->redo();
|
editor->redo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Open current map scripts in system default editor for .inc files
|
||||||
|
void MainWindow::openInTextEditor() {
|
||||||
|
QString path = QDir::cleanPath("file://" + editor->project->root + QDir::separator() + "data/maps/" + editor->map->name + "/scripts.inc");
|
||||||
|
QDesktopServices::openUrl(QUrl(path));
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_Save_triggered() {
|
void MainWindow::on_action_Save_triggered() {
|
||||||
editor->save();
|
editor->save();
|
||||||
updateMapList();
|
updateMapList();
|
||||||
|
@ -591,6 +606,66 @@ void MainWindow::on_actionRedo_triggered()
|
||||||
redo();
|
redo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionZoom_In_triggered() {
|
||||||
|
scaleMapView(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionZoom_Out_triggered() {
|
||||||
|
scaleMapView(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionBetter_Cursors_triggered() {
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("cursor_mode", QString::number(ui->actionBetter_Cursors->isChecked()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionPencil_triggered()
|
||||||
|
{
|
||||||
|
on_toolButton_Paint_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionPointer_triggered()
|
||||||
|
{
|
||||||
|
on_toolButton_Select_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionFlood_Fill_triggered()
|
||||||
|
{
|
||||||
|
on_toolButton_Fill_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionEyedropper_triggered()
|
||||||
|
{
|
||||||
|
on_toolButton_Dropper_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionMove_triggered()
|
||||||
|
{
|
||||||
|
on_toolButton_Move_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_actionMap_Shift_triggered()
|
||||||
|
{
|
||||||
|
on_toolButton_Shift_clicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::scaleMapView(int s) {
|
||||||
|
editor->map->scale_exp += s;
|
||||||
|
|
||||||
|
double base = (double)editor->map->scale_base;
|
||||||
|
double exp = editor->map->scale_exp;
|
||||||
|
double sfactor = pow(base,s);
|
||||||
|
|
||||||
|
ui->graphicsView_Map->scale(sfactor,sfactor);
|
||||||
|
ui->graphicsView_Objects_Map->scale(sfactor,sfactor);
|
||||||
|
|
||||||
|
ui->graphicsView_Map->setFixedSize((editor->scene->width() + 2) * pow(base,exp),
|
||||||
|
(editor->scene->height() + 2) * pow(base,exp));
|
||||||
|
|
||||||
|
ui->graphicsView_Objects_Map->setFixedSize((editor->scene->width() + 2) * pow(base,exp),
|
||||||
|
(editor->scene->height() + 2) * pow(base,exp));
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::addNewEvent(QString event_type)
|
void MainWindow::addNewEvent(QString event_type)
|
||||||
{
|
{
|
||||||
if (editor) {
|
if (editor) {
|
||||||
|
@ -649,9 +724,12 @@ void MainWindow::updateSelectedObjects() {
|
||||||
QString event_type = item->event->get("event_type");
|
QString event_type = item->event->get("event_type");
|
||||||
QString event_group_type = item->event->get("event_group_type");
|
QString event_group_type = item->event->get("event_group_type");
|
||||||
QString map_name = item->event->get("map_name");
|
QString map_name = item->event->get("map_name");
|
||||||
|
int event_offs;
|
||||||
|
if (event_type == "event_warp") { event_offs = 0; }
|
||||||
|
else { event_offs = 1; }
|
||||||
frame->ui->label_name->setText(
|
frame->ui->label_name->setText(
|
||||||
QString("%1: %2 %3")
|
QString("%1: %2 %3")
|
||||||
.arg(editor->project->getMap(map_name)->events.value(event_group_type).indexOf(item->event) + 1)
|
.arg(editor->project->getMap(map_name)->events.value(event_group_type).indexOf(item->event) + event_offs)
|
||||||
.arg(map_name)
|
.arg(map_name)
|
||||||
.arg(event_type)
|
.arg(event_type)
|
||||||
);
|
);
|
||||||
|
@ -709,8 +787,8 @@ void MainWindow::updateSelectedObjects() {
|
||||||
fields << "sight_radius_tree_id";
|
fields << "sight_radius_tree_id";
|
||||||
}
|
}
|
||||||
else if (event_type == EventType::Warp) {
|
else if (event_type == EventType::Warp) {
|
||||||
fields << "destination_warp";
|
|
||||||
fields << "destination_map_name";
|
fields << "destination_map_name";
|
||||||
|
fields << "destination_warp";
|
||||||
}
|
}
|
||||||
else if (event_type == EventType::CoordScript) {
|
else if (event_type == EventType::CoordScript) {
|
||||||
fields << "script_label";
|
fields << "script_label";
|
||||||
|
@ -864,38 +942,96 @@ void MainWindow::on_toolButton_deleteObject_clicked()
|
||||||
if (editor && editor->selected_events) {
|
if (editor && editor->selected_events) {
|
||||||
if (editor->selected_events->length()) {
|
if (editor->selected_events->length()) {
|
||||||
for (DraggablePixmapItem *item : *editor->selected_events) {
|
for (DraggablePixmapItem *item : *editor->selected_events) {
|
||||||
editor->deleteEvent(item->event);
|
if (item->event->get("event_type") != EventType::HealLocation) {
|
||||||
if (editor->scene->items().contains(item)) {
|
editor->deleteEvent(item->event);
|
||||||
editor->scene->removeItem(item);
|
if (editor->scene->items().contains(item)) {
|
||||||
|
editor->scene->removeItem(item);
|
||||||
|
}
|
||||||
|
editor->selected_events->removeOne(item);
|
||||||
|
}
|
||||||
|
else { // don't allow deletion of heal locations
|
||||||
|
qDebug() << "Cannot delete event of type " << item->event->get("event_type");
|
||||||
}
|
}
|
||||||
editor->selected_events->removeOne(item);
|
|
||||||
}
|
}
|
||||||
updateSelectedObjects();
|
updateSelectedObjects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_toolButton_Open_Scripts_clicked()
|
||||||
|
{
|
||||||
|
openInTextEditor();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::on_toolButton_Paint_clicked()
|
void MainWindow::on_toolButton_Paint_clicked()
|
||||||
{
|
{
|
||||||
editor->map_edit_mode = "paint";
|
editor->map_edit_mode = "paint";
|
||||||
|
editor->cursor = QCursor(QPixmap(":/icons/pencil_cursor.ico"), 10, 10);
|
||||||
|
|
||||||
|
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
QScroller::ungrabGesture(ui->scrollArea);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_toolButton_Select_clicked()
|
void MainWindow::on_toolButton_Select_clicked()
|
||||||
{
|
{
|
||||||
editor->map_edit_mode = "select";
|
editor->map_edit_mode = "select";
|
||||||
|
editor->cursor = QCursor(QPixmap(":/icons/cursor.ico"), 0, 0);
|
||||||
|
|
||||||
|
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
QScroller::ungrabGesture(ui->scrollArea);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_toolButton_Fill_clicked()
|
void MainWindow::on_toolButton_Fill_clicked()
|
||||||
{
|
{
|
||||||
editor->map_edit_mode = "fill";
|
editor->map_edit_mode = "fill";
|
||||||
|
editor->cursor = QCursor(QPixmap(":/icons/fill_color_cursor.ico"), 10, 10);
|
||||||
|
|
||||||
|
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
QScroller::ungrabGesture(ui->scrollArea);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_toolButton_Dropper_clicked()
|
void MainWindow::on_toolButton_Dropper_clicked()
|
||||||
{
|
{
|
||||||
editor->map_edit_mode = "pick";
|
editor->map_edit_mode = "pick";
|
||||||
|
editor->cursor = QCursor(QPixmap(":/icons/pipette_cursor.ico"), 10, 10);
|
||||||
|
|
||||||
|
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
QScroller::ungrabGesture(ui->scrollArea);
|
||||||
|
|
||||||
|
checkToolButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_toolButton_Move_clicked()
|
||||||
|
{
|
||||||
|
editor->map_edit_mode = "move";
|
||||||
|
editor->cursor = QCursor(QPixmap(":/icons/move.ico"), 7, 7);
|
||||||
|
|
||||||
|
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
QScroller::grabGesture(ui->scrollArea, QScroller::LeftMouseButtonGesture);
|
||||||
|
|
||||||
|
checkToolButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_toolButton_Shift_clicked()
|
||||||
|
{
|
||||||
|
editor->map_edit_mode = "shift";
|
||||||
|
editor->cursor = QCursor(QPixmap(":/icons/shift_cursor.ico"), 10, 10);
|
||||||
|
|
||||||
|
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
|
||||||
|
QScroller::ungrabGesture(ui->scrollArea);
|
||||||
|
|
||||||
checkToolButtons();
|
checkToolButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,6 +1040,8 @@ void MainWindow::checkToolButtons() {
|
||||||
ui->toolButton_Select->setChecked(editor->map_edit_mode == "select");
|
ui->toolButton_Select->setChecked(editor->map_edit_mode == "select");
|
||||||
ui->toolButton_Fill->setChecked(editor->map_edit_mode == "fill");
|
ui->toolButton_Fill->setChecked(editor->map_edit_mode == "fill");
|
||||||
ui->toolButton_Dropper->setChecked(editor->map_edit_mode == "pick");
|
ui->toolButton_Dropper->setChecked(editor->map_edit_mode == "pick");
|
||||||
|
ui->toolButton_Move->setChecked(editor->map_edit_mode == "move");
|
||||||
|
ui->toolButton_Shift->setChecked(editor->map_edit_mode == "shift");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) {
|
void MainWindow::onLoadMapRequested(QString mapName, QString fromMapName) {
|
||||||
|
@ -1038,3 +1176,9 @@ void MainWindow::on_checkBox_smartPaths_stateChanged(int selected)
|
||||||
{
|
{
|
||||||
editor->map->smart_paths_enabled = selected == Qt::Checked;
|
editor->map->smart_paths_enabled = selected == Qt::Checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_checkBox_ToggleBorder_stateChanged(int selected)
|
||||||
|
{
|
||||||
|
bool visible = selected != 0;
|
||||||
|
editor->toggleBorderVisibility(visible);
|
||||||
|
}
|
||||||
|
|
21
mainwindow.h
|
@ -37,6 +37,8 @@ private slots:
|
||||||
void undo();
|
void undo();
|
||||||
void redo();
|
void redo();
|
||||||
|
|
||||||
|
void openInTextEditor();
|
||||||
|
|
||||||
void onLoadMapRequested(QString, QString);
|
void onLoadMapRequested(QString, QString);
|
||||||
void onMapChanged(Map *map);
|
void onMapChanged(Map *map);
|
||||||
void onMapNeedsRedrawing(Map *map);
|
void onMapNeedsRedrawing(Map *map);
|
||||||
|
@ -58,7 +60,18 @@ private slots:
|
||||||
|
|
||||||
void on_actionRedo_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_deleteObject_clicked();
|
||||||
|
void on_toolButton_Open_Scripts_clicked();
|
||||||
|
|
||||||
void addNewEvent(QString);
|
void addNewEvent(QString);
|
||||||
void updateSelectedObjects();
|
void updateSelectedObjects();
|
||||||
|
@ -71,6 +84,10 @@ private slots:
|
||||||
|
|
||||||
void on_toolButton_Dropper_clicked();
|
void on_toolButton_Dropper_clicked();
|
||||||
|
|
||||||
|
void on_toolButton_Move_clicked();
|
||||||
|
|
||||||
|
void on_toolButton_Shift_clicked();
|
||||||
|
|
||||||
void onOpenMapListContextMenu(const QPoint &point);
|
void onOpenMapListContextMenu(const QPoint &point);
|
||||||
void onAddNewMapToGroupClick(QAction* triggeredAction);
|
void onAddNewMapToGroupClick(QAction* triggeredAction);
|
||||||
void onTilesetChanged(QString);
|
void onTilesetChanged(QString);
|
||||||
|
@ -102,6 +119,8 @@ private slots:
|
||||||
|
|
||||||
void on_checkBox_Visibility_clicked(bool checked);
|
void on_checkBox_Visibility_clicked(bool checked);
|
||||||
|
|
||||||
|
void on_checkBox_ToggleBorder_stateChanged(int arg1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
QStandardItemModel *mapListModel;
|
QStandardItemModel *mapListModel;
|
||||||
|
@ -124,6 +143,8 @@ private:
|
||||||
|
|
||||||
void displayMapProperties();
|
void displayMapProperties();
|
||||||
void checkToolButtons();
|
void checkToolButtons();
|
||||||
|
|
||||||
|
void scaleMapView(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
enum MapListUserRoles {
|
enum MapListUserRoles {
|
||||||
|
|
191
mainwindow.ui
|
@ -171,7 +171,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Editor</p><p><span style=" font-weight:600;">Click</span> and drag to draw on the map.</p><p><span style=" font-weight:600;">Right-click</span> and drag to select tiles.</p></body></html></string>
|
<string><html><head/><body><p>Pencil</p><p><span style=" font-weight:600;">Click</span> and drag to draw on the map.</p><p><span style=" font-weight:600;">Right-click</span> and drag to select tiles.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Paint</string>
|
<string>Paint</string>
|
||||||
|
@ -214,7 +214,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_Fill">
|
<widget class="QToolButton" name="toolButton_Fill">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Flood Fill</p><p>Fills all similar tiles in a region with the selected metatiles or collision attributes</p></body></html></string>
|
<string><html><head/><body><p>Bucket Fill</p><p>Fills all similar tiles in a region with the selected metatiles or collision attributes</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Fill</string>
|
<string>Fill</string>
|
||||||
|
@ -231,7 +231,7 @@
|
||||||
<item>
|
<item>
|
||||||
<widget class="QToolButton" name="toolButton_Dropper">
|
<widget class="QToolButton" name="toolButton_Dropper">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Eye Dropper</p><p>Click to select a metatile or collision attribute.</p></body></html></string>
|
<string><html><head/><body><p>Eyedropper</p><p><span style=" font-weight:600;">Click</span> to select a metatile or collision attribute.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Dropper</string>
|
<string>Dropper</string>
|
||||||
|
@ -245,10 +245,44 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_Move">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Move</p><p>Click to drag map around.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources/images.qrc">
|
||||||
|
<normaloff>:/icons/move.ico</normaloff>:/icons/move.ico</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_Shift">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Map Shift</p><p><span style=" font-weight:600;">Click and drag</span> on the map to shift the positions all metatiles at once. This is useful after resizing a map.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Shift</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="resources/images.qrc">
|
||||||
|
<normaloff>:/icons/shift.ico</normaloff>:/icons/shift.ico</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox_smartPaths">
|
<widget class="QCheckBox" name="checkBox_smartPaths">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string><html><head/><body><p>Smart-path mode allows easier drawing of paths. If a 3x3 metatile block is selcted in the right panel, then smart path mode will automatically form a pathway using those selected blocks.</p><p>When smart-path mode is <span style=" font-weight:600;">not</span> enabled, clicking and dragging a selection will tile it in a grid.</p></body></html></string>
|
<string><html><head/><body><p>Smart-path mode allows easier drawing of paths. If a 3x3 metatile block is selcted in the right panel, then smart path mode will automatically form a pathway using those selected blocks.</p><p>When smart-path mode is <span style=" font-weight:600;">not</span> enabled, clicking and dragging a selection will tile it in a grid.</p><p>Hold down the <span style=" font-weight:600;">shift</span> key while editing to quickly enable smart-path mode.</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">margin-left: 10px</string>
|
<string notr="true">margin-left: 10px</string>
|
||||||
|
@ -267,7 +301,17 @@
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Show Grid</string>
|
<string>Grid</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_ToggleBorder">
|
||||||
|
<property name="text">
|
||||||
|
<string>Border</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -334,7 +378,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>429</width>
|
<width>469</width>
|
||||||
<height>620</height>
|
<height>620</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -362,9 +406,18 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="mouseTracking">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeAdjustPolicy">
|
||||||
|
<enum>QAbstractScrollArea::AdjustIgnored</enum>
|
||||||
|
</property>
|
||||||
|
<property name="dragMode">
|
||||||
|
<enum>QGraphicsView::NoDrag</enum>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
|
@ -708,7 +761,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>315</width>
|
<width>275</width>
|
||||||
<height>86</height>
|
<height>86</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -814,7 +867,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>365</width>
|
<width>325</width>
|
||||||
<height>405</height>
|
<height>405</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -1330,6 +1383,29 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButton_Open_Scripts">
|
||||||
|
<property name="text">
|
||||||
|
<string>Open Map Scripts</string>
|
||||||
|
</property>
|
||||||
|
<property name="autoRaise">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_20">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -2044,8 +2120,29 @@
|
||||||
<addaction name="actionUndo"/>
|
<addaction name="actionUndo"/>
|
||||||
<addaction name="actionRedo"/>
|
<addaction name="actionRedo"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuView">
|
||||||
|
<property name="title">
|
||||||
|
<string>View</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionZoom_In"/>
|
||||||
|
<addaction name="actionZoom_Out"/>
|
||||||
|
<addaction name="actionBetter_Cursors"/>
|
||||||
|
</widget>
|
||||||
|
<widget class="QMenu" name="menuTools">
|
||||||
|
<property name="title">
|
||||||
|
<string>Tools</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionPencil"/>
|
||||||
|
<addaction name="actionPointer"/>
|
||||||
|
<addaction name="actionFlood_Fill"/>
|
||||||
|
<addaction name="actionEyedropper"/>
|
||||||
|
<addaction name="actionMove"/>
|
||||||
|
<addaction name="actionMap_Shift"/>
|
||||||
|
</widget>
|
||||||
<addaction name="menuFile"/>
|
<addaction name="menuFile"/>
|
||||||
<addaction name="menuEdit"/>
|
<addaction name="menuEdit"/>
|
||||||
|
<addaction name="menuView"/>
|
||||||
|
<addaction name="menuTools"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
<action name="action_Save_Project">
|
<action name="action_Save_Project">
|
||||||
|
@ -2104,6 +2201,84 @@
|
||||||
<string>Export Map Image...</string>
|
<string>Export Map Image...</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionZoom_In">
|
||||||
|
<property name="text">
|
||||||
|
<string>Zoom In</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>+</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionZoom_Out">
|
||||||
|
<property name="text">
|
||||||
|
<string>Zoom Out</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>-</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionBetter_Cursors">
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Cursor Icons</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Use reticule-styled cursors with icon showing currently selected tool.</p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPencil">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pencil</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>N</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionFlood_Fill">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bucket Fill</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>B</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionEyedropper">
|
||||||
|
<property name="text">
|
||||||
|
<string>Eyedropper</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>E</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionMove">
|
||||||
|
<property name="text">
|
||||||
|
<string>Move</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>M</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionMap_Shift">
|
||||||
|
<property name="text">
|
||||||
|
<string>Map Shift</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>S</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionPointer">
|
||||||
|
<property name="text">
|
||||||
|
<string>Pointer</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>P</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
|
|
5
map.cpp
|
@ -608,10 +608,11 @@ bool Map::hasUnsavedChanges() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::hoveredTileChanged(int x, int y, int block) {
|
void Map::hoveredTileChanged(int x, int y, int block) {
|
||||||
emit statusBarMessage(QString("X: %1, Y: %2, Metatile: 0x%3")
|
emit statusBarMessage(QString("X: %1, Y: %2, Metatile: 0x%3, Scale = %4x")
|
||||||
.arg(x)
|
.arg(x)
|
||||||
.arg(y)
|
.arg(y)
|
||||||
.arg(QString("%1").arg(block, 3, 16, QChar('0')).toUpper()));
|
.arg(QString("%1").arg(block, 3, 16, QChar('0')).toUpper())
|
||||||
|
.arg(QString::number(pow(this->scale_base,this->scale_exp))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::clearHoveredTile() {
|
void Map::clearHoveredTile() {
|
||||||
|
|
4
map.h
|
@ -9,6 +9,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QGraphicsPixmapItem>
|
#include <QGraphicsPixmapItem>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
class HistoryItem {
|
class HistoryItem {
|
||||||
public:
|
public:
|
||||||
|
@ -128,12 +129,15 @@ public:
|
||||||
QString layout_id;
|
QString layout_id;
|
||||||
QString location;
|
QString location;
|
||||||
QString requiresFlash;
|
QString requiresFlash;
|
||||||
|
QString isFlyable; // TODO: implement this
|
||||||
QString weather;
|
QString weather;
|
||||||
QString type;
|
QString type;
|
||||||
QString unknown;
|
QString unknown;
|
||||||
QString show_location;
|
QString show_location;
|
||||||
QString battle_scene;
|
QString battle_scene;
|
||||||
MapLayout *layout;
|
MapLayout *layout;
|
||||||
|
int scale_exp = 0;
|
||||||
|
double scale_base = sqrt(2); // adjust scale factor with this
|
||||||
|
|
||||||
bool isPersistedToFile = true;
|
bool isPersistedToFile = true;
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,12 @@ void NewEventToolButton::initButton()
|
||||||
this->newWarpAction->setIcon(QIcon(":/icons/add.ico"));
|
this->newWarpAction->setIcon(QIcon(":/icons/add.ico"));
|
||||||
connect(this->newWarpAction, SIGNAL(triggered(bool)), this, SLOT(newWarp()));
|
connect(this->newWarpAction, SIGNAL(triggered(bool)), this, SLOT(newWarp()));
|
||||||
|
|
||||||
|
/* // disable this functionality for now
|
||||||
|
this->newHealLocationAction = new QAction("New Heal Location", this);
|
||||||
|
this->newHealLocationAction->setIcon(QIcon(":/icons/add.ico"));
|
||||||
|
connect(this->newHealLocationAction, SIGNAL(triggered(bool)), this, SLOT(newHealLocation()));
|
||||||
|
*/
|
||||||
|
|
||||||
this->newCoordScriptAction = new QAction("New Coord Script", this);
|
this->newCoordScriptAction = new QAction("New Coord Script", this);
|
||||||
this->newCoordScriptAction->setIcon(QIcon(":/icons/add.ico"));
|
this->newCoordScriptAction->setIcon(QIcon(":/icons/add.ico"));
|
||||||
connect(this->newCoordScriptAction, SIGNAL(triggered(bool)), this, SLOT(newCoordScript()));
|
connect(this->newCoordScriptAction, SIGNAL(triggered(bool)), this, SLOT(newCoordScript()));
|
||||||
|
@ -46,6 +52,7 @@ void NewEventToolButton::initButton()
|
||||||
QMenu *alignMenu = new QMenu();
|
QMenu *alignMenu = new QMenu();
|
||||||
alignMenu->addAction(this->newObjectAction);
|
alignMenu->addAction(this->newObjectAction);
|
||||||
alignMenu->addAction(this->newWarpAction);
|
alignMenu->addAction(this->newWarpAction);
|
||||||
|
//alignMenu->addAction(this->newHealLocationAction);
|
||||||
alignMenu->addAction(this->newCoordScriptAction);
|
alignMenu->addAction(this->newCoordScriptAction);
|
||||||
alignMenu->addAction(this->newCoordWeatherAction);
|
alignMenu->addAction(this->newCoordWeatherAction);
|
||||||
alignMenu->addAction(this->newSignAction);
|
alignMenu->addAction(this->newSignAction);
|
||||||
|
@ -72,6 +79,12 @@ void NewEventToolButton::newWarp()
|
||||||
emit newEventAdded(this->selectedEventType);
|
emit newEventAdded(this->selectedEventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NewEventToolButton::newHealLocation()
|
||||||
|
{
|
||||||
|
this->selectedEventType = EventType::HealLocation;
|
||||||
|
emit newEventAdded(this->selectedEventType);
|
||||||
|
}
|
||||||
|
|
||||||
void NewEventToolButton::newCoordScript()
|
void NewEventToolButton::newCoordScript()
|
||||||
{
|
{
|
||||||
this->selectedEventType = EventType::CoordScript;
|
this->selectedEventType = EventType::CoordScript;
|
||||||
|
|
|
@ -14,6 +14,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void newObject();
|
void newObject();
|
||||||
void newWarp();
|
void newWarp();
|
||||||
|
void newHealLocation();
|
||||||
void newCoordScript();
|
void newCoordScript();
|
||||||
void newCoordWeather();
|
void newCoordWeather();
|
||||||
void newSign();
|
void newSign();
|
||||||
|
@ -25,6 +26,7 @@ private:
|
||||||
QString selectedEventType;
|
QString selectedEventType;
|
||||||
QAction *newObjectAction;
|
QAction *newObjectAction;
|
||||||
QAction *newWarpAction;
|
QAction *newWarpAction;
|
||||||
|
QAction *newHealLocationAction;
|
||||||
QAction *newCoordScriptAction;
|
QAction *newCoordScriptAction;
|
||||||
QAction *newCoordWeatherAction;
|
QAction *newCoordWeatherAction;
|
||||||
QAction *newSignAction;
|
QAction *newSignAction;
|
||||||
|
|
|
@ -68,6 +68,24 @@ int ParseUtil::evaluateDefine(QString define, QMap<QString, int>* knownDefines)
|
||||||
return evaluatePostfix(postfixExpression);
|
return evaluatePostfix(postfixExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// arg here is the text in the file src/data/heal_locations.h
|
||||||
|
// returns a list of HealLocations (mapname, x, y)
|
||||||
|
QList<HealLocation>* ParseUtil::parseHealLocs(QString text) {
|
||||||
|
QList<HealLocation> *parsed = new QList<HealLocation>;
|
||||||
|
QStringList lines = text.split('\n');
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
for (auto line : lines){
|
||||||
|
if (line.contains("MAP_GROUP")){
|
||||||
|
QList<QString> li = line.replace(" ","").chopped(2).remove('{').split(',');
|
||||||
|
HealLocation hloc = HealLocation(li[1].remove("MAP_NUM(").remove(")"), i, li[2].toInt(), li[3].toInt());
|
||||||
|
parsed->append(hloc);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parsed;
|
||||||
|
}
|
||||||
|
|
||||||
QList<Token> ParseUtil::tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers) {
|
QList<Token> ParseUtil::tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers) {
|
||||||
QList<Token> tokens;
|
QList<Token> tokens;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef PARSEUTIL_H
|
#ifndef PARSEUTIL_H
|
||||||
#define PARSEUTIL_H
|
#define PARSEUTIL_H
|
||||||
|
|
||||||
|
#include "heallocation.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
@ -35,6 +37,7 @@ public:
|
||||||
void strip_comment(QString*);
|
void strip_comment(QString*);
|
||||||
QList<QStringList>* parseAsm(QString);
|
QList<QStringList>* parseAsm(QString);
|
||||||
int evaluateDefine(QString, QMap<QString, int>*);
|
int evaluateDefine(QString, QMap<QString, int>*);
|
||||||
|
QList<HealLocation>* parseHealLocs(QString);
|
||||||
private:
|
private:
|
||||||
QList<Token> tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers);
|
QList<Token> tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers);
|
||||||
QList<Token> generatePostfix(QList<Token> tokens);
|
QList<Token> generatePostfix(QList<Token> tokens);
|
||||||
|
|
110
porymap.pro
|
@ -1,54 +1,56 @@
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
#
|
#
|
||||||
# Project created by QtCreator 2016-08-31T15:19:13
|
# Project created by QtCreator 2016-08-31T15:19:13
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui
|
QT += core gui
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
TARGET = porymap
|
TARGET = porymap
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
RC_ICONS = resources/icons/porymap-icon-1.ico
|
RC_ICONS = resources/icons/porymap-icon-1.ico
|
||||||
ICON = resources/icons/porymap-icon-1.ico
|
ICON = resources/icons/porymap-icon-1.ico
|
||||||
|
|
||||||
|
|
||||||
SOURCES += main.cpp\
|
SOURCES += main.cpp\
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
project.cpp \
|
project.cpp \
|
||||||
map.cpp \
|
map.cpp \
|
||||||
blockdata.cpp \
|
blockdata.cpp \
|
||||||
block.cpp \
|
block.cpp \
|
||||||
tileset.cpp \
|
tileset.cpp \
|
||||||
tile.cpp \
|
tile.cpp \
|
||||||
event.cpp \
|
event.cpp \
|
||||||
editor.cpp \
|
editor.cpp \
|
||||||
objectpropertiesframe.cpp \
|
objectpropertiesframe.cpp \
|
||||||
graphicsview.cpp \
|
graphicsview.cpp \
|
||||||
parseutil.cpp \
|
parseutil.cpp \
|
||||||
neweventtoolbutton.cpp \
|
neweventtoolbutton.cpp \
|
||||||
noscrollcombobox.cpp \
|
noscrollcombobox.cpp \
|
||||||
noscrollspinbox.cpp
|
noscrollspinbox.cpp \
|
||||||
|
heallocation.cpp
|
||||||
HEADERS += mainwindow.h \
|
|
||||||
project.h \
|
HEADERS += mainwindow.h \
|
||||||
map.h \
|
project.h \
|
||||||
blockdata.h \
|
map.h \
|
||||||
block.h \
|
blockdata.h \
|
||||||
tileset.h \
|
block.h \
|
||||||
tile.h \
|
tileset.h \
|
||||||
event.h \
|
tile.h \
|
||||||
editor.h \
|
event.h \
|
||||||
objectpropertiesframe.h \
|
editor.h \
|
||||||
graphicsview.h \
|
objectpropertiesframe.h \
|
||||||
parseutil.h \
|
graphicsview.h \
|
||||||
neweventtoolbutton.h \
|
parseutil.h \
|
||||||
noscrollcombobox.h \
|
neweventtoolbutton.h \
|
||||||
noscrollspinbox.h
|
noscrollcombobox.h \
|
||||||
|
noscrollspinbox.h \
|
||||||
FORMS += mainwindow.ui \
|
heallocation.h
|
||||||
objectpropertiesframe.ui
|
|
||||||
|
FORMS += mainwindow.ui \
|
||||||
RESOURCES += \
|
objectpropertiesframe.ui
|
||||||
resources/images.qrc
|
|
||||||
|
RESOURCES += \
|
||||||
|
resources/images.qrc
|
||||||
|
|
133
project.cpp
|
@ -501,6 +501,73 @@ void Project::saveMapConstantsHeader() {
|
||||||
saveTextFile(root + "/include/constants/maps.h", text);
|
saveTextFile(root + "/include/constants/maps.h", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// saves heal location coords in root + /src/data/heal_locations.h
|
||||||
|
// and indexes as defines in root + /include/constants/heal_locations.h
|
||||||
|
void Project::saveHealLocationStruct(Map *map) {
|
||||||
|
QString tab = QString(" ");
|
||||||
|
|
||||||
|
QString data_text = QString("static const struct HealLocation sHealLocations[] =\n{\n");
|
||||||
|
|
||||||
|
QString constants_text = QString("#ifndef GUARD_CONSTANTS_HEAL_LOCATIONS_H\n");
|
||||||
|
constants_text += QString("#define GUARD_CONSTANTS_HEAL_LOCATIONS_H\n\n");
|
||||||
|
|
||||||
|
QMap<QString, int> flyableMapsDupes;
|
||||||
|
QSet<QString> flyableMapsUnique;
|
||||||
|
|
||||||
|
// set flyableMapsDupes and flyableMapsUnique
|
||||||
|
for (auto it = flyableMaps.begin(); it != flyableMaps.end(); it++) {
|
||||||
|
HealLocation loc = *it;
|
||||||
|
QString xname = loc.name;
|
||||||
|
if (flyableMapsUnique.contains(xname)) {
|
||||||
|
flyableMapsDupes[xname] = 1;
|
||||||
|
}
|
||||||
|
flyableMapsUnique.insert(xname);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set new location in flyableMapsList
|
||||||
|
if (map->events["heal_event_group"].length() > 0) {
|
||||||
|
for (Event *heal : map->events["heal_event_group"]) {
|
||||||
|
HealLocation hl = heal->buildHealLocation();
|
||||||
|
flyableMaps[hl.index - 1] = hl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
|
||||||
|
for (auto map_in : flyableMaps) {
|
||||||
|
data_text += QString(" {MAP_GROUP(%1), MAP_NUM(%1), %2, %3},\n")
|
||||||
|
.arg(map_in.name)
|
||||||
|
.arg(map_in.x)
|
||||||
|
.arg(map_in.y);
|
||||||
|
|
||||||
|
QString ending = QString("");
|
||||||
|
|
||||||
|
// must add _1 / _2 for maps that have duplicates
|
||||||
|
if (flyableMapsDupes.keys().contains(map_in.name)) {
|
||||||
|
// map contains multiple heal locations
|
||||||
|
ending += QString("_%1").arg(flyableMapsDupes[map_in.name]);
|
||||||
|
flyableMapsDupes[map_in.name]++;
|
||||||
|
}
|
||||||
|
if (map_in.index != 0) {
|
||||||
|
constants_text += QString("#define HEAL_LOCATION_%1 %2\n")
|
||||||
|
.arg(map_in.name + ending)
|
||||||
|
.arg(map_in.index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
constants_text += QString("#define HEAL_LOCATION_%1 %2\n")
|
||||||
|
.arg(map_in.name + ending)
|
||||||
|
.arg(i);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
data_text += QString("};\n");
|
||||||
|
constants_text += QString("\n#endif // GUARD_CONSTANTS_HEAL_LOCATIONS_H\n");
|
||||||
|
|
||||||
|
saveTextFile(root + "/src/data/heal_locations.h", data_text);
|
||||||
|
saveTextFile(root + "/include/constants/heal_locations.h", constants_text);
|
||||||
|
}
|
||||||
|
|
||||||
void Project::loadMapTilesets(Map* map) {
|
void Project::loadMapTilesets(Map* map) {
|
||||||
if (map->layout->has_unsaved_changes) {
|
if (map->layout->has_unsaved_changes) {
|
||||||
return;
|
return;
|
||||||
|
@ -947,6 +1014,11 @@ void Project::readMapGroups() {
|
||||||
groupNames = groups;
|
groupNames = groups;
|
||||||
groupedMapNames = groupedMaps;
|
groupedMapNames = groupedMaps;
|
||||||
mapNames = maps;
|
mapNames = maps;
|
||||||
|
|
||||||
|
QString hltext = readTextFile(root + QString("/src/data/heal_locations.h"));
|
||||||
|
QList<HealLocation>* hl = parser->parseHealLocs(hltext);
|
||||||
|
flyableMaps = *hl;
|
||||||
|
delete hl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map* Project::addNewMapToGroup(QString mapName, int groupNum) {
|
Map* Project::addNewMapToGroup(QString mapName, int groupNum) {
|
||||||
|
@ -1212,6 +1284,9 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
|
||||||
if (!object->pixmap.isNull()) {
|
if (!object->pixmap.isNull()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object->spriteWidth = 16;
|
||||||
|
object->spriteHeight = 16;
|
||||||
QString event_type = object->get("event_type");
|
QString event_type = object->get("event_type");
|
||||||
if (event_type == EventType::Object) {
|
if (event_type == EventType::Object) {
|
||||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(0, 0, 16, 16);
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(0, 0, 16, 16);
|
||||||
|
@ -1221,22 +1296,39 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
|
||||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(32, 0, 16, 16);
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(32, 0, 16, 16);
|
||||||
} else if (event_type == EventType::Sign || event_type == EventType::HiddenItem || event_type == EventType::SecretBase) {
|
} else if (event_type == EventType::Sign || event_type == EventType::HiddenItem || event_type == EventType::SecretBase) {
|
||||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
|
||||||
|
} else if (event_type == EventType::HealLocation) {
|
||||||
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(64, 0, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event_type == EventType::Object) {
|
if (event_type == EventType::Object) {
|
||||||
int sprite_id = constants.value(object->get("sprite"));
|
int sprite_id = constants.value(object->get("sprite"));
|
||||||
|
|
||||||
QString info_label = pointers.value(sprite_id).replace("&", "");
|
QString info_label = pointers.value(sprite_id).replace("&", "");
|
||||||
QString pic_label = readCArray(info_text, info_label).value(14);
|
QStringList gfx_info = readCArray(info_text, info_label);
|
||||||
|
QString pic_label = gfx_info.value(14);
|
||||||
|
QString dimensions_label = gfx_info.value(11);
|
||||||
|
QString subsprites_label = gfx_info.value(12);
|
||||||
QString gfx_label = readCArray(pic_text, pic_label).value(0);
|
QString gfx_label = readCArray(pic_text, pic_label).value(0);
|
||||||
gfx_label = gfx_label.section(QRegExp("[\\(\\)]"), 1, 1);
|
gfx_label = gfx_label.section(QRegExp("[\\(\\)]"), 1, 1);
|
||||||
QString path = readCIncbin(assets_text, gfx_label);
|
QString path = readCIncbin(assets_text, gfx_label);
|
||||||
|
|
||||||
if (!path.isNull()) {
|
if (!path.isNull()) {
|
||||||
path = fixGraphicPath(path);
|
path = fixGraphicPath(path);
|
||||||
QPixmap pixmap(root + "/" + path);
|
QImage spritesheet(root + "/" + path);
|
||||||
if (!pixmap.isNull()) {
|
if (!spritesheet.isNull()) {
|
||||||
object->pixmap = pixmap;
|
// Infer the sprite dimensions from the OAM labels.
|
||||||
|
int spriteWidth = spritesheet.width();
|
||||||
|
int spriteHeight = spritesheet.height();
|
||||||
|
QRegularExpression re("\\S+_(\\d+)x(\\d+)");
|
||||||
|
QRegularExpressionMatch dimensionMatch = re.match(dimensions_label);
|
||||||
|
if (dimensionMatch.hasMatch()) {
|
||||||
|
QRegularExpressionMatch oamTablesMatch = re.match(subsprites_label);
|
||||||
|
if (oamTablesMatch.hasMatch()) {
|
||||||
|
spriteWidth = dimensionMatch.captured(1).toInt();
|
||||||
|
spriteHeight = dimensionMatch.captured(2).toInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
object->setPixmapFromSpritesheet(spritesheet, spriteWidth, spriteHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1309,6 +1401,15 @@ void Project::saveMapEvents(Map *map) {
|
||||||
.arg(bgEventsLabel);
|
.arg(bgEventsLabel);
|
||||||
|
|
||||||
saveTextFile(path, text);
|
saveTextFile(path, text);
|
||||||
|
|
||||||
|
// save heal event changes
|
||||||
|
if (map->events["heal_event_group"].length() > 0) {
|
||||||
|
for (Event *heal : map->events["heal_event_group"]) {
|
||||||
|
HealLocation hl = heal->buildHealLocation();
|
||||||
|
flyableMaps[hl.index - 1] = hl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveHealLocationStruct(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readMapEvents(Map *map) {
|
void Project::readMapEvents(Map *map) {
|
||||||
|
@ -1379,6 +1480,29 @@ void Project::readMapEvents(Map *map) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map->events["heal_event_group"].clear();
|
||||||
|
|
||||||
|
for (auto it = flyableMaps.begin(); it != flyableMaps.end(); it++) {
|
||||||
|
|
||||||
|
HealLocation loc = *it;
|
||||||
|
|
||||||
|
//if TRUE map is flyable / has healing location
|
||||||
|
if (loc.name == QString(mapNamesToMapConstants->value(map->name)).remove(0,4)) {
|
||||||
|
Event *heal = new Event;
|
||||||
|
heal->put("map_name", map->name);
|
||||||
|
heal->put("x", loc.x);
|
||||||
|
heal->put("y", loc.y);
|
||||||
|
heal->put("loc_name", loc.name);
|
||||||
|
heal->put("index", loc.index);
|
||||||
|
heal->put("elevation", 3); // TODO: change this?
|
||||||
|
heal->put("destination_map_name", mapConstantsToMapNames->value(map->name));
|
||||||
|
heal->put("event_group_type", "heal_event_group");
|
||||||
|
heal->put("event_type", EventType::HealLocation);
|
||||||
|
map->events["heal_event_group"].append(heal);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
QList<QStringList> *coords = getLabelMacros(parseAsm(text), coordEventsLabel);
|
QList<QStringList> *coords = getLabelMacros(parseAsm(text), coordEventsLabel);
|
||||||
map->events["coord_event_group"].clear();
|
map->events["coord_event_group"].clear();
|
||||||
for (QStringList command : *coords) {
|
for (QStringList command : *coords) {
|
||||||
|
@ -1455,6 +1579,7 @@ void Project::readMapEvents(Map *map) {
|
||||||
void Project::setNewMapEvents(Map *map) {
|
void Project::setNewMapEvents(Map *map) {
|
||||||
map->events["object_event_group"].clear();
|
map->events["object_event_group"].clear();
|
||||||
map->events["warp_event_group"].clear();
|
map->events["warp_event_group"].clear();
|
||||||
|
map->events["heal_event_group"].clear();
|
||||||
map->events["coord_event_group"].clear();
|
map->events["coord_event_group"].clear();
|
||||||
map->events["bg_event_group"].clear();
|
map->events["bg_event_group"].clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "blockdata.h"
|
#include "blockdata.h"
|
||||||
|
#include "heallocation.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
@ -17,6 +18,7 @@ public:
|
||||||
QMap<QString, int> *map_groups;
|
QMap<QString, int> *map_groups;
|
||||||
QList<QStringList> groupedMapNames;
|
QList<QStringList> groupedMapNames;
|
||||||
QStringList *mapNames = NULL;
|
QStringList *mapNames = NULL;
|
||||||
|
QList<HealLocation> flyableMaps;
|
||||||
QMap<QString, QString>* mapConstantsToMapNames;
|
QMap<QString, QString>* mapConstantsToMapNames;
|
||||||
QMap<QString, QString>* mapNamesToMapConstants;
|
QMap<QString, QString>* mapNamesToMapConstants;
|
||||||
QList<QString> mapLayoutsTable;
|
QList<QString> mapLayoutsTable;
|
||||||
|
@ -77,6 +79,7 @@ public:
|
||||||
void saveAllMapLayouts();
|
void saveAllMapLayouts();
|
||||||
void saveMapGroupsTable();
|
void saveMapGroupsTable();
|
||||||
void saveMapConstantsHeader();
|
void saveMapConstantsHeader();
|
||||||
|
void saveHealLocationStruct(Map*);
|
||||||
|
|
||||||
QList<QStringList>* parseAsm(QString text);
|
QList<QStringList>* parseAsm(QString text);
|
||||||
QStringList getSongNames();
|
QStringList getSongNames();
|
||||||
|
|
BIN
resources/icons/fill_color_cursor.ico
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
resources/icons/move.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
resources/icons/pencil_cursor.ico
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
resources/icons/pipette_cursor.ico
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
resources/icons/shift.ico
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
resources/icons/shift_cursor.ico
Normal file
After Width: | Height: | Size: 4.2 KiB |
|
@ -9,6 +9,7 @@
|
||||||
<file>icons/map.ico</file>
|
<file>icons/map.ico</file>
|
||||||
<file>icons/cursor.ico</file>
|
<file>icons/cursor.ico</file>
|
||||||
<file>icons/fill_color.ico</file>
|
<file>icons/fill_color.ico</file>
|
||||||
|
<file>icons/move.ico</file>
|
||||||
<file>icons/pencil.ico</file>
|
<file>icons/pencil.ico</file>
|
||||||
<file>icons/pipette.ico</file>
|
<file>icons/pipette.ico</file>
|
||||||
<file>images/Entities_16x16.png</file>
|
<file>images/Entities_16x16.png</file>
|
||||||
|
@ -16,6 +17,11 @@
|
||||||
<file>icons/delete.ico</file>
|
<file>icons/delete.ico</file>
|
||||||
<file>icons/viewsprites.ico</file>
|
<file>icons/viewsprites.ico</file>
|
||||||
<file>images/collisions.png</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>
|
<file>icons/porymap-icon-1.ico</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 490 B |