Update filepaths and var names from 'map_object' -> 'event_object'

This commit is contained in:
Marcus Huderle 2018-06-05 17:06:14 -05:00
parent a11365176c
commit 3ed27ba5d3
5 changed files with 57 additions and 57 deletions

View file

@ -47,8 +47,8 @@ void Editor::setEditingMap() {
if (collision_item) { if (collision_item) {
collision_item->setVisible(false); collision_item->setVisible(false);
} }
if (objects_group) { if (events_group) {
objects_group->setVisible(false); events_group->setVisible(false);
} }
setBorderItemsVisible(true); setBorderItemsVisible(true);
setConnectionItemsVisible(false); setConnectionItemsVisible(false);
@ -64,8 +64,8 @@ void Editor::setEditingCollision() {
if (map_item) { if (map_item) {
map_item->setVisible(false); map_item->setVisible(false);
} }
if (objects_group) { if (events_group) {
objects_group->setVisible(false); events_group->setVisible(false);
} }
setBorderItemsVisible(true); setBorderItemsVisible(true);
setConnectionItemsVisible(false); setConnectionItemsVisible(false);
@ -73,8 +73,8 @@ void Editor::setEditingCollision() {
void Editor::setEditingObjects() { void Editor::setEditingObjects() {
current_view = map_item; current_view = map_item;
if (objects_group) { if (events_group) {
objects_group->setVisible(true); events_group->setVisible(true);
} }
if (map_item) { if (map_item) {
map_item->setVisible(true); map_item->setVisible(true);
@ -108,8 +108,8 @@ void Editor::setEditingConnections() {
if (collision_item) { if (collision_item) {
collision_item->setVisible(false); collision_item->setVisible(false);
} }
if (objects_group) { if (events_group) {
objects_group->setVisible(false); events_group->setVisible(false);
} }
setBorderItemsVisible(true, 0.4); setBorderItemsVisible(true, 0.4);
setConnectionItemsVisible(true); setConnectionItemsVisible(true);
@ -315,7 +315,7 @@ void Editor::setMap(QString map_name) {
map = project->loadMap(map_name); map = project->loadMap(map_name);
displayMap(); displayMap();
selected_events->clear(); selected_events->clear();
updateSelectedObjects(); updateSelectedEvents();
} }
} }
@ -359,8 +359,8 @@ void Editor::displayMap() {
collision_item->draw(); collision_item->draw();
scene->addItem(collision_item); scene->addItem(collision_item);
objects_group = new EventGroup; events_group = new EventGroup;
scene->addItem(objects_group); scene->addItem(events_group);
if (map_item) { if (map_item) {
map_item->setVisible(false); map_item->setVisible(false);
@ -368,8 +368,8 @@ void Editor::displayMap() {
if (collision_item) { if (collision_item) {
collision_item->setVisible(false); collision_item->setVisible(false);
} }
if (objects_group) { if (events_group) {
objects_group->setVisible(false); events_group->setVisible(false);
} }
int tw = 16; int tw = 16;
@ -384,7 +384,7 @@ void Editor::displayMap() {
displayMetatiles(); displayMetatiles();
displayCollisionMetatiles(); displayCollisionMetatiles();
displayElevationMetatiles(); displayElevationMetatiles();
displayMapObjects(); displayMapEvents();
displayMapConnections(); displayMapConnections();
displayMapBorder(); displayMapBorder();
displayMapGrid(); displayMapGrid();
@ -411,26 +411,26 @@ void Editor::displayElevationMetatiles() {
scene_elevation_metatiles->addItem(elevation_metatiles_item); scene_elevation_metatiles->addItem(elevation_metatiles_item);
} }
void Editor::displayMapObjects() { void Editor::displayMapEvents() {
for (QGraphicsItem *child : objects_group->childItems()) { for (QGraphicsItem *child : events_group->childItems()) {
objects_group->removeFromGroup(child); events_group->removeFromGroup(child);
} }
QList<Event *> events = map->getAllEvents(); QList<Event *> events = map->getAllEvents();
project->loadObjectPixmaps(events); project->loadEventPixmaps(events);
for (Event *event : events) { for (Event *event : events) {
addMapObject(event); addMapEvent(event);
} }
//objects_group->setFiltersChildEvents(false); //objects_group->setFiltersChildEvents(false);
objects_group->setHandlesChildEvents(false); events_group->setHandlesChildEvents(false);
emit objectsChanged(); emit objectsChanged();
} }
DraggablePixmapItem *Editor::addMapObject(Event *event) { DraggablePixmapItem *Editor::addMapEvent(Event *event) {
DraggablePixmapItem *object = new DraggablePixmapItem(event); DraggablePixmapItem *object = new DraggablePixmapItem(event);
object->editor = this; object->editor = this;
objects_group->addToGroup(object); events_group->addToGroup(object);
return object; return object;
} }
@ -1236,8 +1236,8 @@ void DraggablePixmapItem::mouseMoveEvent(QGraphicsSceneMouseEvent *mouse) {
void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) { void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) {
if (clicking) { if (clicking) {
this->editor->selectMapObject(this, mouse->modifiers() & Qt::ControlModifier); this->editor->selectMapEvent(this, mouse->modifiers() & Qt::ControlModifier);
this->editor->updateSelectedObjects(); this->editor->updateSelectedEvents();
} }
active = false; active = false;
} }
@ -1245,7 +1245,7 @@ void DraggablePixmapItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *mouse) {
QList<DraggablePixmapItem *> *Editor::getObjects() { QList<DraggablePixmapItem *> *Editor::getObjects() {
QList<DraggablePixmapItem *> *list = new QList<DraggablePixmapItem *>; QList<DraggablePixmapItem *> *list = new QList<DraggablePixmapItem *>;
for (Event *event : map->getAllEvents()) { for (Event *event : map->getAllEvents()) {
for (QGraphicsItem *child : objects_group->childItems()) { for (QGraphicsItem *child : events_group->childItems()) {
DraggablePixmapItem *item = (DraggablePixmapItem *)child; DraggablePixmapItem *item = (DraggablePixmapItem *)child;
if (item->event == event) { if (item->event == event) {
list->append(item); list->append(item);
@ -1270,18 +1270,18 @@ void Editor::redrawObject(DraggablePixmapItem *item) {
} }
} }
void Editor::updateSelectedObjects() { void Editor::updateSelectedEvents() {
for (DraggablePixmapItem *item : *(getObjects())) { for (DraggablePixmapItem *item : *(getObjects())) {
redrawObject(item); redrawObject(item);
} }
emit selectedObjectsChanged(); emit selectedObjectsChanged();
} }
void Editor::selectMapObject(DraggablePixmapItem *object) { void Editor::selectMapEvent(DraggablePixmapItem *object) {
selectMapObject(object, false); selectMapEvent(object, false);
} }
void Editor::selectMapObject(DraggablePixmapItem *object, bool toggle) { void Editor::selectMapEvent(DraggablePixmapItem *object, bool toggle) {
if (selected_events && object) { if (selected_events && object) {
if (selected_events->contains(object)) { if (selected_events->contains(object)) {
if (toggle) { if (toggle) {
@ -1293,7 +1293,7 @@ void Editor::selectMapObject(DraggablePixmapItem *object, bool toggle) {
} }
selected_events->append(object); selected_events->append(object);
} }
updateSelectedObjects(); updateSelectedEvents();
} }
} }
@ -1307,8 +1307,8 @@ DraggablePixmapItem* Editor::addNewEvent(QString event_type) {
event->put("map_name", map->name); event->put("map_name", map->name);
event->put("event_type", event_type); event->put("event_type", event_type);
map->addEvent(event); map->addEvent(event);
project->loadObjectPixmaps(map->getAllEvents()); project->loadEventPixmaps(map->getAllEvents());
DraggablePixmapItem *object = addMapObject(event); DraggablePixmapItem *object = addMapEvent(event);
return object; return object;
} }
@ -1354,7 +1354,7 @@ void Editor::objectsView_onMouseRelease(QMouseEvent *event) {
} }
if (deselect) { if (deselect) {
selected_events->clear(); selected_events->clear();
updateSelectedObjects(); updateSelectedEvents();
} }
} }
} }

View file

@ -38,7 +38,7 @@ public:
void displayMetatiles(); void displayMetatiles();
void displayCollisionMetatiles(); void displayCollisionMetatiles();
void displayElevationMetatiles(); void displayElevationMetatiles();
void displayMapObjects(); void displayMapEvents();
void displayMapConnections(); void displayMapConnections();
void displayMapBorder(); void displayMapBorder();
void displayMapGrid(); void displayMapGrid();
@ -58,13 +58,13 @@ public:
void updateEmergeMap(QString mapName); void updateEmergeMap(QString mapName);
void setSelectedConnectionFromMap(QString mapName); void setSelectedConnectionFromMap(QString mapName);
DraggablePixmapItem *addMapObject(Event *event); DraggablePixmapItem *addMapEvent(Event *event);
void selectMapObject(DraggablePixmapItem *object); void selectMapEvent(DraggablePixmapItem *object);
void selectMapObject(DraggablePixmapItem *object, bool toggle); void selectMapEvent(DraggablePixmapItem *object, bool toggle);
DraggablePixmapItem *addNewEvent(); DraggablePixmapItem *addNewEvent();
DraggablePixmapItem *addNewEvent(QString event_type); DraggablePixmapItem *addNewEvent(QString event_type);
void deleteEvent(Event *); void deleteEvent(Event *);
void updateSelectedObjects(); void updateSelectedEvents();
void redrawObject(DraggablePixmapItem *item); void redrawObject(DraggablePixmapItem *item);
QList<DraggablePixmapItem *> *getObjects(); QList<DraggablePixmapItem *> *getObjects();
@ -74,7 +74,7 @@ public:
ConnectionPixmapItem* selected_connection_item = NULL; ConnectionPixmapItem* selected_connection_item = NULL;
QList<ConnectionPixmapItem*> connection_edit_items; QList<ConnectionPixmapItem*> connection_edit_items;
CollisionPixmapItem *collision_item = NULL; CollisionPixmapItem *collision_item = NULL;
QGraphicsItemGroup *objects_group = NULL; QGraphicsItemGroup *events_group = NULL;
QList<QGraphicsPixmapItem*> borderItems; QList<QGraphicsPixmapItem*> borderItems;
QGraphicsScene *scene_metatiles = NULL; QGraphicsScene *scene_metatiles = NULL;
@ -161,7 +161,7 @@ public:
QList<Event*> objects; QList<Event*> objects;
objects.append(event); objects.append(event);
event->pixmap = QPixmap(); event->pixmap = QPixmap();
editor->project->loadObjectPixmaps(objects); editor->project->loadEventPixmaps(objects);
editor->redrawObject(this); editor->redrawObject(this);
emit spriteChanged(event->pixmap); emit spriteChanged(event->pixmap);
} }

View file

@ -509,7 +509,7 @@ void MainWindow::on_toolButton_newObject_clicked()
DraggablePixmapItem *object = editor->addNewEvent(); DraggablePixmapItem *object = editor->addNewEvent();
if (object) { if (object) {
//if (editor->selected_events->length()) { //if (editor->selected_events->length()) {
editor->selectMapObject(object, true); editor->selectMapEvent(object, true);
//} //}
} }
updateSelectedObjects(); updateSelectedObjects();
@ -526,7 +526,7 @@ void MainWindow::updateSelectedObjects() {
events = editor->selected_events; events = editor->selected_events;
} }
QMap<QString, int> map_obj_gfx_constants = editor->project->getMapObjGfxConstants(); QMap<QString, int> event_obj_gfx_constants = editor->project->getEventObjGfxConstants();
QList<ObjectPropertiesFrame *> frames; QList<ObjectPropertiesFrame *> frames;
@ -593,7 +593,7 @@ void MainWindow::updateSelectedObjects() {
if (event_type == "object") { if (event_type == "object") {
frame->ui->sprite->setVisible(true); 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")); frame->ui->comboBox_sprite->setCurrentText(item->event->get("sprite"));
connect(frame->ui->comboBox_sprite, SIGNAL(activated(QString)), item, SLOT(set_sprite(QString))); connect(frame->ui->comboBox_sprite, SIGNAL(activated(QString)), item, SLOT(set_sprite(QString)));

View file

@ -1207,13 +1207,13 @@ QStringList Project::getSongNames() {
return names; return names;
} }
QMap<QString, int> Project::getMapObjGfxConstants() { QMap<QString, int> Project::getEventObjGfxConstants() {
QMap<QString, int> constants; QMap<QString, int> constants;
QString text = readTextFile(root + "/include/constants/map_objects.h"); QString text = readTextFile(root + "/include/constants/event_objects.h");
if (!text.isNull()) { if (!text.isNull()) {
QStringList mapObjGfxPrefixes; QStringList eventObjGfxPrefixes;
mapObjGfxPrefixes << "MAP_OBJ_GFX_"; eventObjGfxPrefixes << "EVENT_OBJ_GFX_";
constants = readCDefines(text, mapObjGfxPrefixes); constants = readCDefines(text, eventObjGfxPrefixes);
} }
return constants; return constants;
} }
@ -1224,7 +1224,7 @@ QString Project::fixGraphicPath(QString path) {
return path; return path;
} }
void Project::loadObjectPixmaps(QList<Event*> objects) { void Project::loadEventPixmaps(QList<Event*> objects) {
bool needs_update = false; bool needs_update = false;
for (Event *object : objects) { for (Event *object : objects) {
if (object->pixmap.isNull()) { if (object->pixmap.isNull()) {
@ -1236,14 +1236,14 @@ void Project::loadObjectPixmaps(QList<Event*> objects) {
return; return;
} }
QMap<QString, int> constants = getMapObjGfxConstants(); QMap<QString, int> constants = getEventObjGfxConstants();
QString pointers_text = readTextFile(root + "/src/data/field_map_obj/map_object_graphics_info_pointers.h"); QString pointers_text = readTextFile(root + "/src/data/field_event_obj/event_object_graphics_info_pointers.h");
QString info_text = readTextFile(root + "/src/data/field_map_obj/map_object_graphics_info.h"); QString info_text = readTextFile(root + "/src/data/field_event_obj/event_object_graphics_info.h");
QString pic_text = readTextFile(root + "/src/data/field_map_obj/map_object_pic_tables.h"); QString pic_text = readTextFile(root + "/src/data/field_event_obj/event_object_pic_tables.h");
QString assets_text = readTextFile(root + "/src/event_object_movement.c"); 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) { for (Event *object : objects) {
if (!object->pixmap.isNull()) { if (!object->pixmap.isNull()) {

View file

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