summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-04-08 16:48:15 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-08 16:48:15 +0300
commit25a6eae7f4fb561bbf930be28ee09510b40ebc80 (patch)
treeb6ba46e819293992216c6740c482b491c6f8d0eb /src/game.cpp
parentad0fcc99678c13c6f6ebacead6ba2d573294163d (diff)
downloadmv-25a6eae7f4fb561bbf930be28ee09510b40ebc80.tar.gz
mv-25a6eae7f4fb561bbf930be28ee09510b40ebc80.tar.bz2
mv-25a6eae7f4fb561bbf930be28ee09510b40ebc80.tar.xz
mv-25a6eae7f4fb561bbf930be28ee09510b40ebc80.zip
Move enums from keyboardconfig.h to keydata.h.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 786b72e6f..eda5fd638 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -722,8 +722,8 @@ void Game::handleMoveAndAttack()
// Ignore input if either "ignore" key is pressed
// Stops the character moving about if the user's window manager
// uses "ignore+arrow key" to switch virtual desktops.
- if (keyboard.isActionActive(keyboard.KEY_IGNORE_INPUT_1) ||
- keyboard.isActionActive(keyboard.KEY_IGNORE_INPUT_2))
+ if (keyboard.isActionActive(Input::KEY_IGNORE_INPUT_1) ||
+ keyboard.isActionActive(Input::KEY_IGNORE_INPUT_2))
{
return;
}
@@ -731,14 +731,14 @@ void Game::handleMoveAndAttack()
unsigned char direction = 0;
// Translate pressed keys to movement and direction
- if (keyboard.isActionActive(keyboard.KEY_MOVE_UP) ||
+ if (keyboard.isActionActive(Input::KEY_MOVE_UP) ||
(joystick && joystick->isUp()))
{
direction |= Being::UP;
setValidSpeed();
player_node->cancelFollow();
}
- else if (keyboard.isActionActive(keyboard.KEY_MOVE_DOWN) ||
+ else if (keyboard.isActionActive(Input::KEY_MOVE_DOWN) ||
(joystick && joystick->isDown()))
{
direction |= Being::DOWN;
@@ -746,14 +746,14 @@ void Game::handleMoveAndAttack()
player_node->cancelFollow();
}
- if (keyboard.isActionActive(keyboard.KEY_MOVE_LEFT) ||
+ if (keyboard.isActionActive(Input::KEY_MOVE_LEFT) ||
(joystick && joystick->isLeft()))
{
direction |= Being::LEFT;
setValidSpeed();
player_node->cancelFollow();
}
- else if (keyboard.isActionActive(keyboard.KEY_MOVE_RIGHT) ||
+ else if (keyboard.isActionActive(Input::KEY_MOVE_RIGHT) ||
(joystick && joystick->isRight()))
{
direction |= Being::RIGHT;
@@ -761,7 +761,7 @@ void Game::handleMoveAndAttack()
player_node->cancelFollow();
}
- if (!keyboard.isActionActive(keyboard.KEY_EMOTE) || direction == 0)
+ if (!keyboard.isActionActive(Input::KEY_EMOTE) || direction == 0)
{
if (!viewport->getCameraMode())
{
@@ -791,20 +791,20 @@ void Game::handleMoveAndAttack()
if ((player_node->getFollow().empty() || joyAttack) && mValidSpeed)
{
// Attacking monsters
- if (keyboard.isActionActive(keyboard.KEY_ATTACK))
+ if (keyboard.isActionActive(Input::KEY_ATTACK))
{
if (player_node->getTarget())
player_node->attack(player_node->getTarget(), true);
}
- if ((keyboard.isActionActive(keyboard.KEY_TARGET_ATTACK)
+ if ((keyboard.isActionActive(Input::KEY_TARGET_ATTACK)
|| joyAttack)
- /*&& !keyboard.isActionActive(keyboard.KEY_MOVE_TO_TARGET)*/
+ /*&& !keyboard.isActionActive(Input::KEY_MOVE_TO_TARGET)*/
)
{
Being *target = nullptr;
- bool newTarget = !keyboard.isActionActive(keyboard.KEY_TARGET);
+ bool newTarget = !keyboard.isActionActive(Input::KEY_TARGET);
// A set target has highest priority
if (!player_node->getTarget())
{
@@ -821,27 +821,27 @@ void Game::handleMoveAndAttack()
}
}
- if (!keyboard.isActionActive(keyboard.KEY_EMOTE))
+ if (!keyboard.isActionActive(Input::KEY_EMOTE))
{
// Target the nearest player/monster/npc
- if ((keyboard.isActionActive(keyboard.KEY_TARGET_PLAYER) ||
- keyboard.isActionActive(keyboard.KEY_TARGET_CLOSEST) ||
- keyboard.isActionActive(keyboard.KEY_TARGET_NPC) ||
+ if ((keyboard.isActionActive(Input::KEY_TARGET_PLAYER) ||
+ keyboard.isActionActive(Input::KEY_TARGET_CLOSEST) ||
+ keyboard.isActionActive(Input::KEY_TARGET_NPC) ||
(joystick && joystick->buttonPressed(3))) &&
- !keyboard.isActionActive(keyboard.KEY_TARGET) &&
- !keyboard.isActionActive(keyboard.KEY_UNTARGET))
+ !keyboard.isActionActive(Input::KEY_TARGET) &&
+ !keyboard.isActionActive(Input::KEY_UNTARGET))
{
ActorSprite::Type currentTarget = ActorSprite::UNKNOWN;
- if (keyboard.isActionActive(keyboard.KEY_TARGET_CLOSEST) ||
+ if (keyboard.isActionActive(Input::KEY_TARGET_CLOSEST) ||
(joystick && joystick->buttonPressed(3)))
{
currentTarget = ActorSprite::MONSTER;
}
- else if (keyboard.isActionActive(keyboard.KEY_TARGET_PLAYER))
+ else if (keyboard.isActionActive(Input::KEY_TARGET_PLAYER))
{
currentTarget = ActorSprite::PLAYER;
}
- else if (keyboard.isActionActive(keyboard.KEY_TARGET_NPC))
+ else if (keyboard.isActionActive(Input::KEY_TARGET_NPC))
{
currentTarget = ActorSprite::NPC;
}
@@ -863,15 +863,15 @@ void Game::handleMoveAndAttack()
}
// Stop attacking if the right key is pressed
- if (!keyboard.isActionActive(keyboard.KEY_ATTACK)
- && !keyboard.isActionActive(keyboard.KEY_EMOTE))
+ if (!keyboard.isActionActive(Input::KEY_ATTACK)
+ && !keyboard.isActionActive(Input::KEY_EMOTE))
{
- if (keyboard.isActionActive(keyboard.KEY_TARGET)
+ if (keyboard.isActionActive(Input::KEY_TARGET)
|| (joystick && joystick->buttonPressed(4)))
{
player_node->stopAttack();
}
- else if (keyboard.isActionActive(keyboard.KEY_UNTARGET))
+ else if (keyboard.isActionActive(Input::KEY_UNTARGET))
{
player_node->untarget();
}
@@ -982,8 +982,8 @@ void Game::handleInput()
return;
// If pressed outfits keys, stop processing keys.
- if (keyboard.isActionActive(keyboard.KEY_WEAR_OUTFIT)
- || keyboard.isActionActive(keyboard.KEY_COPY_OUTFIT)
+ if (keyboard.isActionActive(Input::KEY_WEAR_OUTFIT)
+ || keyboard.isActionActive(Input::KEY_COPY_OUTFIT)
|| (setupWindow && setupWindow->isVisible()))
{
return;