Support bg_hidden_item_event
This commit is contained in:
parent
22722f09c7
commit
c3d0769967
3 changed files with 25 additions and 32 deletions
4
event.h
4
event.h
|
@ -39,10 +39,6 @@ public:
|
||||||
values.insert(key, value);
|
values.insert(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_hidden_item() {
|
|
||||||
return getInt("type") >= 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
QMap<QString, QString> values;
|
QMap<QString, QString> values;
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
};
|
};
|
||||||
|
|
|
@ -511,6 +511,8 @@ void MainWindow::updateSelectedObjects() {
|
||||||
field_labels["item"] = "Item";
|
field_labels["item"] = "Item";
|
||||||
field_labels["item_unknown5"] = "Unknown 5";
|
field_labels["item_unknown5"] = "Unknown 5";
|
||||||
field_labels["item_unknown6"] = "Unknown 6";
|
field_labels["item_unknown6"] = "Unknown 6";
|
||||||
|
field_labels["weather"] = "Weather";
|
||||||
|
field_labels["flag"] = "Flag";
|
||||||
|
|
||||||
QStringList fields;
|
QStringList fields;
|
||||||
|
|
||||||
|
@ -556,11 +558,9 @@ void MainWindow::updateSelectedObjects() {
|
||||||
fields << "type";
|
fields << "type";
|
||||||
fields << "script_label";
|
fields << "script_label";
|
||||||
}
|
}
|
||||||
else if (event_type == "hidden item") {
|
else if (event_type == "event_hidden_item") {
|
||||||
fields << "type";
|
|
||||||
fields << "item";
|
fields << "item";
|
||||||
fields << "item_unknown5";
|
fields << "flag";
|
||||||
fields << "item_unknown6";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (QString key : fields) {
|
for (QString key : fields) {
|
||||||
|
|
45
project.cpp
45
project.cpp
|
@ -667,7 +667,7 @@ void Project::loadObjectPixmaps(QList<Event*> objects) {
|
||||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(16, 0, 16, 16);
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(16, 0, 16, 16);
|
||||||
} else if (event_type == "trap" || event_type == "trap_weather") {
|
} else if (event_type == "trap" || event_type == "trap_weather") {
|
||||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(32, 0, 16, 16);
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(32, 0, 16, 16);
|
||||||
} else if (event_type == "sign" || event_type == "hidden item") {
|
} else if (event_type == "sign" || event_type == "event_hidden_item") {
|
||||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,7 +768,7 @@ void Project::saveMapEvents(Map *map) {
|
||||||
text += "\n";
|
text += "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (map->events["sign"].length() + map->events["hidden item"].length() > 0) {
|
if (map->events["sign"].length() + map->events["event_hidden_item"].length() > 0) {
|
||||||
text += QString("%1::\n").arg(map->bg_events_label);
|
text += QString("%1::\n").arg(map->bg_events_label);
|
||||||
for (Event *sign : map->events["sign"]) {
|
for (Event *sign : map->events["sign"]) {
|
||||||
text += QString("\tbg_event %1").arg(sign->get("x"));
|
text += QString("\tbg_event %1").arg(sign->get("x"));
|
||||||
|
@ -779,15 +779,12 @@ void Project::saveMapEvents(Map *map) {
|
||||||
text += QString(", %1").arg(sign->get("script_label"));
|
text += QString(", %1").arg(sign->get("script_label"));
|
||||||
text += "\n";
|
text += "\n";
|
||||||
}
|
}
|
||||||
for (Event *item : map->events["hidden item"]) {
|
for (Event *item : map->events["event_hidden_item"]) {
|
||||||
text += QString("\tbg_event %1").arg(item->get("x"));
|
text += QString("\tbg_hidden_item_event %1").arg(item->get("x"));
|
||||||
text += QString(", %1").arg(item->get("y"));
|
text += QString(", %1").arg(item->get("y"));
|
||||||
text += QString(", %1").arg(item->get("elevation"));
|
text += QString(", %1").arg(item->get("elevation"));
|
||||||
text += QString(", %1").arg(item->get("type"));
|
|
||||||
text += QString(", 0");
|
|
||||||
text += QString(", %1").arg(item->get("item"));
|
text += QString(", %1").arg(item->get("item"));
|
||||||
text += QString(", %1").arg(item->get("item_unknown5"));
|
text += QString(", %1").arg(item->get("flag"));
|
||||||
text += QString(", %1").arg(item->get("item_unknown6"));
|
|
||||||
text += "\n";
|
text += "\n";
|
||||||
}
|
}
|
||||||
text += "\n";
|
text += "\n";
|
||||||
|
@ -924,7 +921,7 @@ void Project::readMapEvents(Map *map) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QStringList> *bgs = getLabelMacros(parse(text), map->bg_events_label);
|
QList<QStringList> *bgs = getLabelMacros(parse(text), map->bg_events_label);
|
||||||
map->events["hidden item"].clear();
|
map->events["event_hidden_item"].clear();
|
||||||
map->events["sign"].clear();
|
map->events["sign"].clear();
|
||||||
for (QStringList command : *bgs) {
|
for (QStringList command : *bgs) {
|
||||||
if (command.value(0) == "bg_event") {
|
if (command.value(0) == "bg_event") {
|
||||||
|
@ -936,23 +933,23 @@ void Project::readMapEvents(Map *map) {
|
||||||
bg->put("elevation", command.value(i++));
|
bg->put("elevation", command.value(i++));
|
||||||
bg->put("type", command.value(i++));
|
bg->put("type", command.value(i++));
|
||||||
i++;
|
i++;
|
||||||
if (bg->is_hidden_item()) {
|
bg->put("script_label", command.value(i++));
|
||||||
bg->put("item", command.value(i++));
|
//sign_unknown7
|
||||||
bg->put("item_unknown5", command.value(i++));
|
bg->put("event_type", "sign");
|
||||||
bg->put("item_unknown6", command.value(i++));
|
map->events["sign"].append(bg);
|
||||||
|
} else if (command.value(0) == "bg_hidden_item_event") {
|
||||||
bg->put("event_type", "hidden item");
|
Event *bg = new Event;
|
||||||
map->events["hidden item"].append(bg);
|
bg->put("map_name", map->name);
|
||||||
} else {
|
int i = 1;
|
||||||
bg->put("script_label", command.value(i++));
|
bg->put("x", command.value(i++));
|
||||||
//sign_unknown7
|
bg->put("y", command.value(i++));
|
||||||
|
bg->put("elevation", command.value(i++));
|
||||||
bg->put("event_type", "sign");
|
bg->put("item", command.value(i++));
|
||||||
map->events["sign"].append(bg);
|
bg->put("flag", command.value(i++));
|
||||||
}
|
bg->put("event_type", "event_hidden_item");
|
||||||
|
map->events["event_hidden_item"].append(bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Project::readCArray(QString text, QString label) {
|
QStringList Project::readCArray(QString text, QString label) {
|
||||||
|
|
Loading…
Reference in a new issue