ソースを参照

Merge pull request #48 from huderlem/fixpath

'Map Object' -> 'Event Object'
yenatch 6 年 前
コミット
ddb832de0c
No account linked to committer's email address
共有5 個のファイルを変更した57 個の追加57 個の削除を含む
  1. 33
    33
      editor.cpp
  2. 7
    7
      editor.h
  3. 3
    3
      mainwindow.cpp
  4. 12
    12
      project.cpp
  5. 2
    2
      project.h

+ 33
- 33
editor.cpp ファイルの表示

@@ -47,8 +47,8 @@ void Editor::setEditingMap() {
47 47
     if (collision_item) {
48 48
         collision_item->setVisible(false);
49 49
     }
50
-    if (objects_group) {
51
-        objects_group->setVisible(false);
50
+    if (events_group) {
51
+        events_group->setVisible(false);
52 52
     }
53 53
     setBorderItemsVisible(true);
54 54
     setConnectionItemsVisible(false);
@@ -64,8 +64,8 @@ void Editor::setEditingCollision() {
64 64
     if (map_item) {
65 65
         map_item->setVisible(false);
66 66
     }
67
-    if (objects_group) {
68
-        objects_group->setVisible(false);
67
+    if (events_group) {
68
+        events_group->setVisible(false);
69 69
     }
70 70
     setBorderItemsVisible(true);
71 71
     setConnectionItemsVisible(false);
@@ -73,8 +73,8 @@ void Editor::setEditingCollision() {
73 73
 
74 74
 void Editor::setEditingObjects() {
75 75
     current_view = map_item;
76
-    if (objects_group) {
77
-        objects_group->setVisible(true);
76
+    if (events_group) {
77
+        events_group->setVisible(true);
78 78
     }
79 79
     if (map_item) {
80 80
         map_item->setVisible(true);
@@ -108,8 +108,8 @@ void Editor::setEditingConnections() {
108 108
     if (collision_item) {
109 109
         collision_item->setVisible(false);
110 110
     }
111
-    if (objects_group) {
112
-        objects_group->setVisible(false);
111
+    if (events_group) {
112
+        events_group->setVisible(false);
113 113
     }
114 114
     setBorderItemsVisible(true, 0.4);
115 115
     setConnectionItemsVisible(true);
@@ -315,7 +315,7 @@ void Editor::setMap(QString map_name) {
315 315
         map = project->loadMap(map_name);
316 316
         displayMap();
317 317
         selected_events->clear();
318
-        updateSelectedObjects();
318
+        updateSelectedEvents();
319 319
     }
320 320
 }
321 321
 
@@ -359,8 +359,8 @@ void Editor::displayMap() {
359 359
     collision_item->draw();
360 360
     scene->addItem(collision_item);
361 361
 
362
-    objects_group = new EventGroup;
363
-    scene->addItem(objects_group);
362
+    events_group = new EventGroup;
363
+    scene->addItem(events_group);
364 364
 
365 365
     if (map_item) {
366 366
         map_item->setVisible(false);
@@ -368,8 +368,8 @@ void Editor::displayMap() {
368 368
     if (collision_item) {
369 369
         collision_item->setVisible(false);
370 370
     }
371
-    if (objects_group) {
372
-        objects_group->setVisible(false);
371
+    if (events_group) {
372
+        events_group->setVisible(false);
373 373
     }
374 374
 
375 375
     int tw = 16;
@@ -384,7 +384,7 @@ void Editor::displayMap() {
384 384
     displayMetatiles();
385 385
     displayCollisionMetatiles();
386 386
     displayElevationMetatiles();
387
-    displayMapObjects();
387
+    displayMapEvents();
388 388
     displayMapConnections();
389 389
     displayMapBorder();
390 390
     displayMapGrid();
@@ -411,26 +411,26 @@ void Editor::displayElevationMetatiles() {
411 411
     scene_elevation_metatiles->addItem(elevation_metatiles_item);
412 412
 }
413 413
 
414
-void Editor::displayMapObjects() {
415
-    for (QGraphicsItem *child : objects_group->childItems()) {
416
-        objects_group->removeFromGroup(child);
414
+void Editor::displayMapEvents() {
415
+    for (QGraphicsItem *child : events_group->childItems()) {
416
+        events_group->removeFromGroup(child);
417 417
     }
418 418
 
419 419
     QList<Event *> events = map->getAllEvents();
420
-    project->loadObjectPixmaps(events);
420
+    project->loadEventPixmaps(events);
421 421
     for (Event *event : events) {
422
-        addMapObject(event);
422
+        addMapEvent(event);
423 423
     }
424 424
     //objects_group->setFiltersChildEvents(false);
425
-    objects_group->setHandlesChildEvents(false);
425
+    events_group->setHandlesChildEvents(false);
426 426
 
427 427
     emit objectsChanged();
428 428
 }
429 429
 
430
-DraggablePixmapItem *Editor::addMapObject(Event *event) {
430
+DraggablePixmapItem *Editor::addMapEvent(Event *event) {
431 431
     DraggablePixmapItem *object = new DraggablePixmapItem(event);
432 432
     object->editor = this;
433
-    objects_group->addToGroup(object);
433
+    events_group->addToGroup(object);
434 434
     return object;
435 435
 }
436 436
 
@@ -1236,8 +1236,8 @@ void DraggablePixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *mouse) {
1236 1236
 
1237 1237
 void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) {
1238 1238
     if (clicking) {
1239
-        this->editor->selectMapObject(this, mouse->modifiers() & Qt::ControlModifier);
1240
-        this->editor->updateSelectedObjects();
1239
+        this->editor->selectMapEvent(this, mouse->modifiers() & Qt::ControlModifier);
1240
+        this->editor->updateSelectedEvents();
1241 1241
     }
1242 1242
     active = false;
1243 1243
 }
@@ -1245,7 +1245,7 @@ void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) {
1245 1245
 QList<DraggablePixmapItem *> *Editor::getObjects() {
1246 1246
     QList<DraggablePixmapItem *> *list = new QList<DraggablePixmapItem *>;
1247 1247
     for (Event *event : map->getAllEvents()) {
1248
-        for (QGraphicsItem *child : objects_group->childItems()) {
1248
+        for (QGraphicsItem *child : events_group->childItems()) {
1249 1249
             DraggablePixmapItem *item = (DraggablePixmapItem *)child;
1250 1250
             if (item->event == event) {
1251 1251
                 list->append(item);
@@ -1270,18 +1270,18 @@ void Editor::redrawObject(DraggablePixmapItem *item) {
1270 1270
     }
1271 1271
 }
1272 1272
 
1273
-void Editor::updateSelectedObjects() {
1273
+void Editor::updateSelectedEvents() {
1274 1274
     for (DraggablePixmapItem *item : *(getObjects())) {
1275 1275
         redrawObject(item);
1276 1276
     }
1277 1277
     emit selectedObjectsChanged();
1278 1278
 }
1279 1279
 
1280
-void Editor::selectMapObject(DraggablePixmapItem *object) {
1281
-    selectMapObject(object, false);
1280
+void Editor::selectMapEvent(DraggablePixmapItem *object) {
1281
+    selectMapEvent(object, false);
1282 1282
 }
1283 1283
 
1284
-void Editor::selectMapObject(DraggablePixmapItem *object, bool toggle) {
1284
+void Editor::selectMapEvent(DraggablePixmapItem *object, bool toggle) {
1285 1285
     if (selected_events && object) {
1286 1286
         if (selected_events->contains(object)) {
1287 1287
             if (toggle) {
@@ -1293,7 +1293,7 @@ void Editor::selectMapObject(DraggablePixmapItem *object, bool toggle) {
1293 1293
             }
1294 1294
             selected_events->append(object);
1295 1295
         }
1296
-        updateSelectedObjects();
1296
+        updateSelectedEvents();
1297 1297
     }
1298 1298
 }
1299 1299
 
@@ -1307,8 +1307,8 @@ DraggablePixmapItem* Editor::addNewEvent(QString event_type) {
1307 1307
         event->put("map_name", map->name);
1308 1308
         event->put("event_type", event_type);
1309 1309
         map->addEvent(event);
1310
-        project->loadObjectPixmaps(map->getAllEvents());
1311
-        DraggablePixmapItem *object = addMapObject(event);
1310
+        project->loadEventPixmaps(map->getAllEvents());
1311
+        DraggablePixmapItem *object = addMapEvent(event);
1312 1312
 
1313 1313
         return object;
1314 1314
     }
@@ -1354,7 +1354,7 @@ void Editor::objectsView_onMouseRelease(QMouseEvent *event) {
1354 1354
                 }
1355 1355
                 if (deselect) {
1356 1356
                     selected_events->clear();
1357
-                    updateSelectedObjects();
1357
+                    updateSelectedEvents();
1358 1358
                 }
1359 1359
             }
1360 1360
         }

+ 7
- 7
editor.h ファイルの表示

@@ -38,7 +38,7 @@ public:
38 38
     void displayMetatiles();
39 39
     void displayCollisionMetatiles();
40 40
     void displayElevationMetatiles();
41
-    void displayMapObjects();
41
+    void displayMapEvents();
42 42
     void displayMapConnections();
43 43
     void displayMapBorder();
44 44
     void displayMapGrid();
@@ -58,13 +58,13 @@ public:
58 58
     void updateEmergeMap(QString mapName);
59 59
     void setSelectedConnectionFromMap(QString mapName);
60 60
 
61
-    DraggablePixmapItem *addMapObject(Event *event);
62
-    void selectMapObject(DraggablePixmapItem *object);
63
-    void selectMapObject(DraggablePixmapItem *object, bool toggle);
61
+    DraggablePixmapItem *addMapEvent(Event *event);
62
+    void selectMapEvent(DraggablePixmapItem *object);
63
+    void selectMapEvent(DraggablePixmapItem *object, bool toggle);
64 64
     DraggablePixmapItem *addNewEvent();
65 65
     DraggablePixmapItem *addNewEvent(QString event_type);
66 66
     void deleteEvent(Event *);
67
-    void updateSelectedObjects();
67
+    void updateSelectedEvents();
68 68
     void redrawObject(DraggablePixmapItem *item);
69 69
     QList<DraggablePixmapItem *> *getObjects();
70 70
 
@@ -74,7 +74,7 @@ public:
74 74
     ConnectionPixmapItem* selected_connection_item = NULL;
75 75
     QList<ConnectionPixmapItem*> connection_edit_items;
76 76
     CollisionPixmapItem *collision_item = NULL;
77
-    QGraphicsItemGroup *objects_group = NULL;
77
+    QGraphicsItemGroup *events_group = NULL;
78 78
     QList<QGraphicsPixmapItem*> borderItems;
79 79
 
80 80
     QGraphicsScene *scene_metatiles = NULL;
@@ -161,7 +161,7 @@ public:
161 161
         QList<Event*> objects;
162 162
         objects.append(event);
163 163
         event->pixmap = QPixmap();
164
-        editor->project->loadObjectPixmaps(objects);
164
+        editor->project->loadEventPixmaps(objects);
165 165
         editor->redrawObject(this);
166 166
         emit spriteChanged(event->pixmap);
167 167
     }

+ 3
- 3
mainwindow.cpp ファイルの表示

@@ -509,7 +509,7 @@ void MainWindow::on_toolButton_newObject_clicked()
509 509
         DraggablePixmapItem *object = editor->addNewEvent();
510 510
         if (object) {
511 511
             //if (editor->selected_events->length()) {
512
-                editor->selectMapObject(object, true);
512
+                editor->selectMapEvent(object, true);
513 513
             //}
514 514
         }
515 515
         updateSelectedObjects();
@@ -526,7 +526,7 @@ void MainWindow::updateSelectedObjects() {
526 526
         events = editor->selected_events;
527 527
     }
528 528
 
529
-    QMap<QString, int> map_obj_gfx_constants = editor->project->getMapObjGfxConstants();
529
+    QMap<QString, int> event_obj_gfx_constants = editor->project->getEventObjGfxConstants();
530 530
 
531 531
     QList<ObjectPropertiesFrame *> frames;
532 532
 
@@ -593,7 +593,7 @@ void MainWindow::updateSelectedObjects() {
593 593
         if (event_type == "object") {
594 594
 
595 595
             frame->ui->sprite->setVisible(true);
596
-            frame->ui->comboBox_sprite->addItems(map_obj_gfx_constants.keys());
596
+            frame->ui->comboBox_sprite->addItems(event_obj_gfx_constants.keys());
597 597
             frame->ui->comboBox_sprite->setCurrentText(item->event->get("sprite"));
598 598
             connect(frame->ui->comboBox_sprite, SIGNAL(activated(QString)), item, SLOT(set_sprite(QString)));
599 599
 

+ 12
- 12
project.cpp ファイルの表示

@@ -1207,13 +1207,13 @@ QStringList Project::getSongNames() {
1207 1207
     return names;
1208 1208
 }
1209 1209
 
1210
-QMap<QString, int> Project::getMapObjGfxConstants() {
1210
+QMap<QString, int> Project::getEventObjGfxConstants() {
1211 1211
     QMap<QString, int> constants;
1212
-    QString text = readTextFile(root + "/include/constants/map_objects.h");
1212
+    QString text = readTextFile(root + "/include/constants/event_objects.h");
1213 1213
     if (!text.isNull()) {
1214
-        QStringList mapObjGfxPrefixes;
1215
-        mapObjGfxPrefixes << "MAP_OBJ_GFX_";
1216
-        constants = readCDefines(text, mapObjGfxPrefixes);
1214
+        QStringList eventObjGfxPrefixes;
1215
+        eventObjGfxPrefixes << "EVENT_OBJ_GFX_";
1216
+        constants = readCDefines(text, eventObjGfxPrefixes);
1217 1217
     }
1218 1218
     return constants;
1219 1219
 }
@@ -1224,7 +1224,7 @@ QString Project::fixGraphicPath(QString path) {
1224 1224
     return path;
1225 1225
 }
1226 1226
 
1227
-void Project::loadObjectPixmaps(QList<Event*> objects) {
1227
+void Project::loadEventPixmaps(QList<Event*> objects) {
1228 1228
     bool needs_update = false;
1229 1229
     for (Event *object : objects) {
1230 1230
         if (object->pixmap.isNull()) {
@@ -1236,14 +1236,14 @@ void Project::loadObjectPixmaps(QList<Event*> objects) {
1236 1236
         return;
1237 1237
     }
1238 1238
 
1239
-    QMap<QString, int> constants = getMapObjGfxConstants();
1239
+    QMap<QString, int> constants = getEventObjGfxConstants();
1240 1240
 
1241
-    QString pointers_text = readTextFile(root + "/src/data/field_map_obj/map_object_graphics_info_pointers.h");
1242
-    QString info_text = readTextFile(root + "/src/data/field_map_obj/map_object_graphics_info.h");
1243
-    QString pic_text = readTextFile(root + "/src/data/field_map_obj/map_object_pic_tables.h");
1244
-    QString assets_text = readTextFile(root + "/src/event_object_movement.c");
1241
+    QString pointers_text = readTextFile(root + "/src/data/field_event_obj/event_object_graphics_info_pointers.h");
1242
+    QString info_text = readTextFile(root + "/src/data/field_event_obj/event_object_graphics_info.h");
1243
+    QString pic_text = readTextFile(root + "/src/data/field_event_obj/event_object_pic_tables.h");
1244
+    QString assets_text = readTextFile(root + "/src/data/field_event_obj/event_object_graphics.h");
1245 1245
 
1246
-    QStringList pointers = readCArray(pointers_text, "gMapObjectGraphicsInfoPointers");
1246
+    QStringList pointers = readCArray(pointers_text, "gEventObjectGraphicsInfoPointers");
1247 1247
 
1248 1248
     for (Event *object : objects) {
1249 1249
         if (!object->pixmap.isNull()) {

+ 2
- 2
project.h ファイルの表示

@@ -81,8 +81,8 @@ public:
81 81
     void readFlagNames();
82 82
     void readVarNames();
83 83
 
84
-    void loadObjectPixmaps(QList<Event*> objects);
85
-    QMap<QString, int> getMapObjGfxConstants();
84
+    void loadEventPixmaps(QList<Event*> objects);
85
+    QMap<QString, int> getEventObjGfxConstants();
86 86
     QString fixGraphicPath(QString path);
87 87
 
88 88
     void readMapEvents(Map *map);