summaryrefslogtreecommitdiffstats
path: root/pokemodr/MapEffectUI.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-05-23 19:05:08 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-05-23 19:05:08 +0000
commitc07a81f2656d1168e7124f0b7281a4e38128926b (patch)
treecf0c4d044bc20683c54631862e07ee166b4c0b7f /pokemodr/MapEffectUI.cpp
parentd8973a8ed86925ea5611520c3b7b989ccc238bb4 (diff)
downloadsigen-c07a81f2656d1168e7124f0b7281a4e38128926b.tar.gz
sigen-c07a81f2656d1168e7124f0b7281a4e38128926b.tar.xz
sigen-c07a81f2656d1168e7124f0b7281a4e38128926b.zip
[FIX] Scrapped effects and such for scripts (going to use Kross) in pokemod
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@166 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemodr/MapEffectUI.cpp')
-rw-r--r--pokemodr/MapEffectUI.cpp92
1 files changed, 6 insertions, 86 deletions
diff --git a/pokemodr/MapEffectUI.cpp b/pokemodr/MapEffectUI.cpp
index 17dea814..2008d4b9 100644
--- a/pokemodr/MapEffectUI.cpp
+++ b/pokemodr/MapEffectUI.cpp
@@ -22,15 +22,13 @@
#include "FileDialog.h"
// Pokemod includes
-#include "../pokemod/Dialog.h"
#include "../pokemod/Item.h"
#include "../pokemod/Map.h"
#include "../pokemod/MapEffect.h"
#include "../pokemod/Pokemod.h"
MapEffectUI::MapEffectUI(MapEffect* effect, QWidget* parent) :
- ObjectUI(parent),
- m_lastEffect(-1)
+ ObjectUI(parent)
{
setupUi(this);
setObjects(effect, new MapEffect(*effect));
@@ -40,68 +38,18 @@ MapEffectUI::~MapEffectUI()
{
}
-void MapEffectUI::initGui()
-{
- varEffect->addItems(MapEffect::EffectStr);
- varDirection->addItems(Pokemod::DirectionStr.mid(0, Pokemod::D_End));
-}
-
void MapEffectUI::refreshGui()
{
varCoordinate->setMaximum(static_cast<const Map*>(original()->parent())->size());
- varDialog->clear();
- for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->dialogCount(); ++i)
- {
- const Dialog* dialog = static_cast<const Pokemod*>(original()->pokemod())->dialog(i);
- varDialog->addItem(dialog->dialog().mid(0, 25), dialog->id());
- }
}
void MapEffectUI::setGui()
{
- const bool resetEffect = (static_cast<MapEffect*>(modified())->effect() != m_lastEffect);
varName->setText(static_cast<MapEffect*>(modified())->name());
varCoordinate->setValue(static_cast<MapEffect*>(modified())->coordinate());
- varExistFlag->setValue(static_cast<MapEffect*>(modified())->existFlag());
varSkin->setIcon(static_cast<MapEffect*>(modified())->skin());
- varEffect->setCurrentIndex(static_cast<MapEffect*>(modified())->effect());
- m_lastEffect = static_cast<MapEffect*>(modified())->effect();
- if (resetEffect)
- {
- varValue1->setEnabled((m_lastEffect == MapEffect::E_Button) || (m_lastEffect == MapEffect::E_StrengthBlock));
- varValue2->clear();
- varValue2->setEnabled(true);
- switch (m_lastEffect)
- {
- case MapEffect::E_Item:
- for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->itemCount(); ++i)
- {
- const Item* item = static_cast<const Pokemod*>(original()->pokemod())->item(i);
- varValue2->addItem(item->name(), item->id());
- }
- break;
- case MapEffect::E_PC:
- varValue2->addItems(MapEffect::PCTypeStr);
- for (int i = 0; i < MapEffect::PC_End; ++i)
- varValue2->setItemData(i, i);
- break;
- case MapEffect::E_StrengthBlock:
- case MapEffect::E_Button:
- varValue2->addItems(Flag::ValueStr);
- for (int i = 0; i < Flag::End; ++i)
- varValue2->setItemData(i, i);
- break;
- default:
- varValue2->setEnabled(false);
- break;
- }
- }
- varValue1->setValue(static_cast<MapEffect*>(modified())->value1());
- varValue2->setCurrentIndex(varValue2->findData(static_cast<MapEffect*>(modified())->value2()));
- varDirection->setCurrentIndex(static_cast<MapEffect*>(modified())->direction());
+ varScript->setPlainText(static_cast<MapEffect*>(modified())->script());
varIsGhost->setChecked(static_cast<MapEffect*>(modified())->isGhost() ? Qt::Checked : Qt::Unchecked);
- varCanMove->setChecked(static_cast<MapEffect*>(modified())->canMove() ? Qt::Checked : Qt::Unchecked);
- varDialog->setCurrentIndex(varDialog->findData(static_cast<MapEffect*>(modified())->dialog()));
}
void MapEffectUI::apply()
@@ -127,11 +75,6 @@ void MapEffectUI::on_varCoordinate_valueChanged(const Point& coordinate)
static_cast<MapEffect*>(modified())->setCoordinate(coordinate);
}
-void MapEffectUI::on_varExistFlag_valueChanged(const Flag& existFlag)
-{
- static_cast<MapEffect*>(modified())->setExistFlag(existFlag);
-}
-
void MapEffectUI::on_varSkin_pressed()
{
FileDialog* dialog = new FileDialog(QSize(192, 128));
@@ -143,37 +86,14 @@ void MapEffectUI::on_varSkin_pressed()
delete dialog;
}
-void MapEffectUI::on_varEffect_activated(const int effect)
-{
- static_cast<MapEffect*>(modified())->setEffect(effect);
-}
-
-void MapEffectUI::on_varValue1_valueChanged(const int value1)
+void MapEffectUI::on_varScript_textChanged()
{
- static_cast<MapEffect*>(modified())->setValue1(value1);
-}
-
-void MapEffectUI::on_varValue2_activated(const int value2)
-{
- static_cast<MapEffect*>(modified())->setValue1(varValue2->itemData(value2).toInt());
-}
-
-void MapEffectUI::on_varDirection_activated(const int direction)
-{
- static_cast<MapEffect*>(modified())->setDirection(direction);
+ QTextCursor cursor = varScript->textCursor();
+ static_cast<MapEffect*>(modified())->setScript(varScript->toPlainText());
+ varScript->setTextCursor(cursor);
}
void MapEffectUI::on_varIsGhost_clicked(const bool isGhost)
{
static_cast<MapEffect*>(modified())->setIsGhost(isGhost);
}
-
-void MapEffectUI::on_varCanMove_clicked(const bool canMove)
-{
- static_cast<MapEffect*>(modified())->setCanMove(canMove);
-}
-
-void MapEffectUI::on_varDialog_activated(const int dialog)
-{
- static_cast<MapEffect*>(modified())->setDialog(varDialog->itemData(dialog).toInt());
-}