From bdb09d26fc6c489228cb2c28be75024f9a49eb75 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 28 Aug 2008 20:29:06 +0000 Subject: Accepted Patch by Scraggy that moves text in such a way that no text overlaps --- src/player.h | 47 ++++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) (limited to 'src/player.h') diff --git a/src/player.h b/src/player.h index fe24ceed..6347b0a6 100644 --- a/src/player.h +++ b/src/player.h @@ -25,23 +25,11 @@ #define _TMW_PLAYER_H #include "being.h" +#include "text.h" class Graphics; class Map; -class Player; - -class PlayerNameDrawStrategy -{ -public: - virtual ~PlayerNameDrawStrategy(void) {} - - /** - * Draw the player's name - */ - virtual void draw(Player *p, Graphics *graphics, int px, int py) = 0; -}; - /** * A player being. Players have their name drawn beneath them. This class also * implements player-specific loading of base sprite, hair sprite and equipment @@ -52,15 +40,20 @@ class Player : public Being public: Player(int id, int job, Map *map); + ~Player(); + + /** + * Set up mName to be the character's name + */ + virtual void + setName(const std::string &name); + virtual void logic(); virtual Type getType() const; - virtual void - drawName(Graphics *graphics, int offsetX, int offsetY); - virtual void setGender(int gender); @@ -83,27 +76,15 @@ class Player : public Being setSprite(int slot, int id, std::string color = ""); /** - * Sets the strategy responsible for drawing the player's name - * - * \param draw_strategy A strategy describing how the player's name - * should be drawn, or NULL for default + * Flash the player's name */ - virtual void - setNameDrawStrategy(PlayerNameDrawStrategy *draw_strategy); - - virtual PlayerNameDrawStrategy * - getNameDrawStrategy(void) const { return mDrawStrategy; } + void flash(int time); - /** - * Triggers a visual/audio effect, such as `level up' - * - * \param effect_id ID of the effect to trigger - */ - virtual void - triggerEffect(int effectId) { internalTriggerEffect(effectId, true, true); } + protected: + void updateCoords(); private: - PlayerNameDrawStrategy *mDrawStrategy; + FlashText *mName; }; #endif -- cgit v1.2.3-70-g09d2