Browse Source

Merge pull request #57 from huderlem/dropdowns

Populated comboboxes and tooltips
Marcus Huderle 5 years ago
parent
commit
f86cf26d6e
No account linked to committer's email address
16 changed files with 602 additions and 355 deletions
  1. 40
    48
      editor.cpp
  2. 4
    3
      editor.h
  3. 7
    10
      event.cpp
  4. 0
    6
      graphicsview.cpp
  5. 138
    22
      mainwindow.cpp
  6. 3
    0
      mainwindow.h
  7. 215
    200
      mainwindow.ui
  8. 1
    1
      map.h
  9. 15
    0
      noscrollcombobox.cpp
  10. 17
    0
      noscrollcombobox.h
  11. 16
    0
      noscrollspinbox.cpp
  12. 17
    0
      noscrollspinbox.h
  13. 40
    4
      objectpropertiesframe.ui
  14. 6
    2
      pretmap.pro
  15. 67
    55
      project.cpp
  16. 16
    4
      project.h

+ 40
- 48
editor.cpp View File

@@ -4,6 +4,8 @@
4 4
 #include <QPainter>
5 5
 #include <QMouseEvent>
6 6
 
7
+bool selectingEvent = false;
8
+
7 9
 Editor::Editor(Ui::MainWindow* ui)
8 10
 {
9 11
     this->ui = ui;
@@ -469,6 +471,8 @@ void Editor::displayMapEvents() {
469 471
         delete events_group;
470 472
     }
471 473
 
474
+    selected_events->clear();
475
+
472 476
     events_group = new EventGroup;
473 477
     scene->addItem(events_group);
474 478
 
@@ -484,8 +488,7 @@ void Editor::displayMapEvents() {
484 488
 }
485 489
 
486 490
 DraggablePixmapItem *Editor::addMapEvent(Event *event) {
487
-    DraggablePixmapItem *object = new DraggablePixmapItem(event);
488
-    object->editor = this;
491
+    DraggablePixmapItem *object = new DraggablePixmapItem(event, this);
489 492
     events_group->addToGroup(object);
490 493
     return object;
491 494
 }
@@ -808,16 +811,22 @@ void Editor::updateDiveEmergeMap(QString mapName, QString direction) {
808 811
 
809 812
 void Editor::updatePrimaryTileset(QString tilesetLabel)
810 813
 {
811
-    map->layout->tileset_primary_label = tilesetLabel;
812
-    map->layout->tileset_primary = project->getTileset(tilesetLabel);
813
-    emit tilesetChanged(map->name);
814
+    if (map->layout->tileset_primary_label != tilesetLabel)
815
+    {
816
+        map->layout->tileset_primary_label = tilesetLabel;
817
+        map->layout->tileset_primary = project->getTileset(tilesetLabel);
818
+        emit tilesetChanged(map->name);
819
+    }
814 820
 }
815 821
 
816 822
 void Editor::updateSecondaryTileset(QString tilesetLabel)
817 823
 {
818
-    map->layout->tileset_secondary_label = tilesetLabel;
819
-    map->layout->tileset_secondary = project->getTileset(tilesetLabel);
820
-    emit tilesetChanged(map->name);
824
+    if (map->layout->tileset_secondary_label != tilesetLabel)
825
+    {
826
+        map->layout->tileset_secondary_label = tilesetLabel;
827
+        map->layout->tileset_secondary = project->getTileset(tilesetLabel);
828
+        emit tilesetChanged(map->name);
829
+    }
821 830
 }
822 831
 
823 832
 void MetatilesPixmapItem::paintTileChanged(Map *map) {
@@ -1471,9 +1480,11 @@ void CollisionPixmapItem::pick(QGraphicsSceneMouseEvent *event) {
1471 1480
 
1472 1481
 void DraggablePixmapItem::mousePressEvent(QGraphicsSceneMouseEvent *mouse) {
1473 1482
     active = true;
1474
-    clicking = true;
1475 1483
     last_x = (mouse->pos().x() + this->pos().x()) / 16;
1476 1484
     last_y = (mouse->pos().y() + this->pos().y()) / 16;
1485
+    this->editor->selectMapEvent(this, mouse->modifiers() & Qt::ControlModifier);
1486
+    this->editor->updateSelectedEvents();
1487
+    selectingEvent = true;
1477 1488
     //qDebug() << QString("(%1, %2)").arg(event->get("x")).arg(event->get("y"));
1478 1489
 }
1479 1490
 
@@ -1489,7 +1500,6 @@ void DraggablePixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *mouse) {
1489 1500
         int x = (mouse->pos().x() + this->pos().x()) / 16;
1490 1501
         int y = (mouse->pos().y() + this->pos().y()) / 16;
1491 1502
         if (x != last_x || y != last_y) {
1492
-            clicking = false;
1493 1503
             if (editor->selected_events->contains(this)) {
1494 1504
                 for (DraggablePixmapItem *item : *editor->selected_events) {
1495 1505
                     item->move(x - last_x, y - last_y);
@@ -1505,13 +1515,15 @@ void DraggablePixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *mouse) {
1505 1515
 }
1506 1516
 
1507 1517
 void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) {
1508
-    if (clicking) {
1509
-        this->editor->selectMapEvent(this, mouse->modifiers() & Qt::ControlModifier);
1510
-        this->editor->updateSelectedEvents();
1511
-    }
1512 1518
     active = false;
1513 1519
 }
1514 1520
 
1521
+void DraggablePixmapItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *mouse) {
1522
+    if (this->event->get("event_type") == EventType::Warp) {
1523
+        emit editor->warpEventDoubleClicked(this->event->get("destination_map_name"), this->event->get("destination_warp"));
1524
+    }
1525
+}
1526
+
1515 1527
 QList<DraggablePixmapItem *> *Editor::getObjects() {
1516 1528
     QList<DraggablePixmapItem *> *list = new QList<DraggablePixmapItem *>;
1517 1529
     for (Event *event : map->getAllEvents()) {
@@ -1532,7 +1544,7 @@ void Editor::redrawObject(DraggablePixmapItem *item) {
1532 1544
         if (selected_events && selected_events->contains(item)) {
1533 1545
             QImage image = item->pixmap().toImage();
1534 1546
             QPainter painter(&image);
1535
-            painter.setPen(QColor(250, 100, 25));
1547
+            painter.setPen(QColor(250, 0, 255));
1536 1548
             painter.drawRect(0, 0, image.width() - 1, image.height() - 1);
1537 1549
             painter.end();
1538 1550
             item->setPixmap(QPixmap::fromImage(image));
@@ -1589,39 +1601,19 @@ void Editor::deleteEvent(Event *event) {
1589 1601
     //updateSelectedObjects();
1590 1602
 }
1591 1603
 
1592
-// dunno how to detect bubbling. QMouseEvent::isAccepted seems to always be true
1593
-// check if selected_events changed instead. this has the side effect of deselecting
1594
-// when you click on a selected event, since selected_events doesn't change.
1595
-
1596
-QList<DraggablePixmapItem *> selected_events_test;
1597
-bool clicking = false;
1598
-
1604
+// It doesn't seem to be possible to prevent the mousePress event
1605
+// from triggering both event's DraggablePixmapItem and the background mousePress.
1606
+// Since the DraggablePixmapItem's event fires first, we can set a temp
1607
+// variable "selectingEvent" so that we can detect whether or not the user
1608
+// is clicking on the background instead of an event.
1599 1609
 void Editor::objectsView_onMousePress(QMouseEvent *event) {
1600
-    clicking = true;
1601
-    selected_events_test = *selected_events;
1602
-}
1603
-
1604
-void Editor::objectsView_onMouseMove(QMouseEvent *event) {
1605
-    clicking = false;
1606
-}
1607
-
1608
-void Editor::objectsView_onMouseRelease(QMouseEvent *event) {
1609
-    if (clicking) {
1610
-        if (selected_events_test.length()) {
1611
-            if (selected_events_test.length() == selected_events->length()) {
1612
-                bool deselect = true;
1613
-                for (int i = 0; i < selected_events_test.length(); i++) {
1614
-                    if (selected_events_test.at(i) != selected_events->at(i)) {
1615
-                        deselect = false;
1616
-                        break;
1617
-                    }
1618
-                }
1619
-                if (deselect) {
1620
-                    selected_events->clear();
1621
-                    updateSelectedEvents();
1622
-                }
1623
-            }
1624
-        }
1625
-        clicking = false;
1610
+    bool multiSelect = event->modifiers() & Qt::ControlModifier;
1611
+    if (!selectingEvent && !multiSelect && selected_events->length() > 1) {
1612
+        DraggablePixmapItem *first = selected_events->first();
1613
+        selected_events->clear();
1614
+        selected_events->append(first);
1615
+        updateSelectedEvents();
1626 1616
     }
1617
+
1618
+    selectingEvent = false;
1627 1619
 }

+ 4
- 3
editor.h View File

@@ -138,6 +138,7 @@ signals:
138 138
     void selectedObjectsChanged();
139 139
     void loadMapRequested(QString, QString);
140 140
     void tilesetChanged(QString);
141
+    void warpEventDoubleClicked(QString mapName, QString warpNum);
141 142
 };
142 143
 
143 144
 
@@ -150,13 +151,12 @@ public:
150 151
     Editor *editor = NULL;
151 152
     Event *event = NULL;
152 153
     QGraphicsItemAnimation *pos_anim = NULL;
153
-    DraggablePixmapItem(Event *event_) : QGraphicsPixmapItem(event_->pixmap) {
154
+    DraggablePixmapItem(Event *event_, Editor *editor_) : QGraphicsPixmapItem(event_->pixmap) {
154 155
         event = event_;
156
+        editor = editor_;
155 157
         updatePosition();
156 158
     }
157 159
     bool active;
158
-    bool right_click;
159
-    bool clicking;
160 160
     int last_x;
161 161
     int last_y;
162 162
     void updatePosition() {
@@ -229,6 +229,7 @@ protected:
229 229
     void mousePressEvent(QGraphicsSceneMouseEvent*);
230 230
     void mouseMoveEvent(QGraphicsSceneMouseEvent*);
231 231
     void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
232
+    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
232 233
 };
233 234
 
234 235
 class EventGroup : public QGraphicsItemGroup {

+ 7
- 10
event.cpp View File

@@ -43,13 +43,13 @@ Event* Event::createNewObjectEvent()
43 43
     event->put("event_group_type", "object_event_group");
44 44
     event->put("event_type", EventType::Object);
45 45
     event->put("sprite", "EVENT_OBJ_GFX_BOY_1");
46
-    event->put("behavior", "1");
46
+    event->put("movement_type", "MOVEMENT_TYPE_LOOK_AROUND");
47 47
     event->put("radius_x", 0);
48 48
     event->put("radius_y", 0);
49 49
     event->put("script_label", "NULL");
50 50
     event->put("event_flag", "0");
51 51
     event->put("replacement", "0");
52
-    event->put("trainer_see_type", "0");
52
+    event->put("is_trainer", "FALSE");
53 53
     event->put("sight_radius_tree_id", 0);
54 54
     return event;
55 55
 }
@@ -89,7 +89,7 @@ Event* Event::createNewSignEvent()
89 89
     Event *event = new Event;
90 90
     event->put("event_group_type", "bg_event_group");
91 91
     event->put("event_type", EventType::Sign);
92
-    event->put("player_facing_direction", "0");
92
+    event->put("player_facing_direction", "BG_EVENT_PLAYER_FACING_ANY");
93 93
     event->put("script_label", "NULL");
94 94
     return event;
95 95
 }
@@ -109,7 +109,7 @@ Event* Event::createNewSecretBaseEvent()
109 109
     Event *event = new Event;
110 110
     event->put("event_group_type", "bg_event_group");
111 111
     event->put("event_type", EventType::SecretBase);
112
-    event->put("secret_base_map", "SECRET_BASE_RED_CAVE2_1");
112
+    event->put("secret_base_id", "SECRET_BASE_RED_CAVE2_1");
113 113
     return event;
114 114
 }
115 115
 
@@ -127,10 +127,10 @@ QString Event::buildObjectEventMacro(int item_index)
127 127
     text += QString(", %1").arg(x);
128 128
     text += QString(", %1").arg(y);
129 129
     text += QString(", %1").arg(this->get("elevation"));
130
-    text += QString(", %1").arg(this->get("behavior"));
130
+    text += QString(", %1").arg(this->get("movement_type"));
131 131
     text += QString(", %1").arg(radius_x);
132 132
     text += QString(", %1").arg(radius_y);
133
-    text += QString(", %1").arg(this->get("trainer_see_type"));
133
+    text += QString(", %1").arg(this->get("is_trainer"));
134 134
     text += QString(", %1").arg(this->get("sight_radius_tree_id"));
135 135
     text += QString(", %1").arg(this->get("script_label"));
136 136
     text += QString(", %1").arg(this->get("event_flag"));
@@ -156,10 +156,8 @@ QString Event::buildCoordScriptEventMacro()
156 156
     text += QString("\tcoord_event %1").arg(this->get("x"));
157 157
     text += QString(", %1").arg(this->get("y"));
158 158
     text += QString(", %1").arg(this->get("elevation"));
159
-    text += QString(", 0");
160 159
     text += QString(", %1").arg(this->get("script_var"));
161 160
     text += QString(", %1").arg(this->get("script_var_value"));
162
-    text += QString(", 0");
163 161
     text += QString(", %1").arg(this->get("script_label"));
164 162
     text += "\n";
165 163
     return text;
@@ -183,7 +181,6 @@ QString Event::buildSignEventMacro()
183 181
     text += QString(", %1").arg(this->get("y"));
184 182
     text += QString(", %1").arg(this->get("elevation"));
185 183
     text += QString(", %1").arg(this->get("player_facing_direction"));
186
-    text += QString(", 0");
187 184
     text += QString(", %1").arg(this->get("script_label"));
188 185
     text += "\n";
189 186
     return text;
@@ -207,7 +204,7 @@ QString Event::buildSecretBaseEventMacro()
207 204
     text += QString("\tbg_secret_base_event %1").arg(this->get("x"));
208 205
     text += QString(", %1").arg(this->get("y"));
209 206
     text += QString(", %1").arg(this->get("elevation"));
210
-    text += QString(", %1").arg(this->get("secret_base_map"));
207
+    text += QString(", %1").arg(this->get("secret_base_id"));
211 208
     text += "\n";
212 209
     return text;
213 210
 }

+ 0
- 6
graphicsview.cpp View File

@@ -10,14 +10,8 @@ void GraphicsView::mousePressEvent(QMouseEvent *event) {
10 10
 
11 11
 void GraphicsView::mouseMoveEvent(QMouseEvent *event) {
12 12
     QGraphicsView::mouseMoveEvent(event);
13
-    if (editor) {
14
-        editor->objectsView_onMouseMove(event);
15
-    }
16 13
 }
17 14
 
18 15
 void GraphicsView::mouseReleaseEvent(QMouseEvent *event) {
19 16
     QGraphicsView::mouseReleaseEvent(event);
20
-    if (editor) {
21
-        editor->objectsView_onMouseRelease(event);
22
-    }
23 17
 }

+ 138
- 22
mainwindow.cpp View File

@@ -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;
@@ -210,7 +244,7 @@ void MainWindow::setRecentMap(QString map_name) {
210 244
 void MainWindow::displayMapProperties() {
211 245
     ui->comboBox_Song->clear();
212 246
     ui->comboBox_Location->clear();
213
-    ui->comboBox_Visibility->clear();
247
+    ui->checkBox_Visibility->setChecked(false);
214 248
     ui->comboBox_Weather->clear();
215 249
     ui->comboBox_Type->clear();
216 250
     ui->comboBox_BattleScene->clear();
@@ -229,7 +263,7 @@ void MainWindow::displayMapProperties() {
229 263
     ui->comboBox_Song->addItems(songs);
230 264
     ui->comboBox_Song->setCurrentText(map->song);
231 265
 
232
-    ui->comboBox_Location->addItems(project->getLocations());
266
+    ui->comboBox_Location->addItems(*project->regionMapSections);
233 267
     ui->comboBox_Location->setCurrentText(map->location);
234 268
 
235 269
     QMap<QString, QStringList> tilesets = project->getTilesets();
@@ -238,16 +272,15 @@ void MainWindow::displayMapProperties() {
238 272
     ui->comboBox_SecondaryTileset->addItems(tilesets.value("secondary"));
239 273
     ui->comboBox_SecondaryTileset->setCurrentText(map->layout->tileset_secondary_label);
240 274
 
241
-    ui->comboBox_Visibility->addItems(project->getVisibilities());
242
-    ui->comboBox_Visibility->setCurrentText(map->visibility);
275
+    ui->checkBox_Visibility->setChecked(map->requiresFlash.toInt() > 0 || map->requiresFlash == "TRUE");
243 276
 
244
-    ui->comboBox_Weather->addItems(project->getWeathers());
277
+    ui->comboBox_Weather->addItems(*project->weatherNames);
245 278
     ui->comboBox_Weather->setCurrentText(map->weather);
246 279
 
247
-    ui->comboBox_Type->addItems(project->getMapTypes());
280
+    ui->comboBox_Type->addItems(*project->mapTypes);
248 281
     ui->comboBox_Type->setCurrentText(map->type);
249 282
 
250
-    ui->comboBox_BattleScene->addItems(project->getBattleScenes());
283
+    ui->comboBox_BattleScene->addItems(*project->mapBattleScenes);
251 284
     ui->comboBox_BattleScene->setCurrentText(map->battle_scene);
252 285
 
253 286
     ui->checkBox_ShowLocation->setChecked(map->show_location.toInt() > 0 || map->show_location == "TRUE");
@@ -267,10 +300,10 @@ void MainWindow::on_comboBox_Location_activated(const QString &location)
267 300
     }
268 301
 }
269 302
 
270
-void MainWindow::on_comboBox_Visibility_activated(const QString &visibility)
303
+void MainWindow::on_comboBox_Visibility_activated(const QString &requiresFlash)
271 304
 {
272 305
     if (editor && editor->map) {
273
-        editor->map->visibility = visibility;
306
+        editor->map->requiresFlash = requiresFlash;
274 307
     }
275 308
 }
276 309
 
@@ -295,6 +328,17 @@ void MainWindow::on_comboBox_BattleScene_activated(const QString &battle_scene)
295 328
     }
296 329
 }
297 330
 
331
+void MainWindow::on_checkBox_Visibility_clicked(bool checked)
332
+{
333
+    if (editor && editor->map) {
334
+        if (checked) {
335
+            editor->map->requiresFlash = "TRUE";
336
+        } else {
337
+            editor->map->requiresFlash = "FALSE";
338
+        }
339
+    }
340
+}
341
+
298 342
 void MainWindow::on_checkBox_ShowLocation_clicked(bool checked)
299 343
 {
300 344
     if (editor && editor->map) {
@@ -310,9 +354,17 @@ void MainWindow::loadDataStructures() {
310 354
     Project *project = editor->project;
311 355
     project->readMapLayoutsTable();
312 356
     project->readAllMapLayouts();
357
+    project->readRegionMapSections();
313 358
     project->readItemNames();
314 359
     project->readFlagNames();
315 360
     project->readVarNames();
361
+    project->readMovementTypes();
362
+    project->readMapTypes();
363
+    project->readMapBattleScenes();
364
+    project->readWeatherNames();
365
+    project->readCoordEventWeatherNames();
366
+    project->readSecretBaseIds();
367
+    project->readBgEventFacingDirections();
316 368
     project->readMapsWithConnections();
317 369
 }
318 370
 
@@ -544,12 +596,19 @@ void MainWindow::addNewEvent(QString event_type)
544 596
 
545 597
 // Should probably just pass layout and let the editor work it out
546 598
 void MainWindow::updateSelectedObjects() {
547
-
548 599
     QList<DraggablePixmapItem *> *all_events = editor->getObjects();
549
-    QList<DraggablePixmapItem *> *events = all_events;
600
+    QList<DraggablePixmapItem *> *events = NULL;
550 601
 
551 602
     if (editor->selected_events && editor->selected_events->length()) {
552 603
         events = editor->selected_events;
604
+    } else {
605
+        events = new QList<DraggablePixmapItem*>;
606
+        if (all_events && all_events->length()) {
607
+            DraggablePixmapItem *selectedEvent = all_events->first();
608
+            editor->selected_events->append(selectedEvent);
609
+            editor->redrawObject(selectedEvent);
610
+            events->append(selectedEvent);
611
+        }
553 612
     }
554 613
 
555 614
     QMap<QString, int> event_obj_gfx_constants = editor->project->getEventObjGfxConstants();
@@ -597,11 +656,10 @@ void MainWindow::updateSelectedObjects() {
597 656
         QMap<QString, QString> field_labels;
598 657
         field_labels["script_label"] = "Script";
599 658
         field_labels["event_flag"] = "Event Flag";
600
-        field_labels["replacement"] = "Replacement";
601
-        field_labels["behavior"] = "Behavior";
659
+        field_labels["movement_type"] = "Movement";
602 660
         field_labels["radius_x"] = "Movement Radius X";
603 661
         field_labels["radius_y"] = "Movement Radius Y";
604
-        field_labels["trainer_see_type"] = "Trainer See Type";
662
+        field_labels["is_trainer"] = "Trainer";
605 663
         field_labels["sight_radius_tree_id"] = "Sight Radius / Berry Tree ID";
606 664
         field_labels["destination_warp"] = "Destination Warp";
607 665
         field_labels["destination_map_name"] = "Destination Map";
@@ -613,7 +671,7 @@ void MainWindow::updateSelectedObjects() {
613 671
         field_labels["item_unknown6"] = "Unknown 6";
614 672
         field_labels["weather"] = "Weather";
615 673
         field_labels["flag"] = "Flag";
616
-        field_labels["secret_base_map"] = "Secret Base Map";
674
+        field_labels["secret_base_id"] = "Secret Base Id";
617 675
 
618 676
         QStringList fields;
619 677
 
@@ -634,13 +692,12 @@ void MainWindow::updateSelectedObjects() {
634 692
             //connect(item, SIGNAL(scriptChanged(QString)), frame->ui->comboBox_script, SLOT(setValue(QString)));
635 693
             */
636 694
 
637
-            fields << "behavior";
695
+            fields << "movement_type";
638 696
             fields << "radius_x";
639 697
             fields << "radius_y";
640 698
             fields << "script_label";
641 699
             fields << "event_flag";
642
-            fields << "replacement";
643
-            fields << "trainer_see_type";
700
+            fields << "is_trainer";
644 701
             fields << "sight_radius_tree_id";
645 702
         }
646 703
         else if (event_type == EventType::Warp) {
@@ -664,37 +721,96 @@ void MainWindow::updateSelectedObjects() {
664 721
             fields << "flag";
665 722
         }
666 723
         else if (event_type == EventType::SecretBase) {
667
-            fields << "secret_base_map";
724
+            fields << "secret_base_id";
668 725
         }
669 726
 
670 727
         for (QString key : fields) {
728
+            QString value = item->event->get(key);
671 729
             QWidget *widget = new QWidget(frame);
672 730
             QFormLayout *fl = new QFormLayout(widget);
673 731
             fl->setContentsMargins(9, 0, 9, 0);
674
-            QComboBox *combo = new QComboBox(widget);
732
+
733
+            // is_trainer is the only non-combobox item.
734
+            if (key == "is_trainer") {
735
+                QCheckBox *checkbox = new QCheckBox(widget);
736
+                checkbox->setEnabled(true);
737
+                checkbox->setChecked(value.toInt() != 0 && value != "FALSE");
738
+                checkbox->setToolTip("Whether or not this object is trainer.");
739
+                fl->addRow(new QLabel(field_labels[key], widget), checkbox);
740
+                widget->setLayout(fl);
741
+                frame->layout()->addWidget(widget);
742
+                connect(checkbox, &QCheckBox::stateChanged, [=](int state) {
743
+                    QString isTrainer = state == Qt::Checked ? "TRUE" : "FALSE";
744
+                    item->event->put("is_trainer", isTrainer);
745
+                });
746
+                continue;
747
+            }
748
+
749
+            NoScrollComboBox *combo = new NoScrollComboBox(widget);
675 750
             combo->setEditable(true);
676 751
 
677
-            QString value = item->event->get(key);
678 752
             if (key == "destination_map_name") {
679 753
                 if (!editor->project->mapNames->contains(value)) {
680 754
                     combo->addItem(value);
681 755
                 }
682 756
                 combo->addItems(*editor->project->mapNames);
757
+                combo->setToolTip("The destination map name of the warp.");
758
+            } else if (key == "destination_warp") {
759
+                combo->setToolTip("The warp id on the destination map.");
683 760
             } else if (key == "item") {
684 761
                 if (!editor->project->itemNames->contains(value)) {
685 762
                     combo->addItem(value);
686 763
                 }
687 764
                 combo->addItems(*editor->project->itemNames);
688
-            } else if (key == "flag") {
765
+            } else if (key == "flag" || key == "event_flag") {
689 766
                 if (!editor->project->flagNames->contains(value)) {
690 767
                     combo->addItem(value);
691 768
                 }
692 769
                 combo->addItems(*editor->project->flagNames);
770
+                if (key == "flag")
771
+                    combo->setToolTip("The flag which is set when the hidden item is picked up.");
772
+                else if (key == "event_flag")
773
+                    combo->setToolTip("The flag which hides the object when set.");
693 774
             } else if (key == "script_var") {
694 775
                 if (!editor->project->varNames->contains(value)) {
695 776
                     combo->addItem(value);
696 777
                 }
697 778
                 combo->addItems(*editor->project->varNames);
779
+                combo->setToolTip("The variable by which the script is triggered. The script is triggered when this variable's value matches 'Var Value'.");
780
+            } else if (key == "script_var_value")  {
781
+                combo->setToolTip("The variable's value which triggers the script.");
782
+            } else if (key == "movement_type") {
783
+                if (!editor->project->movementTypes->contains(value)) {
784
+                    combo->addItem(value);
785
+                }
786
+                combo->addItems(*editor->project->movementTypes);
787
+                combo->setToolTip("The object's natural movement behavior when the player is not interacting with it.");
788
+            } else if (key == "weather") {
789
+                if (!editor->project->coordEventWeatherNames->contains(value)) {
790
+                    combo->addItem(value);
791
+                }
792
+                combo->addItems(*editor->project->coordEventWeatherNames);
793
+                combo->setToolTip("The weather that starts when the player steps on this spot.");
794
+            } else if (key == "secret_base_id") {
795
+                if (!editor->project->secretBaseIds->contains(value)) {
796
+                    combo->addItem(value);
797
+                }
798
+                combo->addItems(*editor->project->secretBaseIds);
799
+                combo->setToolTip("The secret base id which is inside this secret base entrance. Secret base ids are meant to be unique to each and every secret base entrance.");
800
+            } else if (key == "player_facing_direction") {
801
+                if (!editor->project->bgEventFacingDirections->contains(value)) {
802
+                    combo->addItem(value);
803
+                }
804
+                combo->addItems(*editor->project->bgEventFacingDirections);
805
+                combo->setToolTip("The direction which the player must be facing to be able to interact with this event.");
806
+            } else if (key == "radius_x") {
807
+                combo->setToolTip("The maximum number of metatiles this object is allowed to move left or right during its normal movement behavior actions.");
808
+            } else if (key == "radius_y") {
809
+                combo->setToolTip("The maximum number of metatiles this object is allowed to move up or down during its normal movement behavior actions.");
810
+            } else if (key == "script_label") {
811
+                combo->setToolTip("The script which is executed with this event.");
812
+            } else if (key == "sight_radius_tree_id") {
813
+                combo->setToolTip("The maximum sight range of a trainer, OR the unique id of the berry tree.");
698 814
             } else {
699 815
                 combo->addItem(value);
700 816
             }

+ 3
- 0
mainwindow.h View File

@@ -32,6 +32,7 @@ private slots:
32 32
     void on_action_Open_Project_triggered();
33 33
     void on_mapList_activated(const QModelIndex &index);
34 34
     void on_action_Save_Project_triggered();
35
+    void openWarpMap(QString map_name, QString warp_num);
35 36
 
36 37
     void undo();
37 38
     void redo();
@@ -98,6 +99,8 @@ private slots:
98 99
 
99 100
     void on_checkBox_smartPaths_stateChanged(int selected);
100 101
 
102
+    void on_checkBox_Visibility_clicked(bool checked);
103
+
101 104
 private:
102 105
     Ui::MainWindow *ui;
103 106
     QStandardItemModel *mapListModel;

+ 215
- 200
mainwindow.ui View File

@@ -69,6 +69,9 @@
69 69
         <bool>false</bool>
70 70
        </property>
71 71
        <widget class="QWidget" name="tab_Map">
72
+        <property name="toolTip">
73
+         <string/>
74
+        </property>
72 75
         <attribute name="icon">
73 76
          <iconset resource="resources/images.qrc">
74 77
           <normaloff>:/icons/map.ico</normaloff>:/icons/map.ico</iconset>
@@ -76,6 +79,9 @@
76 79
         <attribute name="title">
77 80
          <string>Map</string>
78 81
         </attribute>
82
+        <attribute name="toolTip">
83
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Edit the map layout.&lt;/p&gt;&lt;p&gt;Select metatiles or collision attributes from the right panel, and paint them onto the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
84
+        </attribute>
79 85
         <layout class="QGridLayout" name="gridLayout_9">
80 86
          <property name="leftMargin">
81 87
           <number>0</number>
@@ -164,6 +170,9 @@
164 170
                   <property name="enabled">
165 171
                    <bool>true</bool>
166 172
                   </property>
173
+                  <property name="toolTip">
174
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Pencil&lt;/p&gt;&lt;p&gt;Click and drag to draw on the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
175
+                  </property>
167 176
                   <property name="text">
168 177
                    <string>Paint</string>
169 178
                   </property>
@@ -187,6 +196,9 @@
187 196
                   <property name="enabled">
188 197
                    <bool>true</bool>
189 198
                   </property>
199
+                  <property name="toolTip">
200
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Pointer&lt;/p&gt;&lt;p&gt;Does nothing&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
201
+                  </property>
190 202
                   <property name="text">
191 203
                    <string>Select</string>
192 204
                   </property>
@@ -201,6 +213,9 @@
201 213
                 </item>
202 214
                 <item>
203 215
                  <widget class="QToolButton" name="toolButton_Fill">
216
+                  <property name="toolTip">
217
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Flood Fill&lt;/p&gt;&lt;p&gt;Fills all similar tiles in a region with the selected metatiles or collision attributes&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
218
+                  </property>
204 219
                   <property name="text">
205 220
                    <string>Fill</string>
206 221
                   </property>
@@ -215,6 +230,9 @@
215 230
                 </item>
216 231
                 <item>
217 232
                  <widget class="QToolButton" name="toolButton_Dropper">
233
+                  <property name="toolTip">
234
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Eye Dropper&lt;/p&gt;&lt;p&gt;Click to select a metatile or collision attribute.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
235
+                  </property>
218 236
                   <property name="text">
219 237
                    <string>Dropper</string>
220 238
                   </property>
@@ -229,6 +247,9 @@
229 247
                 </item>
230 248
                 <item>
231 249
                  <widget class="QCheckBox" name="checkBox_smartPaths">
250
+                  <property name="toolTip">
251
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;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.&lt;/p&gt;&lt;p&gt;When smart-path mode is &lt;span style=&quot; font-weight:600;&quot;&gt;not&lt;/span&gt; enabled, clicking and dragging a selection will tile it in a grid.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
252
+                  </property>
232 253
                   <property name="styleSheet">
233 254
                    <string notr="true">margin-left: 10px</string>
234 255
                   </property>
@@ -239,6 +260,9 @@
239 260
                 </item>
240 261
                 <item>
241 262
                  <widget class="QCheckBox" name="checkBox_ToggleGrid">
263
+                  <property name="toolTip">
264
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Toggles a grid over the map's metatile boundaries.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
265
+                  </property>
242 266
                   <property name="styleSheet">
243 267
                    <string notr="true"/>
244 268
                   </property>
@@ -262,6 +286,9 @@
262 286
                 </item>
263 287
                 <item>
264 288
                  <widget class="QPushButton" name="pushButton">
289
+                  <property name="toolTip">
290
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Change a map layout's width and height.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
291
+                  </property>
265 292
                   <property name="text">
266 293
                    <string>Change Dimensions</string>
267 294
                   </property>
@@ -490,7 +517,13 @@
490 517
                      </widget>
491 518
                     </item>
492 519
                     <item row="0" column="1">
493
-                     <widget class="QComboBox" name="comboBox_PrimaryTileset">
520
+                     <widget class="NoScrollComboBox" name="comboBox_PrimaryTileset">
521
+                      <property name="focusPolicy">
522
+                       <enum>Qt::StrongFocus</enum>
523
+                      </property>
524
+                      <property name="toolTip">
525
+                       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Primary Tileset&lt;/p&gt;&lt;p&gt;Defines the first 0x200 metatiles available for the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
526
+                      </property>
494 527
                       <property name="editable">
495 528
                        <bool>true</bool>
496 529
                       </property>
@@ -504,7 +537,13 @@
504 537
                      </widget>
505 538
                     </item>
506 539
                     <item row="1" column="1">
507
-                     <widget class="QComboBox" name="comboBox_SecondaryTileset">
540
+                     <widget class="NoScrollComboBox" name="comboBox_SecondaryTileset">
541
+                      <property name="focusPolicy">
542
+                       <enum>Qt::StrongFocus</enum>
543
+                      </property>
544
+                      <property name="toolTip">
545
+                       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Secondary Tileset&lt;/p&gt;&lt;p&gt;Defines the second 0x200 metatiles available for the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
546
+                      </property>
508 547
                       <property name="editable">
509 548
                        <bool>true</bool>
510 549
                       </property>
@@ -574,6 +613,9 @@
574 613
                         <height>48</height>
575 614
                        </size>
576 615
                       </property>
616
+                      <property name="toolTip">
617
+                       <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The border is a 2x2 metatile which is repeated outside of the map layout's boundary. Draw on this border area to modify it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
618
+                      </property>
577 619
                       <property name="frameShape">
578 620
                        <enum>QFrame::StyledPanel</enum>
579 621
                       </property>
@@ -846,7 +888,10 @@
846 888
          <bool>true</bool>
847 889
         </property>
848 890
         <attribute name="title">
849
-         <string>Objects</string>
891
+         <string>Events</string>
892
+        </attribute>
893
+        <attribute name="toolTip">
894
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Edit the map's events.&lt;/p&gt;&lt;p&gt;View and modify objects, warps, signs, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
850 895
         </attribute>
851 896
         <layout class="QGridLayout" name="gridLayout_10">
852 897
          <property name="leftMargin">
@@ -1107,6 +1152,9 @@
1107 1152
                     <height>32</height>
1108 1153
                    </size>
1109 1154
                   </property>
1155
+                  <property name="toolTip">
1156
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a new event to the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1157
+                  </property>
1110 1158
                   <property name="text">
1111 1159
                    <string>New Object</string>
1112 1160
                   </property>
@@ -1133,6 +1181,9 @@
1133 1181
                     <height>32</height>
1134 1182
                    </size>
1135 1183
                   </property>
1184
+                  <property name="toolTip">
1185
+                   <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Delete the selected event from the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1186
+                  </property>
1136 1187
                   <property name="text">
1137 1188
                    <string>Delete</string>
1138 1189
                   </property>
@@ -1172,7 +1223,7 @@
1172 1223
        </widget>
1173 1224
        <widget class="QWidget" name="tab_Attributes">
1174 1225
         <attribute name="title">
1175
-         <string>Attributes</string>
1226
+         <string>Header</string>
1176 1227
         </attribute>
1177 1228
         <widget class="QFrame" name="frame_3">
1178 1229
          <property name="enabled">
@@ -1182,211 +1233,146 @@
1182 1233
           <rect>
1183 1234
            <x>10</x>
1184 1235
            <y>10</y>
1185
-           <width>301</width>
1186
-           <height>251</height>
1236
+           <width>381</width>
1237
+           <height>311</height>
1187 1238
           </rect>
1188 1239
          </property>
1240
+         <property name="sizePolicy">
1241
+          <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
1242
+           <horstretch>0</horstretch>
1243
+           <verstretch>0</verstretch>
1244
+          </sizepolicy>
1245
+         </property>
1189 1246
          <property name="frameShape">
1190 1247
           <enum>QFrame::StyledPanel</enum>
1191 1248
          </property>
1192 1249
          <property name="frameShadow">
1193 1250
           <enum>QFrame::Raised</enum>
1194 1251
          </property>
1195
-         <widget class="QLabel" name="label_3">
1196
-          <property name="geometry">
1197
-           <rect>
1198
-            <x>20</x>
1199
-            <y>30</y>
1200
-            <width>47</width>
1201
-            <height>21</height>
1202
-           </rect>
1203
-          </property>
1204
-          <property name="text">
1205
-           <string>Song</string>
1206
-          </property>
1207
-         </widget>
1208
-         <widget class="QLabel" name="label_4">
1209
-          <property name="geometry">
1210
-           <rect>
1211
-            <x>20</x>
1212
-            <y>60</y>
1213
-            <width>47</width>
1214
-            <height>21</height>
1215
-           </rect>
1216
-          </property>
1217
-          <property name="text">
1218
-           <string>Location</string>
1219
-          </property>
1220
-         </widget>
1221
-         <widget class="QLabel" name="label_5">
1222
-          <property name="geometry">
1223
-           <rect>
1224
-            <x>20</x>
1225
-            <y>90</y>
1226
-            <width>47</width>
1227
-            <height>21</height>
1228
-           </rect>
1229
-          </property>
1230
-          <property name="text">
1231
-           <string>Visibility</string>
1232
-          </property>
1233
-         </widget>
1234
-         <widget class="QLabel" name="label_6">
1235
-          <property name="geometry">
1236
-           <rect>
1237
-            <x>20</x>
1238
-            <y>120</y>
1239
-            <width>47</width>
1240
-            <height>21</height>
1241
-           </rect>
1242
-          </property>
1243
-          <property name="text">
1244
-           <string>Weather</string>
1252
+         <layout class="QFormLayout" name="formLayout_2">
1253
+          <property name="verticalSpacing">
1254
+           <number>12</number>
1245 1255
           </property>
1246
-         </widget>
1247
-         <widget class="QLabel" name="label_7">
1248
-          <property name="geometry">
1249
-           <rect>
1250
-            <x>20</x>
1251
-            <y>150</y>
1252
-            <width>47</width>
1253
-            <height>21</height>
1254
-           </rect>
1255
-          </property>
1256
-          <property name="text">
1257
-           <string>Type</string>
1258
-          </property>
1259
-         </widget>
1260
-         <widget class="QLabel" name="label_8">
1261
-          <property name="geometry">
1262
-           <rect>
1263
-            <x>20</x>
1264
-            <y>180</y>
1265
-            <width>101</width>
1266
-            <height>21</height>
1267
-           </rect>
1268
-          </property>
1269
-          <property name="text">
1270
-           <string>Show location name</string>
1271
-          </property>
1272
-         </widget>
1273
-         <widget class="QLabel" name="label_9">
1274
-          <property name="geometry">
1275
-           <rect>
1276
-            <x>20</x>
1277
-            <y>210</y>
1278
-            <width>81</width>
1279
-            <height>21</height>
1280
-           </rect>
1281
-          </property>
1282
-          <property name="text">
1283
-           <string>Battle scene</string>
1284
-          </property>
1285
-         </widget>
1286
-         <widget class="QComboBox" name="comboBox_Location">
1287
-          <property name="geometry">
1288
-           <rect>
1289
-            <x>80</x>
1290
-            <y>60</y>
1291
-            <width>211</width>
1292
-            <height>22</height>
1293
-           </rect>
1294
-          </property>
1295
-          <property name="editable">
1296
-           <bool>true</bool>
1297
-          </property>
1298
-         </widget>
1299
-         <widget class="QComboBox" name="comboBox_Visibility">
1300
-          <property name="geometry">
1301
-           <rect>
1302
-            <x>80</x>
1303
-            <y>90</y>
1304
-            <width>211</width>
1305
-            <height>22</height>
1306
-           </rect>
1307
-          </property>
1308
-          <property name="editable">
1309
-           <bool>true</bool>
1310
-          </property>
1311
-         </widget>
1312
-         <widget class="QComboBox" name="comboBox_Song">
1313
-          <property name="geometry">
1314
-           <rect>
1315
-            <x>80</x>
1316
-            <y>30</y>
1317
-            <width>211</width>
1318
-            <height>22</height>
1319
-           </rect>
1320
-          </property>
1321
-          <property name="editable">
1322
-           <bool>true</bool>
1323
-          </property>
1324
-         </widget>
1325
-         <widget class="QComboBox" name="comboBox_Weather">
1326
-          <property name="geometry">
1327
-           <rect>
1328
-            <x>80</x>
1329
-            <y>120</y>
1330
-            <width>211</width>
1331
-            <height>22</height>
1332
-           </rect>
1333
-          </property>
1334
-          <property name="editable">
1335
-           <bool>true</bool>
1336
-          </property>
1337
-         </widget>
1338
-         <widget class="QComboBox" name="comboBox_Type">
1339
-          <property name="geometry">
1340
-           <rect>
1341
-            <x>80</x>
1342
-            <y>150</y>
1343
-            <width>211</width>
1344
-            <height>22</height>
1345
-           </rect>
1346
-          </property>
1347
-          <property name="editable">
1348
-           <bool>true</bool>
1349
-          </property>
1350
-         </widget>
1351
-         <widget class="QComboBox" name="comboBox_BattleScene">
1352
-          <property name="geometry">
1353
-           <rect>
1354
-            <x>90</x>
1355
-            <y>210</y>
1356
-            <width>201</width>
1357
-            <height>22</height>
1358
-           </rect>
1359
-          </property>
1360
-          <property name="editable">
1361
-           <bool>true</bool>
1362
-          </property>
1363
-         </widget>
1364
-         <widget class="QCheckBox" name="checkBox_ShowLocation">
1365
-          <property name="geometry">
1366
-           <rect>
1367
-            <x>130</x>
1368
-            <y>180</y>
1369
-            <width>161</width>
1370
-            <height>21</height>
1371
-           </rect>
1372
-          </property>
1373
-          <property name="text">
1374
-           <string/>
1375
-          </property>
1376
-         </widget>
1377
-         <widget class="QLabel" name="label_10">
1378
-          <property name="geometry">
1379
-           <rect>
1380
-            <x>0</x>
1381
-            <y>0</y>
1382
-            <width>47</width>
1383
-            <height>13</height>
1384
-           </rect>
1385
-          </property>
1386
-          <property name="text">
1387
-           <string>Header</string>
1388
-          </property>
1389
-         </widget>
1256
+          <item row="0" column="0">
1257
+           <widget class="QLabel" name="label_3">
1258
+            <property name="text">
1259
+             <string>Song</string>
1260
+            </property>
1261
+           </widget>
1262
+          </item>
1263
+          <item row="0" column="1">
1264
+           <widget class="QComboBox" name="comboBox_Song">
1265
+            <property name="toolTip">
1266
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default background music for this map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1267
+            </property>
1268
+            <property name="editable">
1269
+             <bool>true</bool>
1270
+            </property>
1271
+           </widget>
1272
+          </item>
1273
+          <item row="1" column="0">
1274
+           <widget class="QLabel" name="label_4">
1275
+            <property name="text">
1276
+             <string>Location</string>
1277
+            </property>
1278
+           </widget>
1279
+          </item>
1280
+          <item row="1" column="1">
1281
+           <widget class="QComboBox" name="comboBox_Location">
1282
+            <property name="toolTip">
1283
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The section of the region map which the map is grouped under. This also determines the name of the map that is display when the player enters it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1284
+            </property>
1285
+            <property name="editable">
1286
+             <bool>true</bool>
1287
+            </property>
1288
+           </widget>
1289
+          </item>
1290
+          <item row="2" column="0">
1291
+           <widget class="QLabel" name="label_5">
1292
+            <property name="text">
1293
+             <string>Requires Flash</string>
1294
+            </property>
1295
+           </widget>
1296
+          </item>
1297
+          <item row="3" column="0">
1298
+           <widget class="QLabel" name="label_6">
1299
+            <property name="text">
1300
+             <string>Weather</string>
1301
+            </property>
1302
+           </widget>
1303
+          </item>
1304
+          <item row="3" column="1">
1305
+           <widget class="QComboBox" name="comboBox_Weather">
1306
+            <property name="toolTip">
1307
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default weather for this map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1308
+            </property>
1309
+            <property name="editable">
1310
+             <bool>true</bool>
1311
+            </property>
1312
+           </widget>
1313
+          </item>
1314
+          <item row="4" column="0">
1315
+           <widget class="QLabel" name="label_7">
1316
+            <property name="text">
1317
+             <string>Type</string>
1318
+            </property>
1319
+           </widget>
1320
+          </item>
1321
+          <item row="4" column="1">
1322
+           <widget class="QComboBox" name="comboBox_Type">
1323
+            <property name="toolTip">
1324
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1325
+            </property>
1326
+            <property name="editable">
1327
+             <bool>true</bool>
1328
+            </property>
1329
+           </widget>
1330
+          </item>
1331
+          <item row="5" column="0">
1332
+           <widget class="QLabel" name="label_8">
1333
+            <property name="text">
1334
+             <string>Show Location Name</string>
1335
+            </property>
1336
+           </widget>
1337
+          </item>
1338
+          <item row="5" column="1">
1339
+           <widget class="QCheckBox" name="checkBox_ShowLocation">
1340
+            <property name="toolTip">
1341
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not to display the location name when the player enters the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1342
+            </property>
1343
+            <property name="text">
1344
+             <string/>
1345
+            </property>
1346
+           </widget>
1347
+          </item>
1348
+          <item row="6" column="0">
1349
+           <widget class="QLabel" name="label_9">
1350
+            <property name="text">
1351
+             <string>Battle scene</string>
1352
+            </property>
1353
+           </widget>
1354
+          </item>
1355
+          <item row="6" column="1">
1356
+           <widget class="QComboBox" name="comboBox_BattleScene">
1357
+            <property name="toolTip">
1358
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines the type of battle scene graphics to use.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1359
+            </property>
1360
+            <property name="editable">
1361
+             <bool>true</bool>
1362
+            </property>
1363
+           </widget>
1364
+          </item>
1365
+          <item row="2" column="1">
1366
+           <widget class="QCheckBox" name="checkBox_Visibility">
1367
+            <property name="toolTip">
1368
+             <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not the map is dark and requires Flash to illuminate.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1369
+            </property>
1370
+            <property name="text">
1371
+             <string/>
1372
+            </property>
1373
+           </widget>
1374
+          </item>
1375
+         </layout>
1390 1376
         </widget>
1391 1377
        </widget>
1392 1378
        <widget class="QWidget" name="tab_Connections">
@@ -1480,6 +1466,9 @@
1480 1466
                    <verstretch>0</verstretch>
1481 1467
                   </sizepolicy>
1482 1468
                  </property>
1469
+                 <property name="toolTip">
1470
+                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a new connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1471
+                 </property>
1483 1472
                  <property name="text">
1484 1473
                   <string/>
1485 1474
                  </property>
@@ -1492,6 +1481,9 @@
1492 1481
                </item>
1493 1482
                <item>
1494 1483
                 <widget class="QPushButton" name="pushButton_RemoveConnection">
1484
+                 <property name="toolTip">
1485
+                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove the currently-selected connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1486
+                 </property>
1495 1487
                  <property name="text">
1496 1488
                   <string/>
1497 1489
                  </property>
@@ -1540,6 +1532,9 @@
1540 1532
                    <verstretch>0</verstretch>
1541 1533
                   </sizepolicy>
1542 1534
                  </property>
1535
+                 <property name="toolTip">
1536
+                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If enabled, connections will automatically be updated on the connected map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1537
+                 </property>
1543 1538
                  <property name="text">
1544 1539
                   <string>Mirror</string>
1545 1540
                  </property>
@@ -1602,6 +1597,9 @@
1602 1597
                </property>
1603 1598
                <item>
1604 1599
                 <widget class="QComboBox" name="comboBox_ConnectionDirection">
1600
+                 <property name="toolTip">
1601
+                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The direction of the connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1602
+                 </property>
1605 1603
                  <item>
1606 1604
                   <property name="text">
1607 1605
                    <string>up</string>
@@ -1649,6 +1647,9 @@
1649 1647
                </item>
1650 1648
                <item>
1651 1649
                 <widget class="QComboBox" name="comboBox_ConnectedMap">
1650
+                 <property name="toolTip">
1651
+                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The destination map name of the connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1652
+                 </property>
1652 1653
                  <property name="editable">
1653 1654
                   <bool>true</bool>
1654 1655
                  </property>
@@ -1663,6 +1664,9 @@
1663 1664
                </item>
1664 1665
                <item>
1665 1666
                 <widget class="QSpinBox" name="spinBox_ConnectionOffset">
1667
+                 <property name="toolTip">
1668
+                  <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The number of metatiles to offset the connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1669
+                 </property>
1666 1670
                  <property name="minimum">
1667 1671
                   <number>-999</number>
1668 1672
                  </property>
@@ -1840,6 +1844,9 @@
1840 1844
                   </item>
1841 1845
                   <item>
1842 1846
                    <widget class="QComboBox" name="comboBox_DiveMap">
1847
+                    <property name="toolTip">
1848
+                     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Destination map name when using &lt;span style=&quot; font-weight:600;&quot;&gt;Dive&lt;/span&gt;. If empty, no such connection will exist.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1849
+                    </property>
1843 1850
                     <property name="editable">
1844 1851
                      <bool>true</bool>
1845 1852
                     </property>
@@ -1854,6 +1861,9 @@
1854 1861
                   </item>
1855 1862
                   <item>
1856 1863
                    <widget class="QComboBox" name="comboBox_EmergeMap">
1864
+                    <property name="toolTip">
1865
+                     <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Destination map name when emerging using &lt;span style=&quot; font-weight:600;&quot;&gt;Dive&lt;/span&gt;. If empty, no such connection will exist.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
1866
+                    </property>
1857 1867
                     <property name="editable">
1858 1868
                      <bool>true</bool>
1859 1869
                     </property>
@@ -1989,6 +1999,11 @@
1989 1999
    <extends>QToolButton</extends>
1990 2000
    <header>neweventtoolbutton.h</header>
1991 2001
   </customwidget>
2002
+  <customwidget>
2003
+   <class>NoScrollComboBox</class>
2004
+   <extends>QComboBox</extends>
2005
+   <header>noscrollcombobox.h</header>
2006
+  </customwidget>
1992 2007
  </customwidgets>
1993 2008
  <resources>
1994 2009
   <include location="resources/images.qrc"/>

+ 1
- 1
map.h View File

@@ -127,7 +127,7 @@ public:
127 127
     QString song;
128 128
     QString layout_id;
129 129
     QString location;
130
-    QString visibility;
130
+    QString requiresFlash;
131 131
     QString weather;
132 132
     QString type;
133 133
     QString unknown;

+ 15
- 0
noscrollcombobox.cpp View File

@@ -0,0 +1,15 @@
1
+#include "noscrollcombobox.h"
2
+
3
+NoScrollComboBox::NoScrollComboBox(QWidget *parent)
4
+    : QComboBox(parent)
5
+{
6
+    // Don't let scrolling hijack focus.
7
+    setFocusPolicy(Qt::StrongFocus);
8
+}
9
+
10
+void NoScrollComboBox::wheelEvent(QWheelEvent *event)
11
+{
12
+    // Only allow scrolling to modify contents when it explicitly has focus.
13
+    if (hasFocus())
14
+        QComboBox::wheelEvent(event);
15
+}

+ 17
- 0
noscrollcombobox.h View File

@@ -0,0 +1,17 @@
1
+#ifndef NOSCROLLCOMBOBOX_H
2
+#define NOSCROLLCOMBOBOX_H
3
+
4
+#include <QComboBox>
5
+
6
+class NoScrollComboBox : public QComboBox
7
+{
8
+    Q_OBJECT
9
+
10
+public:
11
+    explicit NoScrollComboBox(QWidget *parent = nullptr);
12
+    void wheelEvent(QWheelEvent *event);
13
+
14
+private:
15
+};
16
+
17
+#endif // NOSCROLLCOMBOBOX_H

+ 16
- 0
noscrollspinbox.cpp View File

@@ -0,0 +1,16 @@
1
+#include "noscrollspinbox.h"
2
+
3
+NoScrollSpinBox::NoScrollSpinBox(QWidget *parent)
4
+    : QSpinBox(parent)
5
+{
6
+    // Don't let scrolling hijack focus.
7
+    setFocusPolicy(Qt::StrongFocus);
8
+}
9
+
10
+void NoScrollSpinBox::wheelEvent(QWheelEvent *event)
11
+{
12
+    // Only allow scrolling to modify contents when it explicitly has focus.
13
+    if (hasFocus())
14
+        QSpinBox::wheelEvent(event);
15
+}
16
+

+ 17
- 0
noscrollspinbox.h View File

@@ -0,0 +1,17 @@
1
+#ifndef NOSCROLLSPINBOX_H
2
+#define NOSCROLLSPINBOX_H
3
+
4
+#include <QSpinBox>
5
+
6
+class NoScrollSpinBox : public QSpinBox
7
+{
8
+    Q_OBJECT
9
+
10
+public:
11
+    explicit NoScrollSpinBox(QWidget *parent = nullptr);
12
+    void wheelEvent(QWheelEvent *event);
13
+
14
+private:
15
+};
16
+
17
+#endif // NOSCROLLSPINBOX_H

+ 40
- 4
objectpropertiesframe.ui View File

@@ -105,7 +105,13 @@
105 105
              </widget>
106 106
             </item>
107 107
             <item>
108
-             <widget class="QSpinBox" name="spinBox_x">
108
+             <widget class="NoScrollSpinBox" name="spinBox_x">
109
+              <property name="focusPolicy">
110
+               <enum>Qt::StrongFocus</enum>
111
+              </property>
112
+              <property name="toolTip">
113
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The X coordinate of this object.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
114
+              </property>
109 115
               <property name="minimum">
110 116
                <number>-32768</number>
111 117
               </property>
@@ -129,7 +135,13 @@
129 135
              </widget>
130 136
             </item>
131 137
             <item>
132
-             <widget class="QSpinBox" name="spinBox_y">
138
+             <widget class="NoScrollSpinBox" name="spinBox_y">
139
+              <property name="focusPolicy">
140
+               <enum>Qt::StrongFocus</enum>
141
+              </property>
142
+              <property name="toolTip">
143
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The Y coordinate of this object.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
144
+              </property>
133 145
               <property name="minimum">
134 146
                <number>-32768</number>
135 147
               </property>
@@ -153,7 +165,13 @@
153 165
              </widget>
154 166
             </item>
155 167
             <item>
156
-             <widget class="QSpinBox" name="spinBox_z">
168
+             <widget class="NoScrollSpinBox" name="spinBox_z">
169
+              <property name="focusPolicy">
170
+               <enum>Qt::StrongFocus</enum>
171
+              </property>
172
+              <property name="toolTip">
173
+               <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The elevation of this object.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
174
+              </property>
157 175
               <property name="maximum">
158 176
                <number>15</number>
159 177
               </property>
@@ -210,7 +228,7 @@
210 228
        </widget>
211 229
       </item>
212 230
       <item row="0" column="1">
213
-       <widget class="QComboBox" name="comboBox_sprite">
231
+       <widget class="NoScrollComboBox" name="comboBox_sprite">
214 232
         <property name="enabled">
215 233
          <bool>true</bool>
216 234
         </property>
@@ -220,6 +238,12 @@
220 238
           <verstretch>0</verstretch>
221 239
          </sizepolicy>
222 240
         </property>
241
+        <property name="focusPolicy">
242
+         <enum>Qt::StrongFocus</enum>
243
+        </property>
244
+        <property name="toolTip">
245
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The sprite graphics to use for this object.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
246
+        </property>
223 247
         <property name="editable">
224 248
          <bool>true</bool>
225 249
         </property>
@@ -239,6 +263,18 @@
239 263
    </item>
240 264
   </layout>
241 265
  </widget>
266
+ <customwidgets>
267
+  <customwidget>
268
+   <class>NoScrollComboBox</class>
269
+   <extends>QComboBox</extends>
270
+   <header>noscrollcombobox.h</header>
271
+  </customwidget>
272
+  <customwidget>
273
+   <class>NoScrollSpinBox</class>
274
+   <extends>QSpinBox</extends>
275
+   <header>noscrollspinbox.h</header>
276
+  </customwidget>
277
+ </customwidgets>
242 278
  <tabstops>
243 279
   <tabstop>spinBox_x</tabstop>
244 280
   <tabstop>spinBox_y</tabstop>

+ 6
- 2
pretmap.pro View File

@@ -25,7 +25,9 @@ SOURCES += main.cpp\
25 25
     objectpropertiesframe.cpp \
26 26
     graphicsview.cpp \
27 27
     parseutil.cpp \
28
-    neweventtoolbutton.cpp
28
+    neweventtoolbutton.cpp \
29
+    noscrollcombobox.cpp \
30
+    noscrollspinbox.cpp
29 31
 
30 32
 HEADERS  += mainwindow.h \
31 33
     project.h \
@@ -39,7 +41,9 @@ HEADERS  += mainwindow.h \
39 41
     objectpropertiesframe.h \
40 42
     graphicsview.h \
41 43
     parseutil.h \
42
-    neweventtoolbutton.h
44
+    neweventtoolbutton.h \
45
+    noscrollcombobox.h \
46
+    noscrollspinbox.h
43 47
 
44 48
 FORMS    += mainwindow.ui \
45 49
     objectpropertiesframe.ui

+ 67
- 55
project.cpp View File

@@ -17,9 +17,17 @@ Project::Project()
17 17
     groupNames = new QStringList;
18 18
     map_groups = new QMap<QString, int>;
19 19
     mapNames = new QStringList;
20
+    regionMapSections = new QStringList;
20 21
     itemNames = new QStringList;
21 22
     flagNames = new QStringList;
22 23
     varNames = new QStringList;
24
+    movementTypes = new QStringList;
25
+    mapTypes = new QStringList;
26
+    mapBattleScenes = new QStringList;
27
+    weatherNames = new QStringList;
28
+    coordEventWeatherNames = new QStringList;
29
+    secretBaseIds = new QStringList;
30
+    bgEventFacingDirections = new QStringList;
23 31
     map_cache = new QMap<QString, Map*>;
24 32
     mapConstantsToMapNames = new QMap<QString, QString>;
25 33
     mapNamesToMapConstants = new QMap<QString, QString>;
@@ -164,7 +172,7 @@ void Project::readMapHeader(Map* map) {
164 172
     map->song = header->value(4);
165 173
     map->layout_id = header->value(5);
166 174
     map->location = header->value(6);
167
-    map->visibility = header->value(7);
175
+    map->requiresFlash = header->value(7);
168 176
     map->weather = header->value(8);
169 177
     map->type = header->value(9);
170 178
     map->unknown = header->value(10);
@@ -179,13 +187,13 @@ void Project::setNewMapHeader(Map* map, int mapIndex) {
179 187
     map->connections_label = "0x0";
180 188
     map->song = "MUS_DAN02";
181 189
     map->layout_id = QString("%1").arg(mapIndex);
182
-    map->location = "0";
183
-    map->visibility = "0";
184
-    map->weather = "2";
185
-    map->type = "1";
190
+    map->location = "MAPSEC_LITTLEROOT_TOWN";
191
+    map->requiresFlash = "FALSE";
192
+    map->weather = "WEATHER_SUNNY";
193
+    map->type = "MAP_TYPE_TOWN";
186 194
     map->unknown = "0";
187
-    map->show_location = "1";
188
-    map->battle_scene = "0";
195
+    map->show_location = "TRUE";
196
+    map->battle_scene = "MAP_BATTLE_SCENE_NORMAL";
189 197
 }
190 198
 
191 199
 void Project::saveMapHeader(Map *map) {
@@ -207,7 +215,7 @@ void Project::saveMapHeader(Map *map) {
207 215
     text += QString("\t.2byte %1\n").arg(map->song);
208 216
     text += QString("\t.2byte %1\n").arg(map->layout_id);
209 217
     text += QString("\t.byte %1\n").arg(map->location);
210
-    text += QString("\t.byte %1\n").arg(map->visibility);
218
+    text += QString("\t.byte %1\n").arg(map->requiresFlash);
211 219
     text += QString("\t.byte %1\n").arg(map->weather);
212 220
     text += QString("\t.byte %1\n").arg(map->type);
213 221
     text += QString("\t.2byte %1\n").arg(map->unknown);
@@ -982,15 +990,6 @@ QList<QStringList>* Project::parseAsm(QString text) {
982 990
     return parser->parseAsm(text);
983 991
 }
984 992
 
985
-QStringList Project::getLocations() {
986
-    // TODO
987
-    QStringList names;
988
-    for (int i = 0; i < 88; i++) {
989
-        names.append(QString("%1").arg(i));
990
-    }
991
-    return names;
992
-}
993
-
994 993
 QStringList Project::getVisibilities() {
995 994
     // TODO
996 995
     QStringList names;
@@ -1041,31 +1040,10 @@ QMap<QString, QStringList> Project::getTilesets() {
1041 1040
     return allTilesets;
1042 1041
 }
1043 1042
 
1044
-QStringList Project::getWeathers() {
1045
-    // TODO
1046
-    QStringList names;
1047
-    for (int i = 0; i < 16; i++) {
1048
-        names.append(QString("%1").arg(i));
1049
-    }
1050
-    return names;
1051
-}
1052
-
1053
-QStringList Project::getMapTypes() {
1054
-    // TODO
1055
-    QStringList names;
1056
-    for (int i = 0; i < 16; i++) {
1057
-        names.append(QString("%1").arg(i));
1058
-    }
1059
-    return names;
1060
-}
1061
-
1062
-QStringList Project::getBattleScenes() {
1063
-    // TODO
1064
-    QStringList names;
1065
-    for (int i = 0; i < 16; i++) {
1066
-        names.append(QString("%1").arg(i));
1067
-    }
1068
-    return names;
1043
+void Project::readRegionMapSections() {
1044
+    QString filepath = root + "/include/constants/region_map_sections.h";
1045
+    QStringList prefixes = (QStringList() << "MAPSEC_");
1046
+    readCDefinesSorted(filepath, prefixes, regionMapSections);
1069 1047
 }
1070 1048
 
1071 1049
 void Project::readItemNames() {
@@ -1086,6 +1064,48 @@ void Project::readVarNames() {
1086 1064
     readCDefinesSorted(filepath, prefixes, varNames);
1087 1065
 }
1088 1066
 
1067
+void Project::readMovementTypes() {
1068
+    QString filepath = root + "/include/constants/event_object_movement_constants.h";
1069
+    QStringList prefixes = (QStringList() << "MOVEMENT_TYPE_");
1070
+    readCDefinesSorted(filepath, prefixes, movementTypes);
1071
+}
1072
+
1073
+void Project::readMapTypes() {
1074
+    QString filepath = root + "/include/constants/map_types.h";
1075
+    QStringList prefixes = (QStringList() << "MAP_TYPE_");
1076
+    readCDefinesSorted(filepath, prefixes, mapTypes);
1077
+}
1078
+
1079
+void Project::readMapBattleScenes() {
1080
+    QString filepath = root + "/include/constants/map_types.h";
1081
+    QStringList prefixes = (QStringList() << "MAP_BATTLE_SCENE_");
1082
+    readCDefinesSorted(filepath, prefixes, mapBattleScenes);
1083
+}
1084
+
1085
+void Project::readWeatherNames() {
1086
+    QString filepath = root + "/include/constants/weather.h";
1087
+    QStringList prefixes = (QStringList() << "WEATHER_");
1088
+    readCDefinesSorted(filepath, prefixes, weatherNames);
1089
+}
1090
+
1091
+void Project::readCoordEventWeatherNames() {
1092
+    QString filepath = root + "/include/constants/weather.h";
1093
+    QStringList prefixes = (QStringList() << "COORD_EVENT_WEATHER_");
1094
+    readCDefinesSorted(filepath, prefixes, coordEventWeatherNames);
1095
+}
1096
+
1097
+void Project::readSecretBaseIds() {
1098
+    QString filepath = root + "/include/constants/secret_bases.h";
1099
+    QStringList prefixes = (QStringList() << "SECRET_BASE_");
1100
+    readCDefinesSorted(filepath, prefixes, secretBaseIds);
1101
+}
1102
+
1103
+void Project::readBgEventFacingDirections() {
1104
+    QString filepath = root + "/include/constants/bg_event_constants.h";
1105
+    QStringList prefixes = (QStringList() << "BG_EVENT_PLAYER_FACING_");
1106
+    readCDefinesSorted(filepath, prefixes, bgEventFacingDirections);
1107
+}
1108
+
1089 1109
 void Project::readCDefinesSorted(QString filepath, QStringList prefixes, QStringList* definesToSet) {
1090 1110
     QString text = readTextFile(filepath);
1091 1111
     if (!text.isNull()) {
@@ -1098,6 +1118,8 @@ void Project::readCDefinesSorted(QString filepath, QStringList prefixes, QString
1098 1118
             definesInverse.insert(defines[defineName], defineName);
1099 1119
         }
1100 1120
         *definesToSet = definesInverse.values();
1121
+    } else {
1122
+        qDebug() << "Failed to read C defines file: " << filepath;
1101 1123
     }
1102 1124
 }
1103 1125
 
@@ -1319,10 +1341,10 @@ void Project::readMapEvents(Map *map) {
1319 1341
             object->put("x", command.value(i++).toInt(nullptr, 0));
1320 1342
             object->put("y", command.value(i++).toInt(nullptr, 0));
1321 1343
             object->put("elevation", command.value(i++));
1322
-            object->put("behavior", command.value(i++));
1344
+            object->put("movement_type", command.value(i++));
1323 1345
             object->put("radius_x", command.value(i++).toInt(nullptr, 0));
1324 1346
             object->put("radius_y", command.value(i++).toInt(nullptr, 0));
1325
-            object->put("trainer_see_type", command.value(i++));
1347
+            object->put("is_trainer", command.value(i++));
1326 1348
             object->put("sight_radius_tree_id", command.value(i++));
1327 1349
             object->put("script_label", command.value(i++));
1328 1350
             object->put("event_flag", command.value(i++));
@@ -1363,12 +1385,6 @@ void Project::readMapEvents(Map *map) {
1363 1385
         if (command.value(0) == "coord_event") {
1364 1386
             Event *coord = new Event;
1365 1387
             coord->put("map_name", map->name);
1366
-            bool old_macro = false;
1367
-            if (command.length() >= 9) {
1368
-                command.removeAt(7);
1369
-                command.removeAt(4);
1370
-                old_macro = true;
1371
-            }
1372 1388
             int i = 1;
1373 1389
             coord->put("x", command.value(i++));
1374 1390
             coord->put("y", command.value(i++));
@@ -1376,9 +1392,6 @@ void Project::readMapEvents(Map *map) {
1376 1392
             coord->put("script_var", command.value(i++));
1377 1393
             coord->put("script_var_value", command.value(i++));
1378 1394
             coord->put("script_label", command.value(i++));
1379
-            //coord_unknown3
1380
-            //coord_unknown4
1381
-
1382 1395
             coord->put("event_group_type", "coord_event_group");
1383 1396
             coord->put("event_type", EventType::CoordScript);
1384 1397
             map->events["coord_event_group"].append(coord);
@@ -1407,7 +1420,6 @@ void Project::readMapEvents(Map *map) {
1407 1420
             bg->put("y", command.value(i++));
1408 1421
             bg->put("elevation", command.value(i++));
1409 1422
             bg->put("player_facing_direction", command.value(i++));
1410
-            i++;
1411 1423
             bg->put("script_label", command.value(i++));
1412 1424
             //sign_unknown7
1413 1425
             bg->put("event_group_type", "bg_event_group");
@@ -1432,7 +1444,7 @@ void Project::readMapEvents(Map *map) {
1432 1444
             bg->put("x", command.value(i++));
1433 1445
             bg->put("y", command.value(i++));
1434 1446
             bg->put("elevation", command.value(i++));
1435
-            bg->put("secret_base_map", command.value(i++));
1447
+            bg->put("secret_base_id", command.value(i++));
1436 1448
             bg->put("event_group_type", "bg_event_group");
1437 1449
             bg->put("event_type", EventType::SecretBase);
1438 1450
             map->events["bg_event_group"].append(bg);

+ 16
- 4
project.h View File

@@ -23,9 +23,17 @@ public:
23 23
     QList<QString> mapLayoutsTableMaster;
24 24
     QMap<QString, MapLayout*> mapLayouts;
25 25
     QMap<QString, MapLayout*> mapLayoutsMaster;
26
+    QStringList *regionMapSections = NULL;
26 27
     QStringList *itemNames = NULL;
27 28
     QStringList *flagNames = NULL;
28 29
     QStringList *varNames = NULL;
30
+    QStringList *movementTypes = NULL;
31
+    QStringList *mapTypes = NULL;
32
+    QStringList *mapBattleScenes = NULL;
33
+    QStringList *weatherNames = NULL;
34
+    QStringList *coordEventWeatherNames = NULL;
35
+    QStringList *secretBaseIds = NULL;
36
+    QStringList *bgEventFacingDirections = NULL;
29 37
     QStringList mapsWithConnections;
30 38
 
31 39
     QMap<QString, Map*> *map_cache;
@@ -72,15 +80,19 @@ public:
72 80
 
73 81
     QList<QStringList>* parseAsm(QString text);
74 82
     QStringList getSongNames();
75
-    QStringList getLocations();
76 83
     QStringList getVisibilities();
77 84
     QMap<QString, QStringList> getTilesets();
78
-    QStringList getWeathers();
79
-    QStringList getMapTypes();
80
-    QStringList getBattleScenes();
85
+    void readRegionMapSections();
81 86
     void readItemNames();
82 87
     void readFlagNames();
83 88
     void readVarNames();
89
+    void readMovementTypes();
90
+    void readMapTypes();
91
+    void readMapBattleScenes();
92
+    void readWeatherNames();
93
+    void readCoordEventWeatherNames();
94
+    void readSecretBaseIds();
95
+    void readBgEventFacingDirections();
84 96
 
85 97
     void loadEventPixmaps(QList<Event*> objects);
86 98
     QMap<QString, int> getEventObjGfxConstants();