|
@@ -37,6 +37,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
37
|
37
|
connect(editor, SIGNAL(selectedObjectsChanged()), this, SLOT(updateSelectedObjects()));
|
38
|
38
|
connect(editor, SIGNAL(loadMapRequested(QString, QString)), this, SLOT(onLoadMapRequested(QString, QString)));
|
39
|
39
|
connect(editor, SIGNAL(tilesetChanged(QString)), this, SLOT(onTilesetChanged(QString)));
|
|
40
|
+ connect(editor, SIGNAL(warpEventDoubleClicked(QString,QString)), this, SLOT(openWarpMap(QString,QString)));
|
40
|
41
|
|
41
|
42
|
on_toolButton_Paint_clicked();
|
42
|
43
|
|
|
@@ -196,6 +197,39 @@ void MainWindow::redrawMapScene()
|
196
|
197
|
ui->graphicsView_Elevation->setFixedSize(editor->elevation_metatiles_item->pixmap().width() + 2, editor->elevation_metatiles_item->pixmap().height() + 2);
|
197
|
198
|
}
|
198
|
199
|
|
|
200
|
+void MainWindow::openWarpMap(QString map_name, QString warp_num) {
|
|
201
|
+ // Ensure valid destination map name.
|
|
202
|
+ if (!editor->project->mapNames->contains(map_name)) {
|
|
203
|
+ qDebug() << QString("Invalid warp destination map name '%1'").arg(map_name);
|
|
204
|
+ return;
|
|
205
|
+ }
|
|
206
|
+
|
|
207
|
+ // Ensure valid destination warp number.
|
|
208
|
+ bool ok;
|
|
209
|
+ int warpNum = warp_num.toInt(&ok, 0);
|
|
210
|
+ if (!ok) {
|
|
211
|
+ qDebug() << QString("Invalid warp number '%1' for destination map '%2'").arg(warp_num).arg(map_name);
|
|
212
|
+ return;
|
|
213
|
+ }
|
|
214
|
+
|
|
215
|
+ // Open the destination map, and select the target warp event.
|
|
216
|
+ setMap(map_name);
|
|
217
|
+ QList<Event*> warp_events = editor->map->events["warp_event_group"];
|
|
218
|
+ if (warp_events.length() > warpNum) {
|
|
219
|
+ Event *warp_event = warp_events.at(warpNum);
|
|
220
|
+ QList<DraggablePixmapItem *> *all_events = editor->getObjects();
|
|
221
|
+ for (DraggablePixmapItem *item : *all_events) {
|
|
222
|
+ if (item->event == warp_event) {
|
|
223
|
+ editor->selected_events->clear();
|
|
224
|
+ editor->selected_events->append(item);
|
|
225
|
+ editor->updateSelectedEvents();
|
|
226
|
+ }
|
|
227
|
+ }
|
|
228
|
+
|
|
229
|
+ delete all_events;
|
|
230
|
+ }
|
|
231
|
+}
|
|
232
|
+
|
199
|
233
|
void MainWindow::setRecentMap(QString map_name) {
|
200
|
234
|
QSettings settings;
|
201
|
235
|
QString key = "project:" + editor->project->root;
|