summaryrefslogtreecommitdiff
path: root/src/player.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 17:45:36 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 17:45:45 +0100
commit1dcaa196fd8339dbdd28f9c09c62636b663a3846 (patch)
treec7faf82210e428787804204e3dc8e5dc6c725947 /src/player.cpp
parent17b2b19e7b907ae955e500d44dd167d2f31ce7bd (diff)
downloadmana-client-1dcaa196fd8339dbdd28f9c09c62636b663a3846.tar.gz
mana-client-1dcaa196fd8339dbdd28f9c09c62636b663a3846.tar.bz2
mana-client-1dcaa196fd8339dbdd28f9c09c62636b663a3846.tar.xz
mana-client-1dcaa196fd8339dbdd28f9c09c62636b663a3846.zip
Fixed some positioning issues
Started with not being able to click NPCs properly, and I ended up correcting the draw positions of overhead text, targets and sprite ordering. It's now a bit more straight-forward. The position of a being is simply in the middle of the sprite at the bottom. When drawing the sprite, an offset remains because all the sprites are compensating for getting drawn half a tile to the left and one tile up.
Diffstat (limited to 'src/player.cpp')
-rw-r--r--src/player.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/player.cpp b/src/player.cpp
index b966e891..a75d4e35 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -37,9 +37,6 @@
#include "utils/strprintf.h"
-static const int NAME_X_OFFSET = 15;
-static const int NAME_Y_OFFSET = 30;
-
Player::Player(int id, int job, Map *map):
Being(id, job, map)
{
@@ -59,8 +56,8 @@ void Player::setName(const std::string &name)
{
mNameColor = &guiPalette->getColor(Palette::GM);
mName = new FlashText("(GM) " + name,
- getPixelX() + NAME_X_OFFSET,
- getPixelY() + NAME_Y_OFFSET,
+ getPixelX(),
+ getPixelY(),
gcn::Graphics::CENTER,
&guiPalette->getColor(Palette::GM_NAME));
}
@@ -68,8 +65,8 @@ void Player::setName(const std::string &name)
{
mNameColor = &guiPalette->getColor(Palette::PLAYER);
mName = new FlashText(name,
- getPixelX() + NAME_X_OFFSET,
- getPixelY() + NAME_Y_OFFSET,
+ getPixelX(),
+ getPixelY(),
gcn::Graphics::CENTER,
(this == player_node) ?
&guiPalette->getColor(Palette::SELF) :
@@ -237,8 +234,7 @@ void Player::setSprite(int slot, int id, const std::string &color)
void Player::updateCoords()
{
if (mName)
- mName->adviseXY(getPixelX() + NAME_X_OFFSET,
- getPixelY() + NAME_Y_OFFSET);
+ mName->adviseXY(getPixelX(), getPixelY());
}
#ifdef TMWSERV_SUPPORT