Browse Source

Support bg_secret_base_event

Marcus Huderle 6 years ago
parent
commit
9274796d65
2 changed files with 28 additions and 3 deletions
  1. 4
    0
      mainwindow.cpp
  2. 24
    3
      project.cpp

+ 4
- 0
mainwindow.cpp View File

@@ -513,6 +513,7 @@ void MainWindow::updateSelectedObjects() {
513 513
         field_labels["item_unknown6"] = "Unknown 6";
514 514
         field_labels["weather"] = "Weather";
515 515
         field_labels["flag"] = "Flag";
516
+        field_labels["secret_base_map"] = "Secret Base Map";
516 517
 
517 518
         QStringList fields;
518 519
 
@@ -562,6 +563,9 @@ void MainWindow::updateSelectedObjects() {
562 563
             fields << "item";
563 564
             fields << "flag";
564 565
         }
566
+        else if (event_type == "event_secret_base") {
567
+            fields << "secret_base_map";
568
+        }
565 569
 
566 570
         for (QString key : fields) {
567 571
             QWidget *widget = new QWidget(frame);

+ 24
- 3
project.cpp View File

@@ -667,7 +667,7 @@ void Project::loadObjectPixmaps(QList<Event*> objects) {
667 667
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(16, 0, 16, 16);
668 668
         } else if (event_type == "trap" || event_type == "trap_weather") {
669 669
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(32, 0, 16, 16);
670
-        } else if (event_type == "sign" || event_type == "event_hidden_item") {
670
+        } else if (event_type == "sign" || event_type == "event_hidden_item" || event_type == "event_secret_base") {
671 671
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
672 672
         }
673 673
 
@@ -768,7 +768,10 @@ void Project::saveMapEvents(Map *map) {
768 768
         text += "\n";
769 769
     }
770 770
 
771
-    if (map->events["sign"].length() + map->events["event_hidden_item"].length() > 0) {
771
+    if (map->events["sign"].length() +
772
+        map->events["event_hidden_item"].length() +
773
+        map->events["event_secret_base"].length() > 0)
774
+    {
772 775
         text += QString("%1::\n").arg(map->bg_events_label);
773 776
         for (Event *sign : map->events["sign"]) {
774 777
             text += QString("\tbg_event %1").arg(sign->get("x"));
@@ -787,6 +790,13 @@ void Project::saveMapEvents(Map *map) {
787 790
             text += QString(", %1").arg(item->get("flag"));
788 791
             text += "\n";
789 792
         }
793
+        for (Event *item : map->events["event_secret_base"]) {
794
+            text += QString("\tbg_secret_base_event %1").arg(item->get("x"));
795
+            text += QString(", %1").arg(item->get("y"));
796
+            text += QString(", %1").arg(item->get("elevation"));
797
+            text += QString(", %1").arg(item->get("secret_base_map"));
798
+            text += "\n";
799
+        }
790 800
         text += "\n";
791 801
     }
792 802
 
@@ -921,8 +931,9 @@ void Project::readMapEvents(Map *map) {
921 931
     }
922 932
 
923 933
     QList<QStringList> *bgs = getLabelMacros(parse(text), map->bg_events_label);
924
-    map->events["event_hidden_item"].clear();
925 934
     map->events["sign"].clear();
935
+    map->events["event_hidden_item"].clear();
936
+    map->events["event_secret_base"].clear();
926 937
     for (QStringList command : *bgs) {
927 938
         if (command.value(0) == "bg_event") {
928 939
             Event *bg = new Event;
@@ -948,6 +959,16 @@ void Project::readMapEvents(Map *map) {
948 959
             bg->put("flag", command.value(i++));
949 960
             bg->put("event_type", "event_hidden_item");
950 961
             map->events["event_hidden_item"].append(bg);
962
+        } else if (command.value(0) == "bg_secret_base_event") {
963
+            Event *bg = new Event;
964
+            bg->put("map_name", map->name);
965
+            int i = 1;
966
+            bg->put("x", command.value(i++));
967
+            bg->put("y", command.value(i++));
968
+            bg->put("elevation", command.value(i++));
969
+            bg->put("secret_base_map", command.value(i++));
970
+            bg->put("event_type", "event_secret_base");
971
+            map->events["event_secret_base"].append(bg);
951 972
         }
952 973
     }
953 974
 }