diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-01-30 01:34:16 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-02-09 20:00:07 +0100 |
commit | 1b1050da1c7b84cc72b7efbb2229294975be9e10 (patch) | |
tree | 68d15ccb015d58aeb5797ffd06efca3e55997c24 /src/player.cpp | |
parent | 0d4142a891cd228da24ee3aa3bbd7dc622da5b75 (diff) | |
parent | 955a7613d1fe116fe5e1da07a222b6849b3c885c (diff) | |
download | mana-client-1b1050da1c7b84cc72b7efbb2229294975be9e10.tar.gz mana-client-1b1050da1c7b84cc72b7efbb2229294975be9e10.tar.bz2 mana-client-1b1050da1c7b84cc72b7efbb2229294975be9e10.tar.xz mana-client-1b1050da1c7b84cc72b7efbb2229294975be9e10.zip |
Merged with Aethyra master as of 2009-01-27
Conflicts:
Almost everywhere.
Diffstat (limited to 'src/player.cpp')
-rw-r--r-- | src/player.cpp | 44 |
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() } } - |