summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/player.cpp b/src/player.cpp
index 5ab94595..ca8c9f14 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -19,20 +19,19 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "player.h"
+#include <iostream>
#include "animatedsprite.h"
#include "game.h"
#include "graphics.h"
#include "log.h"
+#include "player.h"
#include "resources/itemdb.h"
#include "resources/iteminfo.h"
#include "utils/strprintf.h"
-#include <iostream>
-
static const int NAME_X_OFFSET = 15;
static const int NAME_Y_OFFSET = 30;
@@ -44,19 +43,25 @@ Player::Player(int id, int job, Map *map):
Player::~Player()
{
- if (mName)
- {
- delete mName;
- }
+ delete mName;
}
void Player::setName(const std::string &name)
{
if (mName == 0)
{
- mName = new FlashText(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
- gcn::Graphics::CENTER,
- gcn::Color(255, 255, 255));
+ if (mIsGM)
+ {
+ mNameColor = 0x009000;
+ mName = new FlashText("(GM) " + name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
+ gcn::Graphics::CENTER, gcn::Color(0, 255, 0));
+ }
+ else
+ {
+ mNameColor = 0x202020;
+ mName = new FlashText(name, mPx + NAME_X_OFFSET, mPy + NAME_Y_OFFSET,
+ gcn::Graphics::CENTER, gcn::Color(255, 255, 255));
+ }
Being::setName(name);
}
}
@@ -64,6 +69,18 @@ void Player::setName(const std::string &name)
void Player::logic()
{
switch (mAction) {
+ case STAND:
+ break;
+
+ case SIT:
+ break;
+
+ case DEAD:
+ break;
+
+ case HURT:
+ break;
+
case WALK:
mFrame = (get_elapsed_time(mWalkTime) * 6) / mWalkSpeed;
if (mFrame >= 6) {
@@ -126,13 +143,13 @@ void Player::setGender(Gender gender)
void Player::setHairStyle(int style, int color)
{
- style = style < 0 ? mHairStyle : style % getHairStylesNr();
- color = color < 0 ? mHairColor : color % getHairColorsNr();
+ style = style < 0 ? mHairStyle : style % mNumberOfHairstyles;
+ color = color < 0 ? mHairColor : color % ColorDB::size();
if (style == mHairStyle && color == mHairColor) return;
Being::setHairStyle(style, color);
- setSprite(HAIR_SPRITE, style * -1, getHairColor(color));
+ setSprite(HAIR_SPRITE, style * -1, ColorDB::get(color));
setAction(mAction);
}
@@ -187,4 +204,3 @@ void Player::updateCoords()
}
}
-