summaryrefslogtreecommitdiff
path: root/src/player.h
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-08-13 17:30:59 -0600
committerJared Adams <jaxad0127@gmail.com>2009-08-13 17:33:08 -0600
commitf46cfb91278b27f4943f5512778129fe985c678e (patch)
tree0be219d66e723bcca8de2d584d66bc65d040fb26 /src/player.h
parentbe85ca9d91ff867faf140328d0bcbb2062b58cdf (diff)
downloadmana-client-f46cfb91278b27f4943f5512778129fe985c678e.tar.gz
mana-client-f46cfb91278b27f4943f5512778129fe985c678e.tar.bz2
mana-client-f46cfb91278b27f4943f5512778129fe985c678e.tar.xz
mana-client-f46cfb91278b27f4943f5512778129fe985c678e.zip
Clean up Being and it's derivatives
Move stuff only needed for Players into Player (like slots and sprite limits). Move name handling into Being (no need for three copies of this code). Clean up terminology (including Map terminology). Remove hair-related variables.
Diffstat (limited to 'src/player.h')
-rw-r--r--src/player.h71
1 files changed, 42 insertions, 29 deletions
diff --git a/src/player.h b/src/player.h
index 9a5c6c94..36f0266e 100644
--- a/src/player.h
+++ b/src/player.h
@@ -24,13 +24,19 @@
#include "being.h"
-class FlashText;
class Graphics;
class Map;
#ifdef TMWSERV_SUPPORT
class Guild;
#endif
+enum Gender
+{
+ GENDER_MALE = 0,
+ GENDER_FEMALE = 1,
+ GENDER_UNSPECIFIED = 2
+};
+
/**
* A player being. Players have their name drawn beneath them. This class also
* implements player-specific loading of base sprite, hair sprite and equipment
@@ -39,6 +45,29 @@ class Guild;
class Player : public Being
{
public:
+ enum Sprite
+ {
+ BASE_SPRITE = 0,
+ SHOE_SPRITE,
+ BOTTOMCLOTHES_SPRITE,
+ TOPCLOTHES_SPRITE,
+#ifdef EATHENA_SUPPORT
+ MISC1_SPRITE,
+ MISC2_SPRITE,
+#endif
+ HAIR_SPRITE,
+ HAT_SPRITE,
+#ifdef EATHENA_SUPPORT
+ CAPE_SPRITE,
+ GLOVES_SPRITE,
+#endif
+ WEAPON_SPRITE,
+#ifdef EATHENA_SUPPORT
+ SHIELD_SPRITE,
+#endif
+ VECTOREND_SPRITE
+ };
+
/**
* Constructor.
*/
@@ -46,19 +75,19 @@ class Player : public Being
~Player();
- /**
- * Set up mName to be the character's name
- */
- virtual void setName(const std::string &name);
-
#ifdef EATHENA_SUPPORT
virtual void logic();
#endif
- virtual Type getType() const;
+ virtual Type getType() const { return PLAYER; }
+ /**
+ * Sets the gender of this being.
+ */
virtual void setGender(Gender gender);
+ Gender getGender() const { return mGender; }
+
/**
* Whether or not this player is a GM.
*/
@@ -70,27 +99,10 @@ class Player : public Being
virtual void setGM(bool gm);
/**
- * Sets the hair style and color for this player.
- *
- * Only for convenience in 0.0 client. When porting
- * this to the trunk remove this function and
- * call setSprite directly instead. The server should
- * provide the hair ID and coloring in the same way
- * it does for other equipment pieces.
- *
- */
- void setHairStyle(int style, int color);
-
- /**
* Sets visible equipments for this player.
*/
virtual void setSprite(int slot, int id, const std::string &color = "");
- /**
- * Flash the player's name
- */
- void flash(int time);
-
#ifdef TMWSERV_SUPPORT
/**
* Adds a guild to the player.
@@ -137,7 +149,7 @@ class Player : public Being
/**
* Called when a option (set with config.addListener()) is changed
*/
- void optionChanged(const std::string &value);
+ virtual void optionChanged(const std::string &value);
protected:
/**
@@ -146,16 +158,17 @@ class Player : public Being
virtual Map::BlockType getBlockType() const
{ return Map::BLOCKTYPE_CHARACTER; }
- virtual void updateCoords();
+ virtual void updateColors();
+
+ Gender mGender;
+ std::vector<int> mSpriteIDs;
+ std::vector<std::string> mSpriteColors;
#ifdef TMWSERV_SUPPORT
// Character guild information
std::map<int, Guild*> mGuilds;
#endif
- bool mShowName;
- FlashText *mName;
-
bool mIsGM;
private: