diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2008-05-19 03:27:00 +0000 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2008-05-19 03:27:00 +0000 |
commit | e6bd0fad66fcce1a81d5b61ba6afd856d8f84d67 (patch) | |
tree | 5a33febc4ec0f5efe270bed38f4c7c451694ead4 | |
parent | c0634abfb225376249023faf524f5252f47f5090 (diff) | |
download | sigen-e6bd0fad66fcce1a81d5b61ba6afd856d8f84d67.tar.gz sigen-e6bd0fad66fcce1a81d5b61ba6afd856d8f84d67.tar.xz sigen-e6bd0fad66fcce1a81d5b61ba6afd856d8f84d67.zip |
[FIX] general is now merged into pokemod
[FIX] Added ItemEffect widget code
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@153 6ecfd1a5-f3ed-3746-8530-beee90d26b22
60 files changed, 578 insertions, 109 deletions
@@ -1,4 +1,12 @@ ----------------- +Rev: 153 +Date: 18 May 2008 +User: MathStuf +----------------- +[FIX] general is now merged into pokemod +[FIX] Added ItemEffect widget code + +----------------- Rev: 152 Date: 18 May 2008 User: MathStuf diff --git a/general/TODO b/general/TODO deleted file mode 100644 index ccc403c1..00000000 --- a/general/TODO +++ /dev/null @@ -1 +0,0 @@ -FlagWidget diff --git a/general/general.pro b/general/general.pro deleted file mode 100644 index 71c61d60..00000000 --- a/general/general.pro +++ /dev/null @@ -1,29 +0,0 @@ -include(../version.pro) -TEMPLATE = lib -OBJECTS_DIR = .obj -DESTDIR = ../bin - -CONFIG += qt \ - warn_on \ - dll -!win32 { - CONFIG += debug -} - -SOURCES += Flag.cpp \ - Fraction.cpp - -HEADERS += Flag.h \ - Fraction.h \ - Hat.h \ - Matrix.h \ - Point.h - -isEmpty(PREFIX) { - PREFIX = $$(PREFIX) -} -isEmpty(PREFIX) { - PREFIX = /usr -} -target.path = $$PREFIX/lib$$system(kde4-config --libsuffix) -INSTALLS += target diff --git a/pokegen.pro b/pokegen.pro index f3357f56..a8c04a55 100755 --- a/pokegen.pro +++ b/pokegen.pro @@ -8,13 +8,10 @@ CONFIG += ordered \ CONFIG += debug } -SUBDIRS = general \ - pokemod \ +SUBDIRS = pokemod \ pokemodr -pokemod.depends = general -pokemodr.depends = pokemod \ - general +pokemodr.depends = pokemod distsrc.target = distsrc distsrc.commands = ./make-tarball.sh $${VERSION} diff --git a/pokemod/AbilityEffect.cpp b/pokemod/AbilityEffect.cpp index b7532e2d..df33be3b 100644 --- a/pokemod/AbilityEffect.cpp +++ b/pokemod/AbilityEffect.cpp @@ -22,6 +22,7 @@ #include "Ability.h" #include "Type.h" #include "Pokemod.h" +#include "Rules.h" const QStringList AbilityEffect::EffectStr = QStringList() << "Damage to HP" << "Prevent Damage" << "Auto Heal" << "Deal Damage" << "Wilds" << "Stat" << "Status" << "Ability" << "Accuracy/Power Trade" << "Bullseye" << "Item Effect" << "Type" << "Fast Hatch" << "Weather"; const QStringList AbilityEffect::TriggerStr = QStringList() << "Anything" << "Contact" << "Weather" << "Damage" << "Type" << "HP Boundary" << "Stat Change" << "Status"; diff --git a/pokemod/AbilityEffect.h b/pokemod/AbilityEffect.h index 17b6d027..d855cdc8 100644 --- a/pokemod/AbilityEffect.h +++ b/pokemod/AbilityEffect.h @@ -19,11 +19,9 @@ #define __POKEMOD_ABILITYEFFECT__ // Pokemod includes +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include <QStringList> diff --git a/pokemod/Badge.cpp b/pokemod/Badge.cpp index f4518f0d..75df4b73 100644 --- a/pokemod/Badge.cpp +++ b/pokemod/Badge.cpp @@ -17,6 +17,7 @@ // Header include #include "Badge.h" +#include "Rules.h" // Qt includes #include <QBuffer> diff --git a/pokemod/Badge.h b/pokemod/Badge.h index 70b5c528..988fea9a 100644 --- a/pokemod/Badge.h +++ b/pokemod/Badge.h @@ -19,12 +19,10 @@ #define __POKEMOD_BADGE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include <QPixmap> diff --git a/pokemod/Dialog.cpp b/pokemod/Dialog.cpp index 15607831..a755fbf2 100644 --- a/pokemod/Dialog.cpp +++ b/pokemod/Dialog.cpp @@ -26,8 +26,9 @@ #include "MapTrainer.h" #include "MapWarp.h" #include "Move.h" -#include "Species.h" #include "Pokemod.h" +#include "Rules.h" +#include "Species.h" const QStringList Dialog::CommandStr = QStringList() << "Flip Flag" << "Set Flag" << "Unset Flag" << "Randomize Flag" << "Test Flag" << "Dialog" << "Yes/No" << "Item Shop" << "Give Item" << "Take Item" << "Check Item" << "Coin List" << "Teach Move" << "Delete Move" << "Give Pokemon" << "Take Pokemon" << "Show Pokemon" << "View Pokemon" << "Give Money" << "Take Money" << "Move Effect" << "Turn Effect" << "Check Direction" << "Check Roster" << "Check Levels" << "Check Species" << "Check Held Items" << "Check Money" << "Trade" << "Daycare" << "Battle" << "Badge" << "Warp" << "Name" << "Music" << "Sound Effect" << "Timer" << "Map Sign" << "Wild Scope" << "Safari" << "Heal Party" << "Refresh" << "Clear" << "Pause" << "New Line" << "Exit" << "Menu"; const QStringList Dialog::CommandAbbrStr = QStringList() << "FF" << "SF" << "UF" << "RF" << "TF" << "D" << "YN" << "ItS" << "GIt" << "TIt" << "CIt" << "CL" << "TMv" << "DMv" << "GPk" << "TPk" << "SPk" << "VPk" << "G$" << "T$" << "MvEf" << "TEf" << "CD" << "CR" << "CLv" << "CS" << "CHIt" << "C$" << "T" << "Dc" << "Bat" << "Bdg" << "W" << "N" << "Ms" << "SFX" << "Tmr" << "MS" << "WS" << "S" << "HP" << "R" << "C" << "P" << "NL" << "X" << "M"; diff --git a/general/Flag.cpp b/pokemod/Flag.cpp index e08ba9f0..e08ba9f0 100644 --- a/general/Flag.cpp +++ b/pokemod/Flag.cpp diff --git a/general/Flag.h b/pokemod/Flag.h index 55b3a73d..55b3a73d 100644 --- a/general/Flag.h +++ b/pokemod/Flag.h diff --git a/general/Fraction.cpp b/pokemod/Fraction.cpp index a4a41e7d..a4a41e7d 100644 --- a/general/Fraction.cpp +++ b/pokemod/Fraction.cpp diff --git a/general/Fraction.h b/pokemod/Fraction.h index 2c1dc663..2c1dc663 100644 --- a/general/Fraction.h +++ b/pokemod/Fraction.h diff --git a/general/Hat.h b/pokemod/Hat.h index 2b7fccea..2b7fccea 100644 --- a/general/Hat.h +++ b/pokemod/Hat.h diff --git a/pokemod/Item.cpp b/pokemod/Item.cpp index 777f5856..d76d74ec 100644 --- a/pokemod/Item.cpp +++ b/pokemod/Item.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "ItemEffect.h" #include "Pokemod.h" +#include "Rules.h" // Qt includes #include <QSet> diff --git a/pokemod/ItemEffect.cpp b/pokemod/ItemEffect.cpp index cd9266a3..eed64e62 100644 --- a/pokemod/ItemEffect.cpp +++ b/pokemod/ItemEffect.cpp @@ -22,6 +22,7 @@ #include "Item.h" #include "MapWildList.h" #include "Pokemod.h" +#include "Rules.h" const QStringList ItemEffect::EffectStr = QStringList() << "HP Cure" << "Revive" << "Cure Status" << "Level Boost" << "Stat Boost" << "Flinch" << "Go First" << "Keep Alive" << "Modify Stat (Battle Only)" << "Shield (Battle Only)" << "Run (Battle Only)" << "PP Boost" << "Type Boost" << "PP Restore" << "Experience Share" << "Fishing Rod" << "Repel" << "Escape" << "TM" << "HM" << "Map" << "Ball" << "Itemfinder" << "Bike" << "Scope" << "Coin" << "Coin Case" << "Berry" << "Acorn"; const QStringList ItemEffect::RelativeStr = QStringList() << "Absolute" << "Relative"; diff --git a/pokemod/ItemEffect.h b/pokemod/ItemEffect.h index 456ef3ad..5ce5af21 100644 --- a/pokemod/ItemEffect.h +++ b/pokemod/ItemEffect.h @@ -19,11 +19,9 @@ #define __POKEMOD_ITEMEFFECT__ // Pokemod include +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include <QStringList> diff --git a/pokemod/Map.h b/pokemod/Map.h index 355257f4..09280a69 100644 --- a/pokemod/Map.h +++ b/pokemod/Map.h @@ -19,11 +19,9 @@ #define __POKEMOD_MAP__ // Pokemod includes +#include "Matrix.h" #include "Object.h" -// General includes -#include "../general/Matrix.h" - // Qt includes #include <QList> diff --git a/pokemod/MapEffect.h b/pokemod/MapEffect.h index d9cc2383..1d84d09e 100644 --- a/pokemod/MapEffect.h +++ b/pokemod/MapEffect.h @@ -19,11 +19,9 @@ #define __POKEMOD_MAPEFFECT__ // Pokemod includes +#include "Flag.h" #include "Object.h" - -// General includes -#include "../general/Flag.h" -#include "../general/Point.h" +#include "Point.h" // Qt includes #include <QPixmap> diff --git a/pokemod/MapTrainer.cpp b/pokemod/MapTrainer.cpp index ad0da7bc..8eb93ebd 100644 --- a/pokemod/MapTrainer.cpp +++ b/pokemod/MapTrainer.cpp @@ -23,6 +23,7 @@ #include "Map.h" #include "MapTrainerTeamMember.h" #include "Pokemod.h" +#include "Rules.h" // Qt includes #include <QSet> diff --git a/pokemod/MapTrainer.h b/pokemod/MapTrainer.h index 4bfaf3bc..f7dea954 100644 --- a/pokemod/MapTrainer.h +++ b/pokemod/MapTrainer.h @@ -19,11 +19,9 @@ #define __POKEMOD_MAPTRAINER__ // Pokemod includes +#include "Flag.h" #include "Object.h" - -// General includes -#include "../general/Flag.h" -#include "../general/Point.h" +#include "Point.h" // Qt includes #include <QList> diff --git a/pokemod/MapTrainerTeamMember.cpp b/pokemod/MapTrainerTeamMember.cpp index f95ae7e0..ce8cddae 100644 --- a/pokemod/MapTrainerTeamMember.cpp +++ b/pokemod/MapTrainerTeamMember.cpp @@ -22,6 +22,7 @@ #include "Item.h" #include "MapTrainer.h" #include "Pokemod.h" +#include "Rules.h" #include "Species.h" // Qt includes diff --git a/pokemod/MapWarp.h b/pokemod/MapWarp.h index a25c60c1..6395e3ef 100644 --- a/pokemod/MapWarp.h +++ b/pokemod/MapWarp.h @@ -19,13 +19,11 @@ #define __POKEMOD_MAPWARP__ // Pokemod includes +#include "Flag.h" #include "Object.h" +#include "Point.h" #include "Pokemod.h" -// General includes -#include "../general/Flag.h" -#include "../general/Point.h" - class MapWarp : public Object { Q_OBJECT diff --git a/pokemod/MapWildListEncounter.cpp b/pokemod/MapWildListEncounter.cpp index 5918df09..3ce241a8 100644 --- a/pokemod/MapWildListEncounter.cpp +++ b/pokemod/MapWildListEncounter.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "MapWildList.h" #include "Pokemod.h" +#include "Rules.h" #include "Species.h" MapWildListEncounter::MapWildListEncounter(const MapWildListEncounter& encounter) : diff --git a/general/Matrix.h b/pokemod/Matrix.h index 8d714f9d..8d714f9d 100644 --- a/general/Matrix.h +++ b/pokemod/Matrix.h diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp index 5567947d..b69dc373 100644 --- a/pokemod/Move.cpp +++ b/pokemod/Move.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "MoveEffect.h" #include "Pokemod.h" +#include "Rules.h" // Qt includes #include <QSet> diff --git a/pokemod/Move.h b/pokemod/Move.h index ca70c7fb..c2080b7e 100644 --- a/pokemod/Move.h +++ b/pokemod/Move.h @@ -19,11 +19,9 @@ #define __POKEMOD_MOVE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include <QList> diff --git a/pokemod/MoveEffect.h b/pokemod/MoveEffect.h index bbc0f322..adadaeb5 100644 --- a/pokemod/MoveEffect.h +++ b/pokemod/MoveEffect.h @@ -19,11 +19,9 @@ #define __POKEMOD_MOVEEFFECT__ // Pokemod includes +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include <QStringList> diff --git a/pokemod/Nature.cpp b/pokemod/Nature.cpp index db571d00..30f5a779 100644 --- a/pokemod/Nature.cpp +++ b/pokemod/Nature.cpp @@ -20,6 +20,7 @@ // Pokemod includes #include "Pokemod.h" +#include "Rules.h" Nature::Nature(const Nature& nature) : Object("Nature", nature.parent(), nature.id()) diff --git a/pokemod/Nature.h b/pokemod/Nature.h index 82cb361f..1ef8bdee 100644 --- a/pokemod/Nature.h +++ b/pokemod/Nature.h @@ -19,12 +19,10 @@ #define __POKEMOD_NATURE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - class Nature : public Object { Q_OBJECT diff --git a/general/Point.h b/pokemod/Point.h index 0525f85b..0525f85b 100644 --- a/general/Point.h +++ b/pokemod/Point.h diff --git a/pokemod/Pokemod.cpp b/pokemod/Pokemod.cpp index f19bb6c1..b33d8175 100644 --- a/pokemod/Pokemod.cpp +++ b/pokemod/Pokemod.cpp @@ -30,6 +30,7 @@ #include "Map.h" #include "Move.h" #include "Nature.h" +#include "Rules.h" #include "Sound.h" #include "Species.h" #include "Store.h" diff --git a/pokemod/Pokemod.h b/pokemod/Pokemod.h index 702314ea..7166f397 100644 --- a/pokemod/Pokemod.h +++ b/pokemod/Pokemod.h @@ -19,13 +19,12 @@ #define __POKEMOD_POKEMOD__ // Pokemod includes +#include "Fraction.h" +#include "Matrix.h" #include "Object.h" -#include "Rules.h" +#include "Point.h" // General includes -#include "../general/Fraction.h" -#include "../general/Matrix.h" -#include "../general/Point.h" // Qt includes #include <QList> @@ -43,6 +42,7 @@ class ItemType; class Map; class Move; class Nature; +class Rules; class Sound; class Species; class Store; diff --git a/pokemod/Rules.h b/pokemod/Rules.h index 87562774..3b2b3e5a 100644 --- a/pokemod/Rules.h +++ b/pokemod/Rules.h @@ -19,11 +19,9 @@ #define __POKEMOD_RULES__ // Pokemod includes +#include "Fraction.h" #include "Object.h" -// General includes -#include "../general/Fraction.h" - // Forward declarations class Pokemod; diff --git a/pokemod/Species.cpp b/pokemod/Species.cpp index 91ba0720..2867b401 100644 --- a/pokemod/Species.cpp +++ b/pokemod/Species.cpp @@ -20,6 +20,7 @@ // Pokemod includes #include "Pokemod.h" +#include "Rules.h" #include "SpeciesAbility.h" #include "SpeciesEvolution.h" #include "SpeciesItem.h" diff --git a/pokemod/Species.h b/pokemod/Species.h index 704a6d29..c0d93460 100644 --- a/pokemod/Species.h +++ b/pokemod/Species.h @@ -19,12 +19,10 @@ #define __POKEMOD_SPECIES__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - // Qt includes #include <QList> diff --git a/pokemod/SpeciesEvolution.cpp b/pokemod/SpeciesEvolution.cpp index b57f3715..060cc8de 100644 --- a/pokemod/SpeciesEvolution.cpp +++ b/pokemod/SpeciesEvolution.cpp @@ -22,6 +22,7 @@ #include "Item.h" #include "ItemEffect.h" #include "Pokemod.h" +#include "Rules.h" #include "Species.h" const QStringList SpeciesEvolution::StyleStr = QStringList() << "Level" << "Happiness" << "Stat" << "Item" << "Trade" << "TradeItem" << "Personality" << "Spare Slot"; diff --git a/pokemod/SpeciesMove.cpp b/pokemod/SpeciesMove.cpp index d5042414..c013c9de 100644 --- a/pokemod/SpeciesMove.cpp +++ b/pokemod/SpeciesMove.cpp @@ -20,6 +20,7 @@ // Pokemod includes #include "Pokemod.h" +#include "Rules.h" #include "Species.h" SpeciesMove::SpeciesMove(const SpeciesMove& move) : diff --git a/pokemod/Tile.h b/pokemod/Tile.h index c0ebc44d..12efe6f5 100644 --- a/pokemod/Tile.h +++ b/pokemod/Tile.h @@ -19,12 +19,10 @@ #define __POKEMOD_TILE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - // Forward declarations class Pokemod; diff --git a/pokemod/Type.h b/pokemod/Type.h index 8f492039..06a7cdaf 100644 --- a/pokemod/Type.h +++ b/pokemod/Type.h @@ -19,12 +19,10 @@ #define __POKEMOD_TYPE__ // Pokemod includes +#include "Fraction.h" #include "Object.h" #include "Pokemod.h" -// General includes -#include "../general/Fraction.h" - // Forward declarations class Pokemod; diff --git a/pokemod/pokemod.pro b/pokemod/pokemod.pro index 2a90538d..158233b9 100644 --- a/pokemod/pokemod.pro +++ b/pokemod/pokemod.pro @@ -3,8 +3,6 @@ TEMPLATE = lib OBJECTS_DIR = .obj MOC_DIR = .moc DESTDIR = ../bin -LIBS += -L../bin \ - -lgeneral CONFIG += qt \ warn_on \ @@ -14,12 +12,6 @@ QT += xml CONFIG += debug } -win32 { - TARGETDEPS += $${DESTDIR}/general.dll -} else { - TARGETDEPS += $${DESTDIR}/libgeneral.so -} - SOURCES += Ability.cpp \ AbilityEffect.cpp \ Author.cpp \ @@ -28,6 +20,8 @@ SOURCES += Ability.cpp \ CoinListObject.cpp \ Dialog.cpp \ EggGroup.cpp \ + Flag.cpp \ + Fraction.cpp \ Item.cpp \ ItemEffect.cpp \ ItemType.cpp \ @@ -64,6 +58,9 @@ HEADERS += AbilityEffect.h \ CoinListObject.h \ Dialog.h \ EggGroup.h \ + Flag.h \ + Fraction.h \ + Hat.h \ ItemEffect.h \ Item.h \ ItemType.h \ @@ -74,10 +71,12 @@ HEADERS += AbilityEffect.h \ MapWarp.h \ MapWildListEncounter.h \ MapWildList.h \ + Matrix.h \ MoveEffect.h \ Move.h \ Nature.h \ Object.h \ + Point.h \ Pokemod.h \ Rules.h \ Sound.h \ diff --git a/pokemodr/AbilityEffectUI.cpp b/pokemodr/AbilityEffectUI.cpp index 58033344..638ed6fe 100644 --- a/pokemodr/AbilityEffectUI.cpp +++ b/pokemodr/AbilityEffectUI.cpp @@ -22,6 +22,7 @@ #include "../pokemod/Ability.h" #include "../pokemod/AbilityEffect.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Type.h" AbilityEffectUI::AbilityEffectUI(AbilityEffect* effect, QWidget* parent) : diff --git a/pokemodr/BadgeUI.cpp b/pokemodr/BadgeUI.cpp index a07943a2..27666eb9 100644 --- a/pokemodr/BadgeUI.cpp +++ b/pokemodr/BadgeUI.cpp @@ -24,6 +24,7 @@ // Pokemod includes #include "../pokemod/Badge.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" BadgeUI::BadgeUI(Badge* badge, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/FlagWidget.h b/pokemodr/FlagWidget.h index 34e5ed1b..7e749179 100644 --- a/pokemodr/FlagWidget.h +++ b/pokemodr/FlagWidget.h @@ -18,8 +18,8 @@ #ifndef __FLAGWIDGET__ #define __FLAGWIDGET__ -// General includes -#include "../general/Flag.h" +// Pokemod includes +#include "../pokemod/Flag.h" // Qt includes #include <QWidget> diff --git a/pokemodr/FractionWidget.h b/pokemodr/FractionWidget.h index a79221c5..38990c72 100644 --- a/pokemodr/FractionWidget.h +++ b/pokemodr/FractionWidget.h @@ -18,8 +18,8 @@ #ifndef __FRACTIONWIDGET__ #define __FRACTIONWIDGET__ -// General includes -#include "../general/Fraction.h" +// Pokemod includes +#include "../pokemod/Fraction.h" // Qt includes #include <QWidget> diff --git a/pokemodr/ItemEffectUI.cpp b/pokemodr/ItemEffectUI.cpp new file mode 100644 index 00000000..bece9c10 --- /dev/null +++ b/pokemodr/ItemEffectUI.cpp @@ -0,0 +1,443 @@ +/* + * 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 "ItemEffectUI.h" + +// Pokemod includes +#include "../pokemod/ItemEffect.h" +#include "../pokemod/MapWildList.h" +#include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" +#include "../pokemod/Time.h" +#include "../pokemod/Type.h" + +ItemEffectUI::ItemEffectUI(ItemEffect* effect, QWidget* parent) : + ObjectUI(parent), + m_lastEffect(-1), + m_lastValue2(-1), + m_lastValue4(-1) +{ + setupUi(this); + QMetaObject::connectSlotsByName(this); + setObjects(effect, new ItemEffect(*effect)); + init(); +} + +ItemEffectUI::~ ItemEffectUI() +{ +} + +void ItemEffectUI::initGui() +{ + varEffect->addItems(ItemEffect::EffectStr); +} + +void ItemEffectUI::setGui() +{ + const bool resetEffect = (static_cast<ItemEffect*>(modified())->effect() == m_lastEffect); + const bool resetValue2 = ((static_cast<ItemEffect*>(modified())->value2() == m_lastValue2) || m_lastEffect); + const bool resetValue4 = ((static_cast<ItemEffect*>(modified())->value4() == m_lastValue4) || m_lastEffect); + const bool isSplit = static_cast<const Pokemod*>(original()->pokemod())->rules()->specialSplit(); + varOverworld->setChecked(static_cast<ItemEffect*>(modified())->overworld() ? Qt::Checked : Qt::Unchecked); + varBattle->setChecked(static_cast<ItemEffect*>(modified())->battle() ? Qt::Checked : Qt::Unchecked); + varHeld->setChecked(static_cast<ItemEffect*>(modified())->held() ? Qt::Checked : Qt::Unchecked); + varEffect->setCurrentIndex(static_cast<ItemEffect*>(modified())->effect()); + m_lastEffect = static_cast<ItemEffect*>(modified())->effect(); + if (resetEffect) + { + switch (m_lastEffect) + { + case ItemEffect::E_Revive: + case ItemEffect::E_LevelBoost: + case ItemEffect::E_StatBoost: + case ItemEffect::E_PPBoost: + case ItemEffect::E_Fish: + case ItemEffect::E_Repel: + case ItemEffect::E_Escape: + case ItemEffect::E_TM: + case ItemEffect::E_HM: + case ItemEffect::E_Map: + case ItemEffect::E_Itemfinder: + case ItemEffect::E_Bike: + case ItemEffect::E_Scope: + case ItemEffect::E_Coin: + case ItemEffect::E_CoinCase: + case ItemEffect::E_Acorn: + case ItemEffect::E_Evolution: + case ItemEffect::E_Flinch: + case ItemEffect::E_First: + case ItemEffect::E_KeepAlive: + case ItemEffect::E_ModifyStatBattle: + case ItemEffect::E_ShieldBattle: + case ItemEffect::E_RunBattle: + case ItemEffect::E_TypeBoost: + case ItemEffect::E_ExpShare: + case ItemEffect::E_Ball: + case ItemEffect::E_Berry: + varOverworld->setEnabled(false); + break; + default: + varOverworld->setEnabled(true); + break; + } + varValue1->setEnabled(true); + varValue2->clear(); + varValue2->setEnabled(true); + varValue3->clear(); + varValue3->setEnabled(true); + varValue4->setEnabled(true); + varValue4->setBehavior(((ItemEffect::E_TypeBoost == m_lastEffect) || (ItemEffect::E_PPBoost == m_lastEffect)) ? -1 : 1); + switch (m_lastEffect) + { + case ItemEffect::E_HPCure: + case ItemEffect::E_Revive: + // Value 4 dependent + case ItemEffect::E_Ball: + // Value 2 dependent + break; + case ItemEffect::E_LevelBoost: + case ItemEffect::E_ShieldBattle: + case ItemEffect::E_PPBoost: + case ItemEffect::E_Repel: + varValue1->setRange(1, INT_MAX); + break; + case ItemEffect::E_StatBoost: + case ItemEffect::E_Acorn: + varValue1->setRange(0, 65535); + break; + case ItemEffect::E_ModifyStatBattle: + varValue1->setRange(-12, 12); + break; + case ItemEffect::E_Fish: + case ItemEffect::E_Coin: + case ItemEffect::E_CoinCase: + varValue1->setRange(0, INT_MAX); + break; + default: + varValue1->setEnabled(false); + break; + } + switch (m_lastEffect) + { + // TODO: Value2 code +// case ItemEffect::E_HPCure: +// case ItemEffect::E_Revive: +// if (ItemEffect::R_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_CureStatus: +// if (Pokemod::STS_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_StatBoost: +// if ((value2 <= 0) || (65536 <= value2)) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_ModifyStatBattle: +// if (Pokemod::ST_End_Battle <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_ShieldBattle: +// if (ItemEffect::SP_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_TypeBoost: +// if (static_cast<const Pokemod*>(pokemod())->typeIndex(value2) == INT_MAX) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_PPRestore: +// if (ItemEffect::A_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Repel: +// if (ItemEffect::RP_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Escape: +// if (ItemEffect::ES_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_TM: +// case ItemEffect::E_HM: +// if (static_cast<const Pokemod*>(pokemod())->moveIndex(value2) == INT_MAX) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Ball: +// if (ItemEffect::B_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Scope: +// break; +// case ItemEffect::E_Berry: +// if (ItemEffect::B2_End <= value2) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Coin: +// case ItemEffect::E_CoinCase: +// if (value2 <= 0) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// case ItemEffect::E_Acorn: +// if (static_cast<const Pokemod*>(pokemod())->itemIndex(value2) == INT_MAX) +// { +// emit(error(bounds("value2"))); +// return; +// } +// break; +// default: +// varValue2->setEnabled(false); +// break; + } + switch (m_lastEffect) + { + case ItemEffect::E_StatBoost: + for (int i = 0; i < (isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY); ++i) + varValue3->addItem((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr)[i], i); + break; + case ItemEffect::E_Ball: + // Value 2 dependent + case ItemEffect::E_Berry: + // Value 2 dependent + break; + default: + varValue3->setEnabled(false); + break; + } + switch (m_lastEffect) + { + case ItemEffect::E_CureStatus: + case ItemEffect::E_LevelBoost: + case ItemEffect::E_StatBoost: + case ItemEffect::E_ModifyStatBattle: + case ItemEffect::E_Fish: + case ItemEffect::E_Escape: + case ItemEffect::E_TM: + case ItemEffect::E_HM: + case ItemEffect::E_Map: + case ItemEffect::E_Itemfinder: + case ItemEffect::E_Bike: + case ItemEffect::E_Scope: + case ItemEffect::E_Coin: + case ItemEffect::E_CoinCase: + case ItemEffect::E_Acorn: + case ItemEffect::E_Evolution: + varValue4->setEnabled(false); + break; + case ItemEffect::E_Ball: + if (m_lastValue2 == ItemEffect::B_Master) + varValue4->setEnabled(false); + break; + case ItemEffect::E_Berry: + if (m_lastValue2 != ItemEffect::B2_HPCure) + varValue4->setEnabled(false); + break; + } + } + varValue2->setCurrentIndex(varValue2->findData(static_cast<ItemEffect*>(modified())->value2())); + m_lastValue2 = static_cast<ItemEffect*>(modified())->value2(); + if (resetValue2) + { + if (m_lastEffect == ItemEffect::E_Ball) + { + switch (m_lastValue2) + { + case ItemEffect::B_Regular: + varValue1->setRange(0, 255); + break; + case ItemEffect::B_Level: + varValue1->setRange(0, static_cast<const Pokemod*>(original()->pokemod())->rules()->maxLevel()); + break; + case ItemEffect::B_Master: + case ItemEffect::B_Love: + case ItemEffect::B_Area: + case ItemEffect::B_Time: + case ItemEffect::B_Battle: + case ItemEffect::B_Friend: + case ItemEffect::B_Stat: + case ItemEffect::B_Type: + case ItemEffect::B_Weight: + break; + default: + varValue1->setEnabled(false); + break; + } + switch (m_lastValue2) + { + case ItemEffect::B_Level: + case ItemEffect::B_Friend: + case ItemEffect::B_Weight: + // TODO: ??? + break; + case ItemEffect::B_Area: + varValue3->addItems(MapWildList::ControlStr); + for (int i = 0; i < MapWildList::End; ++i) + varValue3->setItemData(i, i); + break; + case ItemEffect::B_Time: + for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->timeCount(); ++i) + { + const Time* time = static_cast<const Pokemod*>(original()->pokemod())->time(i); + varValue3->addItem(time->name(), time->id()); + } + break; + case ItemEffect::B_Stat: + for (int i = 0; i < (isSplit ? Pokemod::ST_End_GSC : Pokemod::ST_End_RBY); ++i) + varValue3->addItem((isSplit ? Pokemod::StatGSCStr : Pokemod::StatRBYStr)[i], i); + break; + case ItemEffect::B_Type: + for (int i = 0; i < static_cast<const Pokemod*>(original()->pokemod())->typeCount(); ++i) + { + const Type* type = static_cast<const Pokemod*>(original()->pokemod())->type(i); + varValue3->addItem(type->name(), type->id()); + } + break; + case ItemEffect::B_Regular: + case ItemEffect::B_Master: + case ItemEffect::B_Love: + case ItemEffect::B_Battle: + varValue3->setEnabled(false); + break; + } + } + else if (m_lastEffect == ItemEffect::E_Berry) + { + switch (m_lastValue2) + { + case ItemEffect::B2_HPCure: + varValue3->addItems(Pokemod::RelativeStr); + for (int i = 0; i < Pokemod::REL_End; ++i) + varValue3->setItemData(i, i); + break; + case ItemEffect::B2_StatusCure: + varValue3->addItems(Pokemod::StatusStr); + for (int i = 0; i < Pokemod::STS_End; ++i) + varValue3->setItemData(i, i); + break; + default: + varValue3->setEnabled(false); + break; + } + } + } + varValue4->setValue(static_cast<ItemEffect*>(modified())->value4()); + m_lastValue4 = static_cast<ItemEffect*>(modified())->value4(); + if (resetValue4) + { + if ((m_lastValue4 == ItemEffect::E_HPCure) || (m_lastValue4 == ItemEffect::E_Revive)) + { + if (m_lastValue4 == ItemEffect::R_Absolute) + varValue1->setRange(1, INT_MAX); + else + varValue1->setEnabled(false); + } + } + varValue1->setValue(static_cast<ItemEffect*>(modified())->value1()); + varValue3->setCurrentIndex(varValue3->findData(static_cast<ItemEffect*>(modified())->value3())); +} + +void ItemEffectUI::apply() +{ + *static_cast<ItemEffect*>(original()) = *static_cast<ItemEffect*>(modified()); + emit(changed(false)); +} + +void ItemEffectUI::discard() +{ + *static_cast<ItemEffect*>(modified()) = *static_cast<ItemEffect*>(original()); + setGui(); + emit(changed(false)); +} + +void ItemEffectUI::on_varOverworld_toggled(const bool overworld) +{ + static_cast<ItemEffect*>(modified())->setOverworld(overworld); +} + +void ItemEffectUI::on_varBattle_toggled(const bool battle) +{ + static_cast<ItemEffect*>(modified())->setBattle(battle); +} + +void ItemEffectUI::on_varHeld_toggled(const bool held) +{ + static_cast<ItemEffect*>(modified())->setHeld(held); +} + +void ItemEffectUI::on_varEffect_currentIndexChanged(const int effect) +{ + static_cast<ItemEffect*>(modified())->setEffect(effect); +} + +void ItemEffectUI::on_varValue1_valueChanged(const int value1) +{ + static_cast<ItemEffect*>(modified())->setValue1(value1); +} + +void ItemEffectUI::on_varValue2_currentIndexChanged(const int value2) +{ + static_cast<ItemEffect*>(modified())->setValue2(varValue2->itemData(value2).toInt()); +} + +void ItemEffectUI::on_varValue3_currentIndexChanged(const int value3) +{ + static_cast<ItemEffect*>(modified())->setValue3(varValue3->itemData(value3).toInt()); +} + +void ItemEffectUI::on_varValue4_valueChanged(const Fraction& value4) +{ + static_cast<ItemEffect*>(modified())->setValue4(value4); +} diff --git a/pokemodr/ItemEffectUI.h b/pokemodr/ItemEffectUI.h new file mode 100644 index 00000000..5a428fe6 --- /dev/null +++ b/pokemodr/ItemEffectUI.h @@ -0,0 +1,58 @@ +/* + * 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 __POKEMODR_ITEMEFFECTUI__ +#define __POKEMODR_ITEMEFFECTUI__ + +// PokeModr includes +#include "ObjectUI.h" + +// Form include +#include "ui_itemeffect.h" + +// Forward declarations +class ItemEffect; + +class ItemEffectUI : public ObjectUI, private Ui::formItemEffect +{ + Q_OBJECT + + public: + ItemEffectUI(ItemEffect* effect, QWidget* parent); + ~ItemEffectUI(); + public slots: + void apply(); + void discard(); + protected slots: + void on_varOverworld_toggled(const bool overworld); + void on_varBattle_toggled(const bool battle); + void on_varHeld_toggled(const bool held); + void on_varEffect_currentIndexChanged(const int effect); + void on_varValue1_valueChanged(const int value1); + void on_varValue2_currentIndexChanged(const int value2); + void on_varValue3_currentIndexChanged(const int value3); + void on_varValue4_valueChanged(const Fraction& value4); + private slots: + void initGui(); + void setGui(); + private: + int m_lastEffect; + int m_lastValue2; + int m_lastValue4; +}; + +#endif diff --git a/pokemodr/ItemUI.cpp b/pokemodr/ItemUI.cpp index 6e7945a7..771ba979 100644 --- a/pokemodr/ItemUI.cpp +++ b/pokemodr/ItemUI.cpp @@ -22,6 +22,7 @@ #include "../pokemod/Item.h" #include "../pokemod/ItemType.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" ItemUI::ItemUI(Item* item, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/MapTrainerTeamMemberUI.cpp b/pokemodr/MapTrainerTeamMemberUI.cpp index d2489dc9..5664b05b 100644 --- a/pokemodr/MapTrainerTeamMemberUI.cpp +++ b/pokemodr/MapTrainerTeamMemberUI.cpp @@ -23,6 +23,7 @@ #include "../pokemod/MapTrainerTeamMember.h" #include "../pokemod/Nature.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Species.h" MapTrainerTeamMemberUI::MapTrainerTeamMemberUI(MapTrainerTeamMember* teamMember, QWidget* parent) : diff --git a/pokemodr/MapTrainerUI.cpp b/pokemodr/MapTrainerUI.cpp index 69ac68fe..d8993130 100644 --- a/pokemodr/MapTrainerUI.cpp +++ b/pokemodr/MapTrainerUI.cpp @@ -24,6 +24,7 @@ #include "../pokemod/MapTrainer.h" #include "../pokemod/MapTrainerTeamMember.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Species.h" #include "../pokemod/Trainer.h" diff --git a/pokemodr/MapWildListEncounterUI.cpp b/pokemodr/MapWildListEncounterUI.cpp index d8421a26..d8352c50 100644 --- a/pokemodr/MapWildListEncounterUI.cpp +++ b/pokemodr/MapWildListEncounterUI.cpp @@ -20,8 +20,9 @@ // Pokemod includes #include "../pokemod/MapWildListEncounter.h" -#include "../pokemod/Species.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" +#include "../pokemod/Species.h" MapWildListEncounterUI::MapWildListEncounterUI(MapWildListEncounter* encounter, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/MoveUI.cpp b/pokemodr/MoveUI.cpp index 0582e095..cea2e6a5 100644 --- a/pokemodr/MoveUI.cpp +++ b/pokemodr/MoveUI.cpp @@ -20,8 +20,9 @@ // Pokemod includes #include "../pokemod/Move.h" -#include "../pokemod/Type.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" +#include "../pokemod/Type.h" MoveUI::MoveUI(Move* move, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/NatureUI.cpp b/pokemodr/NatureUI.cpp index 3a71fcbf..4f289859 100644 --- a/pokemodr/NatureUI.cpp +++ b/pokemodr/NatureUI.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "../pokemod/Nature.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" NatureUI::NatureUI(Nature* nature, QWidget* parent) : ObjectUI(parent) diff --git a/pokemodr/PointWidget.h b/pokemodr/PointWidget.h index 4ff72148..8f303f18 100644 --- a/pokemodr/PointWidget.h +++ b/pokemodr/PointWidget.h @@ -18,8 +18,8 @@ #ifndef __POINTWIDGET__ #define __POINTWIDGET__ -// General includes -#include "../general/Point.h" +// Pokemod includes +#include "../pokemod/Point.h" // Qt includes #include <QWidget> diff --git a/pokemodr/SpeciesEvolutionUI.cpp b/pokemodr/SpeciesEvolutionUI.cpp index bb4a8e38..d8eca1c2 100644 --- a/pokemodr/SpeciesEvolutionUI.cpp +++ b/pokemodr/SpeciesEvolutionUI.cpp @@ -22,6 +22,7 @@ #include "../pokemod/Item.h" #include "../pokemod/ItemEffect.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Species.h" #include "../pokemod/SpeciesEvolution.h" diff --git a/pokemodr/SpeciesMoveUI.cpp b/pokemodr/SpeciesMoveUI.cpp index d8021c74..7fa4a8c9 100644 --- a/pokemodr/SpeciesMoveUI.cpp +++ b/pokemodr/SpeciesMoveUI.cpp @@ -21,6 +21,7 @@ // Pokemod includes #include "../pokemod/Move.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/SpeciesMove.h" SpeciesMoveUI::SpeciesMoveUI(SpeciesMove* move, QWidget* parent) : diff --git a/pokemodr/SpeciesUI.cpp b/pokemodr/SpeciesUI.cpp index 7c754afe..09d17e53 100644 --- a/pokemodr/SpeciesUI.cpp +++ b/pokemodr/SpeciesUI.cpp @@ -24,6 +24,7 @@ // Pokemod includes #include "../pokemod/EggGroup.h" #include "../pokemod/Pokemod.h" +#include "../pokemod/Rules.h" #include "../pokemod/Species.h" #include "../pokemod/Type.h" diff --git a/pokemodr/TilemapModel.h b/pokemodr/TilemapModel.h index 98d585f2..5b1fe46d 100644 --- a/pokemodr/TilemapModel.h +++ b/pokemodr/TilemapModel.h @@ -19,11 +19,9 @@ #define __POKEMODR_TILEMAPMODEL__ // Pokemod includes +#include "../pokemod/Matrix.h" #include "../pokemod/Pokemod.h" -// General includes -#include "../general/Matrix.h" - // Qt includes #include <QAbstractTableModel> #include <QObject> diff --git a/pokemodr/TypechartWidgetItem.h b/pokemodr/TypechartWidgetItem.h index 86c612fb..5e1890c2 100644 --- a/pokemodr/TypechartWidgetItem.h +++ b/pokemodr/TypechartWidgetItem.h @@ -18,8 +18,8 @@ #ifndef __TYPECHARTWIDGETITEM__ #define __TYPECHARTWIDGETITEM__ -// General includes -#include "../general/Fraction.h" +// Pokemod includes +#include "../pokemod/Fraction.h" // Qt includes #include <QObject> diff --git a/pokemodr/pokemodr.pro b/pokemodr/pokemodr.pro index 62b12a0d..b06e331a 100644 --- a/pokemodr/pokemodr.pro +++ b/pokemodr/pokemodr.pro @@ -6,7 +6,6 @@ MOC_DIR = .moc DOC_DIR = ../doc DESTDIR = ../bin LIBS += -L../bin \ - -lgeneral \ -lpokemod \ -lphonon \ -lkdecore \ @@ -24,9 +23,9 @@ QT += xml RESOURCES += overlays/overlays.qrc win32 { - TARGETDEPS += $${DESTDIR}/pokemod.dll $${DESTDIR}/general.dll + TARGETDEPS += $${DESTDIR}/pokemod.dll } else { - TARGETDEPS += $${DESTDIR}/libpokemod.so $${DESTDIR}/libgeneral.so + TARGETDEPS += $${DESTDIR}/libpokemod.so } include(../latex.inc) |