summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp45
1 files changed, 24 insertions, 21 deletions
diff --git a/src/game.cpp b/src/game.cpp
index df23a0146..3ed71efcb 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -828,27 +828,30 @@ void Game::handleMove()
}
if (!inputManager.isActionActive(Input::KEY_EMOTE) || direction == 0)
- {
- if (!viewport->getCameraMode())
- {
- player_node->specialMove(direction);
- }
- else
- {
- int dx = 0;
- int dy = 0;
- if (direction & Being::LEFT)
- dx = -5;
- else if (direction & Being::RIGHT)
- dx = 5;
-
- if (direction & Being::UP)
- dy = -5;
- else if (direction & Being::DOWN)
- dy = 5;
- viewport->moveCamera(dx, dy);
- }
- }
+ moveInDirection(direction);
+ }
+}
+
+void Game::moveInDirection(const unsigned char direction)
+{
+ if (!viewport->getCameraMode())
+ {
+ player_node->specialMove(direction);
+ }
+ else
+ {
+ int dx = 0;
+ int dy = 0;
+ if (direction & Being::LEFT)
+ dx = -5;
+ else if (direction & Being::RIGHT)
+ dx = 5;
+
+ if (direction & Being::UP)
+ dy = -5;
+ else if (direction & Being::DOWN)
+ dy = 5;
+ viewport->moveCamera(dx, dy);
}
}