Browse Source

Support coord_event_weather

Marcus Huderle 6 years ago
parent
commit
22722f09c7
2 changed files with 23 additions and 2 deletions
  1. 3
    0
      mainwindow.cpp
  2. 20
    2
      project.cpp

+ 3
- 0
mainwindow.cpp View File

549
             fields << "coord_unknown1";
549
             fields << "coord_unknown1";
550
             fields << "coord_unknown2";
550
             fields << "coord_unknown2";
551
         }
551
         }
552
+        else if (event_type == "trap_weather") {
553
+            fields << "weather";
554
+        }
552
         else if (event_type == "sign") {
555
         else if (event_type == "sign") {
553
             fields << "type";
556
             fields << "type";
554
             fields << "script_label";
557
             fields << "script_label";

+ 20
- 2
project.cpp View File

665
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(0, 0, 16, 16);
665
             object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(0, 0, 16, 16);
666
         } else if (event_type == "warp") {
666
         } else if (event_type == "warp") {
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") {
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 == "hidden item") {
670
         } else if (event_type == "sign" || event_type == "hidden item") {
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);
745
         text += "\n";
745
         text += "\n";
746
     }
746
     }
747
 
747
 
748
-    if (map->events["trap"].length() > 0) {
748
+    if (map->events["trap"].length() + map->events["trap_weather"].length() > 0) {
749
         text += QString("%1::\n").arg(map->coord_events_label);
749
         text += QString("%1::\n").arg(map->coord_events_label);
750
         for (Event *coords : map->events["trap"]) {
750
         for (Event *coords : map->events["trap"]) {
751
             text += QString("\tcoord_event %1").arg(coords->get("x"));
751
             text += QString("\tcoord_event %1").arg(coords->get("x"));
758
             text += QString(", %1").arg(coords->get("script_label"));
758
             text += QString(", %1").arg(coords->get("script_label"));
759
             text += "\n";
759
             text += "\n";
760
         }
760
         }
761
+        for (Event *coords : map->events["trap_weather"]) {
762
+            text += QString("\tcoord_weather_event %1").arg(coords->get("x"));
763
+            text += QString(", %1").arg(coords->get("y"));
764
+            text += QString(", %1").arg(coords->get("elevation"));
765
+            text += QString(", %1").arg(coords->get("weather"));
766
+            text += "\n";
767
+        }
761
         text += "\n";
768
         text += "\n";
762
     }
769
     }
763
 
770
 
880
 
887
 
881
     QList<QStringList> *coords = getLabelMacros(parse(text), map->coord_events_label);
888
     QList<QStringList> *coords = getLabelMacros(parse(text), map->coord_events_label);
882
     map->events["trap"].clear();
889
     map->events["trap"].clear();
890
+    map->events["trap_weather"].clear();
883
     for (QStringList command : *coords) {
891
     for (QStringList command : *coords) {
884
         if (command.value(0) == "coord_event") {
892
         if (command.value(0) == "coord_event") {
885
             Event *coord = new Event;
893
             Event *coord = new Event;
902
 
910
 
903
             coord->put("event_type", "trap");
911
             coord->put("event_type", "trap");
904
             map->events["trap"].append(coord);
912
             map->events["trap"].append(coord);
913
+        } else if (command.value(0) == "coord_weather_event") {
914
+            Event *coord = new Event;
915
+            coord->put("map_name", map->name);
916
+            int i = 1;
917
+            coord->put("x", command.value(i++));
918
+            coord->put("y", command.value(i++));
919
+            coord->put("elevation", command.value(i++));
920
+            coord->put("weather", command.value(i++));
921
+            coord->put("event_type", "trap_weather");
922
+            map->events["trap_weather"].append(coord);
905
         }
923
         }
906
     }
924
     }
907
 
925