summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/Makefile.am6
-rw-r--r--src/animatedsprite.cpp1
-rw-r--r--src/being.cpp14
-rw-r--r--src/being.h4
-rw-r--r--src/engine.cpp4
-rw-r--r--src/floor_item.cpp1
-rw-r--r--src/gui/equipmentwindow.cpp1
-rw-r--r--src/gui/itemcontainer.cpp8
-rw-r--r--src/gui/viewport.cpp32
-rw-r--r--src/gui/viewport.h16
-rw-r--r--src/main.cpp1
-rw-r--r--src/npc.cpp2
-rw-r--r--src/resources/animation.h1
-rw-r--r--src/resources/imageset.cpp (renamed from src/resources/spriteset.cpp)18
-rw-r--r--src/resources/imageset.h (renamed from src/resources/spriteset.h)23
-rw-r--r--src/resources/resourcemanager.cpp22
-rw-r--r--src/resources/resourcemanager.h8
-rw-r--r--src/resources/spritedef.cpp34
-rw-r--r--src/resources/spritedef.h10
-rw-r--r--src/simpleanimation.cpp4
-rw-r--r--src/simpleanimation.h16
-rw-r--r--src/tileset.h8
24 files changed, 130 insertions, 119 deletions
diff --git a/ChangeLog b/ChangeLog
index 55f73e71..b74f92f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,15 @@
* src/gui/viewport.cpp, src/monster.h: Avoiding magic numbers where
possible (1002) and also display the target when other players are
targeted.
+ * src/floor_item.cpp, src/being.cpp, src/main.cpp, src/CMakeLists.txt,
+ src/gui/equipmentwindow.cpp, src/gui/viewport.cpp,
+ src/gui/itemcontainer.cpp, src/gui/viewport.h, src/engine.cpp,
+ src/animatedsprite.cpp, src/tileset.h, src/npc.cpp, src/Makefile.am,
+ src/being.h, src/resources/imageset.cpp, src/resources/animation.h,
+ src/resources/spritedef.cpp, src/resources/resourcemanager.h,
+ src/resources/spriteset.h, src/resources/imageset.h,
+ src/resources/resourcemanager.cpp, src/resources/spriteset.cpp,
+ src/resources/spritedef.h: Renamed Spriteset to ImageSet.
2007-03-20 David Athay <ko2fan@gmail.com>
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 261bb161..2dd84177 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -246,8 +246,8 @@ SET(SRCS
resources/soundeffect.cpp
resources/spritedef.h
resources/spritedef.cpp
- resources/spriteset.h
- resources/spriteset.cpp
+ resources/imageset.h
+ resources/imageset.cpp
resources/buddylist.h
resources/buddylist.cpp
utils/base64.cpp
@@ -329,4 +329,4 @@ TARGET_LINK_LIBRARIES(tmw
INSTALL(TARGETS tmw RUNTIME DESTINATION ${PKG_BINDIR})
-SET_TARGET_PROPERTIES(tmw PROPERTIES COMPILE_FLAGS "${FLAGS}") \ No newline at end of file
+SET_TARGET_PROPERTIES(tmw PROPERTIES COMPILE_FLAGS "${FLAGS}")
diff --git a/src/Makefile.am b/src/Makefile.am
index a8632678..a71414ed 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -195,8 +195,8 @@ tmw_SOURCES = gui/browserbox.cpp \
resources/soundeffect.cpp \
resources/spritedef.h \
resources/spritedef.cpp \
- resources/spriteset.h \
- resources/spriteset.cpp \
+ resources/imageset.h \
+ resources/imageset.cpp \
resources/buddylist.h \
resources/buddylist.cpp \
utils/base64.cpp \
@@ -269,4 +269,4 @@ INCLUDES = \
tmw_LDFLAGS = $(all_libraries) $(LIBSDL_RPATH) `pkg-config --libs libxml-2.0`
tmw_CXXFLAGS = -Wall -Werror $(OPENGL_CFLAGS) $(LIBSDL_CFLAGS) `pkg-config --cflags libxml-2.0` $(CURL_CFLAGS)
tmw_LDADD = $(LIBSDL_LIBS) -lguichan_sdl $(OPENGL_LIBS) $(CURL_LIBS)
-tmw_TARGET = tmw \ No newline at end of file
+tmw_TARGET = tmw
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index 3d1979a9..7260a512 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -30,7 +30,6 @@
#include "resources/animation.h"
#include "resources/image.h"
#include "resources/resourcemanager.h"
-#include "resources/spriteset.h"
#include "utils/xml.h"
diff --git a/src/being.cpp b/src/being.cpp
index 03129c61..930c2d24 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -32,7 +32,7 @@
#include "map.h"
#include "resources/resourcemanager.h"
-#include "resources/spriteset.h"
+#include "resources/imageset.h"
#include "gui/gui.h"
@@ -40,7 +40,7 @@
#include "utils/tostring.h"
int Being::instances = 0;
-Spriteset *Being::emotionset = NULL;
+ImageSet *Being::emotionSet = NULL;
Being::Being(Uint32 id, Uint16 job, Map *map):
mJob(job),
@@ -69,8 +69,8 @@ Being::Being(Uint32 id, Uint16 job, Map *map):
{
// Load the emotion set
ResourceManager *rm = ResourceManager::getInstance();
- emotionset = rm->getSpriteset("graphics/sprites/emotions.png", 30, 32);
- if (!emotionset) logger->error("Unable to load emotions spriteset!");
+ emotionSet = rm->getImageSet("graphics/sprites/emotions.png", 30, 32);
+ if (!emotionSet) logger->error("Unable to load emotions!");
}
instances++;
@@ -86,8 +86,8 @@ Being::~Being()
if (instances == 0)
{
- emotionset->decRef();
- emotionset = NULL;
+ emotionSet->decRef();
+ emotionSet = NULL;
}
}
@@ -371,7 +371,7 @@ Being::drawEmotion(Graphics *graphics, Sint32 offsetX, Sint32 offsetY)
int px = mPx + offsetX + 3;
int py = mPy + offsetY - 60;
- graphics->drawImage(emotionset->get(mEmotion - 1), px, py);
+ graphics->drawImage(emotionSet->get(mEmotion - 1), px, py);
}
void
diff --git a/src/being.h b/src/being.h
index 9dda42a7..08b0e710 100644
--- a/src/being.h
+++ b/src/being.h
@@ -41,7 +41,7 @@ class Equipment;
class Item;
class Map;
class Graphics;
-class Spriteset;
+class ImageSet;
/**
* A position along a being's path.
@@ -392,7 +392,7 @@ class Being : public Sprite
private:
static int instances; /**< Number of Being instances */
- static Spriteset *emotionset; /**< Emoticons used by beings */
+ static ImageSet *emotionSet; /**< Emoticons used by beings */
};
#endif
diff --git a/src/engine.cpp b/src/engine.cpp
index be195c9f..8546f150 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -48,7 +48,6 @@
#include "resources/mapreader.h"
#include "resources/monsterdb.h"
#include "resources/resourcemanager.h"
-#include "resources/spriteset.h"
#include "utils/dtor.h"
#include "utils/tostring.h"
@@ -82,7 +81,8 @@ void Engine::changeMap(const std::string &mapPath)
// Notify the minimap and beingManager about the map change
Image *mapImage = NULL;
- if (newMap->hasProperty("minimap")) {
+ if (newMap->hasProperty("minimap"))
+ {
ResourceManager *resman = ResourceManager::getInstance();
mapImage = resman->getImage(newMap->getProperty("minimap"));
}
diff --git a/src/floor_item.cpp b/src/floor_item.cpp
index f33f7eb4..5d83e1dd 100644
--- a/src/floor_item.cpp
+++ b/src/floor_item.cpp
@@ -27,7 +27,6 @@
#include "resources/itemdb.h"
#include "resources/iteminfo.h"
-#include "resources/spriteset.h"
FloorItem::FloorItem(unsigned int id,
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp
index ec525c47..ec84491e 100644
--- a/src/gui/equipmentwindow.cpp
+++ b/src/gui/equipmentwindow.cpp
@@ -30,7 +30,6 @@
#include "../resources/iteminfo.h"
#include "../resources/resourcemanager.h"
-#include "../resources/spriteset.h"
#include "../utils/tostring.h"
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp
index 055a07cb..334770f8 100644
--- a/src/gui/itemcontainer.cpp
+++ b/src/gui/itemcontainer.cpp
@@ -35,7 +35,6 @@
#include "../resources/image.h"
#include "../resources/iteminfo.h"
#include "../resources/resourcemanager.h"
-#include "../resources/spriteset.h"
#include "../utils/tostring.h"
@@ -65,7 +64,8 @@ ItemContainer::logic()
int i = mInventory->getLastUsedSlot() - 1; // Count from 0, usage from 2
- if (i != mMaxItems) {
+ if (i != mMaxItems)
+ {
mMaxItems = i;
setWidth(getWidth());
}
@@ -197,9 +197,9 @@ ItemContainer::mousePressed(gcn::MouseEvent &event)
int my = event.getY();
int index = mx / gridWidth + ((my / gridHeight) * columns) + 2;
- if (index > INVENTORY_SIZE) {
+ if (index > INVENTORY_SIZE)
index = INVENTORY_SIZE - 1;
- }
+
setSelectedItem(mInventory->getItem(index));
}
}
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index c1f17804..84634ca6 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -41,7 +41,7 @@
#include "../resources/animation.h"
#include "../resources/monsterinfo.h"
#include "../resources/resourcemanager.h"
-#include "../resources/spriteset.h"
+#include "../resources/imageset.h"
#include "../utils/tostring.h"
@@ -66,25 +66,26 @@ Viewport::Viewport():
mPopupMenu = new PopupMenu();
- // Load target cursors.
+ // Load target cursors
ResourceManager *resman = ResourceManager::getInstance();
+ mInRangeImages = resman->getImageSet(
+ "graphics/gui/target-cursor-blue.png", 44, 35);
+ mOutRangeImages = resman->getImageSet(
+ "graphics/gui/target-cursor-red.png", 44, 35);
Animation *animInRange = new Animation();
- //Load animation frames into a spriteset, with each frame being 44x35
- Spriteset *ssInRange = resman->getSpriteset("graphics/gui/target-cursor-blue.png", 44, 35);
- for(int i = 0; i < 8; ++i)
+ Animation *animOutRange = new Animation();
+
+ for (unsigned int i = 0; i < mInRangeImages->size(); ++i)
{
- //Have a delay of 75
- animInRange->addFrame(ssInRange->get(i),75,0,0);
+ animInRange->addFrame(mInRangeImages->get(i), 75, 0, 0);
}
- mTargetCursorInRange = new SimpleAnimation(animInRange);
- Animation *animOutRange = new Animation();
- //Load animation frames into a spriteset, with each frame being 44x35
- Spriteset *ssOutRange = resman->getSpriteset("graphics/gui/target-cursor-red.png", 44, 35);
- for(int j = 0; j < 8; ++j)
+
+ for (unsigned int j = 0; j < mOutRangeImages->size(); ++j)
{
- //Have a delay of 75
- animOutRange->addFrame(ssOutRange->get(j),75,0,0);
+ animOutRange->addFrame(mOutRangeImages->get(j), 75, 0, 0);
}
+
+ mTargetCursorInRange = new SimpleAnimation(animInRange);
mTargetCursorOutRange = new SimpleAnimation(animOutRange);
}
@@ -94,6 +95,9 @@ Viewport::~Viewport()
delete mTargetCursorInRange;
delete mTargetCursorOutRange;
+
+ mInRangeImages->decRef();
+ mOutRangeImages->decRef();
}
void
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 6bb82d7f..84efeff3 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -33,6 +33,7 @@
class Map;
class Being;
class FloorItem;
+class ImageSet;
class Item;
class PopupMenu;
class Graphics;
@@ -139,13 +140,13 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
* TODO Find some way to get rid of Being here
*/
void showPopup(int x, int y, Being *being);
-
+
/**
* Draws range based target cursor
*/
void
drawTargetCursor(Graphics *graphics);
-
+
/**
* Draws target name
*/
@@ -162,11 +163,14 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
int mCameraX; /**< Current viewpoint in tiles. */
int mCameraY; /**< Current viewpoint in tiles. */
bool mShowDebugPath; /**< Show a path from player to pointer. */
-
- /**
- * Target animated cursor.
- */
+
+ ImageSet *mInRangeImages; /**< Images of in range target cursor. */
+ ImageSet *mOutRangeImages; /**< Images of out of range target cursor.*/
+
+ /** Animated in range target cursor. */
SimpleAnimation *mTargetCursorInRange;
+
+ /** Animated out of range target cursor. */
SimpleAnimation *mTargetCursorOutRange;
bool mPlayerFollowMouse;
diff --git a/src/main.cpp b/src/main.cpp
index 2c8e970f..88a862e0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -77,7 +77,6 @@
#include "resources/itemdb.h"
#include "resources/monsterdb.h"
#include "resources/resourcemanager.h"
-#include "resources/spriteset.h"
#include "utils/dtor.h"
#include "utils/tostring.h"
diff --git a/src/npc.cpp b/src/npc.cpp
index e96ad0b7..8081770c 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -31,8 +31,6 @@
#include "gui/gui.h"
-class Spriteset;
-
NPC *current_npc = 0;
NPC::NPC(Uint32 id, Uint16 job, Map *map, Network *network):
diff --git a/src/resources/animation.h b/src/resources/animation.h
index 54142bcb..d0d11c69 100644
--- a/src/resources/animation.h
+++ b/src/resources/animation.h
@@ -29,7 +29,6 @@
#include <libxml/tree.h>
class Image;
-class Spriteset;
/**
* A single frame in an animation, with a delay and an offset.
diff --git a/src/resources/spriteset.cpp b/src/resources/imageset.cpp
index 96bcef0c..677c024b 100644
--- a/src/resources/spriteset.cpp
+++ b/src/resources/imageset.cpp
@@ -21,7 +21,7 @@
* $Id$
*/
-#include "spriteset.h"
+#include "imageset.h"
#include "../log.h"
@@ -29,7 +29,7 @@
#include "../utils/dtor.h"
-Spriteset::Spriteset(const std::string& idPath,
+ImageSet::ImageSet(const std::string& idPath,
Image *img,
int width, int height):
Resource(idPath)
@@ -38,28 +38,28 @@ Spriteset::Spriteset(const std::string& idPath,
{
for (int x = 0; x + width <= img->getWidth(); x += width)
{
- mSpriteset.push_back(img->getSubImage(x, y, width, height));
+ mImages.push_back(img->getSubImage(x, y, width, height));
}
}
mWidth = width;
mHeight = height;
}
-Spriteset::~Spriteset()
+ImageSet::~ImageSet()
{
- for_each(mSpriteset.begin(), mSpriteset.end(), make_dtor(mSpriteset));
+ for_each(mImages.begin(), mImages.end(), make_dtor(mImages));
}
Image*
-Spriteset::get(size_type i)
+ImageSet::get(size_type i)
{
- if (i >= mSpriteset.size())
+ if (i >= mImages.size())
{
- logger->log("Warning: Sprite #%i does not exist in this spriteset", i);
+ logger->log("Warning: Sprite #%i does not exist in this image set", i);
return NULL;
}
else
{
- return mSpriteset[i];
+ return mImages[i];
}
}
diff --git a/src/resources/spriteset.h b/src/resources/imageset.h
index 7f6b42df..3469a3bb 100644
--- a/src/resources/spriteset.h
+++ b/src/resources/imageset.h
@@ -21,8 +21,8 @@
* $Id$
*/
-#ifndef _TMW_SPRITESET_H
-#define _TMW_SPRITESET_H
+#ifndef _TMW_IMAGESET_H
+#define _TMW_IMAGESET_H
#include <vector>
@@ -33,21 +33,19 @@ class Image;
/**
* Stores a set of subimages originating from a single image.
- *
- * TODO: Should probably be renamed to ImageSet or TileSet.
*/
-class Spriteset : public Resource
+class ImageSet : public Resource
{
public:
/*
* Cuts the passed image in a grid of sub images.
*/
- Spriteset(const std::string &idPath, Image *img, int w, int h);
+ ImageSet(const std::string &idPath, Image *img, int w, int h);
/**
* Destructor.
*/
- ~Spriteset();
+ ~ImageSet();
int getWidth() { return mWidth; };
@@ -56,14 +54,13 @@ class Spriteset : public Resource
typedef std::vector<Image*>::size_type size_type;
Image* get(size_type i);
- size_type size() { return mSpriteset.size(); }
+ size_type size() { return mImages.size(); }
private:
- // Vector storing the whole spriteset.
- std::vector<Image*> mSpriteset;
- // Height and width of the images in the spriteset
- int mHeight;
- int mWidth;
+ std::vector<Image*> mImages;
+
+ int mHeight; /**< Height of the images in the image set. */
+ int mWidth; /**< Width of the images in the image set. */
};
#endif
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 37a82b0c..985c11dd 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -31,7 +31,7 @@
#include "image.h"
#include "music.h"
#include "soundeffect.h"
-#include "spriteset.h"
+#include "imageset.h"
#include "spritedef.h"
#include "../log.h"
@@ -46,7 +46,7 @@ ResourceManager::ResourceManager()
ResourceManager::~ResourceManager()
{
- // Release any remaining spritedefs first because they depend on spritesets
+ // Release any remaining spritedefs first because they depend on image sets
ResourceIterator iter = mResources.begin();
while (iter != mResources.end())
{
@@ -63,11 +63,11 @@ ResourceManager::~ResourceManager()
}
}
- // Release any remaining spritesets first because they depend on images
+ // Release any remaining image sets first because they depend on images
iter = mResources.begin();
while (iter != mResources.end())
{
- if (dynamic_cast<Spriteset*>(iter->second) != 0)
+ if (dynamic_cast<ImageSet*>(iter->second) != 0)
{
cleanUp(iter->second);
ResourceIterator toErase = iter;
@@ -229,8 +229,8 @@ ResourceManager::getSoundEffect(const std::string &idPath)
return dynamic_cast<SoundEffect*>(get(SOUND_EFFECT, idPath));
}
-Spriteset*
-ResourceManager::getSpriteset(const std::string &imagePath, int w, int h)
+ImageSet*
+ResourceManager::getImageSet(const std::string &imagePath, int w, int h)
{
std::stringstream ss;
ss << imagePath << "[" << w << "x" << h << "]";
@@ -240,7 +240,7 @@ ResourceManager::getSpriteset(const std::string &imagePath, int w, int h)
if (resIter != mResources.end()) {
resIter->second->incRef();
- return dynamic_cast<Spriteset*>(resIter->second);
+ return dynamic_cast<ImageSet*>(resIter->second);
}
Image *img = getImage(imagePath);
@@ -249,13 +249,13 @@ ResourceManager::getSpriteset(const std::string &imagePath, int w, int h)
return NULL;
}
- Spriteset *spriteset = new Spriteset(idPath, img, w, h);
- spriteset->incRef();
- mResources[idPath] = spriteset;
+ ImageSet *imageSet = new ImageSet(idPath, img, w, h);
+ imageSet->incRef();
+ mResources[idPath] = imageSet;
img->decRef();
- return spriteset;
+ return imageSet;
}
SpriteDef*
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index e176e337..db29e6d3 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -33,7 +33,7 @@ class Resource;
class Image;
class Music;
class SoundEffect;
-class Spriteset;
+class ImageSet;
class SpriteDef;
/**
@@ -143,11 +143,11 @@ class ResourceManager
getSoundEffect(const std::string &idPath);
/**
- * Creates a spriteset based on the image referenced by the given
+ * Creates a image set based on the image referenced by the given
* path and the supplied sprite sizes
*/
- Spriteset*
- getSpriteset(const std::string &imagePath, int w, int h);
+ ImageSet*
+ getImageSet(const std::string &imagePath, int w, int h);
/**
* Creates a sprite definition based on a given path and the supplied
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index feb6f8f8..d29bd847 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -28,7 +28,7 @@
#include "animation.h"
#include "action.h"
#include "resourcemanager.h"
-#include "spriteset.h"
+#include "imageset.h"
#include "image.h"
#include "../utils/xml.h"
@@ -135,30 +135,30 @@ SpriteDef::loadImageSet(xmlNodePtr node)
std::string imageSrc = XML::getProperty(node, "src", "");
ResourceManager *resman = ResourceManager::getInstance();
- Spriteset *spriteset = resman->getSpriteset(imageSrc, width, height);
+ ImageSet *imageSet = resman->getImageSet(imageSrc, width, height);
- if (!spriteset)
+ if (!imageSet)
{
logger->error("Couldn't load imageset!");
}
- mSpritesets[name] = spriteset;
+ mImageSets[name] = imageSet;
}
void
SpriteDef::loadAction(xmlNodePtr node, int variant_offset)
{
const std::string actionName = XML::getProperty(node, "name", "");
- const std::string imagesetName = XML::getProperty(node, "imageset", "");
+ const std::string imageSetName = XML::getProperty(node, "imageset", "");
- SpritesetIterator si = mSpritesets.find(imagesetName);
- if (si == mSpritesets.end())
+ ImageSetIterator si = mImageSets.find(imageSetName);
+ if (si == mImageSets.end())
{
logger->log("Warning: imageset \"%s\" not defined in %s",
- imagesetName.c_str(), getIdPath().c_str());
+ imageSetName.c_str(), getIdPath().c_str());
return;
}
- Spriteset *imageset = si->second;
+ ImageSet *imageSet = si->second;
SpriteAction actionType = makeSpriteAction(actionName);
if (actionType == ACTION_INVALID)
@@ -183,14 +183,14 @@ SpriteDef::loadAction(xmlNodePtr node, int variant_offset)
{
if (xmlStrEqual(animationNode->name, BAD_CAST "animation"))
{
- loadAnimation(animationNode, action, imageset, variant_offset);
+ loadAnimation(animationNode, action, imageSet, variant_offset);
}
}
}
void
SpriteDef::loadAnimation(xmlNodePtr animationNode,
- Action *action, Spriteset *imageset,
+ Action *action, ImageSet *imageSet,
int variant_offset)
{
std::string directionName =
@@ -215,8 +215,8 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
int delay = XML::getProperty(frameNode, "delay", 0);
int offsetX = XML::getProperty(frameNode, "offsetX", 0);
int offsetY = XML::getProperty(frameNode, "offsetY", 0);
- offsetY -= imageset->getHeight() - 32;
- offsetX -= imageset->getWidth() / 2 - 16;
+ offsetY -= imageSet->getHeight() - 32;
+ offsetX -= imageSet->getWidth() / 2 - 16;
if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
{
@@ -228,7 +228,7 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
continue;
}
- Image *img = imageset->get(index + variant_offset);
+ Image *img = imageSet->get(index + variant_offset);
if (!img)
{
@@ -251,7 +251,7 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
while (end >= start)
{
- Image *img = imageset->get(start + variant_offset);
+ Image *img = imageSet->get(start + variant_offset);
if (!img)
{
@@ -296,8 +296,8 @@ SpriteDef::substituteAction(SpriteAction complete, SpriteAction with)
SpriteDef::~SpriteDef()
{
- for (SpritesetIterator i = mSpritesets.begin();
- i != mSpritesets.end(); ++i)
+ for (ImageSetIterator i = mImageSets.begin();
+ i != mImageSets.end(); ++i)
{
i->second->decRef();
}
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 057129ad..6d335b02 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -32,7 +32,7 @@
#include <libxml/tree.h>
class Action;
-class Spriteset;
+class ImageSet;
enum SpriteAction
{
@@ -111,7 +111,7 @@ class SpriteDef : public Resource
*/
void
loadAnimation(xmlNodePtr animationNode,
- Action *action, Spriteset *imageset,
+ Action *action, ImageSet *imageSet,
int variant_offset);
/**
@@ -140,12 +140,12 @@ class SpriteDef : public Resource
makeSpriteDirection(const std::string &direction);
- typedef std::map<std::string, Spriteset*> Spritesets;
- typedef Spritesets::iterator SpritesetIterator;
+ typedef std::map<std::string, ImageSet*> ImageSets;
+ typedef ImageSets::iterator ImageSetIterator;
typedef std::map<SpriteAction, Action*> Actions;
- Spritesets mSpritesets;
+ ImageSets mImageSets;
Actions mActions;
Action *mAction;
SpriteDirection mDirection;
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index a0aedc06..5fc35bcd 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -23,12 +23,10 @@
#include "simpleanimation.h"
-#include "graphics.h"
-
void SimpleAnimation::update(unsigned int timePassed)
{
- mAnimationTime+=timePassed;
+ mAnimationTime += timePassed;
while (mAnimationTime > mCurrentFrame->delay)
{
mAnimationTime -= mCurrentFrame->delay;
diff --git a/src/simpleanimation.h b/src/simpleanimation.h
index 3eb51c7e..a56c31da 100644
--- a/src/simpleanimation.h
+++ b/src/simpleanimation.h
@@ -27,7 +27,6 @@
#include "resources/animation.h"
class Frame;
-class Graphics;
/**
* This class is a leightweight alternative to the AnimatedSprite class.
@@ -50,10 +49,17 @@ class SimpleAnimation
Image *getCurrentImage() const;
private:
- Animation *mAnimation; /**< The hosted animation */
- unsigned int mAnimationTime; /**< Time in game ticks the current frame is shown*/
- unsigned int mAnimationPhase; /**< Index of current animation phase*/
- Frame *mCurrentFrame; /**< Current animation phase */
+ /** The hosted animation. */
+ Animation *mAnimation;
+
+ /** Time in game ticks the current frame is shown. */
+ unsigned int mAnimationTime;
+
+ /** Index of current animation frame. */
+ unsigned int mAnimationPhase;
+
+ /** Current animation frame. */
+ Frame *mCurrentFrame;
};
#endif
diff --git a/src/tileset.h b/src/tileset.h
index 27bc28c3..7521a3e5 100644
--- a/src/tileset.h
+++ b/src/tileset.h
@@ -24,19 +24,19 @@
#ifndef _TMW_TILESET_H_
#define _TMW_TILESET_H_
-#include "resources/spriteset.h"
+#include "resources/imageset.h"
/**
- * A tileset, which is basically just a spriteset but it stores a firstgid.
+ * A tileset, which is basically just an image set but it stores a firstgid.
*/
-class Tileset : public Spriteset
+class Tileset : public ImageSet
{
public:
/**
* Constructor.
*/
Tileset(Image *img, int w, int h, int firstGid):
- Spriteset("", img, w, h),
+ ImageSet("", img, w, h),
mFirstGid(firstGid)
{
}