From d3cba1c4beac4a1c98f38bbca076a98f9c90bbc4 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sun, 27 Aug 2006 11:21:10 +0000 Subject: Changed to pixel-based coordinates for beings. --- src/game.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/game.cpp') 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); -- cgit v1.2.3-70-g09d2