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

+ 24
- 3
project.cpp View File

667
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(16, 0, 16, 16);
667
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(16, 0, 16, 16);
668
         } else if (event_type == "trap" || event_type == "trap_weather") {
668
         } else if (event_type == "trap" || event_type == "trap_weather") {
669
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(32, 0, 16, 16);
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
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
671
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
672
         }
672
         }
673
 
673
 
768
         text += "\n";
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
         text += QString("%1::\n").arg(map->bg_events_label);
775
         text += QString("%1::\n").arg(map->bg_events_label);
773
         for (Event *sign : map->events["sign"]) {
776
         for (Event *sign : map->events["sign"]) {
774
             text += QString("\tbg_event %1").arg(sign->get("x"));
777
             text += QString("\tbg_event %1").arg(sign->get("x"));
787
             text += QString(", %1").arg(item->get("flag"));
790
             text += QString(", %1").arg(item->get("flag"));
788
             text += "\n";
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
         text += "\n";
800
         text += "\n";
791
     }
801
     }
792
 
802
 
921
     }
931
     }
922
 
932
 
923
     QList<QStringList> *bgs = getLabelMacros(parse(text), map->bg_events_label);
933
     QList<QStringList> *bgs = getLabelMacros(parse(text), map->bg_events_label);
924
-    map->events["event_hidden_item"].clear();
925
     map->events["sign"].clear();
934
     map->events["sign"].clear();
935
+    map->events["event_hidden_item"].clear();
936
+    map->events["event_secret_base"].clear();
926
     for (QStringList command : *bgs) {
937
     for (QStringList command : *bgs) {
927
         if (command.value(0) == "bg_event") {
938
         if (command.value(0) == "bg_event") {
928
             Event *bg = new Event;
939
             Event *bg = new Event;
948
             bg->put("flag", command.value(i++));
959
             bg->put("flag", command.value(i++));
949
             bg->put("event_type", "event_hidden_item");
960
             bg->put("event_type", "event_hidden_item");
950
             map->events["event_hidden_item"].append(bg);
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
 }