diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2008-11-08 06:15:08 +0000 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2008-11-08 06:15:08 +0000 |
commit | 8bad37e82371bd41864903ac0d6f49808ad119bf (patch) | |
tree | 77f0cb46059654cefb357d6eb4064c5740edf3d4 /sigmodr | |
parent | c127c0dae65a7600e0ab30b634f25d4915c61d16 (diff) | |
download | sigen-8bad37e82371bd41864903ac0d6f49808ad119bf.tar.gz sigen-8bad37e82371bd41864903ac0d6f49808ad119bf.tar.xz sigen-8bad37e82371bd41864903ac0d6f49808ad119bf.zip |
[FIX] No more asserts in sigmod
[FIX] Moved to using *ById instead of *Index methods in sigmod
[FIX] Tilemaps are now collaged (not completely done on the editing side yet)
[FIX] Removed the resource files (drawn natively instead)
[FIX] ATBTimer now uses the built-in QTimer in a QObject
[FIX] Coordinates are now edited on the map for warps, trainers, and effects
[FIX] Tiles are now completely scripted
[FIX] Config is now thread-safe
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@308 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'sigmodr')
50 files changed, 1100 insertions, 899 deletions
diff --git a/sigmodr/CMakeLists.txt b/sigmodr/CMakeLists.txt index 558c6916..626ad0ea 100644 --- a/sigmodr/CMakeLists.txt +++ b/sigmodr/CMakeLists.txt @@ -9,10 +9,6 @@ INCLUDE_DIRECTORIES( ${PROJECT_BINARY_DIR} ) -SET(sigmodr_RESOURCES - overlays/overlays.qrc -) -QT4_ADD_RESOURCES(sigmodr_RESOURCE_SRCS ${sigmodr_RESOURCES}) SET(sigmodr_FORMS gui/ability.ui gui/author.ui @@ -33,7 +29,6 @@ SET(sigmodr_FORMS gui/mapwildlistencounter.ui gui/move.ui gui/nature.ui - gui/point.ui gui/rules.ui gui/script.ui gui/sigmod.ui @@ -164,16 +159,20 @@ SET(sigmodr_MODEL_HEADERS models/WeatherModel.h ) SET(sigmodr_MAIN_HEADERS + EffectItem.h FractionWidget.h - PointWidget.h + MapEditor.h + MapScene.h ScriptWidget.h SigmodTree.h SigmodTreeModel.h SigmodrPreferences.h SigmodrUI.h - TilemapModel.h + TileItem.h + TrainerItem.h TypechartModel.h ValidationDialog.h + WarpItem.h ) SET(sigmodr_HEADERS ${sigmodr_WIDGET_HEADERS} @@ -290,17 +289,21 @@ SET(sigmodr_MODEL_SRCS models/WeatherModel.cpp ) SET(sigmodr_MAIN_SRCS + EffectItem.cpp FractionWidget.cpp - PointWidget.cpp + MapEditor.cpp + MapScene.cpp ScriptWidget.cpp SigmodTree.cpp SigmodTreeModel.cpp Sigmodr.cpp SigmodrPreferences.cpp SigmodrUI.cpp - TilemapModel.cpp + TileItem.cpp + TrainerItem.cpp TypechartModel.cpp ValidationDialog.cpp + WarpItem.cpp ) SET(sigmodr_SRCS ${sigmodr_WIDGET_SRCS} @@ -320,7 +323,6 @@ SET(sigmodr_DESKTOP_FILES KDE4_ADD_EXECUTABLE(sigmodr ${sigmodr_SRCS} ${sigmodr_UI_HEADERS} - ${sigmodr_RESOURCE_SRCS} ) SET_TARGET_PROPERTIES(sigmodr PROPERTIES diff --git a/sigmodr/EffectItem.cpp b/sigmodr/EffectItem.cpp new file mode 100644 index 00000000..9b6c3327 --- /dev/null +++ b/sigmodr/EffectItem.cpp @@ -0,0 +1,116 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Header include +#include "EffectItem.h" + +// Sigmod includes +#include "../sigmod/MapEffect.h" +#include "../sigmod/Sigmod.h" +#include "../sigmod/Sprite.h" + +// KDE includes +#include <KColorScheme> + +// Qt includes +#include <QtGui/QPainter> +#include <QtGui/QStyle> +#include <QtGui/QStyleOptionGraphicsItem> + +Sigmodr::EffectItem::EffectItem(Sigmod::MapEffect* effect, QObject* parent) : + QObject(parent), + m_effect(effect) +{ + connect(m_effect, SIGNAL(changed()), this, SLOT(effectChanged())); + effectChanged(); + setZValue(INT_MAX); + setAcceptHoverEvents(true); +} + +QRectF Sigmodr::EffectItem::boundingRect() const +{ + return m_pixmap.rect(); +} + +void Sigmodr::EffectItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) +{ + Q_UNUSED(widget) + if (!(flags() & QGraphicsItem::ItemIsSelectable)) + { + QPixmap temp(m_pixmap.size()); + temp.fill(Qt::transparent); + QPainter p; + p.begin(&temp); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + p.fillRect(temp.rect(), QColor(0, 0, 0, 127)); + p.end(); + painter->drawPixmap(0, 0, temp); + } + painter->drawPixmap(0, 0, m_pixmap); + if (option->state & QStyle::State_MouseOver) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::View, (flags() & QGraphicsItem::ItemIsSelectable) ? KColorScheme::ActiveText : KColorScheme::InactiveText).brush((flags() & QGraphicsItem::ItemIsSelectable) ? QPalette::Active : QPalette::Inactive), 1)); + painter->drawText(m_pixmap.rect(), Qt::AlignHCenter | Qt::AlignVCenter, m_effect->name()); + } + if (option->state & QStyle::State_HasFocus) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::FocusColor).brush(QPalette::Active), 6)); + painter->drawRect(m_pixmap.rect()); + } + else if (option->state & QStyle::State_Selected) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::ActiveBackground).brush(QPalette::Active), 6)); + painter->drawRect(m_pixmap.rect()); + } + else if ((option->state & QStyle::State_MouseOver) && (flags() & QGraphicsItem::ItemIsSelectable)) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::HoverColor).brush(QPalette::Active), 6)); + painter->drawRect(m_pixmap.rect()); + } +} + +void Sigmodr::EffectItem::changeSprite(const int spriteId) +{ + const Sigmod::Sprite* sprite = m_effect->sigmod()->spriteById(spriteId); + if (sprite) + m_pixmap.loadFromData(sprite->sprite()); + update(); +} + +void Sigmodr::EffectItem::mousePressEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mousePressEvent(event); + update(); +} + +void Sigmodr::EffectItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mouseMoveEvent(event); + m_effect->setCoordinate(scenePos().toPoint()); +} + +void Sigmodr::EffectItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mouseReleaseEvent(event); + update(); +} + +void Sigmodr::EffectItem::effectChanged() +{ + setPos(m_effect->coordinate()); + update(); +} diff --git a/sigmodr/EffectItem.h b/sigmodr/EffectItem.h new file mode 100644 index 00000000..b13ffda1 --- /dev/null +++ b/sigmodr/EffectItem.h @@ -0,0 +1,56 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SIGMODR_EFFECTITEM +#define SIGMODR_EFFECTITEM + +// Qt includes +#include <QtGui/QGraphicsItem> + +// Forward declarations +namespace Sigmod +{ +class MapEffect; +} + +namespace Sigmodr +{ +class EffectItem : public QObject, public QGraphicsItem +{ + Q_OBJECT + + public: + EffectItem(Sigmod::MapEffect* effect, QObject* parent); + + QRectF boundingRect() const; + + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); + public slots: + void changeSprite(const int spriteId); + protected: + void mousePressEvent(QGraphicsSceneMouseEvent* event); + void mouseMoveEvent(QGraphicsSceneMouseEvent* event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); + protected slots: + void effectChanged(); + private: + QPixmap m_pixmap; + Sigmod::MapEffect* m_effect; +}; +} + +#endif diff --git a/sigmodr/ItemUI.cpp b/sigmodr/ItemUI.cpp index 03788a16..76412886 100644 --- a/sigmodr/ItemUI.cpp +++ b/sigmodr/ItemUI.cpp @@ -60,9 +60,9 @@ void Sigmodr::ItemUI::setGui() varSellPrice->setValue(qobject_cast<Sigmod::Item*>(modified())->sellPrice()); if (resetWeight) { - const int itemTypeIndex = sigmod()->itemTypeIndex(qobject_cast<Sigmod::Item*>(modified())->type()); - if (itemTypeIndex != INT_MAX) - varWeight->setMaximum(sigmod()->itemType(itemTypeIndex)->maxWeight()); + const Sigmod::ItemType* itemType = sigmod()->itemTypeById(qobject_cast<Sigmod::Item*>(modified())->type()); + if (itemType) + varWeight->setMaximum(itemType->maxWeight()); } varWeight->setValue(qobject_cast<Sigmod::Item*>(modified())->weight()); varDescription->setText(qobject_cast<Sigmod::Item*>(modified())->description()); diff --git a/sigmodr/MapEditor.cpp b/sigmodr/MapEditor.cpp new file mode 100644 index 00000000..de168803 --- /dev/null +++ b/sigmodr/MapEditor.cpp @@ -0,0 +1,49 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Header include +#include "MapEditor.h" + +// Sigmodr includes +#include "MapScene.h" + +// Qt includes +#include <QtGui/QGraphicsView> +#include <QtGui/QGridLayout> + +Sigmodr::MapEditor::MapEditor(QWidget* parent) : + QWidget(parent) +{ + QGridLayout* layout = new QGridLayout; + + m_view = new QGraphicsView; + layout->addWidget(m_view, 0, 0, 2, 0); + + setLayout(layout); +} + +void Sigmodr::MapEditor::setMap(Sigmod::Map* map) +{ + m_map = map; + m_scene = new MapScene(map, this); + connect(m_scene, SIGNAL(changed()), this, SIGNAL(changed())); + m_view->setScene(m_scene); +} + +void Sigmodr::MapEditor::reset() +{ +} diff --git a/sigmodr/MapEditor.h b/sigmodr/MapEditor.h new file mode 100644 index 00000000..cf628f38 --- /dev/null +++ b/sigmodr/MapEditor.h @@ -0,0 +1,67 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SIGMODR_MAPEDITOR +#define SIGMODR_MAPEDITOR + +// Qt includes +#include <QtGui/QWidget> + +// Forward declarations +class KComboBox; +class KPushButton; +class QGraphicsView; + +namespace Sigmod +{ +class Map; +} + +namespace Sigmodr +{ +class MapScene; + +class MapEditor : public QWidget +{ + Q_OBJECT + + public: + MapEditor(QWidget* parent); + + void setMap(Sigmod::Map* map); + + void reset(); + signals: + void changed(); + private: + Sigmod::Map* m_map; + MapScene* m_scene; + + QGraphicsView* m_view; + + KPushButton* m_addTile; + KPushButton* m_removeTile; + KPushButton* m_moveUp; + KPushButton* m_moveDown; + KPushButton* m_moveToTop; + KPushButton* m_moveToBottom; + + KComboBox* m_types; +}; +} + +#endif diff --git a/sigmodr/MapEffectUI.cpp b/sigmodr/MapEffectUI.cpp index 87f79509..4708683a 100644 --- a/sigmodr/MapEffectUI.cpp +++ b/sigmodr/MapEffectUI.cpp @@ -20,7 +20,6 @@ // Sigmod includes #include "../sigmod/Item.h" -#include "../sigmod/Map.h" #include "../sigmod/MapEffect.h" #include "../sigmod/Sigmod.h" #include "../sigmod/Skin.h" @@ -38,8 +37,6 @@ Sigmodr::MapEffectUI::~MapEffectUI() void Sigmodr::MapEffectUI::refreshGui() { - const Sigmod::Map* map = qobject_cast<const Sigmod::Map*>(original()->parent()); - varCoordinate->setMaximum(QPoint(map->width(), map->height())); for (int i = 0; i < sigmod()->skinCount(); ++i) { const Sigmod::Skin* skin = sigmod()->skin(i); @@ -50,7 +47,6 @@ void Sigmodr::MapEffectUI::refreshGui() void Sigmodr::MapEffectUI::setGui() { varName->setText(qobject_cast<Sigmod::MapEffect*>(modified())->name()); - varCoordinate->setValue(qobject_cast<Sigmod::MapEffect*>(modified())->coordinate()); varSkin->setCurrentIndex(varSkin->findData(qobject_cast<Sigmod::MapEffect*>(modified())->skin())); varScript->setValue(qobject_cast<Sigmod::MapEffect*>(modified())->script()); varIsGhost->setChecked(qobject_cast<Sigmod::MapEffect*>(modified())->isGhost() ? Qt::Checked : Qt::Unchecked); @@ -76,11 +72,6 @@ void Sigmodr::MapEffectUI::on_varName_textChanged(const QString& name) varName->setCursorPosition(cursor); } -void Sigmodr::MapEffectUI::on_varCoordinate_valueChanged(const QPoint& coordinate) -{ - qobject_cast<Sigmod::MapEffect*>(modified())->setCoordinate(coordinate); -} - void Sigmodr::MapEffectUI::on_varSkin_currentIndexChanged(const int skin) { qobject_cast<Sigmod::MapEffect*>(modified())->setSkin(varSkin->itemData(skin).toInt()); diff --git a/sigmodr/MapEffectUI.h b/sigmodr/MapEffectUI.h index 15005ed9..8c8f2277 100644 --- a/sigmodr/MapEffectUI.h +++ b/sigmodr/MapEffectUI.h @@ -44,7 +44,6 @@ class MapEffectUI : public ObjectUI, private Ui::formMapEffect void discard(); protected slots: void on_varName_textChanged(const QString& name); - void on_varCoordinate_valueChanged(const QPoint& coordinate); void on_varSkin_currentIndexChanged(const int skin); void on_varScript_valueChanged(const Sigcore::Script& script); void on_varIsGhost_clicked(const bool isGhost); diff --git a/sigmodr/MapScene.cpp b/sigmodr/MapScene.cpp new file mode 100644 index 00000000..45a96dd7 --- /dev/null +++ b/sigmodr/MapScene.cpp @@ -0,0 +1,115 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Header include +#include "MapScene.h" + +// Sigmodr includes +#include "EffectItem.h" +#include "TileItem.h" +#include "TrainerItem.h" +#include "WarpItem.h" + +// Sigmod includes +#include "../sigmod/Map.h" +#include "../sigmod/MapEffect.h" +#include "../sigmod/MapTile.h" +#include "../sigmod/MapTrainer.h" +#include "../sigmod/MapWarp.h" + +Sigmodr::MapScene::MapScene(Sigmod::Map* map, QObject* parent) : + QGraphicsScene(parent), + m_map(map) +{ + connect(this, SIGNAL(changed(QList<QRectF>)), this, SIGNAL(changed())); + for (int i = 0; i < m_map->effectCount(); ++i) + addItem(new EffectItem(m_map->effect(i), this)); + for (int i = 0; i < m_map->tileCount(); ++i) + addItem(new TileItem(m_map->tile(i), this)); + for (int i = 0; i < m_map->trainerCount(); ++i) + addItem(new TrainerItem(m_map->trainer(i), this)); + for (int i = 0; i < m_map->warpCount(); ++i) + addItem(new WarpItem(m_map->warp(i), this)); + typeChanged("Warps"); +} + +void Sigmodr::MapScene::addTile(Sigmod::MapTile* tile) +{ + if (!tile) + tile = m_map->newTile(); + addItem(new TileItem(tile, this)); +} + +void Sigmodr::MapScene::removeTiles() +{ + QList<QGraphicsItem*> items = selectedItems(); + foreach (QGraphicsItem* item, items) + { + if (m_effects.key(static_cast<EffectItem*>(item))) + { + Sigmod::MapEffect* effect = m_effects.key(static_cast<EffectItem*>(item)); + m_map->deleteEffectById(effect->id()); + delete m_effects[effect]; + m_effects.remove(effect); + } + else if (m_tiles.key(static_cast<TileItem*>(item))) + { + Sigmod::MapTile* tile = m_tiles.key(static_cast<TileItem*>(item)); + m_map->deleteTileById(tile->id()); + delete m_tiles[tile]; + m_tiles.remove(tile); + } + else if (m_trainers.key(static_cast<TrainerItem*>(item))) + { + Sigmod::MapTrainer* trainer = m_trainers.key(static_cast<TrainerItem*>(item)); + m_map->deleteTrainerById(trainer->id()); + delete m_trainers[trainer]; + m_trainers.remove(trainer); + } + else if (m_warps.key(static_cast<WarpItem*>(item))) + { + Sigmod::MapWarp* warp = m_warps.key(static_cast<WarpItem*>(item)); + m_map->deleteWarpById(warp->id()); + delete m_warps[warp]; + m_warps.remove(warp); + } + } +} + +void Sigmodr::MapScene::typeChanged(const QString& type) +{ + QGraphicsItem::GraphicsItemFlags effectFlags = 0; + QGraphicsItem::GraphicsItemFlags tileFlags = 0; + QGraphicsItem::GraphicsItemFlags trainerFlags = 0; + QGraphicsItem::GraphicsItemFlags warpFlags = 0; + if (type == "Effects") + effectFlags = QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable; + else if (type == "Tiles") + tileFlags = QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable; + else if (type == "Trainers") + trainerFlags = QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable; + else if (type == "Warps") + warpFlags = QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable; + foreach (EffectItem* effect, m_effects) + effect->setFlags(effectFlags); + foreach (TileItem* tile, m_tiles) + tile->setFlags(tileFlags); + foreach (TrainerItem* trainer, m_trainers) + trainer->setFlags(trainerFlags); + foreach (WarpItem* warp, m_warps) + warp->setFlags(warpFlags); +} diff --git a/sigmodr/MapScene.h b/sigmodr/MapScene.h new file mode 100644 index 00000000..4d8a6204 --- /dev/null +++ b/sigmodr/MapScene.h @@ -0,0 +1,64 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SIGMODR_MAPSCENE +#define SIGMODR_MAPSCENE + +// Qt includes +#include <QtCore/QMap> +#include <QtGui/QGraphicsScene> + +// Forward declarations +namespace Sigmod +{ +class Map; +class MapEffect; +class MapTile; +class MapTrainer; +class MapWarp; +} + +namespace Sigmodr +{ +class EffectItem; +class TileItem; +class TrainerItem; +class WarpItem; + +class MapScene : public QGraphicsScene +{ + Q_OBJECT + + public: + MapScene(Sigmod::Map* map, QObject* parent); + public slots: + void addTile(Sigmod::MapTile* tile = NULL); + void removeTiles(); + + void typeChanged(const QString& type); + signals: + void changed(); + private: + Sigmod::Map* m_map; + QMap<Sigmod::MapEffect*, EffectItem*> m_effects; + QMap<Sigmod::MapTile*, TileItem*> m_tiles; + QMap<Sigmod::MapTrainer*, TrainerItem*> m_trainers; + QMap<Sigmod::MapWarp*, WarpItem*> m_warps; +}; +} + +#endif diff --git a/sigmodr/MapTrainerUI.cpp b/sigmodr/MapTrainerUI.cpp index e18e7900..73a79537 100644 --- a/sigmodr/MapTrainerUI.cpp +++ b/sigmodr/MapTrainerUI.cpp @@ -19,7 +19,6 @@ #include "MapTrainerUI.h" // Sigmod includes -#include "../sigmod/Map.h" #include "../sigmod/MapTrainer.h" #include "../sigmod/MapTrainerTeamMember.h" #include "../sigmod/Rules.h" @@ -48,8 +47,6 @@ void Sigmodr::MapTrainerUI::refreshGui() varTrainerClass->addItem(trainer->name(), trainer->id()); } varTrainerClass->blockSignals(blockedTrainerClass); - const Sigmod::Map* map = qobject_cast<const Sigmod::Map*>(original()->parent()); - varCoordinate->setMaximum(QPoint(map->width(), map->height())); varNumberFight->setMaximum(sigmod()->rules()->maxFight()); const bool blockedLeadTeamMember = varLeadTeamMember->blockSignals(true); varLeadTeamMember->clear(); @@ -67,7 +64,6 @@ void Sigmodr::MapTrainerUI::setGui() { varName->setText(qobject_cast<Sigmod::MapTrainer*>(modified())->name()); varTrainerClass->setCurrentIndex(varTrainerClass->findData(qobject_cast<Sigmod::MapTrainer*>(modified())->trainerClass())); - varCoordinate->setValue(qobject_cast<Sigmod::MapTrainer*>(modified())->coordinate()); varNumberFight->setValue(qobject_cast<Sigmod::MapTrainer*>(modified())->numberFight()); varScript->setValue(qobject_cast<Sigmod::MapTrainer*>(modified())->script()); varLeadTeamMember->setCurrentIndex(varLeadTeamMember->findData(qobject_cast<Sigmod::MapTrainer*>(modified())->leadTeamMember())); @@ -98,11 +94,6 @@ void Sigmodr::MapTrainerUI::on_varTrainerClass_activated(const int trainerClass) qobject_cast<Sigmod::MapTrainer*>(modified())->setTrainerClass(varTrainerClass->itemData(trainerClass).toInt()); } -void Sigmodr::MapTrainerUI::on_varCoordinate_valueChanged(const QPoint& coordinate) -{ - qobject_cast<Sigmod::MapTrainer*>(modified())->setCoordinate(coordinate); -} - void Sigmodr::MapTrainerUI::on_varNumberFight_valueChanged(const int numberFight) { qobject_cast<Sigmod::MapTrainer*>(modified())->setNumberFight(numberFight); diff --git a/sigmodr/MapTrainerUI.h b/sigmodr/MapTrainerUI.h index 30efd35b..c213a1a0 100644 --- a/sigmodr/MapTrainerUI.h +++ b/sigmodr/MapTrainerUI.h @@ -45,7 +45,6 @@ class MapTrainerUI : public ObjectUI, private Ui::formMapTrainer protected slots: void on_varName_textChanged(const QString& name); void on_varTrainerClass_activated(const int trainerClass); - void on_varCoordinate_valueChanged(const QPoint& coordinate); void on_varNumberFight_valueChanged(const int numberFight); void on_varScript_valueChanged(const Sigcore::Script& script); void on_varLeadTeamMember_activated(const int leadTeamMember); diff --git a/sigmodr/MapUI.cpp b/sigmodr/MapUI.cpp index a6b575e4..204f93a4 100644 --- a/sigmodr/MapUI.cpp +++ b/sigmodr/MapUI.cpp @@ -18,9 +18,6 @@ // Header include #include "MapUI.h" -// Sigmodr includes -#include "TilemapModel.h" - // Sigmod includes #include "../sigmod/Map.h" #include "../sigmod/MapWarp.h" @@ -28,14 +25,13 @@ #include "../sigmod/Sprite.h" #include "../sigmod/Tile.h" -// Qt includes -#include <QtGui/QHeaderView> - Sigmodr::MapUI::MapUI(Sigmod::Map* map, QWidget* parent) : ObjectUI(parent) { setupUi(this); setObjects(map, new Sigmod::Map(*map)); + varMap->setMap(map); + connect(varMap, SIGNAL(changed()), this, SIGNAL(changed())); } Sigmodr::MapUI::~MapUI() @@ -47,11 +43,6 @@ void Sigmodr::MapUI::initGui() varType->addItem(Sigmod::Map::TypeStr[Sigmod::Map::Outdoor], QVariant::fromValue(Sigmod::Map::Outdoor)); varType->addItem(Sigmod::Map::TypeStr[Sigmod::Map::Dungeon], QVariant::fromValue(Sigmod::Map::Dungeon)); varType->addItem(Sigmod::Map::TypeStr[Sigmod::Map::Building], QVariant::fromValue(Sigmod::Map::Building)); - varTilemap->horizontalHeader()->setResizeMode(QHeaderView::Fixed); - varTilemap->verticalHeader()->setResizeMode(QHeaderView::Fixed); - varTilemap->horizontalHeader()->setDefaultSectionSize(64); - varTilemap->verticalHeader()->setDefaultSectionSize(64); - varTilemap->setModel(new TilemapModel(qobject_cast<Sigmod::Map*>(modified())->map(), sigmod())); } void Sigmodr::MapUI::refreshGui() @@ -64,22 +55,6 @@ void Sigmodr::MapUI::refreshGui() varFlyWarp->addItem(warp->name(), warp->id()); } varFlyWarp->blockSignals(blockedFlyWarp); - const bool blockedTile = varTile->blockSignals(true); - varTile->clear(); - for (int i = 0; i < sigmod()->tileCount(); ++i) - { - const Sigmod::Tile* tile = sigmod()->tile(i); - if (sigmod()->spriteIndex(tile->sprite()) == INT_MAX) - varTile->addItem(tile->name(), tile->id()); - else - { - QPixmap icon; - icon.loadFromData(sigmod()->spriteById(tile->sprite())->sprite()); - varTile->addItem(icon, tile->name(), tile->id()); - } - } - varTile->blockSignals(blockedTile); - varTile->setEnabled(false); } void Sigmodr::MapUI::setGui() @@ -88,8 +63,7 @@ void Sigmodr::MapUI::setGui() boxFlyWarp->setChecked((qobject_cast<Sigmod::Map*>(modified())->flyWarp() == -1) ? Qt::Unchecked : Qt::Checked); varFlyWarp->setCurrentIndex(varFlyWarp->findData(qobject_cast<Sigmod::Map*>(modified())->flyWarp())); varType->setCurrentIndex(qobject_cast<Sigmod::Map*>(modified())->type()); - buttonDeleteColumn->setEnabled(0 < varTilemap->model()->columnCount()); - buttonDeleteRow->setEnabled(0 < varTilemap->model()->rowCount()); + varMap->reset(); } void Sigmodr::MapUI::apply() @@ -126,53 +100,3 @@ void Sigmodr::MapUI::on_varType_activated(const int type) { qobject_cast<Sigmod::Map*>(modified())->setType(varType->itemData(type).value<Sigmod::Map::Type>()); } - -void Sigmodr::MapUI::on_varTilemap_clicked(const QModelIndex& index) -{ - m_index = index; - varTile->setEnabled(true); - varTile->setCurrentIndex(varTile->findData(varTilemap->model()->data(m_index, Qt::EditRole))); -} - -void Sigmodr::MapUI::on_buttonAddColumn_pressed() -{ - varTilemap->model()->insertColumns(varTilemap->model()->columnCount(), 1); - emit(changed(true)); -} - -void Sigmodr::MapUI::on_buttonAddRow_pressed() -{ - varTilemap->model()->insertRows(varTilemap->model()->rowCount(), 1); - emit(changed(true)); -} - -void Sigmodr::MapUI::on_buttonDeleteColumn_pressed() -{ - varTilemap->model()->removeColumns(m_index.column(), 1); - emit(changed(true)); -} - -void Sigmodr::MapUI::on_buttonDeleteRow_pressed() -{ - varTilemap->model()->removeRows(m_index.row(), 1); - emit(changed(true)); -} - -void Sigmodr::MapUI::on_buttonInsertColumn_pressed() -{ - varTilemap->model()->insertColumns(m_index.column(), 1); - emit(changed(true)); -} - -void Sigmodr::MapUI::on_buttonInsertRow_pressed() -{ - varTilemap->model()->insertRows(m_index.row(), 1); - emit(changed(true)); -} - -void Sigmodr::MapUI::on_varTile_activated(const int tile) -{ - varTilemap->model()->setData(m_index, varTile->itemData(tile), Qt::EditRole); - emit(changed(true)); - setGui(); -} diff --git a/sigmodr/MapUI.h b/sigmodr/MapUI.h index d57ae934..3ac48bf9 100644 --- a/sigmodr/MapUI.h +++ b/sigmodr/MapUI.h @@ -49,16 +49,6 @@ class MapUI : public ObjectUI, private Ui::formMap void on_boxFlyWarp_toggled(); void on_varFlyWarp_activated(const int flyWarp); void on_varType_activated(const int type); - void on_varTilemap_clicked(const QModelIndex& index); - void on_buttonAddColumn_pressed(); - void on_buttonAddRow_pressed(); - void on_buttonDeleteColumn_pressed(); - void on_buttonDeleteRow_pressed(); - void on_buttonInsertColumn_pressed(); - void on_buttonInsertRow_pressed(); - void on_varTile_activated(const int tile); - private: - QModelIndex m_index; private slots: void initGui(); void refreshGui(); diff --git a/sigmodr/MapWarpUI.cpp b/sigmodr/MapWarpUI.cpp index 304467b2..ffb054b5 100644 --- a/sigmodr/MapWarpUI.cpp +++ b/sigmodr/MapWarpUI.cpp @@ -45,8 +45,6 @@ void Sigmodr::MapWarpUI::initGui() void Sigmodr::MapWarpUI::refreshGui() { - const Sigmod::Map* map = qobject_cast<const Sigmod::Map*>(original()->parent()); - varCoordinate->setMaximum(QPoint(map->width(), map->height())); const bool blocked = varToMap->blockSignals(true); varToMap->clear(); for (int i = 0; i < sigmod()->mapCount(); ++i) @@ -61,7 +59,6 @@ void Sigmodr::MapWarpUI::setGui() { const bool resetWarps = (qobject_cast<Sigmod::MapWarp*>(modified())->toMap() != m_lastMap); varName->setText(qobject_cast<Sigmod::MapWarp*>(modified())->name()); - varCoordinate->setValue(qobject_cast<Sigmod::MapWarp*>(modified())->coordinate()); varType->setCurrentIndex(qobject_cast<Sigmod::MapWarp*>(modified())->type()); varToMap->setCurrentIndex(varToMap->findData(qobject_cast<Sigmod::MapWarp*>(modified())->toMap())); m_lastMap = qobject_cast<Sigmod::MapWarp*>(modified())->toMap(); @@ -104,11 +101,6 @@ void Sigmodr::MapWarpUI::on_varName_textChanged(const QString& name) varName->setCursorPosition(cursor); } -void Sigmodr::MapWarpUI::on_varCoordinate_valueChanged(const QPoint& coordinate) -{ - qobject_cast<Sigmod::MapWarp*>(modified())->setCoordinate(coordinate); -} - void Sigmodr::MapWarpUI::on_varType_activated(const int type) { qobject_cast<Sigmod::MapWarp*>(modified())->setType(varType->itemData(type).value<Sigmod::MapWarp::Type>()); diff --git a/sigmodr/MapWarpUI.h b/sigmodr/MapWarpUI.h index 5a065c69..eb8582d2 100644 --- a/sigmodr/MapWarpUI.h +++ b/sigmodr/MapWarpUI.h @@ -44,7 +44,6 @@ class MapWarpUI : public ObjectUI, private Ui::formMapWarp void discard(); protected slots: void on_varName_textChanged(const QString& name); - void on_varCoordinate_valueChanged(const QPoint& coordinate); void on_varType_activated(const int type); void on_varToMap_activated(const int toMap); void on_varToWarp_activated(const int toWarp); diff --git a/sigmodr/ObjectUI.cpp b/sigmodr/ObjectUI.cpp index e9559921..a7743bb8 100644 --- a/sigmodr/ObjectUI.cpp +++ b/sigmodr/ObjectUI.cpp @@ -61,7 +61,7 @@ bool Sigmodr::ObjectUI::isChanged() const const Sigmod::Sigmod* Sigmodr::ObjectUI::sigmod() const { - return qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod()); + return m_object->sigmod(); } const Sigmod::Sigmod::Object* Sigmodr::ObjectUI::original() const diff --git a/sigmodr/PointWidget.cpp b/sigmodr/PointWidget.cpp deleted file mode 100644 index 9153160d..00000000 --- a/sigmodr/PointWidget.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -// Header include -#include "PointWidget.h" - -Sigmodr::PointWidget::PointWidget(QWidget* parent, const QPoint& value) : - QWidget(parent), - m_value(value) -{ - setupUi(this); -} - -QPoint Sigmodr::PointWidget::value() const -{ - return m_value; -} - -void Sigmodr::PointWidget::setValue(const QPoint& value) -{ - if (m_value == value) - return; - m_value = value; - varX->setValue(m_value.x()); - varY->setValue(m_value.y()); - emit(valueChanged(m_value)); -} - -void Sigmodr::PointWidget::setMaximum(const QPoint& maximum) -{ - varX->setMaximum(maximum.x()); - varY->setMaximum(maximum.y()); -} - -void Sigmodr::PointWidget::on_varX_valueChanged(const int x) -{ - m_value.setX(x); - emit(valueChanged(m_value)); -} - -void Sigmodr::PointWidget::on_varY_valueChanged(const int y) -{ - m_value.setY(y); - emit(valueChanged(m_value)); -} diff --git a/sigmodr/SigmodTree.cpp b/sigmodr/SigmodTree.cpp index cdcb548b..9437a0e6 100644 --- a/sigmodr/SigmodTree.cpp +++ b/sigmodr/SigmodTree.cpp @@ -69,7 +69,7 @@ const Sigmod::Sigmod* Sigmodr::SigmodTree::currentSigmod() const { const Sigmod::Object* object = static_cast<BaseModel*>(index.internalPointer())->object(); if (object) - return qobject_cast<const Sigmod::Sigmod*>(object->sigmod()); + return object->sigmod(); } return NULL; } @@ -152,9 +152,7 @@ bool Sigmodr::SigmodTree::dirty() const void Sigmodr::SigmodTree::setDirty(const Sigmod::Sigmod* sigmod, const bool dirty) { if (m_sigmods.contains(sigmod)) - { m_sigmods[sigmod].second = dirty; - } } void Sigmodr::SigmodTree::setDirty() diff --git a/sigmodr/SigmodUI.cpp b/sigmodr/SigmodUI.cpp index 8128707a..0ff3388f 100644 --- a/sigmodr/SigmodUI.cpp +++ b/sigmodr/SigmodUI.cpp @@ -75,10 +75,9 @@ void Sigmodr::SigmodUI::setGui() { const bool blocked = varWarp->blockSignals(true); varWarp->clear(); - const int mapIndex = qobject_cast<Sigmod::Sigmod*>(original())->mapIndex(qobject_cast<Sigmod::Sigmod*>(modified())->startMap()); - if (mapIndex != INT_MAX) + const Sigmod::Map* map = qobject_cast<Sigmod::Sigmod*>(original())->mapById(qobject_cast<Sigmod::Sigmod*>(modified())->startMap()); + if (map) { - const Sigmod::Map* map = qobject_cast<Sigmod::Sigmod*>(original())->map(mapIndex); for (int i = 0; i < map->warpCount(); ++i) { const Sigmod::MapWarp* warp = map->warp(i); diff --git a/sigmodr/SigmodrUI.cpp b/sigmodr/SigmodrUI.cpp index 5505c45e..6e7c2923 100644 --- a/sigmodr/SigmodrUI.cpp +++ b/sigmodr/SigmodrUI.cpp @@ -152,7 +152,7 @@ void Sigmodr::SigmodrUI::setChangedTitle(const bool changed) void Sigmodr::SigmodrUI::setDirty(const bool dirty) { - const Sigmod::Sigmod* sigmod = qobject_cast<const Sigmod::Sigmod*>(static_cast<Sigmod::Object*>(treeSigmod->currentIndex().internalPointer())->sigmod()); + const Sigmod::Sigmod* sigmod = static_cast<Sigmod::Object*>(treeSigmod->currentIndex().internalPointer())->sigmod(); treeSigmod->setDirty(sigmod, dirty); setChangedTitle(dirty); actionCollection()->action("file_save")->setEnabled(dirty); diff --git a/sigmodr/TileItem.cpp b/sigmodr/TileItem.cpp new file mode 100644 index 00000000..e97c09d7 --- /dev/null +++ b/sigmodr/TileItem.cpp @@ -0,0 +1,121 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Header include +#include "TileItem.h" + +// Sigmod includes +#include "../sigmod/MapTile.h" +#include "../sigmod/Sigmod.h" +#include "../sigmod/Sprite.h" +#include "../sigmod/Tile.h" + +// KDE includes +#include <KColorScheme> + +// Qt includes +#include <QtGui/QPainter> +#include <QtGui/QStyle> +#include <QtGui/QStyleOptionGraphicsItem> + +Sigmodr::TileItem::TileItem(Sigmod::MapTile* tile, QObject* parent) : + QObject(parent), + m_tile(tile) +{ + connect(m_tile, SIGNAL(changed()), this, SLOT(tileChanged())); + tileChanged(); + setAcceptHoverEvents(true); +} + +QRectF Sigmodr::TileItem::boundingRect() const +{ + return m_pixmap.rect(); +} + +void Sigmodr::TileItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) +{ + Q_UNUSED(widget) + if (m_pixmap.isNull()) + return; + if (!(flags() & QGraphicsItem::ItemIsSelectable)) + { + QPixmap temp(m_pixmap.size()); + temp.fill(Qt::transparent); + QPainter p; + p.begin(&temp); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + p.fillRect(temp.rect(), QColor(0, 0, 0, 127)); + p.end(); + painter->drawPixmap(0, 0, temp); + } + painter->drawPixmap(0, 0, m_pixmap); + if (option->state & QStyle::State_HasFocus) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::FocusColor).brush(QPalette::Active), 6)); + painter->drawRect(m_pixmap.rect()); + } + else if (option->state & QStyle::State_Selected) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::ActiveBackground).brush(QPalette::Active), 6)); + painter->drawRect(m_pixmap.rect()); + } + else if ((option->state & QStyle::State_MouseOver) && (flags() & QGraphicsItem::ItemIsSelectable)) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::HoverColor).brush(QPalette::Active), 6)); + painter->drawRect(m_pixmap.rect()); + } +} + +void Sigmodr::TileItem::setZIndex(const int zIndex) +{ + if (zIndex < INT_MAX) + m_tile->setZIndex(zIndex); +} + +void Sigmodr::TileItem::changeSprite(const int spriteId) +{ + const Sigmod::Sprite* sprite = m_tile->sigmod()->spriteById(spriteId); + if (sprite) + m_pixmap.loadFromData(sprite->sprite()); + update(); +} + +void Sigmodr::TileItem::mousePressEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mousePressEvent(event); + update(); +} + +void Sigmodr::TileItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mouseMoveEvent(event); + m_tile->setPosition(scenePos().toPoint()); +} + +void Sigmodr::TileItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mouseReleaseEvent(event); + update(); +} + +void Sigmodr::TileItem::tileChanged() +{ + m_tileInfo = m_tile->sigmod()->tileById(m_tile->tile()); + setPos(m_tile->position()); + setZValue(m_tile->zIndex()); + update(); +} diff --git a/sigmodr/TileItem.h b/sigmodr/TileItem.h new file mode 100644 index 00000000..5cf3f35f --- /dev/null +++ b/sigmodr/TileItem.h @@ -0,0 +1,60 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SIGMODR_TILEITEM +#define SIGMODR_TILEITEM + +// Qt includes +#include <QtGui/QGraphicsItem> + +// Forward declarations +namespace Sigmod +{ +class MapTile; +class Tile; +} + +namespace Sigmodr +{ +class TileItem : public QObject, public QGraphicsItem +{ + Q_OBJECT + + public: + TileItem(Sigmod::MapTile* tile, QObject* parent); + + QRectF boundingRect() const; + + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); + + void setZIndex(const int zIndex); + public slots: + void changeSprite(const int spriteId); + protected: + void mousePressEvent(QGraphicsSceneMouseEvent* event); + void mouseMoveEvent(QGraphicsSceneMouseEvent* event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); + protected slots: + void tileChanged(); + private: + QPixmap m_pixmap; + Sigmod::MapTile* m_tile; + const Sigmod::Tile* m_tileInfo; +}; +} + +#endif diff --git a/sigmodr/TileUI.cpp b/sigmodr/TileUI.cpp index efa428e3..1c3410c2 100644 --- a/sigmodr/TileUI.cpp +++ b/sigmodr/TileUI.cpp @@ -34,45 +34,9 @@ Sigmodr::TileUI::~TileUI() { } -void Sigmodr::TileUI::initGui() -{ - QListWidgetItem* item; - item = new QListWidgetItem(Sigmod::DirectionStr[Sigmod::D_Up], varAccessibility); - item->setData(Qt::UserRole, QVariant::fromValue(Sigmod::D_Up)); - item = new QListWidgetItem(Sigmod::DirectionStr[Sigmod::D_Down], varAccessibility); - item->setData(Qt::UserRole, QVariant::fromValue(Sigmod::D_Down)); - item = new QListWidgetItem(Sigmod::DirectionStr[Sigmod::D_Left], varAccessibility); - item->setData(Qt::UserRole, QVariant::fromValue(Sigmod::D_Left)); - item = new QListWidgetItem(Sigmod::DirectionStr[Sigmod::D_Right], varAccessibility); - item->setData(Qt::UserRole, QVariant::fromValue(Sigmod::D_Right)); -} - -void Sigmodr::TileUI::refreshGui() -{ - int maxHeight = 0; - int maxWidth = 0; - const bool blocked = varSprite->blockSignals(true); - varSprite->clear(); - for (int i = 0; i < sigmod()->spriteCount(); ++i) - { - const Sigmod::Sprite* sprite = sigmod()->sprite(i); - QPixmap icon; - icon.loadFromData(sprite->sprite()); - maxHeight = qMax(maxHeight, icon.height()); - maxWidth = qMax(maxWidth, icon.width()); - varSprite->addItem(icon, sprite->name(), sprite->id()); - } - varSprite->blockSignals(blocked); - const QSize maxSize(maxWidth, maxHeight); - varSprite->setIconSize(maxSize); -} - void Sigmodr::TileUI::setGui() { varName->setText(qobject_cast<Sigmod::Tile*>(modified())->name()); - varSprite->setCurrentIndex(varSprite->findData(qobject_cast<Sigmod::Tile*>(modified())->sprite())); - for (int i = 0; i < varAccessibility->count(); ++i) - varAccessibility->item(i)->setSelected(qobject_cast<Sigmod::Tile*>(modified())->from(QVariant(i).value<Sigmod::Direction>())); varScript->setValue(qobject_cast<Sigmod::Tile*>(modified())->script()); } @@ -96,16 +60,6 @@ void Sigmodr::TileUI::on_varName_textChanged(const QString& name) varName->setCursorPosition(cursor); } -void Sigmodr::TileUI::on_varSprite_currentIndexChanged(const int sprite) -{ - qobject_cast<Sigmod::Tile*>(modified())->setSprite(varSprite->itemData(sprite).toInt()); -} - -void Sigmodr::TileUI::on_varAccessibility_itemClicked(QListWidgetItem* item) -{ - qobject_cast<Sigmod::Tile*>(modified())->setFrom(item->data(Qt::UserRole).value<Sigmod::Direction>(), item->isSelected()); -} - void Sigmodr::TileUI::on_varScript_valueChanged(const Sigcore::Script& script) { qobject_cast<Sigmod::Tile*>(modified())->setScript(script); diff --git a/sigmodr/TileUI.h b/sigmodr/TileUI.h index b387f89c..d72d4d28 100644 --- a/sigmodr/TileUI.h +++ b/sigmodr/TileUI.h @@ -44,12 +44,8 @@ class TileUI : public ObjectUI, private Ui::formTile void discard(); protected slots: void on_varName_textChanged(const QString& name); - void on_varSprite_currentIndexChanged(const int sprite); - void on_varAccessibility_itemClicked(QListWidgetItem* item); void on_varScript_valueChanged(const Sigcore::Script& script); private slots: - void initGui(); - void refreshGui(); void setGui(); }; } diff --git a/sigmodr/TilemapModel.cpp b/sigmodr/TilemapModel.cpp deleted file mode 100644 index 093b2389..00000000 --- a/sigmodr/TilemapModel.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -// Header include -#include "TilemapModel.h" - -// Sigmod includes -#include "../sigmod/Sigmod.h" -#include "../sigmod/Sprite.h" -#include "../sigmod/Tile.h" - -// Qt includes -#include <QtGui/QPixmap> - -Sigmodr::TilemapModel::TilemapModel(Sigcore::Matrix<int>* tilemap, const Sigmod::Sigmod* sigmod) : - QAbstractTableModel(), - m_tilemap(*tilemap), - m_sigmod(sigmod) -{ -} - -QVariant Sigmodr::TilemapModel::data(const QModelIndex& index, int role) const -{ - if (!index.isValid()) - return QVariant(); - if (role == Qt::DisplayRole) - { - const int tileIndex = m_sigmod->tileIndex(m_tilemap(index.row(), index.column())); - if (tileIndex != INT_MAX) - { - const Sigmod::Tile* tile = m_sigmod->tile(tileIndex); - if (m_sigmod->spriteIndex(tile->sprite()) == INT_MAX) - return QPixmap(); - else - { - QPixmap icon; - icon.loadFromData(m_sigmod->spriteById(tile->sprite())->sprite()); - return icon; - } - } - } - else if (role == Qt::EditRole) - return m_tilemap(index.row(), index.column()); - return QVariant(); -} - -QVariant Sigmodr::TilemapModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - Q_UNUSED(orientation) - if (role == Qt::DisplayRole) - return section; - return QVariant(); -} - -int Sigmodr::TilemapModel::rowCount(const QModelIndex& parent) const -{ - Q_UNUSED(parent) - return m_tilemap.height(); -} - -int Sigmodr::TilemapModel::columnCount(const QModelIndex& parent) const -{ - Q_UNUSED(parent) - return m_tilemap.width(); -} - -bool Sigmodr::TilemapModel::insertRows(int row, int count, const QModelIndex& parent) -{ - emit(beginInsertRows(parent, row, row + count - 1)); - for (int i = 0; i < count; ++i) - m_tilemap.insertRow(row); - emit(endInsertRows()); - if (m_tilemap.height() == 1) - reset(); - return true; -} - -bool Sigmodr::TilemapModel::insertColumns(int column, int count, const QModelIndex& parent) -{ - emit(beginInsertColumns(parent, column, column + count - 1)); - for (int i = 0; i < count; ++i) - m_tilemap.insertColumn(column); - emit(endInsertColumns()); - if (m_tilemap.width() == 1) - reset(); - return true; -} - -bool Sigmodr::TilemapModel::removeRows(int row, int count, const QModelIndex& parent) -{ - emit(beginRemoveRows(parent, row, row + count - 1)); - for (int i = 0; i < count; ++i) - m_tilemap.deleteRow(row); - emit(endRemoveRows()); - if (!m_tilemap.height()) - reset(); - return true; -} - -bool Sigmodr::TilemapModel::removeColumns(int column, int count, const QModelIndex& parent) -{ - emit(beginRemoveColumns(parent, column, column + count - 1)); - for (int i = 0; i < count; ++i) - m_tilemap.deleteColumn(column); - emit(endRemoveColumns()); - if (!m_tilemap.width()) - reset(); - return true; -} - -Qt::ItemFlags Sigmodr::TilemapModel::flags(const QModelIndex& index) const -{ - if (!index.isValid()) - return 0; - return Qt::ItemIsEnabled | Qt::ItemIsSelectable; -} - -bool Sigmodr::TilemapModel::setData(const QModelIndex& index, const QVariant& value, int role) -{ - if (!index.isValid()) - return false; - if (role == Qt::EditRole) - { - m_tilemap(index.row(), index.column()) = value.toInt(); - emit(dataChanged(index, index)); - return true; - } - return false; -} diff --git a/sigmodr/TilemapModel.h b/sigmodr/TilemapModel.h deleted file mode 100644 index a63a43da..00000000 --- a/sigmodr/TilemapModel.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef SIGMODR_TILEMAPMODEL -#define SIGMODR_TILEMAPMODEL - -// Sigcore includes -#include "../sigcore/Matrix.h" - -// Qt includes -#include <QtCore/QAbstractTableModel> -#include <QtCore/QVariant> - -// Forward declarations -namespace Sigmod -{ -class Sigmod; -} - -namespace Sigmodr -{ -class TilemapModel : public QAbstractTableModel -{ - Q_OBJECT - - public: - TilemapModel(Sigcore::Matrix<int>* tilemap, const Sigmod::Sigmod* sigmod); - - QVariant data(const QModelIndex& index, int role) const; - QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; - - int rowCount(const QModelIndex& parent) const; - int columnCount(const QModelIndex& parent) const; - - bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()); - bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex()); - bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()); - bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex()); - - Qt::ItemFlags flags(const QModelIndex& index) const; - - bool setData(const QModelIndex& index, const QVariant& value, int role); - private: - Sigcore::Matrix<int>& m_tilemap; - const Sigmod::Sigmod* m_sigmod; -}; -} - -#endif diff --git a/sigmodr/TrainerItem.cpp b/sigmodr/TrainerItem.cpp new file mode 100644 index 00000000..b23856be --- /dev/null +++ b/sigmodr/TrainerItem.cpp @@ -0,0 +1,118 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Header include +#include "TrainerItem.h" + +// Sigmod includes +#include "../sigmod/MapTrainer.h" +#include "../sigmod/Sigmod.h" +#include "../sigmod/Sprite.h" + +// KDE includes +#include <KColorScheme> + +// Qt includes +#include <QtGui/QPainter> +#include <QtGui/QStyle> +#include <QtGui/QStyleOptionGraphicsItem> + +Sigmodr::TrainerItem::TrainerItem(Sigmod::MapTrainer* trainer, QObject* parent) : + QObject(parent), + m_trainer(trainer) +{ + connect(m_trainer, SIGNAL(changed()), this, SLOT(trainerChanged())); + trainerChanged(); + setZValue(INT_MAX); + setAcceptHoverEvents(true); +} + +QRectF Sigmodr::TrainerItem::boundingRect() const +{ + return m_pixmap.rect(); +} + +void Sigmodr::TrainerItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) +{ + Q_UNUSED(widget) + if (m_pixmap.isNull()) + return; + if (!(flags() & QGraphicsItem::ItemIsSelectable)) + { + QPixmap temp(m_pixmap.size()); + temp.fill(Qt::transparent); + QPainter p; + p.begin(&temp); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + p.fillRect(temp.rect(), QColor(0, 0, 0, 127)); + p.end(); + painter->drawPixmap(0, 0, temp); + } + painter->drawPixmap(0, 0, m_pixmap); + if (option->state & QStyle::State_MouseOver) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::View, (flags() & QGraphicsItem::ItemIsSelectable) ? KColorScheme::ActiveText : KColorScheme::InactiveText).brush((flags() & QGraphicsItem::ItemIsSelectable) ? QPalette::Active : QPalette::Inactive), 1)); + painter->drawText(m_pixmap.rect(), Qt::AlignHCenter | Qt::AlignVCenter, m_trainer->name()); + } + if (option->state & QStyle::State_HasFocus) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::FocusColor).brush(QPalette::Active), 6)); + painter->drawRect(m_pixmap.rect()); + } + else if (option->state & QStyle::State_Selected) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::ActiveBackground).brush(QPalette::Active), 6)); + painter->drawRect(m_pixmap.rect()); + } + else if ((option->state & QStyle::State_MouseOver) && (flags() & QGraphicsItem::ItemIsSelectable)) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::HoverColor).brush(QPalette::Active), 6)); + painter->drawRect(m_pixmap.rect()); + } +} + +void Sigmodr::TrainerItem::changeSprite(const int spriteId) +{ + const Sigmod::Sprite* sprite = m_trainer->sigmod()->spriteById(spriteId); + if (sprite) + m_pixmap.loadFromData(sprite->sprite()); + update(); +} + +void Sigmodr::TrainerItem::mousePressEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mousePressEvent(event); + update(); +} + +void Sigmodr::TrainerItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mouseMoveEvent(event); + m_trainer->setCoordinate(scenePos().toPoint()); +} + +void Sigmodr::TrainerItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mouseReleaseEvent(event); + update(); +} + +void Sigmodr::TrainerItem::trainerChanged() +{ + setPos(m_trainer->coordinate()); + update(); +} diff --git a/sigmodr/TrainerItem.h b/sigmodr/TrainerItem.h new file mode 100644 index 00000000..5733194b --- /dev/null +++ b/sigmodr/TrainerItem.h @@ -0,0 +1,56 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef SIGMODR_TRAINERITEM +#define SIGMODR_TRAINERITEM + +// Qt includes +#include <QtGui/QGraphicsItem> + +// Forward declarations +namespace Sigmod +{ +class MapTrainer; +} + +namespace Sigmodr +{ +class TrainerItem : public QObject, public QGraphicsItem +{ + Q_OBJECT + + public: + TrainerItem(Sigmod::MapTrainer* trainer, QObject* parent); + + QRectF boundingRect() const; + + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); + public slots: + void changeSprite(const int spriteId); + protected: + void mousePressEvent(QGraphicsSceneMouseEvent* event); + void mouseMoveEvent(QGraphicsSceneMouseEvent* event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); + protected slots: + void trainerChanged(); + private: + QPixmap m_pixmap; + Sigmod::MapTrainer* m_trainer; +}; +} + +#endif diff --git a/sigmodr/WarpItem.cpp b/sigmodr/WarpItem.cpp new file mode 100644 index 00000000..bf1f2385 --- /dev/null +++ b/sigmodr/WarpItem.cpp @@ -0,0 +1,123 @@ +/* + * Copyright 2008 Ben Boeckel <MathStuf@gmail.com> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +// Header include +#include "WarpItem.h" + +// Sigmod includes +#include "../sigmod/MapWarp.h" +#include "../sigmod/Sigmod.h" + +// KDE includes +#include <KColorScheme> + +// Qt includes +#include <QtGui/QGraphicsSceneMouseEvent> +#include <QtGui/QPainter> +#include <QtGui/QStyle> +#include <QtGui/QStyleOptionGraphicsItem> + +Sigmodr::WarpItem::WarpItem(Sigmod::MapWarp* warp, QObject* parent) : + QObject(parent), + m_warp(warp) +{ + connect(m_warp, SIGNAL(changed()), this, SLOT(warpChanged())); + warpChanged(); + setZValue(INT_MAX); + setAcceptHoverEvents(true); +} + +QRectF Sigmodr::WarpItem::boundingRect() const +{ + return m_warp->area(); +} + +void Sigmodr::WarpItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) +{ + Q_UNUSED(widget) + if (m_warp->area().size().isValid()) + return; + if (!(flags() & QGraphicsItem::ItemIsSelectable)) + { + QPixmap temp(m_warp->area().size()); + temp.fill(Qt::transparent); + QPainter p; + p.begin(&temp); + p.setCompositionMode(QPainter::CompositionMode_DestinationIn); + p.fillRect(temp.rect(), QColor(0, 0, 0, 127)); + p.end(); + painter->drawPixmap(0, 0, temp); + } + painter->setBrush(KStatefulBrush(KColorScheme::View, KColorScheme::ActiveBackground).brush(QPalette::Active)); + painter->drawRect(m_warp->area()); + if (option->state & QStyle::State_MouseOver) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::View, (flags() & QGraphicsItem::ItemIsSelectable) ? KColorScheme::ActiveText : KColorScheme::InactiveText).brush((flags() & QGraphicsItem::ItemIsSelectable) ? QPalette::Active : QPalette::Inactive), 1)); + painter->drawText(m_warp->area(), Qt::AlignHCenter | Qt::AlignVCenter, m_warp->name()); + } + if (option->state & QStyle::State_HasFocus) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::FocusColor).brush(QPalette::Active), 6)); + painter->drawRect(m_warp->area()); + } + else if (option->state & QStyle::State_Selected) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::ActiveBackground).brush(QPalette::Active), 6)); + painter->drawRect(m_warp->area()); + } + else if ((option->state & QStyle::State_MouseOver) && (flags() & QGraphicsItem::ItemIsSelectable)) + { + painter->setPen(QPen(KStatefulBrush(KColorScheme::Selection, KColorScheme::HoverColor).brush(QPalette::Active), 6)); + painter->drawRect(m_warp->area()); + } +} + +void Sigmodr::WarpItem::mousePressEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mousePressEvent(event); + update(); +} + +void Sigmodr::WarpItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event) +{ + if (event->modifiers() & Qt::ShiftModifier) + { + QRect rect = m_warp->area(); + QPointF diff = event->scenePos() - event->lastScenePos(); + rect.setSize(rect.size() + QSize(diff.x(), diff.y())); + m_warp->setArea(rect); + } + else + { + QGraphicsItem::mouseMoveEvent(event); + QRect rect = m_warp->area(); + rect.setTopLeft(scenePos().toPoint()); + m_warp->setArea(rect); + } +} + +void Sigmodr::WarpItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) +{ + QGraphicsItem::mouseReleaseEvent(event); + update(); +} + +void Sigmodr::WarpItem::warpChanged() +{ + setPos(m_warp->area().topLeft()); + update(); +} diff --git a/sigmodr/PointWidget.h b/sigmodr/WarpItem.h index be50d0d5..c9bf9eb2 100644 --- a/sigmodr/PointWidget.h +++ b/sigmodr/WarpItem.h @@ -15,36 +15,38 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SIGMODR_POINTWIDGET -#define SIGMODR_POINTWIDGET +#ifndef SIGMODR_WARPITEM +#define SIGMODR_WARPITEM // Qt includes -#include <QtCore/QPoint> -#include <QtGui/QWidget> +#include <QtGui/QGraphicsItem> -// Form include -#include "ui_point.h" +// Forward declarations +namespace Sigmod +{ +class MapWarp; +} namespace Sigmodr { -class PointWidget : public QWidget, private Ui::formPoint +class WarpItem : public QObject, public QGraphicsItem { Q_OBJECT public: - explicit PointWidget(QWidget* parent, const QPoint& value = QPoint(0, 0)); + WarpItem(Sigmod::MapWarp* warp, QObject* parent); + + QRectF boundingRect() const; - QPoint value() const; - public slots: - void setValue(const QPoint& value); - void setMaximum(const QPoint& maximum); - signals: - void valueChanged(const QPoint&); + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); + protected: + void mousePressEvent(QGraphicsSceneMouseEvent* event); + void mouseMoveEvent(QGraphicsSceneMouseEvent* event); + void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); protected slots: - void on_varX_valueChanged(const int x); - void on_varY_valueChanged(const int y); + void warpChanged(); private: - QPoint m_value; + Sigmod::MapWarp* m_warp; }; } diff --git a/sigmodr/gui/map.ui b/sigmodr/gui/map.ui index 4fe79161..1797e7aa 100644 --- a/sigmodr/gui/map.ui +++ b/sigmodr/gui/map.ui @@ -4,9 +4,6 @@ <layout class="QVBoxLayout" > <item> <widget class="QGroupBox" name="boxName" > - <property name="title" > - <string>Name</string> - </property> <property name="toolTip" > <string>Name of the map (internal use only)</string> </property> @@ -16,6 +13,9 @@ <property name="whatsThis" > <string>Name of the map (internal use only)</string> </property> + <property name="title" > + <string>Name</string> + </property> <layout class="QHBoxLayout" > <item> <widget class="KLineEdit" name="varName" > @@ -29,15 +29,6 @@ </item> <item> <widget class="QGroupBox" name="boxFlyWarp" > - <property name="title" > - <string>Fly Warp</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>false</bool> - </property> <property name="toolTip" > <string>The destination when flown to the map</string> </property> @@ -47,19 +38,24 @@ <property name="whatsThis" > <string>The destination when flown to the map</string> </property> + <property name="title" > + <string>Fly Warp</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>false</bool> + </property> <layout class="QHBoxLayout" > <item> - <widget class="KComboBox" name="varFlyWarp" > - </widget> + <widget class="KComboBox" name="varFlyWarp" /> </item> </layout> </widget> </item> <item> <widget class="QGroupBox" name="boxType" > - <property name="title" > - <string>Type</string> - </property> <property name="toolTip" > <string>They type of map</string> </property> @@ -69,6 +65,9 @@ <property name="whatsThis" > <string>They type of map</string> </property> + <property name="title" > + <string>Type</string> + </property> <layout class="QHBoxLayout" > <item> <widget class="KComboBox" name="varType" /> @@ -77,141 +76,13 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxTilemap" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Expanding" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <widget class="QGroupBox" name="boxMap" > <property name="title" > - <string>Tilemap</string> + <string>Map</string> </property> - <layout class="QGridLayout" > - <item rowspan="7" row="0" column="0" > - <widget class="QTableView" name="varTilemap" > - <property name="toolTip" > - <string>The tilemap of the map</string> - </property> - <property name="statusTip" > - <string>The tilemap of the map</string> - </property> - <property name="whatsThis" > - <string>The tilemap of the map</string> - </property> - <property name="selectionMode" > - <enum>QAbstractItemView::SingleSelection</enum> - </property> - </widget> - </item> - <item row="6" column="1" > - <widget class="KComboBox" name="varTile" > - <property name="toolTip" > - <string>The tile for the current position</string> - </property> - <property name="statusTip" > - <string>The tile for the current position</string> - </property> - <property name="whatsThis" > - <string>The tile for the current position</string> - </property> - </widget> - </item> - <item row="5" column="1" > - <widget class="KPushButton" name="buttonDeleteColumn" > - <property name="text" > - <string>Delete Column</string> - </property> - <property name="toolTip" > - <string>Delete the current column</string> - </property> - <property name="statusTip" > - <string>Delete the current column</string> - </property> - <property name="whatsThis" > - <string>Delete the current column</string> - </property> - </widget> - </item> - <item row="4" column="1" > - <widget class="KPushButton" name="buttonInsertColumn" > - <property name="text" > - <string>Insert Column</string> - </property> - <property name="toolTip" > - <string>Insert a new column at the current position</string> - </property> - <property name="statusTip" > - <string>Insert a new column at the current position</string> - </property> - <property name="whatsThis" > - <string>Insert a new column at the current position</string> - </property> - </widget> - </item> - <item row="3" column="1" > - <widget class="KPushButton" name="buttonAddColumn" > - <property name="text" > - <string>Add Column</string> - </property> - <property name="toolTip" > - <string>Add a new column</string> - </property> - <property name="statusTip" > - <string>Add a new column</string> - </property> - <property name="whatsThis" > - <string>Add a new column</string> - </property> - </widget> - </item> - <item row="2" column="1" > - <widget class="KPushButton" name="buttonDeleteRow" > - <property name="text" > - <string>Delete Row</string> - </property> - <property name="toolTip" > - <string>Delete the current row</string> - </property> - <property name="statusTip" > - <string>Delete the current row</string> - </property> - <property name="whatsThis" > - <string>Delete the current row</string> - </property> - </widget> - </item> - <item row="1" column="1" > - <widget class="KPushButton" name="buttonInsertRow" > - <property name="text" > - <string>Insert Row</string> - </property> - <property name="toolTip" > - <string>Insert a new row at the current position</string> - </property> - <property name="statusTip" > - <string>Insert a new row at the current position</string> - </property> - <property name="whatsThis" > - <string>Insert a new row at the current position</string> - </property> - </widget> - </item> - <item row="0" column="1" > - <widget class="KPushButton" name="buttonAddRow" > - <property name="text" > - <string>Add Row</string> - </property> - <property name="toolTip" > - <string>Add a new row</string> - </property> - <property name="statusTip" > - <string>Add a new row</string> - </property> - <property name="whatsThis" > - <string>Add a new row</string> - </property> - </widget> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <widget class="Sigmodr::MapEditor" name="varMap" /> </item> </layout> </widget> @@ -225,14 +96,20 @@ <header location="global" >KComboBox</header> </customwidget> <customwidget> + <class>KIntNumInput</class> + <extends>QWidget</extends> + <header location="global" >KIntNumInput</header> + </customwidget> + <customwidget> <class>KLineEdit</class> <extends>QLineEdit</extends> <header location="global" >KLineEdit</header> </customwidget> <customwidget> - <class>KPushButton</class> - <extends>QPushButton</extends> - <header location="global" >KPushButton</header> + <class>Sigmodr::MapEditor</class> + <extends>QWidget</extends> + <header>MapEditor.h</header> + <container>1</container> </customwidget> </customwidgets> <resources/> diff --git a/sigmodr/gui/mapeffect.ui b/sigmodr/gui/mapeffect.ui index 96efbab9..ec3ec03d 100644 --- a/sigmodr/gui/mapeffect.ui +++ b/sigmodr/gui/mapeffect.ui @@ -4,9 +4,6 @@ <layout class="QVBoxLayout" > <item> <widget class="QGroupBox" name="boxName" > - <property name="title" > - <string>Name</string> - </property> <property name="toolTip" > <string>Name of the effect</string> </property> @@ -16,6 +13,9 @@ <property name="whatsThis" > <string>Name of the effect</string> </property> + <property name="title" > + <string>Name</string> + </property> <layout class="QHBoxLayout" > <item> <widget class="KLineEdit" name="varName" > @@ -28,31 +28,7 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxCoordinate" > - <property name="title" > - <string>Coordinate</string> - </property> - <property name="toolTip" > - <string>The coordinate of the effect</string> - </property> - <property name="statusTip" > - <string>The coordinate of the effect</string> - </property> - <property name="whatsThis" > - <string>The coordinate of the effect</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="Sigmodr::PointWidget" name="varCoordinate" /> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="boxSkin" > - <property name="title" > - <string>Skin</string> - </property> <property name="toolTip" > <string>Skin of the effect</string> </property> @@ -62,6 +38,9 @@ <property name="whatsThis" > <string>Skin of the effect</string> </property> + <property name="title" > + <string>Skin</string> + </property> <layout class="QHBoxLayout" > <item> <widget class="KComboBox" name="varSkin" /> @@ -71,15 +50,6 @@ </item> <item> <widget class="QGroupBox" name="varIsGhost" > - <property name="title" > - <string>Is Transparent</string> - </property> - <property name="checkable" > - <bool>true</bool> - </property> - <property name="checked" > - <bool>false</bool> - </property> <property name="toolTip" > <string>If checked, the effect does not block movement</string> </property> @@ -89,14 +59,20 @@ <property name="whatsThis" > <string>If checked, the effect does not block movement</string> </property> + <property name="title" > + <string>Is Transparent</string> + </property> + <property name="checkable" > + <bool>true</bool> + </property> + <property name="checked" > + <bool>false</bool> + </property> <layout class="QHBoxLayout" /> </widget> </item> <item> <widget class="QGroupBox" name="boxScript" > - <property name="title" > - <string>Script</string> - </property> <property name="toolTip" > <string>The script for the effect</string> </property> @@ -106,9 +82,12 @@ <property name="whatsThis" > <string>The script for the effect</string> </property> + <property name="title" > + <string>Script</string> + </property> <layout class="QHBoxLayout" > <item> - <widget class="Sigmodr::ScriptWidget" name="varScript" /> + <widget class="Sigmodr::ScriptWidget" native="1" name="varScript" /> </item> </layout> </widget> @@ -117,24 +96,19 @@ </widget> <customwidgets> <customwidget> - <class>KLineEdit</class> - <extends>QLineEdit</extends> - <header location="global" >KLineEdit</header> - </customwidget> - <customwidget> <class>KComboBox</class> <extends>QComboBox</extends> <header location="global" >KComboBox</header> </customwidget> <customwidget> - <class>Sigmodr::ScriptWidget</class> - <extends>QWidget</extends> - <header>ScriptWidget.h</header> + <class>KLineEdit</class> + <extends>QLineEdit</extends> + <header location="global" >KLineEdit</header> </customwidget> <customwidget> - <class>Sigmodr::PointWidget</class> + <class>Sigmodr::ScriptWidget</class> <extends>QWidget</extends> - <header>PointWidget.h</header> + <header>ScriptWidget.h</header> </customwidget> </customwidgets> <resources/> diff --git a/sigmodr/gui/maptrainer.ui b/sigmodr/gui/maptrainer.ui index f2eb5d3b..6f4421fd 100644 --- a/sigmodr/gui/maptrainer.ui +++ b/sigmodr/gui/maptrainer.ui @@ -4,9 +4,6 @@ <layout class="QVBoxLayout" > <item> <widget class="QGroupBox" name="boxName" > - <property name="title" > - <string>Name</string> - </property> <property name="toolTip" > <string>Name of the trainer</string> </property> @@ -16,6 +13,9 @@ <property name="whatsThis" > <string>Name of the trainer</string> </property> + <property name="title" > + <string>Name</string> + </property> <layout class="QHBoxLayout" > <item> <widget class="KLineEdit" name="varName" > @@ -29,9 +29,6 @@ </item> <item> <widget class="QGroupBox" name="boxTrainerClass" > - <property name="title" > - <string>Trainer Class</string> - </property> <property name="toolTip" > <string>The base class of the trainer</string> </property> @@ -41,39 +38,18 @@ <property name="whatsThis" > <string>The base class of the trainer</string> </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KComboBox" name="varTrainerClass" /> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="boxCoordinate" > <property name="title" > - <string>Coordinate</string> - </property> - <property name="toolTip" > - <string>The coordinate of the trainer</string> - </property> - <property name="statusTip" > - <string>The coordinate of the trainer</string> - </property> - <property name="whatsThis" > - <string>The coordinate of the trainer</string> + <string>Trainer Class</string> </property> - <layout class="QVBoxLayout" > + <layout class="QHBoxLayout" > <item> - <widget class="Sigmodr::PointWidget" name="varCoordinate" /> + <widget class="KComboBox" name="varTrainerClass" /> </item> </layout> </widget> </item> <item> <widget class="QGroupBox" name="boxNumberFight" > - <property name="title" > - <string>Number Fight</string> - </property> <property name="toolTip" > <string>How many team members from each side fight at a time</string> </property> @@ -83,6 +59,9 @@ <property name="whatsThis" > <string>How many team members from each side fight at a time</string> </property> + <property name="title" > + <string>Number Fight</string> + </property> <layout class="QHBoxLayout" > <item> <widget class="KIntNumInput" name="varNumberFight" > @@ -96,9 +75,6 @@ </item> <item> <widget class="QGroupBox" name="boxScript" > - <property name="title" > - <string>Script</string> - </property> <property name="toolTip" > <string>The script for the trainer</string> </property> @@ -108,18 +84,18 @@ <property name="whatsThis" > <string>The script for the trainer</string> </property> + <property name="title" > + <string>Script</string> + </property> <layout class="QHBoxLayout" name="horizontalLayout" > <item> - <widget class="Sigmodr::ScriptWidget" name="varScript" /> + <widget class="Sigmodr::ScriptWidget" native="1" name="varScript" /> </item> </layout> </widget> </item> <item> <widget class="QGroupBox" name="boxLeadTeamMember" > - <property name="title" > - <string>Lead Team Member</string> - </property> <property name="toolTip" > <string>The lead team member</string> </property> @@ -129,6 +105,9 @@ <property name="whatsThis" > <string>The lead team member</string> </property> + <property name="title" > + <string>Lead Team Member</string> + </property> <layout class="QHBoxLayout" > <item> <widget class="KComboBox" name="varLeadTeamMember" /> @@ -159,11 +138,6 @@ <extends>QWidget</extends> <header>ScriptWidget.h</header> </customwidget> - <customwidget> - <class>Sigmodr::PointWidget</class> - <extends>QWidget</extends> - <header>PointWidget.h</header> - </customwidget> </customwidgets> <resources/> <connections/> diff --git a/sigmodr/gui/mapwarp.ui b/sigmodr/gui/mapwarp.ui index 4fb9ad26..c6bdbf9f 100644 --- a/sigmodr/gui/mapwarp.ui +++ b/sigmodr/gui/mapwarp.ui @@ -4,9 +4,6 @@ <layout class="QVBoxLayout" > <item> <widget class="QGroupBox" name="boxName" > - <property name="title" > - <string>Name</string> - </property> <property name="toolTip" > <string>Name of the warp (internal use only)</string> </property> @@ -16,6 +13,9 @@ <property name="whatsThis" > <string>Name of the warp (internal use only)</string> </property> + <property name="title" > + <string>Name</string> + </property> <layout class="QHBoxLayout" > <item> <widget class="KLineEdit" name="varName" > @@ -28,31 +28,7 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxCoordinate" > - <property name="title" > - <string>Coordinate</string> - </property> - <property name="toolTip" > - <string>The coordinate of the warp</string> - </property> - <property name="statusTip" > - <string>The coordinate of the warp</string> - </property> - <property name="whatsThis" > - <string>The coordinate of the warp</string> - </property> - <layout class="QVBoxLayout" > - <item> - <widget class="Sigmodr::PointWidget" name="varCoordinate" /> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="boxType" > - <property name="title" > - <string>Type</string> - </property> <property name="toolTip" > <string>The type of warp</string> </property> @@ -62,6 +38,9 @@ <property name="whatsThis" > <string>The type of warp</string> </property> + <property name="title" > + <string>Type</string> + </property> <layout class="QHBoxLayout" > <item> <widget class="KComboBox" name="varType" /> @@ -71,9 +50,6 @@ </item> <item> <widget class="QGroupBox" name="boxDestination" > - <property name="title" > - <string>Destination Map</string> - </property> <property name="toolTip" > <string>The destination for the warp</string> </property> @@ -83,6 +59,9 @@ <property name="whatsThis" > <string>The destination for the warp</string> </property> + <property name="title" > + <string>Destination Map</string> + </property> <layout class="QVBoxLayout" > <item> <widget class="KComboBox" name="varToMap" > @@ -124,9 +103,6 @@ </item> <item> <widget class="QGroupBox" name="boxScript" > - <property name="title" > - <string>Script</string> - </property> <property name="toolTip" > <string>The script that is executed when the warp is activated</string> </property> @@ -136,9 +112,12 @@ <property name="whatsThis" > <string>The script that is executed when the warp is activated</string> </property> + <property name="title" > + <string>Script</string> + </property> <layout class="QHBoxLayout" > <item> - <widget class="Sigmodr::ScriptWidget" name="varScript" /> + <widget class="Sigmodr::ScriptWidget" native="1" name="varScript" /> </item> </layout> </widget> @@ -161,11 +140,6 @@ <extends>QWidget</extends> <header>ScriptWidget.h</header> </customwidget> - <customwidget> - <class>Sigmodr::PointWidget</class> - <extends>QWidget</extends> - <header>PointWidget.h</header> - </customwidget> </customwidgets> <resources/> <connections/> diff --git a/sigmodr/gui/point.ui b/sigmodr/gui/point.ui deleted file mode 100644 index 2337800f..00000000 --- a/sigmodr/gui/point.ui +++ /dev/null @@ -1,54 +0,0 @@ -<ui version="4.0" > - <class>formPoint</class> - <widget class="QWidget" name="formPoint" > - <layout class="QHBoxLayout" > - <item> - <widget class="KIntNumInput" name="varX" > - <property name="label" > - <string>x</string> - </property> - <property name="toolTip" > - <string>The x coordinate of the point</string> - </property> - <property name="statusTip" > - <string>The x coordinate of the point</string> - </property> - <property name="whatsThis" > - <string>The x coordinate of the point</string> - </property> - <property name="minimum" > - <number>0</number> - </property> - </widget> - </item> - <item> - <widget class="KIntNumInput" name="varY" > - <property name="label" > - <string>y</string> - </property> - <property name="toolTip" > - <string>The y coordinate of the point</string> - </property> - <property name="statusTip" > - <string>The y coordinate of the point</string> - </property> - <property name="whatsThis" > - <string>The y coordinate of the point</string> - </property> - <property name="minimum" > - <number>0</number> - </property> - </widget> - </item> - </layout> - </widget> - <customwidgets> - <customwidget> - <class>KIntNumInput</class> - <extends>QWidget</extends> - <header location="global" >KIntNumInput</header> - </customwidget> - </customwidgets> - <resources/> - <connections/> -</ui> diff --git a/sigmodr/gui/tile.ui b/sigmodr/gui/tile.ui index 5419ef1e..5b87332e 100644 --- a/sigmodr/gui/tile.ui +++ b/sigmodr/gui/tile.ui @@ -28,52 +28,6 @@ </widget> </item> <item> - <widget class="QGroupBox" name="boxSprite" > - <property name="title" > - <string>Image</string> - </property> - <property name="toolTip" > - <string>Image of the tile</string> - </property> - <property name="statusTip" > - <string>Image of the tile</string> - </property> - <property name="whatsThis" > - <string>Image of the tile</string> - </property> - <layout class="QVBoxLayout" > - <item> - <widget class="KComboBox" name="varSprite" /> - </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="boxAccessibility" > - <property name="title" > - <string>Accessibility</string> - </property> - <property name="toolTip" > - <string>Directions into the tile</string> - </property> - <property name="statusTip" > - <string>Directions into the tile</string> - </property> - <property name="whatsThis" > - <string>Directions into the tile</string> - </property> - <layout class="QHBoxLayout" > - <item> - <widget class="KListWidget" name="varAccessibility" > - <property name="selectionMode" > - <enum>QAbstractItemView::ExtendedSelection</enum> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> <widget class="QGroupBox" name="boxScript" > <property name="title" > <string>Script</string> @@ -103,16 +57,6 @@ <header location="global" >KLineEdit</header> </customwidget> <customwidget> - <class>KListWidget</class> - <extends>QListWidget</extends> - <header location="global" >KListWidget</header> - </customwidget> - <customwidget> - <class>KComboBox</class> - <extends>QComboBox</extends> - <header location="global" >KComboBox</header> - </customwidget> - <customwidget> <class>Sigmodr::ScriptWidget</class> <extends>QWidget</extends> <header>ScriptWidget.h</header> diff --git a/sigmodr/models/CoinListObjectModel.cpp b/sigmodr/models/CoinListObjectModel.cpp index ee74e2e4..8264e272 100644 --- a/sigmodr/models/CoinListObjectModel.cpp +++ b/sigmodr/models/CoinListObjectModel.cpp @@ -50,15 +50,15 @@ QVariant Sigmodr::CoinListObjectModel::data(int role) const Sigmod::CoinListObject* object = qobject_cast<Sigmod::CoinListObject*>(m_object); if (object->type() == Sigmod::CoinListObject::Item) { - const int index = qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->itemIndex(object->object()); - if (index != INT_MAX) - return qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->item(index)->name(); + const Sigmod::Item* item = m_object->sigmod()->itemById(object->object()); + if (item) + return item->name(); } else if (object->type() == Sigmod::CoinListObject::Species) { - const int index = qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->speciesIndex(object->object()); - if (index != INT_MAX) - return qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->species(index)->name(); + const Sigmod::Species* species = m_object->sigmod()->speciesById(object->object()); + if (species) + return species->name(); } return ""; } diff --git a/sigmodr/models/MapTrainerTeamMemberModel.cpp b/sigmodr/models/MapTrainerTeamMemberModel.cpp index 80395d5c..eeaf3377 100644 --- a/sigmodr/models/MapTrainerTeamMemberModel.cpp +++ b/sigmodr/models/MapTrainerTeamMemberModel.cpp @@ -46,7 +46,7 @@ QVariant Sigmodr::MapTrainerTeamMemberModel::data(int role) const { if (role == Qt::DisplayRole) { - const Sigmod::Species* species = qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->speciesById(qobject_cast<Sigmod::MapTrainerTeamMember*>(m_object)->species()); + const Sigmod::Species* species = m_object->sigmod()->speciesById(qobject_cast<Sigmod::MapTrainerTeamMember*>(m_object)->species()); if (species) return species->name(); return ""; diff --git a/sigmodr/models/MapWildListEncounterModel.cpp b/sigmodr/models/MapWildListEncounterModel.cpp index e5130c10..9f5cb801 100644 --- a/sigmodr/models/MapWildListEncounterModel.cpp +++ b/sigmodr/models/MapWildListEncounterModel.cpp @@ -46,7 +46,7 @@ QVariant Sigmodr::MapWildListEncounterModel::data(int role) const { if (role == Qt::DisplayRole) { - const Sigmod::Species* species = qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->speciesById(qobject_cast<Sigmod::MapWildListEncounter*>(m_object)->species()); + const Sigmod::Species* species = m_object->sigmod()->speciesById(qobject_cast<Sigmod::MapWildListEncounter*>(m_object)->species()); if (species) return species->name(); return ""; diff --git a/sigmodr/models/SpeciesAbilityModel.cpp b/sigmodr/models/SpeciesAbilityModel.cpp index 3aefd6fd..9e5ee6c2 100644 --- a/sigmodr/models/SpeciesAbilityModel.cpp +++ b/sigmodr/models/SpeciesAbilityModel.cpp @@ -46,9 +46,9 @@ QVariant Sigmodr::SpeciesAbilityModel::data(int role) const { if (role == Qt::DisplayRole) { - const int index = qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->abilityIndex(qobject_cast<Sigmod::SpeciesAbility*>(m_object)->ability()); - if (index != INT_MAX) - return qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->ability(index)->name(); + const Sigmod::Ability* ability = m_object->sigmod()->abilityById(qobject_cast<Sigmod::SpeciesAbility*>(m_object)->ability()); + if (ability) + return ability->name(); return ""; } else if (role == Sigmodr::BaseModel::XmlRole) diff --git a/sigmodr/models/SpeciesItemModel.cpp b/sigmodr/models/SpeciesItemModel.cpp index 2d26bde5..28ec11df 100644 --- a/sigmodr/models/SpeciesItemModel.cpp +++ b/sigmodr/models/SpeciesItemModel.cpp @@ -46,9 +46,9 @@ QVariant Sigmodr::SpeciesItemModel::data(int role) const { if (role == Qt::DisplayRole) { - const int index = qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->itemIndex(qobject_cast<Sigmod::SpeciesItem*>(m_object)->item()); - if (index != INT_MAX) - return qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->item(index)->name(); + const Sigmod::Item* item = m_object->sigmod()->itemById(qobject_cast<Sigmod::SpeciesItem*>(m_object)->item()); + if (item) + return item->name(); return ""; } else if (role == Sigmodr::BaseModel::XmlRole) diff --git a/sigmodr/models/SpeciesMoveModel.cpp b/sigmodr/models/SpeciesMoveModel.cpp index b2441a45..8357a261 100644 --- a/sigmodr/models/SpeciesMoveModel.cpp +++ b/sigmodr/models/SpeciesMoveModel.cpp @@ -46,9 +46,9 @@ QVariant Sigmodr::SpeciesMoveModel::data(int role) const { if (role == Qt::DisplayRole) { - const int index = qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->moveIndex(qobject_cast<Sigmod::SpeciesMove*>(m_object)->move()); - if (index != INT_MAX) - return qobject_cast<const Sigmod::Sigmod*>(m_object->sigmod())->move(index)->name(); + const Sigmod::Move* move = m_object->sigmod()->move(qobject_cast<Sigmod::SpeciesMove*>(m_object)->move()); + if (move) + return move->name(); return ""; } else if (role == Sigmodr::BaseModel::XmlRole) diff --git a/sigmodr/overlays/effect.png b/sigmodr/overlays/effect.png Binary files differdeleted file mode 100644 index 6d4c38a1..00000000 --- a/sigmodr/overlays/effect.png +++ /dev/null diff --git a/sigmodr/overlays/no-walk.png b/sigmodr/overlays/no-walk.png Binary files differdeleted file mode 100644 index 11b15e81..00000000 --- a/sigmodr/overlays/no-walk.png +++ /dev/null diff --git a/sigmodr/overlays/overlays.qrc b/sigmodr/overlays/overlays.qrc deleted file mode 100644 index 265ada6d..00000000 --- a/sigmodr/overlays/overlays.qrc +++ /dev/null @@ -1,9 +0,0 @@ -<RCC> - <qresource prefix="overlays/" > - <file alias="effects" >effect.png</file> - <file alias="no-walk" >no-walk.png</file> - <file alias="trainer" >trainer.png</file> - <file alias="walk" >walk.png</file> - <file alias="warp" >warp.png</file> - </qresource> -</RCC> diff --git a/sigmodr/overlays/trainer.png b/sigmodr/overlays/trainer.png Binary files differdeleted file mode 100644 index e0d23cae..00000000 --- a/sigmodr/overlays/trainer.png +++ /dev/null diff --git a/sigmodr/overlays/walk.png b/sigmodr/overlays/walk.png Binary files differdeleted file mode 100644 index f4e69557..00000000 --- a/sigmodr/overlays/walk.png +++ /dev/null diff --git a/sigmodr/overlays/warp.png b/sigmodr/overlays/warp.png Binary files differdeleted file mode 100644 index 20baeb10..00000000 --- a/sigmodr/overlays/warp.png +++ /dev/null diff --git a/sigmodr/sigmodr.pro b/sigmodr/sigmodr.pro index 3f9ce5fe..8d86cabc 100644 --- a/sigmodr/sigmodr.pro +++ b/sigmodr/sigmodr.pro @@ -40,11 +40,13 @@ SOURCES += AbilityUI.cpp \ BadgeUI.cpp \ CoinListUI.cpp \ CoinListObjectUI.cpp \ + EffectItem.cpp \ EggGroupUI.cpp \ FractionWidget.cpp \ GlobalScriptUI.cpp \ ItemUI.cpp \ ItemTypeUI.cpp \ + MapEditor.cpp \ MapUI.cpp \ MapEffectUI.cpp \ MapTrainerUI.cpp \ @@ -55,7 +57,6 @@ SOURCES += AbilityUI.cpp \ MoveUI.cpp \ NatureUI.cpp \ ObjectUI.cpp \ - PointWidget.cpp \ RulesUI.cpp \ ScriptWidget.cpp \ SigmodTree.cpp \ @@ -73,13 +74,16 @@ SOURCES += AbilityUI.cpp \ SpriteUI.cpp \ StatusUI.cpp \ StoreUI.cpp \ - TilemapModel.cpp \ + TileItem.cpp \ + TilemapScene.cpp \ TileUI.cpp \ TimeUI.cpp \ + TrainerItem.cpp \ TrainerUI.cpp \ TypechartModel.cpp \ TypeUI.cpp \ ValidationDialog.cpp \ + WarpItem.cpp \ WeatherUI.cpp \ models/AbilityGroupModel.cpp \ models/AbilityModel.cpp \ @@ -157,11 +161,13 @@ HEADERS += AbilityUI.h \ BadgeUI.h \ CoinListUI.h \ CoinListObjectUI.h \ + EffectItem.h \ EggGroupUI.h \ FractionWidget.h \ GlobalScriptUI.h \ ItemUI.h \ ItemTypeUI.h \ + MapEditor.h \ MapUI.h \ MapEffectUI.h \ MapTrainerUI.h \ @@ -172,7 +178,6 @@ HEADERS += AbilityUI.h \ MoveUI.h \ NatureUI.h \ ObjectUI.h \ - PointWidget.h \ RulesUI.h \ ScriptWidget.h \ SigmodTree.h \ @@ -189,13 +194,16 @@ HEADERS += AbilityUI.h \ SpriteUI.h \ StatusUI.h \ StoreUI.h \ - TilemapModel.h \ + TileItem.h \ + TilemapScene.h \ TileUI.h \ TimeUI.h \ - TypechartModel.h \ + TrainerItem.h \ TrainerUI.h \ + TypechartModel.h \ TypeUI.h \ ValidationDialog.h \ + WarpItem.h \ WeatherUI.h \ models/AbilityGroupModel.h \ models/AbilityModel.h \ @@ -287,7 +295,6 @@ FORMS += gui/ability.ui \ gui/mapwildlistencounter.ui \ gui/move.ui \ gui/nature.ui \ - gui/point.ui \ gui/rules.ui \ gui/script.ui \ gui/sigmod.ui \ @@ -307,6 +314,4 @@ FORMS += gui/ability.ui \ gui/type.ui \ gui/weather.ui -RESOURCES += overlays/overlays.qrc - include(../headers.pri) |