|
@@ -1185,9 +1185,14 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
|
1185
|
1185
|
void Project::saveMapEvents(Map *map) {
|
1186
|
1186
|
QString path = root + QString("/data/maps/%1/events.inc").arg(map->name);
|
1187
|
1187
|
QString text = "";
|
|
1188
|
+ QString objectEventsLabel = "0x0";
|
|
1189
|
+ QString warpEventsLabel = "0x0";
|
|
1190
|
+ QString coordEventsLabel = "0x0";
|
|
1191
|
+ QString bgEventsLabel = "0x0";
|
1188
|
1192
|
|
1189
|
1193
|
if (map->events["object_event_group"].length() > 0) {
|
1190
|
|
- text += QString("%1::\n").arg(map->object_events_label);
|
|
1194
|
+ objectEventsLabel = Map::objectEventsLabelFromName(map->name);
|
|
1195
|
+ text += QString("%1::\n").arg(objectEventsLabel);
|
1191
|
1196
|
for (int i = 0; i < map->events["object_event_group"].length(); i++) {
|
1192
|
1197
|
Event *object_event = map->events["object_event_group"].value(i);
|
1193
|
1198
|
text += object_event->buildObjectEventMacro(i);
|
|
@@ -1196,7 +1201,8 @@ void Project::saveMapEvents(Map *map) {
|
1196
|
1201
|
}
|
1197
|
1202
|
|
1198
|
1203
|
if (map->events["warp_event_group"].length() > 0) {
|
1199
|
|
- text += QString("%1::\n").arg(map->warps_label);
|
|
1204
|
+ warpEventsLabel = Map::warpEventsLabelFromName(map->name);
|
|
1205
|
+ text += QString("%1::\n").arg(warpEventsLabel);
|
1200
|
1206
|
for (Event *warp : map->events["warp_event_group"]) {
|
1201
|
1207
|
text += warp->buildWarpEventMacro(mapNamesToMapConstants);
|
1202
|
1208
|
}
|
|
@@ -1204,7 +1210,8 @@ void Project::saveMapEvents(Map *map) {
|
1204
|
1210
|
}
|
1205
|
1211
|
|
1206
|
1212
|
if (map->events["coord_event_group"].length() > 0) {
|
1207
|
|
- text += QString("%1::\n").arg(map->coord_events_label);
|
|
1213
|
+ coordEventsLabel = Map::coordEventsLabelFromName(map->name);
|
|
1214
|
+ text += QString("%1::\n").arg(coordEventsLabel);
|
1208
|
1215
|
for (Event *event : map->events["coord_event_group"]) {
|
1209
|
1216
|
QString event_type = event->get("event_type");
|
1210
|
1217
|
if (event_type == EventType::CoordScript) {
|
|
@@ -1218,7 +1225,8 @@ void Project::saveMapEvents(Map *map) {
|
1218
|
1225
|
|
1219
|
1226
|
if (map->events["bg_event_group"].length() > 0)
|
1220
|
1227
|
{
|
1221
|
|
- text += QString("%1::\n").arg(map->bg_events_label);
|
|
1228
|
+ bgEventsLabel = Map::bgEventsLabelFromName(map->name);
|
|
1229
|
+ text += QString("%1::\n").arg(bgEventsLabel);
|
1222
|
1230
|
for (Event *event : map->events["bg_event_group"]) {
|
1223
|
1231
|
QString event_type = event->get("event_type");
|
1224
|
1232
|
if (event_type == EventType::Sign) {
|
|
@@ -1234,10 +1242,10 @@ void Project::saveMapEvents(Map *map) {
|
1234
|
1242
|
|
1235
|
1243
|
text += QString("%1::\n").arg(map->events_label);
|
1236
|
1244
|
text += QString("\tmap_events %1, %2, %3, %4\n")
|
1237
|
|
- .arg(map->object_events_label)
|
1238
|
|
- .arg(map->warps_label)
|
1239
|
|
- .arg(map->coord_events_label)
|
1240
|
|
- .arg(map->bg_events_label);
|
|
1245
|
+ .arg(objectEventsLabel)
|
|
1246
|
+ .arg(warpEventsLabel)
|
|
1247
|
+ .arg(coordEventsLabel)
|
|
1248
|
+ .arg(bgEventsLabel);
|
1241
|
1249
|
|
1242
|
1250
|
saveTextFile(path, text);
|
1243
|
1251
|
}
|
|
@@ -1255,12 +1263,12 @@ void Project::readMapEvents(Map *map) {
|
1255
|
1263
|
}
|
1256
|
1264
|
|
1257
|
1265
|
QStringList *labels = getLabelValues(parseAsm(text), map->events_label);
|
1258
|
|
- map->object_events_label = labels->value(0);
|
1259
|
|
- map->warps_label = labels->value(1);
|
1260
|
|
- map->coord_events_label = labels->value(2);
|
1261
|
|
- map->bg_events_label = labels->value(3);
|
|
1266
|
+ QString objectEventsLabel = labels->value(0);
|
|
1267
|
+ QString warpEventsLabel = labels->value(1);
|
|
1268
|
+ QString coordEventsLabel = labels->value(2);
|
|
1269
|
+ QString bgEventsLabel = labels->value(3);
|
1262
|
1270
|
|
1263
|
|
- QList<QStringList> *object_events = getLabelMacros(parseAsm(text), map->object_events_label);
|
|
1271
|
+ QList<QStringList> *object_events = getLabelMacros(parseAsm(text), objectEventsLabel);
|
1264
|
1272
|
map->events["object_event_group"].clear();
|
1265
|
1273
|
for (QStringList command : *object_events) {
|
1266
|
1274
|
if (command.value(0) == "object_event") {
|
|
@@ -1285,7 +1293,7 @@ void Project::readMapEvents(Map *map) {
|
1285
|
1293
|
}
|
1286
|
1294
|
}
|
1287
|
1295
|
|
1288
|
|
- QList<QStringList> *warps = getLabelMacros(parseAsm(text), map->warps_label);
|
|
1296
|
+ QList<QStringList> *warps = getLabelMacros(parseAsm(text), warpEventsLabel);
|
1289
|
1297
|
map->events["warp_event_group"].clear();
|
1290
|
1298
|
for (QStringList command : *warps) {
|
1291
|
1299
|
if (command.value(0) == "warp_def") {
|
|
@@ -1310,7 +1318,7 @@ void Project::readMapEvents(Map *map) {
|
1310
|
1318
|
}
|
1311
|
1319
|
}
|
1312
|
1320
|
|
1313
|
|
- QList<QStringList> *coords = getLabelMacros(parseAsm(text), map->coord_events_label);
|
|
1321
|
+ QList<QStringList> *coords = getLabelMacros(parseAsm(text), coordEventsLabel);
|
1314
|
1322
|
map->events["coord_event_group"].clear();
|
1315
|
1323
|
for (QStringList command : *coords) {
|
1316
|
1324
|
if (command.value(0) == "coord_event") {
|
|
@@ -1349,7 +1357,7 @@ void Project::readMapEvents(Map *map) {
|
1349
|
1357
|
}
|
1350
|
1358
|
}
|
1351
|
1359
|
|
1352
|
|
- QList<QStringList> *bgs = getLabelMacros(parseAsm(text), map->bg_events_label);
|
|
1360
|
+ QList<QStringList> *bgs = getLabelMacros(parseAsm(text), bgEventsLabel);
|
1353
|
1361
|
map->events["bg_event_group"].clear();
|
1354
|
1362
|
for (QStringList command : *bgs) {
|
1355
|
1363
|
if (command.value(0) == "bg_event") {
|
|
@@ -1394,10 +1402,6 @@ void Project::readMapEvents(Map *map) {
|
1394
|
1402
|
}
|
1395
|
1403
|
|
1396
|
1404
|
void Project::setNewMapEvents(Map *map) {
|
1397
|
|
- map->object_events_label = "0x0";
|
1398
|
|
- map->warps_label = "0x0";
|
1399
|
|
- map->coord_events_label = "0x0";
|
1400
|
|
- map->bg_events_label = "0x0";
|
1401
|
1405
|
map->events["object_event_group"].clear();
|
1402
|
1406
|
map->events["warp_event_group"].clear();
|
1403
|
1407
|
map->events["coord_event_group"].clear();
|