summaryrefslogtreecommitdiff
path: root/src/actorsprite.h
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-05-09 14:31:43 -0600
committerJared Adams <jaxad0127@gmail.com>2010-05-09 15:09:56 -0600
commitf269d5a68e6a22676c49961c7529b9c00dc90649 (patch)
tree3ccce636203883c0009146099df9d4854cab2171 /src/actorsprite.h
parent9baedc27191c82bbf1fedee2a7e738bc5b267c0e (diff)
downloadmana-client-f269d5a68e6a22676c49961c7529b9c00dc90649.tar.gz
mana-client-f269d5a68e6a22676c49961c7529b9c00dc90649.tar.bz2
mana-client-f269d5a68e6a22676c49961c7529b9c00dc90649.tar.xz
mana-client-f269d5a68e6a22676c49961c7529b9c00dc90649.zip
Move target cursor management into ActorSprite
This simplifies handling of target cursors, centralizing their logic into a single class, instead of two. Also make them more flexible and move the image files outside of the theme so servers can can control them and give them better names. Reviewed-by: Thorbjørn Lindeijer
Diffstat (limited to 'src/actorsprite.h')
-rw-r--r--src/actorsprite.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/actorsprite.h b/src/actorsprite.h
index b5c402eb..a56be125 100644
--- a/src/actorsprite.h
+++ b/src/actorsprite.h
@@ -53,6 +53,14 @@ public:
NUM_TC
};
+ enum TargetCursorType
+ {
+ TCT_NONE = -1,
+ TCT_NORMAL = 0,
+ TCT_IN_RANGE,
+ NUM_TCT
+ };
+
ActorSprite(int id);
~ActorSprite();
@@ -73,6 +81,8 @@ public:
virtual void logic();
+ static void actorLogic();
+
void setMap(Map* map);
/**
@@ -95,7 +105,7 @@ public:
/**
* Sets the target animation for this actor.
*/
- void setTargetAnimation(SimpleAnimation *animation);
+ void setTargetType(TargetCursorType type);
/**
* Untargets the actor.
@@ -140,6 +150,10 @@ public:
virtual float getAlpha() const
{ return CompoundSprite::getAlpha(); }
+ static void load();
+
+ static void unload();
+
protected:
/**
* Trigger visual effect, with components
@@ -185,6 +199,24 @@ private:
/** Reset particle status effects on next redraw? */
bool mMustResetParticles;
+ /** Load the target cursors into memory */
+ static void initTargetCursor();
+
+ /** Remove the target cursors from memory */
+ static void cleanupTargetCursors();
+
+ /**
+ * Helper function for loading target cursors
+ */
+ static void loadTargetCursor(const std::string &filename,
+ int width, int height, int type, int size);
+
+ /** Images of the target cursor. */
+ static ImageSet *targetCursorImages[NUM_TCT][NUM_TC];
+
+ /** Animated target cursors. */
+ static SimpleAnimation *targetCursor[NUM_TCT][NUM_TC];
+
/** Target cursor being used */
SimpleAnimation *mUsedTargetCursor;
};