summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--NEWS2
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/animatedsprite.cpp6
-rw-r--r--src/animatedsprite.h9
-rw-r--r--src/resources/action.cpp (renamed from src/action.cpp)3
-rw-r--r--src/resources/action.h (renamed from src/action.h)0
-rw-r--r--src/resources/animation.cpp (renamed from src/animation.cpp)14
-rw-r--r--src/resources/animation.h (renamed from src/animation.h)16
-rw-r--r--src/resources/spritedef.cpp37
-rw-r--r--src/resources/spritedef.h3
11 files changed, 58 insertions, 53 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c72fd15..83f21af7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,15 @@
-2006-12-11 Philipp Sehmisch <tmw@crushnet.org>
+2006-12-12 Bjørn Lindeijer <bjorn@lindeijer.nl>
- * data/sfx/bat-dying1.ogg, data/sfx/bat-hit1.ogg,
+ * src/animatedsprite.h, src/CMakeLists.txt, src/animatedsprite.cpp,
+ src/resources/action.h, src/resources/animation.h,
+ src/resources/spritedef.cpp, src/resources/action.cpp,
+ src/resources/animation.cpp, src/resources/spritedef.h: Moved
+ Action, Animation and Frame (renamed from AnimationPhase) classes into
+ the resources directory, since they are part of the SpriteDef class.
+
+2006-12-12 Philipp Sehmisch <tmw@crushnet.org>
+
+ * data/sfx/bat-dying1.ogg, data/sfx/bat-hit1.ogg,
data/sfx/bow_shoot_1.ogg, data/sfx/fire-goblin-hit1.ogg
data/sfx/fire-goblin-hit2.ogg, data/sfx/fire-goblin-miss1.ogg,
data/sfx/fist-swish.ogg, data/sfx/flower-hit1.ogg,
diff --git a/NEWS b/NEWS
index f3b586f8..74c00090 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
0.0.22 (...)
- Added support for female-specific equipment graphics
- Added support for monster sounds
+- Added item icons to buy/sell dialogs
+- Enhanced character select dialog to show equipment
- Changed to new update host (http://updates.themanaworld.org)
- Worked around a Guichan exception thrown for mice with many buttons
- Changed mouse walk to keep following mouse while button is held down
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b6a77e27..5d796fc2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -199,8 +199,12 @@ SET(SRCS
net/skillhandler.h
net/tradehandler.cpp
net/tradehandler.h
+ resources/action.cpp
+ resources/action.h
resources/ambientoverlay.cpp
resources/ambientoverlay.h
+ resources/animation.cpp
+ resources/animation.h
resources/equipmentdb.cpp
resources/equipmentdb.h
resources/equipmentinfo.h
@@ -240,12 +244,8 @@ SET(SRCS
utils/tostring.h
utils/xml.cpp
utils/xml.h
- action.cpp
- action.h
animatedsprite.cpp
animatedsprite.h
- animation.cpp
- animation.h
base64.cpp
base64.h
being.cpp
diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp
index 46369c80..3d1979a9 100644
--- a/src/animatedsprite.cpp
+++ b/src/animatedsprite.cpp
@@ -23,14 +23,14 @@
#include "animatedsprite.h"
-#include "animation.h"
-#include "action.h"
#include "graphics.h"
#include "log.h"
+#include "resources/action.h"
+#include "resources/animation.h"
+#include "resources/image.h"
#include "resources/resourcemanager.h"
#include "resources/spriteset.h"
-#include "resources/image.h"
#include "utils/xml.h"
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index dde570e2..101ff159 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -29,8 +29,9 @@
#include <map>
#include <string>
+class Animation;
class Graphics;
-struct AnimationPhase;
+struct Frame;
/**
* Animates a sprite by adding playback state.
@@ -72,13 +73,13 @@ class AnimatedSprite
/**
* Inform the animation of the passed time so that it can output the
- * correct animation phase.
+ * correct animation frame.
*/
void
update(int time);
/**
- * Draw the current animation phase at the coordinates given in screen
+ * Draw the current animation frame at the coordinates given in screen
* pixels.
*/
bool
@@ -103,7 +104,7 @@ class AnimatedSprite
SpriteDef *mSprite; /**< The sprite definition. */
Action *mAction; /**< The currently active action. */
Animation *mAnimation; /**< The currently active animation. */
- AnimationPhase *mFrame; /**< The currently active frame. */
+ Frame *mFrame; /**< The currently active frame. */
};
#endif
diff --git a/src/action.cpp b/src/resources/action.cpp
index 148ea105..247455db 100644
--- a/src/action.cpp
+++ b/src/resources/action.cpp
@@ -26,7 +26,8 @@
#include <algorithm>
#include "animation.h"
-#include "utils/dtor.h"
+
+#include "../utils/dtor.h"
Action::Action()
diff --git a/src/action.h b/src/resources/action.h
index 8d5e8d11..8d5e8d11 100644
--- a/src/action.h
+++ b/src/resources/action.h
diff --git a/src/animation.cpp b/src/resources/animation.cpp
index 67fdae11..de96525c 100644
--- a/src/animation.cpp
+++ b/src/resources/animation.cpp
@@ -25,7 +25,7 @@
#include <algorithm>
-#include "utils/dtor.h"
+#include "../utils/dtor.h"
Animation::Animation():
mDuration(0)
@@ -33,23 +33,21 @@ Animation::Animation():
}
void
-Animation::addPhase(Image *image, unsigned int delay, int offsetX, int offsetY)
+Animation::addFrame(Image *image, unsigned int delay, int offsetX, int offsetY)
{
- // Add new phase to animation list
- AnimationPhase newPhase = { image, delay, offsetX, offsetY };
-
- mAnimationPhases.push_back(newPhase);
+ Frame frame = { image, delay, offsetX, offsetY };
+ mFrames.push_back(frame);
mDuration += delay;
}
void
Animation::addTerminator()
{
- addPhase(NULL, 0, 0, 0);
+ addFrame(NULL, 0, 0, 0);
}
bool
-Animation::isTerminator(const AnimationPhase candidate)
+Animation::isTerminator(const Frame &candidate)
{
return (candidate.image == NULL);
}
diff --git a/src/animation.h b/src/resources/animation.h
index 85e950d7..54142bcb 100644
--- a/src/animation.h
+++ b/src/resources/animation.h
@@ -33,10 +33,8 @@ class Spriteset;
/**
* A single frame in an animation, with a delay and an offset.
- *
- * TODO: Rename this struct to Frame
*/
-struct AnimationPhase
+struct Frame
{
Image *image;
unsigned int delay;
@@ -60,7 +58,7 @@ class Animation
* Appends a new animation at the end of the sequence
*/
void
- addPhase(Image *image, unsigned int delay, int offsetX, int offsetY);
+ addFrame(Image *image, unsigned int delay, int offsetX, int offsetY);
/**
* Appends an animation terminator that states that the animation
@@ -72,14 +70,14 @@ class Animation
/**
* Returns the frame at the specified index.
*/
- AnimationPhase*
- getFrame(int index) { return &(mAnimationPhases[index]); }
+ Frame*
+ getFrame(int index) { return &(mFrames[index]); }
/**
* Returns the length of this animation in frames.
*/
unsigned int
- getLength() const { return mAnimationPhases.size(); }
+ getLength() const { return mFrames.size(); }
/**
* Returns the duration of this animation.
@@ -91,10 +89,10 @@ class Animation
* Determines whether the given animation frame is a terminator.
*/
static bool
- isTerminator(const AnimationPhase phase);
+ isTerminator(const Frame &phase);
protected:
- std::vector<AnimationPhase> mAnimationPhases;
+ std::vector<Frame> mFrames;
int mDuration;
};
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index bd273b3b..feb6f8f8 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -23,11 +23,10 @@
#include "spritedef.h"
-#include "../animation.h"
-#include "../action.h"
-#include "../graphics.h"
#include "../log.h"
+#include "animation.h"
+#include "action.h"
#include "resourcemanager.h"
#include "spriteset.h"
#include "image.h"
@@ -208,20 +207,20 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
Animation *animation = new Animation();
action->setAnimation(directionType, animation);
- // Get animation phases
- for (xmlNodePtr phaseNode = animationNode->xmlChildrenNode;
- phaseNode != NULL;
- phaseNode = phaseNode->next)
+ // Get animation frames
+ for (xmlNodePtr frameNode = animationNode->xmlChildrenNode;
+ frameNode != NULL;
+ frameNode = frameNode->next)
{
- int delay = XML::getProperty(phaseNode, "delay", 0);
- int offsetX = XML::getProperty(phaseNode, "offsetX", 0);
- int offsetY = XML::getProperty(phaseNode, "offsetY", 0);
+ 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;
- if (xmlStrEqual(phaseNode->name, BAD_CAST "frame"))
+ if (xmlStrEqual(frameNode->name, BAD_CAST "frame"))
{
- int index = XML::getProperty(phaseNode, "index", -1);
+ int index = XML::getProperty(frameNode, "index", -1);
if (index < 0)
{
@@ -237,12 +236,12 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
continue;
}
- animation->addPhase(img, delay, offsetX, offsetY);
+ animation->addFrame(img, delay, offsetX, offsetY);
}
- else if (xmlStrEqual(phaseNode->name, BAD_CAST "sequence"))
+ else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence"))
{
- int start = XML::getProperty(phaseNode, "start", -1);
- int end = XML::getProperty(phaseNode, "end", -1);
+ int start = XML::getProperty(frameNode, "start", -1);
+ int end = XML::getProperty(frameNode, "end", -1);
if (start < 0 || end < 0)
{
@@ -261,15 +260,15 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
continue;
}
- animation->addPhase(img, delay, offsetX, offsetY);
+ animation->addFrame(img, delay, offsetX, offsetY);
start++;
}
}
- else if (xmlStrEqual(phaseNode->name, BAD_CAST "end"))
+ else if (xmlStrEqual(frameNode->name, BAD_CAST "end"))
{
animation->addTerminator();
}
- } // for phaseNode
+ } // for frameNode
}
void
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 64414259..057129ad 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -32,10 +32,7 @@
#include <libxml/tree.h>
class Action;
-class Graphics;
class Spriteset;
-struct AnimationPhase;
-class Animation;
enum SpriteAction
{