summaryrefslogtreecommitdiff
path: root/src/gui/playerbox.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-09 01:44:18 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-12-09 01:44:18 +0000
commit3c214ff26a33555e3744608d7047286eb9eb5780 (patch)
tree46f5dce9cee082509cfa588b4cf93e7eb937e931 /src/gui/playerbox.cpp
parent4408659ea0f7c25e1d73718576822b562a29d0b4 (diff)
downloadmana-3c214ff26a33555e3744608d7047286eb9eb5780.tar.gz
mana-3c214ff26a33555e3744608d7047286eb9eb5780.tar.bz2
mana-3c214ff26a33555e3744608d7047286eb9eb5780.tar.xz
mana-3c214ff26a33555e3744608d7047286eb9eb5780.zip
Use new animation system in character selection/creation. Shows equipment and
allowed for some cleanup. Had a bit of help from the patch by VictorSan.
Diffstat (limited to 'src/gui/playerbox.cpp')
-rw-r--r--src/gui/playerbox.cpp37
1 files changed, 10 insertions, 27 deletions
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 0a155573..907e9a2d 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -23,7 +23,7 @@
#include "playerbox.h"
-#include "../being.h"
+#include "../player.h"
#include "../graphics.h"
#include "../graphic/imagerect.h"
@@ -34,17 +34,11 @@
#include "../utils/dtor.h"
-extern std::vector<Spriteset *> hairset;
-extern Spriteset *playerset[2];
-
int PlayerBox::instances = 0;
ImageRect PlayerBox::background;
-PlayerBox::PlayerBox(unsigned char sex):
- mHairColor(0),
- mHairStyle(0),
- mSex(sex),
- mShowPlayer(false)
+PlayerBox::PlayerBox(const Player *player):
+ mPlayer(player)
{
setBorderSize(2);
@@ -83,29 +77,18 @@ PlayerBox::~PlayerBox()
}
}
-void PlayerBox::draw(gcn::Graphics *graphics)
+void
+PlayerBox::draw(gcn::Graphics *graphics)
{
- if (!mShowPlayer) {
- return;
- }
-
- // Draw character
- dynamic_cast<Graphics*>(graphics)->drawImage(
- playerset[mSex]->get(0), 23, 12);
-
- // Draw his hair
- if (mHairColor >= 0 && mHairStyle >= 0 &&
- mHairColor < NR_HAIR_COLORS && mHairStyle < NR_HAIR_STYLES)
+ if (mPlayer)
{
- int hf = 5 * mHairColor;
- if (hf >= 0 && hf < (int)hairset[mHairStyle]->size()) {
- dynamic_cast<Graphics*>(graphics)->drawImage(
- hairset[mHairStyle]->get(hf), 35, 7);
- }
+ // Draw character
+ mPlayer->draw(dynamic_cast<Graphics*>(graphics), 40, 42);
}
}
-void PlayerBox::drawBorder(gcn::Graphics *graphics)
+void
+PlayerBox::drawBorder(gcn::Graphics *graphics)
{
int w, h, bs;
bs = getBorderSize();