diff options
author | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-27 11:21:10 +0000 |
---|---|---|
committer | Guillaume Melquiond <guillaume.melquiond@gmail.com> | 2006-08-27 11:21:10 +0000 |
commit | d3cba1c4beac4a1c98f38bbca076a98f9c90bbc4 (patch) | |
tree | e7d1ea0a7575d0dd28802e7dfe2a322e818729fc /src/game.cpp | |
parent | 5980dba7ace73e6587b9966bc2076ad2b2eaa5f0 (diff) | |
download | mana-d3cba1c4beac4a1c98f38bbca076a98f9c90bbc4.tar.gz mana-d3cba1c4beac4a1c98f38bbca076a98f9c90bbc4.tar.bz2 mana-d3cba1c4beac4a1c98f38bbca076a98f9c90bbc4.tar.xz mana-d3cba1c4beac4a1c98f38bbca076a98f9c90bbc4.zip |
Changed to pixel-based coordinates for beings.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp index f83e9c1f..3e789728 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -462,14 +462,12 @@ void Game::handleInput() case SDLK_z: if (!chatWindow->isFocused()) { - FloorItem *item = floorItemManager->findByCoordinates( - player_node->mX, player_node->mY); + Uint16 x = player_node->mX / 32, y = player_node->mY / 32; + FloorItem *item = floorItemManager->findByCoordinates(x, y); // If none below the player, try the tile in front of // the player if (!item) { - Uint16 x = player_node->mX; - Uint16 y = player_node->mY; if (player_node->mDirection & Being::UP) y--; if (player_node->mDirection & Being::DOWN) @@ -591,8 +589,7 @@ void Game::handleInput() current_npc == 0 && !chatWindow->isFocused()) { - Uint16 x = player_node->mX; - Uint16 y = player_node->mY; + Uint16 x = player_node->mX / 32, y = player_node->mY / 32; unsigned char Direction = 0; // Translate pressed keys to movement and direction @@ -644,7 +641,7 @@ void Game::handleInput() if (player_node->mDirection & Being::RIGHT) targetX++; - // Attack priorioty is: Monster, Player, auto target + // Attack priority is: Monster, Player, auto target target = beingManager->findBeing( targetX, targetY, Being::MONSTER); if (!target) @@ -659,8 +656,7 @@ void Game::handleInput() { if (joystick->buttonPressed(1)) { - FloorItem *item = floorItemManager->findByCoordinates( - player_node->mX, player_node->mY); + FloorItem *item = floorItemManager->findByCoordinates(x, y); if (item) player_node->pickUp(item); |