From 3ed27ba5d3054595fe2f72a3bc59fbb24100dccc Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Tue, 5 Jun 2018 17:06:14 -0500 Subject: [PATCH] Update filepaths and var names from 'map_object' -> 'event_object' --- editor.cpp | 66 +++++++++++++++++++++++++------------------------- editor.h | 14 +++++------ mainwindow.cpp | 6 ++--- project.cpp | 24 +++++++++--------- project.h | 4 +-- 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/editor.cpp b/editor.cpp index f0e0e996..e12cde83 100755 --- a/editor.cpp +++ b/editor.cpp @@ -47,8 +47,8 @@ void Editor::setEditingMap() { if (collision_item) { collision_item->setVisible(false); } - if (objects_group) { - objects_group->setVisible(false); + if (events_group) { + events_group->setVisible(false); } setBorderItemsVisible(true); setConnectionItemsVisible(false); @@ -64,8 +64,8 @@ void Editor::setEditingCollision() { if (map_item) { map_item->setVisible(false); } - if (objects_group) { - objects_group->setVisible(false); + if (events_group) { + events_group->setVisible(false); } setBorderItemsVisible(true); setConnectionItemsVisible(false); @@ -73,8 +73,8 @@ void Editor::setEditingCollision() { void Editor::setEditingObjects() { current_view = map_item; - if (objects_group) { - objects_group->setVisible(true); + if (events_group) { + events_group->setVisible(true); } if (map_item) { map_item->setVisible(true); @@ -108,8 +108,8 @@ void Editor::setEditingConnections() { if (collision_item) { collision_item->setVisible(false); } - if (objects_group) { - objects_group->setVisible(false); + if (events_group) { + events_group->setVisible(false); } setBorderItemsVisible(true, 0.4); setConnectionItemsVisible(true); @@ -315,7 +315,7 @@ void Editor::setMap(QString map_name) { map = project->loadMap(map_name); displayMap(); selected_events->clear(); - updateSelectedObjects(); + updateSelectedEvents(); } } @@ -359,8 +359,8 @@ void Editor::displayMap() { collision_item->draw(); scene->addItem(collision_item); - objects_group = new EventGroup; - scene->addItem(objects_group); + events_group = new EventGroup; + scene->addItem(events_group); if (map_item) { map_item->setVisible(false); @@ -368,8 +368,8 @@ void Editor::displayMap() { if (collision_item) { collision_item->setVisible(false); } - if (objects_group) { - objects_group->setVisible(false); + if (events_group) { + events_group->setVisible(false); } int tw = 16; @@ -384,7 +384,7 @@ void Editor::displayMap() { displayMetatiles(); displayCollisionMetatiles(); displayElevationMetatiles(); - displayMapObjects(); + displayMapEvents(); displayMapConnections(); displayMapBorder(); displayMapGrid(); @@ -411,26 +411,26 @@ void Editor::displayElevationMetatiles() { scene_elevation_metatiles->addItem(elevation_metatiles_item); } -void Editor::displayMapObjects() { - for (QGraphicsItem *child : objects_group->childItems()) { - objects_group->removeFromGroup(child); +void Editor::displayMapEvents() { + for (QGraphicsItem *child : events_group->childItems()) { + events_group->removeFromGroup(child); } QList events = map->getAllEvents(); - project->loadObjectPixmaps(events); + project->loadEventPixmaps(events); for (Event *event : events) { - addMapObject(event); + addMapEvent(event); } //objects_group->setFiltersChildEvents(false); - objects_group->setHandlesChildEvents(false); + events_group->setHandlesChildEvents(false); emit objectsChanged(); } -DraggablePixmapItem *Editor::addMapObject(Event *event) { +DraggablePixmapItem *Editor::addMapEvent(Event *event) { DraggablePixmapItem *object = new DraggablePixmapItem(event); object->editor = this; - objects_group->addToGroup(object); + events_group->addToGroup(object); return object; } @@ -1236,8 +1236,8 @@ void DraggablePixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *mouse) { void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) { if (clicking) { - this->editor->selectMapObject(this, mouse->modifiers() & Qt::ControlModifier); - this->editor->updateSelectedObjects(); + this->editor->selectMapEvent(this, mouse->modifiers() & Qt::ControlModifier); + this->editor->updateSelectedEvents(); } active = false; } @@ -1245,7 +1245,7 @@ void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) { QList *Editor::getObjects() { QList *list = new QList; for (Event *event : map->getAllEvents()) { - for (QGraphicsItem *child : objects_group->childItems()) { + for (QGraphicsItem *child : events_group->childItems()) { DraggablePixmapItem *item = (DraggablePixmapItem *)child; if (item->event == event) { list->append(item); @@ -1270,18 +1270,18 @@ void Editor::redrawObject(DraggablePixmapItem *item) { } } -void Editor::updateSelectedObjects() { +void Editor::updateSelectedEvents() { for (DraggablePixmapItem *item : *(getObjects())) { redrawObject(item); } emit selectedObjectsChanged(); } -void Editor::selectMapObject(DraggablePixmapItem *object) { - selectMapObject(object, false); +void Editor::selectMapEvent(DraggablePixmapItem *object) { + selectMapEvent(object, false); } -void Editor::selectMapObject(DraggablePixmapItem *object, bool toggle) { +void Editor::selectMapEvent(DraggablePixmapItem *object, bool toggle) { if (selected_events && object) { if (selected_events->contains(object)) { if (toggle) { @@ -1293,7 +1293,7 @@ void Editor::selectMapObject(DraggablePixmapItem *object, bool toggle) { } selected_events->append(object); } - updateSelectedObjects(); + updateSelectedEvents(); } } @@ -1307,8 +1307,8 @@ DraggablePixmapItem* Editor::addNewEvent(QString event_type) { event->put("map_name", map->name); event->put("event_type", event_type); map->addEvent(event); - project->loadObjectPixmaps(map->getAllEvents()); - DraggablePixmapItem *object = addMapObject(event); + project->loadEventPixmaps(map->getAllEvents()); + DraggablePixmapItem *object = addMapEvent(event); return object; } @@ -1354,7 +1354,7 @@ void Editor::objectsView_onMouseRelease(QMouseEvent *event) { } if (deselect) { selected_events->clear(); - updateSelectedObjects(); + updateSelectedEvents(); } } } diff --git a/editor.h b/editor.h index 1d411505..f0f29231 100755 --- a/editor.h +++ b/editor.h @@ -38,7 +38,7 @@ public: void displayMetatiles(); void displayCollisionMetatiles(); void displayElevationMetatiles(); - void displayMapObjects(); + void displayMapEvents(); void displayMapConnections(); void displayMapBorder(); void displayMapGrid(); @@ -58,13 +58,13 @@ public: void updateEmergeMap(QString mapName); void setSelectedConnectionFromMap(QString mapName); - DraggablePixmapItem *addMapObject(Event *event); - void selectMapObject(DraggablePixmapItem *object); - void selectMapObject(DraggablePixmapItem *object, bool toggle); + DraggablePixmapItem *addMapEvent(Event *event); + void selectMapEvent(DraggablePixmapItem *object); + void selectMapEvent(DraggablePixmapItem *object, bool toggle); DraggablePixmapItem *addNewEvent(); DraggablePixmapItem *addNewEvent(QString event_type); void deleteEvent(Event *); - void updateSelectedObjects(); + void updateSelectedEvents(); void redrawObject(DraggablePixmapItem *item); QList *getObjects(); @@ -74,7 +74,7 @@ public: ConnectionPixmapItem* selected_connection_item = NULL; QList connection_edit_items; CollisionPixmapItem *collision_item = NULL; - QGraphicsItemGroup *objects_group = NULL; + QGraphicsItemGroup *events_group = NULL; QList borderItems; QGraphicsScene *scene_metatiles = NULL; @@ -161,7 +161,7 @@ public: QList objects; objects.append(event); event->pixmap = QPixmap(); - editor->project->loadObjectPixmaps(objects); + editor->project->loadEventPixmaps(objects); editor->redrawObject(this); emit spriteChanged(event->pixmap); } diff --git a/mainwindow.cpp b/mainwindow.cpp index f1cfa90d..ce48ff4c 100755 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -509,7 +509,7 @@ void MainWindow::on_toolButton_newObject_clicked() DraggablePixmapItem *object = editor->addNewEvent(); if (object) { //if (editor->selected_events->length()) { - editor->selectMapObject(object, true); + editor->selectMapEvent(object, true); //} } updateSelectedObjects(); @@ -526,7 +526,7 @@ void MainWindow::updateSelectedObjects() { events = editor->selected_events; } - QMap map_obj_gfx_constants = editor->project->getMapObjGfxConstants(); + QMap event_obj_gfx_constants = editor->project->getEventObjGfxConstants(); QList frames; @@ -593,7 +593,7 @@ void MainWindow::updateSelectedObjects() { if (event_type == "object") { frame->ui->sprite->setVisible(true); - frame->ui->comboBox_sprite->addItems(map_obj_gfx_constants.keys()); + frame->ui->comboBox_sprite->addItems(event_obj_gfx_constants.keys()); frame->ui->comboBox_sprite->setCurrentText(item->event->get("sprite")); connect(frame->ui->comboBox_sprite, SIGNAL(activated(QString)), item, SLOT(set_sprite(QString))); diff --git a/project.cpp b/project.cpp index 1288d192..3ac8e9fa 100755 --- a/project.cpp +++ b/project.cpp @@ -1207,13 +1207,13 @@ QStringList Project::getSongNames() { return names; } -QMap Project::getMapObjGfxConstants() { +QMap Project::getEventObjGfxConstants() { QMap constants; - QString text = readTextFile(root + "/include/constants/map_objects.h"); + QString text = readTextFile(root + "/include/constants/event_objects.h"); if (!text.isNull()) { - QStringList mapObjGfxPrefixes; - mapObjGfxPrefixes << "MAP_OBJ_GFX_"; - constants = readCDefines(text, mapObjGfxPrefixes); + QStringList eventObjGfxPrefixes; + eventObjGfxPrefixes << "EVENT_OBJ_GFX_"; + constants = readCDefines(text, eventObjGfxPrefixes); } return constants; } @@ -1224,7 +1224,7 @@ QString Project::fixGraphicPath(QString path) { return path; } -void Project::loadObjectPixmaps(QList objects) { +void Project::loadEventPixmaps(QList objects) { bool needs_update = false; for (Event *object : objects) { if (object->pixmap.isNull()) { @@ -1236,14 +1236,14 @@ void Project::loadObjectPixmaps(QList objects) { return; } - QMap constants = getMapObjGfxConstants(); + QMap constants = getEventObjGfxConstants(); - QString pointers_text = readTextFile(root + "/src/data/field_map_obj/map_object_graphics_info_pointers.h"); - QString info_text = readTextFile(root + "/src/data/field_map_obj/map_object_graphics_info.h"); - QString pic_text = readTextFile(root + "/src/data/field_map_obj/map_object_pic_tables.h"); - QString assets_text = readTextFile(root + "/src/event_object_movement.c"); + QString pointers_text = readTextFile(root + "/src/data/field_event_obj/event_object_graphics_info_pointers.h"); + QString info_text = readTextFile(root + "/src/data/field_event_obj/event_object_graphics_info.h"); + QString pic_text = readTextFile(root + "/src/data/field_event_obj/event_object_pic_tables.h"); + QString assets_text = readTextFile(root + "/src/data/field_event_obj/event_object_graphics.h"); - QStringList pointers = readCArray(pointers_text, "gMapObjectGraphicsInfoPointers"); + QStringList pointers = readCArray(pointers_text, "gEventObjectGraphicsInfoPointers"); for (Event *object : objects) { if (!object->pixmap.isNull()) { diff --git a/project.h b/project.h index 58502c2f..27da8654 100755 --- a/project.h +++ b/project.h @@ -81,8 +81,8 @@ public: void readFlagNames(); void readVarNames(); - void loadObjectPixmaps(QList objects); - QMap getMapObjGfxConstants(); + void loadEventPixmaps(QList objects); + QMap getEventObjGfxConstants(); QString fixGraphicPath(QString path); void readMapEvents(Map *map);