Merge pull request #48 from huderlem/fixpath
'Map Object' -> 'Event Object'
This commit is contained in:
commit
ddb832de0c
5 changed files with 57 additions and 57 deletions
66
editor.cpp
66
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<Event *> 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<DraggablePixmapItem *> *Editor::getObjects() {
|
||||
QList<DraggablePixmapItem *> *list = new QList<DraggablePixmapItem *>;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
14
editor.h
14
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<DraggablePixmapItem *> *getObjects();
|
||||
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
ConnectionPixmapItem* selected_connection_item = NULL;
|
||||
QList<ConnectionPixmapItem*> connection_edit_items;
|
||||
CollisionPixmapItem *collision_item = NULL;
|
||||
QGraphicsItemGroup *objects_group = NULL;
|
||||
QGraphicsItemGroup *events_group = NULL;
|
||||
QList<QGraphicsPixmapItem*> borderItems;
|
||||
|
||||
QGraphicsScene *scene_metatiles = NULL;
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
QList<Event*> objects;
|
||||
objects.append(event);
|
||||
event->pixmap = QPixmap();
|
||||
editor->project->loadObjectPixmaps(objects);
|
||||
editor->project->loadEventPixmaps(objects);
|
||||
editor->redrawObject(this);
|
||||
emit spriteChanged(event->pixmap);
|
||||
}
|
||||
|
|
|
@ -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<QString, int> map_obj_gfx_constants = editor->project->getMapObjGfxConstants();
|
||||
QMap<QString, int> event_obj_gfx_constants = editor->project->getEventObjGfxConstants();
|
||||
|
||||
QList<ObjectPropertiesFrame *> 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)));
|
||||
|
||||
|
|
24
project.cpp
24
project.cpp
|
@ -1207,13 +1207,13 @@ QStringList Project::getSongNames() {
|
|||
return names;
|
||||
}
|
||||
|
||||
QMap<QString, int> Project::getMapObjGfxConstants() {
|
||||
QMap<QString, int> Project::getEventObjGfxConstants() {
|
||||
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()) {
|
||||
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<Event*> objects) {
|
||||
void Project::loadEventPixmaps(QList<Event*> objects) {
|
||||
bool needs_update = false;
|
||||
for (Event *object : objects) {
|
||||
if (object->pixmap.isNull()) {
|
||||
|
@ -1236,14 +1236,14 @@ void Project::loadObjectPixmaps(QList<Event*> objects) {
|
|||
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 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()) {
|
||||
|
|
|
@ -81,8 +81,8 @@ public:
|
|||
void readFlagNames();
|
||||
void readVarNames();
|
||||
|
||||
void loadObjectPixmaps(QList<Event*> objects);
|
||||
QMap<QString, int> getMapObjGfxConstants();
|
||||
void loadEventPixmaps(QList<Event*> objects);
|
||||
QMap<QString, int> getEventObjGfxConstants();
|
||||
QString fixGraphicPath(QString path);
|
||||
|
||||
void readMapEvents(Map *map);
|
||||
|
|
Loading…
Reference in a new issue