summaryrefslogtreecommitdiffstats
path: root/pokescripting
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2008-08-04 03:27:13 +0000
committerBen Boeckel <MathStuf@gmail.com>2008-08-04 03:27:13 +0000
commit373e686bf4ecaaabcf80544e74f017eebe05213f (patch)
treecddf7a223f16944b0380386e568f2606f634c366 /pokescripting
parent63417b1c5057d22bd853e92cd3a25aa812b8d917 (diff)
downloadsigen-373e686bf4ecaaabcf80544e74f017eebe05213f.tar.gz
sigen-373e686bf4ecaaabcf80544e74f017eebe05213f.tar.xz
sigen-373e686bf4ecaaabcf80544e74f017eebe05213f.zip
[FIX] Cleaned up the RC file
[FIX] Script editing is getting there (still a little weird...) [FIX] Cleaned up the main file a bit [FIX] Added the Skin class [FIX] All sprites and skins are internally linked now [FIX] No more image restraints (tiles are still enforced so that map editing works) [FIX] Cleaned up checking for valid values when setting in pokemod [FIX] Removed FileDialog files git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@233 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokescripting')
-rw-r--r--pokescripting/BadgeWrapper.h13
-rw-r--r--pokescripting/CMakeLists.txt1
-rw-r--r--pokescripting/MapEffectWrapper.h7
-rw-r--r--pokescripting/SkinWrapper.h56
-rw-r--r--pokescripting/SpeciesWrapper.h32
-rw-r--r--pokescripting/TileWrapper.h7
-rw-r--r--pokescripting/TrainerWrapper.h7
7 files changed, 96 insertions, 27 deletions
diff --git a/pokescripting/BadgeWrapper.h b/pokescripting/BadgeWrapper.h
index bafb1509..6cfd637a 100644
--- a/pokescripting/BadgeWrapper.h
+++ b/pokescripting/BadgeWrapper.h
@@ -20,6 +20,7 @@
// Pokescripting includes
#include "ObjectWrapper.h"
+#include "SpriteWrapper.h"
// Pokemod includes
#include "../pokemod/Badge.h"
@@ -34,8 +35,8 @@ class POKESCRIPTING_EXPORT BadgeWrapper : public ObjectWrapper
BadgeWrapper(const Pokemod::Badge* badge, QObject* parent);
public slots:
QString name() const;
- QPixmap face() const;
- QPixmap badge() const;
+ const SpriteWrapper* face() const;
+ const SpriteWrapper* badge() const;
int obey() const;
Pokemod::Fraction stat(const int stat) const;
private:
@@ -55,14 +56,14 @@ inline QString BadgeWrapper::name() const
return m_badge->name();
}
-inline QPixmap BadgeWrapper::face() const
+inline const Pokescripting::SpriteWrapper* BadgeWrapper::face() const
{
- return m_badge->face();
+ return new SpriteWrapper(pokemod()->spriteById(m_badge->face()), const_cast<BadgeWrapper*>(this));
}
-inline QPixmap BadgeWrapper::badge() const
+inline const Pokescripting::SpriteWrapper* BadgeWrapper::badge() const
{
- return m_badge->badge();
+ return new SpriteWrapper(pokemod()->spriteById(m_badge->badge()), const_cast<BadgeWrapper*>(this));
}
inline int BadgeWrapper::obey() const
diff --git a/pokescripting/CMakeLists.txt b/pokescripting/CMakeLists.txt
index 4dd5aa47..1f5a44f4 100644
--- a/pokescripting/CMakeLists.txt
+++ b/pokescripting/CMakeLists.txt
@@ -29,6 +29,7 @@ SET(pokescripting_MOC_HEADERS
ObjectWrapper.h
PokemodWrapper.h
RulesWrapper.h
+ SkinWrapper.h
SoundWrapper.h
SpeciesWrapper.h
SpeciesAbilityWrapper.h
diff --git a/pokescripting/MapEffectWrapper.h b/pokescripting/MapEffectWrapper.h
index 161838e2..bf2bb127 100644
--- a/pokescripting/MapEffectWrapper.h
+++ b/pokescripting/MapEffectWrapper.h
@@ -20,6 +20,7 @@
// Pokescripting includes
#include "ObjectWrapper.h"
+#include "SkinWrapper.h"
// Pokemod includes
#include "../pokemod/MapEffect.h"
@@ -34,7 +35,7 @@ class POKESCRIPTING_EXPORT MapEffectWrapper : public ObjectWrapper
MapEffectWrapper(const Pokemod::MapEffect* effect, QObject* parent);
public slots:
QString name() const;
- QPixmap skin() const;
+ const SkinWrapper* skin() const;
bool isGhost() const;
private:
MapEffectWrapper& operator=(const MapEffectWrapper& rhs);
@@ -53,9 +54,9 @@ inline QString MapEffectWrapper::name() const
return m_effect->name();
}
-inline QPixmap MapEffectWrapper::skin() const
+inline const Pokescripting::SkinWrapper* MapEffectWrapper::skin() const
{
- return m_effect->skin();
+ return new SkinWrapper(pokemod()->skinById(m_effect->skin()), const_cast<MapEffectWrapper*>(this));
}
inline bool MapEffectWrapper::isGhost() const
diff --git a/pokescripting/SkinWrapper.h b/pokescripting/SkinWrapper.h
new file mode 100644
index 00000000..46d4c2a2
--- /dev/null
+++ b/pokescripting/SkinWrapper.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 __POKESCRIPTING_SKINWRAPPER__
+#define __POKESCRIPTING_SKINWRAPPER__
+
+// Pokescripting includes
+#include "ObjectWrapper.h"
+
+// Pokemod includes
+#include "../pokemod/Skin.h"
+
+namespace Pokescripting
+{
+class POKESCRIPTING_EXPORT SkinWrapper : public ObjectWrapper
+{
+ Q_OBJECT
+
+ public:
+ SkinWrapper(const Pokemod::Skin* skin, QObject* parent);
+ public slots:
+ QString name() const;
+ private:
+ SkinWrapper& operator=(const SkinWrapper& rhs);
+
+ const Pokemod::Skin* m_skin;
+};
+
+inline SkinWrapper::SkinWrapper(const Pokemod::Skin* skin, QObject* parent) :
+ ObjectWrapper(skin, parent),
+ m_skin(skin)
+{
+}
+
+inline QString SkinWrapper::name() const
+{
+ return m_skin->name();
+}
+
+}
+
+#endif
diff --git a/pokescripting/SpeciesWrapper.h b/pokescripting/SpeciesWrapper.h
index 45ae996d..d0938e25 100644
--- a/pokescripting/SpeciesWrapper.h
+++ b/pokescripting/SpeciesWrapper.h
@@ -20,9 +20,11 @@
// Pokescripting includes
#include "ObjectWrapper.h"
+#include "SkinWrapper.h"
#include "SpeciesAbilityWrapper.h"
#include "SpeciesItemWrapper.h"
#include "SpeciesMoveWrapper.h"
+#include "SpriteWrapper.h"
// Pokemod includes
#include "../pokemod/Species.h"
@@ -49,10 +51,11 @@ class POKESCRIPTING_EXPORT SpeciesWrapper : public ObjectWrapper
int weight() const;
int height() const;
QString pokedexEntry() const;
- QPixmap frontMaleSprite() const;
- QPixmap backMaleSprite() const;
- QPixmap frontFemaleSprite() const;
- QPixmap backFemaleSprite() const;
+ const SpriteWrapper* frontMaleSprite() const;
+ const SpriteWrapper* backMaleSprite() const;
+ const SpriteWrapper* frontFemaleSprite() const;
+ const SpriteWrapper* backFemaleSprite() const;
+ const SkinWrapper* skin() const;
Pokemod::Fraction genderFactor() const;
int eggSpecies() const;
int eggSteps() const;
@@ -144,24 +147,29 @@ inline QString SpeciesWrapper::pokedexEntry() const
return m_species->pokedexEntry();
}
-inline QPixmap SpeciesWrapper::frontMaleSprite() const
+inline const Pokescripting::SpriteWrapper* SpeciesWrapper::frontMaleSprite() const
{
- return m_species->frontMaleSprite();
+ return new SpriteWrapper(pokemod()->spriteById(m_species->frontMaleSprite()), const_cast<SpeciesWrapper*>(this));
}
-inline QPixmap SpeciesWrapper::backMaleSprite() const
+inline const Pokescripting::SpriteWrapper* SpeciesWrapper::backMaleSprite() const
{
- return m_species->backMaleSprite();
+ return new SpriteWrapper(pokemod()->spriteById(m_species->backMaleSprite()), const_cast<SpeciesWrapper*>(this));
}
-inline QPixmap SpeciesWrapper::frontFemaleSprite() const
+inline const Pokescripting::SpriteWrapper* SpeciesWrapper::frontFemaleSprite() const
{
- return m_species->frontFemaleSprite();
+ return new SpriteWrapper(pokemod()->spriteById(m_species->frontFemaleSprite()), const_cast<SpeciesWrapper*>(this));
}
-inline QPixmap SpeciesWrapper::backFemaleSprite() const
+inline const Pokescripting::SpriteWrapper* SpeciesWrapper::backFemaleSprite() const
{
- return m_species->backFemaleSprite();
+ return new SpriteWrapper(pokemod()->spriteById(m_species->backFemaleSprite()), const_cast<SpeciesWrapper*>(this));
+}
+
+inline const Pokescripting::SkinWrapper* SpeciesWrapper::skin() const
+{
+ return new SkinWrapper(pokemod()->skinById(m_species->skin()), const_cast<SpeciesWrapper*>(this));
}
inline Pokemod::Fraction SpeciesWrapper::genderFactor() const
diff --git a/pokescripting/TileWrapper.h b/pokescripting/TileWrapper.h
index c78a2cea..babc304e 100644
--- a/pokescripting/TileWrapper.h
+++ b/pokescripting/TileWrapper.h
@@ -20,6 +20,7 @@
// Pokescripting includes
#include "ObjectWrapper.h"
+#include "SpriteWrapper.h"
// Pokemod includes
#include "../pokemod/Tile.h"
@@ -34,7 +35,7 @@ class POKESCRIPTING_EXPORT TileWrapper : public ObjectWrapper
TileWrapper(const Pokemod::Tile* tile, QObject* parent);
public slots:
QString name() const;
- QPixmap sprite() const;
+ const SpriteWrapper* sprite() const;
bool from(const int direction) const;
private:
TileWrapper& operator=(const TileWrapper& rhs);
@@ -53,9 +54,9 @@ inline QString TileWrapper::name() const
return m_tile->name();
}
-inline QPixmap TileWrapper::sprite() const
+inline const Pokescripting::SpriteWrapper* TileWrapper::sprite() const
{
- return m_tile->sprite();
+ return new SpriteWrapper(pokemod()->spriteById(m_tile->sprite()), const_cast<TileWrapper*>(this));
}
inline bool TileWrapper::from(const int direction) const
diff --git a/pokescripting/TrainerWrapper.h b/pokescripting/TrainerWrapper.h
index 766cc030..963e153f 100644
--- a/pokescripting/TrainerWrapper.h
+++ b/pokescripting/TrainerWrapper.h
@@ -20,6 +20,7 @@
// Pokemod includes
#include "ObjectWrapper.h"
+#include "SkinWrapper.h"
// Pokemod includes
#include "../pokemod/Trainer.h"
@@ -35,7 +36,7 @@ class POKESCRIPTING_EXPORT TrainerWrapper : public ObjectWrapper
public slots:
QString name() const;
int moneyFactor() const;
- QPixmap skin() const;
+ const SkinWrapper* skin() const;
int depth() const;
int teamIntel() const;
int moveIntel() const;
@@ -64,9 +65,9 @@ inline int TrainerWrapper::TrainerWrapper::moneyFactor() const
return m_trainer->moneyFactor();
}
-inline QPixmap TrainerWrapper::TrainerWrapper::skin() const
+inline const Pokescripting::SkinWrapper* TrainerWrapper::TrainerWrapper::skin() const
{
- return m_trainer->skin();
+ return new SkinWrapper(pokemod()->skinById(m_trainer->skin()), const_cast<TrainerWrapper*>(this));
}
inline int TrainerWrapper::TrainerWrapper::depth() const