summaryrefslogtreecommitdiff
path: root/src/npc.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/npc.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/npc.cpp')
-rw-r--r--src/npc.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/npc.cpp b/src/npc.cpp
index 133f11c6..b75d74b3 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -40,14 +40,11 @@
bool NPC::isTalking = false;
int current_npc = 0;
-static const int NAME_X_OFFSET = 15;
-static const int NAME_Y_OFFSET = 30;
-
#ifdef TMWSERV_SUPPORT
-NPC::NPC(Uint16 id, int job, Map *map):
+NPC::NPC(int id, int job, Map *map):
Player(id, job, map)
#else
-NPC::NPC(int id, Uint16 job, Map *map, Network *network):
+NPC::NPC(int id, int job, Map *map, Network *network):
Player(id, job, map),
mNetwork(network)
#endif
@@ -96,8 +93,8 @@ void NPC::setName(const std::string &name)
delete mName;
mName = new Text(displayName,
- getPixelX() + NAME_X_OFFSET,
- getPixelY() + NAME_Y_OFFSET,
+ getPixelX(),
+ getPixelY(),
gcn::Graphics::CENTER,
&guiPalette->getColor(Palette::NPC));
Being::setName(displayName + " (NPC)");
@@ -134,7 +131,6 @@ void NPC::talk()
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_TALK);
- //outMsg.writeInt16(CMSG_NPC_TALK);
outMsg.writeInt32(mId);
outMsg.writeInt8(0);
#endif
@@ -144,8 +140,6 @@ void NPC::updateCoords()
{
if (mName)
{
- const int px = getPixelX() + NAME_X_OFFSET;
- const int py = getPixelY() + NAME_Y_OFFSET;
- mName->adviseXY(px, py);
+ mName->adviseXY(getPixelX(), getPixelY());
}
}