summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2009-08-01 22:39:01 -0400
committerChuck Miller <shadowmil@gmail.com>2009-08-01 22:39:01 -0400
commitd1c92918319afa943bbc0ced77765563f1fdf559 (patch)
treeedd03730125a0dbb95f0d1c0fb41b368949d41c6 /src
parent455b56f0a3aa89fec063696ef86aa39986b21a5f (diff)
downloadmana-client-d1c92918319afa943bbc0ced77765563f1fdf559.tar.gz
mana-client-d1c92918319afa943bbc0ced77765563f1fdf559.tar.bz2
mana-client-d1c92918319afa943bbc0ced77765563f1fdf559.tar.xz
mana-client-d1c92918319afa943bbc0ced77765563f1fdf559.zip
Fixes pickup items on eA, also cleaned up some code
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp15
-rw-r--r--src/game.cpp5
2 files changed, 11 insertions, 9 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 5395f064..70be4ddb 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -172,16 +172,13 @@ void Being::setDestination(int dstX, int dstY)
// FIXME: Look into making this code neater.
// Interpolate the offsets. Also convert from tile based to pixel based
- // Note: I divided the offsets by 32 then muilpied it back to get the top left
- // Conner of where the tile is. (If you know a better way then please change it)
-
// Find the starting offset
- int startX = srcX - ((srcX / 32) * 32 + 16);
- int startY = srcY - ((srcY / 32) * 32 + 16);
+ int startX = (srcX % 32);
+ int startY = (srcY % 32);
// Find the ending offset
- int endX = dstX - ((dstX / 32) * 32 + 16);
- int endY = dstY - ((dstY / 32) * 32 + 16);
+ int endX = (dstX % 32);
+ int endY = (dstY % 32);
// Find the distance, and divide it by the number of steps
int changeX = (endX - startX) / thisPath.size();
@@ -193,8 +190,8 @@ void Being::setDestination(int dstX, int dstY)
int i = 0;
while(it != thisPath.end())
{
- it->x = (it->x * 32 + 16) + startX + (changeX * i);
- it->y = (it->y * 32 + 16) + startY + (changeY * i);
+ it->x = (it->x * 32) + startX + (changeX * i);
+ it->y = (it->y * 32) + startY + (changeY * i);
i++;
it++;
}
diff --git a/src/game.cpp b/src/game.cpp
index abb74b2a..f424ad50 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -759,9 +759,14 @@ void Game::handleInput()
{
case KeyboardConfig::KEY_PICKUP:
{
+#ifdef TMWSERV_SUPPORT
const Vector &pos = player_node->getPosition();
Uint16 x = (int) pos.x / 32;
Uint16 y = (int) pos.y / 32;
+#else
+ Uint16 x = player_node->getTileX();
+ Uint16 y = player_node->getTileY();
+#endif
FloorItem *item =
floorItemManager->findByCoordinates(x, y);