summaryrefslogtreecommitdiff
path: root/src/being.h
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-05-02 14:43:40 -0600
committerJared Adams <jaxad0127@gmail.com>2010-05-06 22:21:57 -0600
commit9baedc27191c82bbf1fedee2a7e738bc5b267c0e (patch)
treef0986c6839d1e79b402d5d4ec36e4994741955ea /src/being.h
parent844e9a7a72faca6a212e788a3adc45e17f41dca6 (diff)
downloadmana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.tar.gz
mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.tar.bz2
mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.tar.xz
mana-9baedc27191c82bbf1fedee2a7e738bc5b267c0e.zip
Add support for floor item sprites
This commit adds a sprite hierarchy (Sprite->ImageSprite,AnimatedSprite,CompundSprite; CompoundSprite,Actor->ActorSprite;ActorSprite->Being,FloorItem) to collect common functionailty into new base classes which will make other Mantis tickets easier to do. Also allows monsters to use particle effects. Reviewed-by: Bertram
Diffstat (limited to 'src/being.h')
-rw-r--r--src/being.h167
1 files changed, 2 insertions, 165 deletions
diff --git a/src/being.h b/src/being.h
index 6264d56d..95f8c802 100644
--- a/src/being.h
+++ b/src/being.h
@@ -22,6 +22,7 @@
#ifndef BEING_H
#define BEING_H
+#include "actorsprite.h"
#include "configlistener.h"
#include "map.h"
#include "particlecontainer.h"
@@ -44,31 +45,17 @@
#define SPEECH_TIME 500
#define SPEECH_MAX_TIME 1000
-class AnimatedSprite;
class FlashText;
-class Graphics;
-class Image;
class ItemInfo;
class Item;
class Particle;
class Position;
-class SimpleAnimation;
class SpeechBubble;
class Text;
-class StatusEffect;
-
-class Being : public Actor, public ConfigListener
+class Being : public ActorSprite, public ConfigListener
{
public:
- enum Type
- {
- UNKNOWN,
- PLAYER,
- NPC,
- MONSTER
- };
-
/**
* Action the being is currently performing
* WARNING: Has to be in sync with the same enum in the Being class
@@ -84,14 +71,6 @@ class Being : public Actor, public ConfigListener
HURT
};
- enum TargetCursorSize
- {
- TC_SMALL = 0,
- TC_MEDIUM,
- TC_LARGE,
- NUM_TC
- };
-
enum Speech
{
NO_SPEECH = 0,
@@ -275,11 +254,6 @@ class Being : public Actor, public ConfigListener
*/
void drawEmotion(Graphics *graphics, int offsetX, int offsetY);
- /**
- * Returns the type of the being.
- */
- virtual Type getType() const { return UNKNOWN; }
-
/**
* Return Being's current Job (player job, npc, monster, creature )
*/
@@ -317,18 +291,6 @@ class Being : public Actor, public ConfigListener
int getAttackSpeed() const { return mAttackSpeed; }
/**
- * Sets the sprite id.
- */
- void setId(int id) { mId = id; }
-
- int getId() const { return mId; }
-
- /**
- * Sets the map the being is on
- */
- void setMap(Map *map);
-
- /**
* Sets the current action.
*/
virtual void setAction(Action action, int attackType = 0);
@@ -369,21 +331,6 @@ class Being : public Actor, public ConfigListener
SpriteDirection getSpriteDirection() const
{ return SpriteDirection(mSpriteDirection); }
- /**
- * Draws this being to the given graphics context.
- *
- * @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
- * only for the offset, drawSpriteAt() takes x, and y and draws the sprite
- * exactly at those coords (though it does do some computing to work how the
- * old draw() worked).
- */
- virtual void draw(Graphics *graphics, int offsetX, int offsetY) const;
-
- virtual void drawSpriteAt(Graphics *graphics, int x, int y) const;
-
void setPosition(const Vector &pos);
/**
@@ -412,17 +359,6 @@ class Being : public Actor, public ConfigListener
virtual int getCollisionRadius() const;
/**
- * Returns the required size of a target cursor for this being.
- */
- virtual Being::TargetCursorSize getTargetCursorSize() const
- { return TC_MEDIUM; }
-
- /**
- * Take control of a particle.
- */
- void controlParticle(Particle *particle);
-
- /**
* Shoots a missile particle from this being, to target being
*/
void fireMissile(Being *target, const std::string &particle);
@@ -439,16 +375,6 @@ class Being : public Actor, public ConfigListener
*/
const Path &getPath() const { return mPath; }
- /**
- * Sets the target animation for this being.
- */
- void setTargetAnimation(SimpleAnimation *animation);
-
- /**
- * Untargets the being
- */
- void untarget() { mUsedTargetCursor = NULL; }
-
/**
* Set the Emoticon type and time displayed above
@@ -466,42 +392,6 @@ class Being : public Actor, public ConfigListener
*/
Uint8 getEmotion() const { return mEmotion; }
- /**
- * Sets the being's stun mode. If zero, the being is `normal',
- * otherwise it is `stunned' in some fashion.
- */
- void setStunMode(int stunMode)
- {
- if (mStunMode != stunMode)
- updateStunMode(mStunMode, stunMode);
- mStunMode = stunMode;
- };
-
- void setStatusEffect(int index, bool active);
-
- /**
- * A status effect block is a 16 bit mask of status effects.
- * We assign each such flag a block ID of offset + bitnr.
- *
- * These are NOT the same as the status effect indices.
- */
- void setStatusEffectBlock(int offset, Uint16 flags);
-
- /**
- * Triggers a visual effect, such as `level up'
- *
- * Only draws the visual effect, does not play sound effects
- *
- * \param effectId ID of the effect to trigger
- */
- virtual void triggerEffect(int effectId)
- {
- internalTriggerEffect(effectId, false, true);
- }
-
- virtual AnimatedSprite *getSprite(int index) const
- { return mSprites[index]; }
-
static void load();
virtual void optionChanged(const std::string &value) {}
@@ -524,41 +414,6 @@ class Being : public Actor, public ConfigListener
*/
virtual void updateCoords();
- /**
- * Gets the way the object blocks pathfinding for other objects
- */
- virtual Map::BlockType getBlockType() const
- { return Map::BLOCKTYPE_NONE; }
-
- /**
- * Trigger visual effect, with components
- *
- * \param effectId ID of the effect to trigger
- * \param sfx Whether to trigger sound effects
- * \param gfx Whether to trigger graphical effects
- */
- void internalTriggerEffect(int effectId, bool sfx, bool gfx);
-
- /**
- * Notify self that the stun mode has been updated. Invoked by
- * setStunMode if something changed.
- */
- virtual void updateStunMode(int oldMode, int newMode);
-
- /**
- * Notify self that a status effect has flipped.
- * The new flag is passed.
- */
- virtual void updateStatusEffect(int index, bool newStatus);
-
- /**
- * Handle an update to a status or stun effect
- *
- * \param The StatusEffect to effect
- * \param effectId -1 for stun, otherwise the effect index
- */
- virtual void handleStatusEffect(StatusEffect *effect, int effectId);
-
virtual void showName();
/** The current sprite Frame number to be displayed */
@@ -578,7 +433,6 @@ class Being : public Actor, public ConfigListener
Action mAction; /**< Action the being is performing */
Uint16 mSubType; /**< Subtype (graphical view, basically) */
- int mId; /**< Unique sprite id */
Uint8 mDirection; /**< Facing direction */
Uint8 mSpriteDirection; /**< Facing direction */
std::string mName; /**< Name of character */
@@ -600,17 +454,6 @@ class Being : public Actor, public ConfigListener
std::string mSpeech;
Text *mText;
const gcn::Color *mTextColor;
- Uint16 mStunMode; /**< Stun mode; zero if not stunned */
- std::set<int> mStatusEffects; /**< set of active status effects */
-
- typedef std::vector<AnimatedSprite*> Sprites;
- typedef Sprites::iterator SpriteIterator;
- typedef Sprites::const_iterator SpriteConstIterator;
- Sprites mSprites;
-
- ParticleList mStunParticleEffects;
- ParticleVector mStatusParticleEffects;
- ParticleList mChildParticleEffects;
Vector mDest; /**< destination coordinates. */
@@ -623,9 +466,6 @@ class Being : public Actor, public ConfigListener
*/
int getOffset(char pos, char neg) const;
- /** Reset particle status effects on next redraw? */
- bool mMustResetParticles;
-
/** Speech Bubble components */
SpeechBubble *mSpeechBubble;
@@ -640,9 +480,6 @@ class Being : public Actor, public ConfigListener
int mX, mY; /**< Position in tile */
int mDamageTaken;
-
- /** Target cursor being used */
- SimpleAnimation *mUsedTargetCursor;
};
#endif