summaryrefslogtreecommitdiff
path: root/src/being.h
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-04-22 07:15:35 -0600
committerJared Adams <jaxad0127@gmail.com>2010-04-23 08:33:25 -0600
commitc22ea2f169f58e765fc699fcd71bfd3a3cd4f859 (patch)
tree9e19b57d562d3fe24cd69e6441db41162aa6d3e4 /src/being.h
parent93d4de19fdffb6d568c907729449f169c3520c7b (diff)
downloadmana-client-c22ea2f169f58e765fc699fcd71bfd3a3cd4f859.tar.gz
mana-client-c22ea2f169f58e765fc699fcd71bfd3a3cd4f859.tar.bz2
mana-client-c22ea2f169f58e765fc699fcd71bfd3a3cd4f859.tar.xz
mana-client-c22ea2f169f58e765fc699fcd71bfd3a3cd4f859.zip
Add an Actor class to replace the Sprite class
The Actor class manages the Map reference, position vector, and alpha float. These are the common parts from it's children.
Diffstat (limited to 'src/being.h')
-rw-r--r--src/being.h45
1 files changed, 3 insertions, 42 deletions
diff --git a/src/being.h b/src/being.h
index 3d3dfa71..6264d56d 100644
--- a/src/being.h
+++ b/src/being.h
@@ -26,7 +26,6 @@
#include "map.h"
#include "particlecontainer.h"
#include "position.h"
-#include "sprite.h"
#include "vector.h"
#include "resources/spritedef.h"
@@ -59,7 +58,7 @@ class Text;
class StatusEffect;
-class Being : public Sprite, public ConfigListener
+class Being : public Actor, public ConfigListener
{
public:
enum Type
@@ -373,7 +372,7 @@ class Being : public Sprite, public ConfigListener
/**
* Draws this being to the given graphics context.
*
- * @see Sprite::draw(Graphics, int, int)
+ * @see Actor::draw(Graphics, int, int)
*
* TODO: The following two functions should be combined.
* at some point draw(), was changed to use mPx and mPy, with arugements
@@ -385,35 +384,6 @@ class Being : public Sprite, public ConfigListener
virtual void drawSpriteAt(Graphics *graphics, int x, int y) const;
- /**
- * Set the alpha opacity used to draw the being.
- */
- virtual void setAlpha(float alpha)
- { mAlpha = alpha; }
-
- /**
- * Returns the current alpha opacity of the Being.
- */
- virtual float getAlpha() const
- { return mAlpha; }
-
- /**
- * Returns the X coordinate in pixels.
- */
- int getPixelX() const
- { return (int) mPos.x; }
-
- /**
- * Returns the Y coordinate in pixels.
- *
- * @see Sprite::getPixelY()
- */
- int getPixelY() const
- { return (int) mPos.y; }
-
- /**
- * Sets the position of this being.
- */
void setPosition(const Vector &pos);
/**
@@ -421,17 +391,12 @@ class Being : public Sprite, public ConfigListener
*
* @see setPosition(const Vector &pos)
*/
- void setPosition(float x, float y, float z = 0.0f)
+ inline void setPosition(float x, float y, float z = 0.0f)
{
setPosition(Vector(x, y, z));
}
/**
- * Returns the position of this being.
- */
- const Vector &getPosition() const { return mPos; }
-
- /**
* Returns the horizontal size of the current base sprite of the being.
*/
virtual int getWidth() const;
@@ -616,10 +581,8 @@ class Being : public Sprite, public ConfigListener
int mId; /**< Unique sprite id */
Uint8 mDirection; /**< Facing direction */
Uint8 mSpriteDirection; /**< Facing direction */
- Map *mMap; /**< Map on which this being resides */
std::string mName; /**< Name of character */
std::string mPartyName;
- MapSprite mMapSprite;
/**
* Holds a text object when the being displays it's name, 0 otherwise
@@ -644,7 +607,6 @@ class Being : public Sprite, public ConfigListener
typedef Sprites::iterator SpriteIterator;
typedef Sprites::const_iterator SpriteConstIterator;
Sprites mSprites;
- float mAlpha; /**< Alpha opacity to draw the sprite */
ParticleList mStunParticleEffects;
ParticleVector mStatusParticleEffects;
@@ -675,7 +637,6 @@ class Being : public Sprite, public ConfigListener
*/
Vector mWalkSpeed;
- Vector mPos; /**< Position coordinates. */
int mX, mY; /**< Position in tile */
int mDamageTaken;