|
@@ -1186,97 +1186,48 @@ void Project::saveMapEvents(Map *map) {
|
1186
|
1186
|
QString path = root + QString("/data/maps/%1/events.inc").arg(map->name);
|
1187
|
1187
|
QString text = "";
|
1188
|
1188
|
|
1189
|
|
- if (map->events["object"].length() > 0) {
|
|
1189
|
+ if (map->events["object_event_group"].length() > 0) {
|
1190
|
1190
|
text += QString("%1::\n").arg(map->object_events_label);
|
1191
|
|
- for (int i = 0; i < map->events["object"].length(); i++) {
|
1192
|
|
- Event *object_event = map->events["object"].value(i);
|
1193
|
|
- int radius_x = object_event->getInt("radius_x");
|
1194
|
|
- int radius_y = object_event->getInt("radius_y");
|
1195
|
|
- uint16_t x = object_event->getInt("x");
|
1196
|
|
- uint16_t y = object_event->getInt("y");
|
1197
|
|
-
|
1198
|
|
- text += QString("\tobject_event %1").arg(i + 1);
|
1199
|
|
- text += QString(", %1").arg(object_event->get("sprite"));
|
1200
|
|
- text += QString(", %1").arg(object_event->get("replacement"));
|
1201
|
|
- text += QString(", %1").arg(x);
|
1202
|
|
- text += QString(", %1").arg(y);
|
1203
|
|
- text += QString(", %1").arg(object_event->get("elevation"));
|
1204
|
|
- text += QString(", %1").arg(object_event->get("behavior"));
|
1205
|
|
- text += QString(", %1").arg(radius_x);
|
1206
|
|
- text += QString(", %1").arg(radius_y);
|
1207
|
|
- text += QString(", %1").arg(object_event->get("property"));
|
1208
|
|
- text += QString(", %1").arg(object_event->get("sight_radius"));
|
1209
|
|
- text += QString(", %1").arg(object_event->get("script_label"));
|
1210
|
|
- text += QString(", %1").arg(object_event->get("event_flag"));
|
1211
|
|
- text += "\n";
|
|
1191
|
+ for (int i = 0; i < map->events["object_event_group"].length(); i++) {
|
|
1192
|
+ Event *object_event = map->events["object_event_group"].value(i);
|
|
1193
|
+ text += object_event->buildObjectEventMacro(i);
|
1212
|
1194
|
}
|
1213
|
1195
|
text += "\n";
|
1214
|
1196
|
}
|
1215
|
1197
|
|
1216
|
|
- if (map->events["warp"].length() > 0) {
|
|
1198
|
+ if (map->events["warp_event_group"].length() > 0) {
|
1217
|
1199
|
text += QString("%1::\n").arg(map->warps_label);
|
1218
|
|
- for (Event *warp : map->events["warp"]) {
|
1219
|
|
- text += QString("\twarp_def %1").arg(warp->get("x"));
|
1220
|
|
- text += QString(", %1").arg(warp->get("y"));
|
1221
|
|
- text += QString(", %1").arg(warp->get("elevation"));
|
1222
|
|
- text += QString(", %1").arg(warp->get("destination_warp"));
|
1223
|
|
- text += QString(", %1").arg(mapNamesToMapConstants->value(warp->get("destination_map_name")));
|
1224
|
|
- text += "\n";
|
|
1200
|
+ for (Event *warp : map->events["warp_event_group"]) {
|
|
1201
|
+ text += warp->buildWarpEventMacro(mapNamesToMapConstants);
|
1225
|
1202
|
}
|
1226
|
1203
|
text += "\n";
|
1227
|
1204
|
}
|
1228
|
1205
|
|
1229
|
|
- if (map->events["trap"].length() + map->events["trap_weather"].length() > 0) {
|
|
1206
|
+ if (map->events["coord_event_group"].length() > 0) {
|
1230
|
1207
|
text += QString("%1::\n").arg(map->coord_events_label);
|
1231
|
|
- for (Event *coords : map->events["trap"]) {
|
1232
|
|
- text += QString("\tcoord_event %1").arg(coords->get("x"));
|
1233
|
|
- text += QString(", %1").arg(coords->get("y"));
|
1234
|
|
- text += QString(", %1").arg(coords->get("elevation"));
|
1235
|
|
- text += QString(", 0");
|
1236
|
|
- text += QString(", %1").arg(coords->get("script_var"));
|
1237
|
|
- text += QString(", %1").arg(coords->get("script_var_value"));
|
1238
|
|
- text += QString(", 0");
|
1239
|
|
- text += QString(", %1").arg(coords->get("script_label"));
|
1240
|
|
- text += "\n";
|
1241
|
|
- }
|
1242
|
|
- for (Event *coords : map->events["trap_weather"]) {
|
1243
|
|
- text += QString("\tcoord_weather_event %1").arg(coords->get("x"));
|
1244
|
|
- text += QString(", %1").arg(coords->get("y"));
|
1245
|
|
- text += QString(", %1").arg(coords->get("elevation"));
|
1246
|
|
- text += QString(", %1").arg(coords->get("weather"));
|
1247
|
|
- text += "\n";
|
|
1208
|
+ for (Event *event : map->events["coord_event_group"]) {
|
|
1209
|
+ QString event_type = event->get("event_type");
|
|
1210
|
+ if (event_type == EventType::CoordScript) {
|
|
1211
|
+ text += event->buildCoordScriptEventMacro();
|
|
1212
|
+ } else if (event_type == EventType::CoordWeather) {
|
|
1213
|
+ text += event->buildCoordWeatherEventMacro();
|
|
1214
|
+ }
|
1248
|
1215
|
}
|
1249
|
1216
|
text += "\n";
|
1250
|
1217
|
}
|
1251
|
1218
|
|
1252
|
|
- if (map->events["sign"].length() +
|
1253
|
|
- map->events["event_hidden_item"].length() +
|
1254
|
|
- map->events["event_secret_base"].length() > 0)
|
|
1219
|
+ if (map->events["bg_event_group"].length() > 0)
|
1255
|
1220
|
{
|
1256
|
1221
|
text += QString("%1::\n").arg(map->bg_events_label);
|
1257
|
|
- for (Event *sign : map->events["sign"]) {
|
1258
|
|
- text += QString("\tbg_event %1").arg(sign->get("x"));
|
1259
|
|
- text += QString(", %1").arg(sign->get("y"));
|
1260
|
|
- text += QString(", %1").arg(sign->get("elevation"));
|
1261
|
|
- text += QString(", %1").arg(sign->get("type"));
|
1262
|
|
- text += QString(", 0");
|
1263
|
|
- text += QString(", %1").arg(sign->get("script_label"));
|
1264
|
|
- text += "\n";
|
1265
|
|
- }
|
1266
|
|
- for (Event *item : map->events["event_hidden_item"]) {
|
1267
|
|
- text += QString("\tbg_hidden_item_event %1").arg(item->get("x"));
|
1268
|
|
- text += QString(", %1").arg(item->get("y"));
|
1269
|
|
- text += QString(", %1").arg(item->get("elevation"));
|
1270
|
|
- text += QString(", %1").arg(item->get("item"));
|
1271
|
|
- text += QString(", %1").arg(item->get("flag"));
|
1272
|
|
- text += "\n";
|
1273
|
|
- }
|
1274
|
|
- for (Event *item : map->events["event_secret_base"]) {
|
1275
|
|
- text += QString("\tbg_secret_base_event %1").arg(item->get("x"));
|
1276
|
|
- text += QString(", %1").arg(item->get("y"));
|
1277
|
|
- text += QString(", %1").arg(item->get("elevation"));
|
1278
|
|
- text += QString(", %1").arg(item->get("secret_base_map"));
|
1279
|
|
- text += "\n";
|
|
1222
|
+ for (Event *event : map->events["bg_event_group"]) {
|
|
1223
|
+ QString event_type = event->get("event_type");
|
|
1224
|
+ if (event_type == EventType::Sign) {
|
|
1225
|
+ text += event->buildSignEventMacro();
|
|
1226
|
+ } else if (event_type == EventType::HiddenItem) {
|
|
1227
|
+ text += event->buildHiddenItemEventMacro();
|
|
1228
|
+ } else if (event_type == EventType::SecretBase) {
|
|
1229
|
+ text += event->buildSecretBaseEventMacro();
|
|
1230
|
+ }
|
1280
|
1231
|
}
|
1281
|
1232
|
text += "\n";
|
1282
|
1233
|
}
|
|
@@ -1310,7 +1261,7 @@ void Project::readMapEvents(Map *map) {
|
1310
|
1261
|
map->bg_events_label = labels->value(3);
|
1311
|
1262
|
|
1312
|
1263
|
QList<QStringList> *object_events = getLabelMacros(parseAsm(text), map->object_events_label);
|
1313
|
|
- map->events["object"].clear();
|
|
1264
|
+ map->events["object_event_group"].clear();
|
1314
|
1265
|
for (QStringList command : *object_events) {
|
1315
|
1266
|
if (command.value(0) == "object_event") {
|
1316
|
1267
|
Event *object = new Event;
|
|
@@ -1324,18 +1275,18 @@ void Project::readMapEvents(Map *map) {
|
1324
|
1275
|
object->put("behavior", command.value(i++));
|
1325
|
1276
|
object->put("radius_x", command.value(i++).toInt(nullptr, 0));
|
1326
|
1277
|
object->put("radius_y", command.value(i++).toInt(nullptr, 0));
|
1327
|
|
- object->put("property", command.value(i++));
|
1328
|
|
- object->put("sight_radius", command.value(i++));
|
|
1278
|
+ object->put("trainer_see_type", command.value(i++));
|
|
1279
|
+ object->put("sight_radius_tree_id", command.value(i++));
|
1329
|
1280
|
object->put("script_label", command.value(i++));
|
1330
|
1281
|
object->put("event_flag", command.value(i++));
|
1331
|
|
-
|
|
1282
|
+ object->put("event_group_type", "object_event_group");
|
1332
|
1283
|
object->put("event_type", EventType::Object);
|
1333
|
|
- map->events["object"].append(object);
|
|
1284
|
+ map->events["object_event_group"].append(object);
|
1334
|
1285
|
}
|
1335
|
1286
|
}
|
1336
|
1287
|
|
1337
|
1288
|
QList<QStringList> *warps = getLabelMacros(parseAsm(text), map->warps_label);
|
1338
|
|
- map->events["warp"].clear();
|
|
1289
|
+ map->events["warp_event_group"].clear();
|
1339
|
1290
|
for (QStringList command : *warps) {
|
1340
|
1291
|
if (command.value(0) == "warp_def") {
|
1341
|
1292
|
Event *warp = new Event;
|
|
@@ -1350,8 +1301,9 @@ void Project::readMapEvents(Map *map) {
|
1350
|
1301
|
QString mapConstant = command.value(i++);
|
1351
|
1302
|
if (mapConstantsToMapNames->contains(mapConstant)) {
|
1352
|
1303
|
warp->put("destination_map_name", mapConstantsToMapNames->value(mapConstant));
|
|
1304
|
+ warp->put("event_group_type", "warp_event_group");
|
1353
|
1305
|
warp->put("event_type", EventType::Warp);
|
1354
|
|
- map->events["warp"].append(warp);
|
|
1306
|
+ map->events["warp_event_group"].append(warp);
|
1355
|
1307
|
} else {
|
1356
|
1308
|
qDebug() << QString("Destination map constant '%1' is invalid for warp").arg(mapConstant);
|
1357
|
1309
|
}
|
|
@@ -1359,8 +1311,7 @@ void Project::readMapEvents(Map *map) {
|
1359
|
1311
|
}
|
1360
|
1312
|
|
1361
|
1313
|
QList<QStringList> *coords = getLabelMacros(parseAsm(text), map->coord_events_label);
|
1362
|
|
- map->events["trap"].clear();
|
1363
|
|
- map->events["trap_weather"].clear();
|
|
1314
|
+ map->events["coord_event_group"].clear();
|
1364
|
1315
|
for (QStringList command : *coords) {
|
1365
|
1316
|
if (command.value(0) == "coord_event") {
|
1366
|
1317
|
Event *coord = new Event;
|
|
@@ -1381,8 +1332,9 @@ void Project::readMapEvents(Map *map) {
|
1381
|
1332
|
//coord_unknown3
|
1382
|
1333
|
//coord_unknown4
|
1383
|
1334
|
|
|
1335
|
+ coord->put("event_group_type", "coord_event_group");
|
1384
|
1336
|
coord->put("event_type", EventType::CoordScript);
|
1385
|
|
- map->events["trap"].append(coord);
|
|
1337
|
+ map->events["coord_event_group"].append(coord);
|
1386
|
1338
|
} else if (command.value(0) == "coord_weather_event") {
|
1387
|
1339
|
Event *coord = new Event;
|
1388
|
1340
|
coord->put("map_name", map->name);
|
|
@@ -1391,15 +1343,14 @@ void Project::readMapEvents(Map *map) {
|
1391
|
1343
|
coord->put("y", command.value(i++));
|
1392
|
1344
|
coord->put("elevation", command.value(i++));
|
1393
|
1345
|
coord->put("weather", command.value(i++));
|
|
1346
|
+ coord->put("event_group_type", "coord_event_group");
|
1394
|
1347
|
coord->put("event_type", EventType::CoordWeather);
|
1395
|
|
- map->events["trap_weather"].append(coord);
|
|
1348
|
+ map->events["coord_event_group"].append(coord);
|
1396
|
1349
|
}
|
1397
|
1350
|
}
|
1398
|
1351
|
|
1399
|
1352
|
QList<QStringList> *bgs = getLabelMacros(parseAsm(text), map->bg_events_label);
|
1400
|
|
- map->events["sign"].clear();
|
1401
|
|
- map->events["event_hidden_item"].clear();
|
1402
|
|
- map->events["event_secret_base"].clear();
|
|
1353
|
+ map->events["bg_event_group"].clear();
|
1403
|
1354
|
for (QStringList command : *bgs) {
|
1404
|
1355
|
if (command.value(0) == "bg_event") {
|
1405
|
1356
|
Event *bg = new Event;
|
|
@@ -1408,12 +1359,13 @@ void Project::readMapEvents(Map *map) {
|
1408
|
1359
|
bg->put("x", command.value(i++));
|
1409
|
1360
|
bg->put("y", command.value(i++));
|
1410
|
1361
|
bg->put("elevation", command.value(i++));
|
1411
|
|
- bg->put("type", command.value(i++));
|
|
1362
|
+ bg->put("player_facing_direction", command.value(i++));
|
1412
|
1363
|
i++;
|
1413
|
1364
|
bg->put("script_label", command.value(i++));
|
1414
|
1365
|
//sign_unknown7
|
|
1366
|
+ bg->put("event_group_type", "bg_event_group");
|
1415
|
1367
|
bg->put("event_type", EventType::Sign);
|
1416
|
|
- map->events["sign"].append(bg);
|
|
1368
|
+ map->events["bg_event_group"].append(bg);
|
1417
|
1369
|
} else if (command.value(0) == "bg_hidden_item_event") {
|
1418
|
1370
|
Event *bg = new Event;
|
1419
|
1371
|
bg->put("map_name", map->name);
|
|
@@ -1423,8 +1375,9 @@ void Project::readMapEvents(Map *map) {
|
1423
|
1375
|
bg->put("elevation", command.value(i++));
|
1424
|
1376
|
bg->put("item", command.value(i++));
|
1425
|
1377
|
bg->put("flag", command.value(i++));
|
|
1378
|
+ bg->put("event_group_type", "bg_event_group");
|
1426
|
1379
|
bg->put("event_type", EventType::HiddenItem);
|
1427
|
|
- map->events["event_hidden_item"].append(bg);
|
|
1380
|
+ map->events["bg_event_group"].append(bg);
|
1428
|
1381
|
} else if (command.value(0) == "bg_secret_base_event") {
|
1429
|
1382
|
Event *bg = new Event;
|
1430
|
1383
|
bg->put("map_name", map->name);
|
|
@@ -1433,8 +1386,9 @@ void Project::readMapEvents(Map *map) {
|
1433
|
1386
|
bg->put("y", command.value(i++));
|
1434
|
1387
|
bg->put("elevation", command.value(i++));
|
1435
|
1388
|
bg->put("secret_base_map", command.value(i++));
|
|
1389
|
+ bg->put("event_group_type", "bg_event_group");
|
1436
|
1390
|
bg->put("event_type", EventType::SecretBase);
|
1437
|
|
- map->events["event_secret_base"].append(bg);
|
|
1391
|
+ map->events["bg_event_group"].append(bg);
|
1438
|
1392
|
}
|
1439
|
1393
|
}
|
1440
|
1394
|
}
|
|
@@ -1444,13 +1398,10 @@ void Project::setNewMapEvents(Map *map) {
|
1444
|
1398
|
map->warps_label = "0x0";
|
1445
|
1399
|
map->coord_events_label = "0x0";
|
1446
|
1400
|
map->bg_events_label = "0x0";
|
1447
|
|
- map->events["object"].clear();
|
1448
|
|
- map->events["warp"].clear();
|
1449
|
|
- map->events["trap"].clear();
|
1450
|
|
- map->events["trap_weather"].clear();
|
1451
|
|
- map->events["sign"].clear();
|
1452
|
|
- map->events["event_hidden_item"].clear();
|
1453
|
|
- map->events["event_secret_base"].clear();
|
|
1401
|
+ map->events["object_event_group"].clear();
|
|
1402
|
+ map->events["warp_event_group"].clear();
|
|
1403
|
+ map->events["coord_event_group"].clear();
|
|
1404
|
+ map->events["bg_event_group"].clear();
|
1454
|
1405
|
}
|
1455
|
1406
|
|
1456
|
1407
|
QStringList Project::readCArray(QString text, QString label) {
|