From 373e686bf4ecaaabcf80544e74f017eebe05213f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 4 Aug 2008 03:27:13 +0000 Subject: [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 --- pokescripting/BadgeWrapper.h | 13 +++++----- pokescripting/CMakeLists.txt | 1 + pokescripting/MapEffectWrapper.h | 7 ++--- pokescripting/SkinWrapper.h | 56 ++++++++++++++++++++++++++++++++++++++++ pokescripting/SpeciesWrapper.h | 32 ++++++++++++++--------- pokescripting/TileWrapper.h | 7 ++--- pokescripting/TrainerWrapper.h | 7 ++--- 7 files changed, 96 insertions(+), 27 deletions(-) create mode 100644 pokescripting/SkinWrapper.h (limited to 'pokescripting') 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(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(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(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 + * + * 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 . + */ + +#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(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(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(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(this)); +} + +inline const Pokescripting::SkinWrapper* SpeciesWrapper::skin() const +{ + return new SkinWrapper(pokemod()->skinById(m_species->skin()), const_cast(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(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(this)); } inline int TrainerWrapper::TrainerWrapper::depth() const -- cgit