summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-01-07 10:13:03 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-01-07 10:13:03 +0000
commit071877484ef493631592d9f10b6c4457097eca29 (patch)
tree2beb3921959350855a140d2e782cfdb4ec9380d6 /src/game.cpp
parent553e1d562af1413b9f28bf1c4b079d301349020e (diff)
downloadmana-client-071877484ef493631592d9f10b6c4457097eca29.tar.gz
mana-client-071877484ef493631592d9f10b6c4457097eca29.tar.bz2
mana-client-071877484ef493631592d9f10b6c4457097eca29.tar.xz
mana-client-071877484ef493631592d9f10b6c4457097eca29.zip
Removed --skipupdate option from Dev.Cpp project file, splitted the setup window into 3 tabs and added a joystick calibration tool.
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp
index ee254d13..aa77847d 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -301,8 +301,6 @@ void do_init()
player_node->setWeapon(player_info->weapon);
- remove("packet.list");
-
// Initialize joypad
SDL_InitSubSystem(SDL_INIT_JOYSTICK);
//SDL_JoystickEventState(SDL_ENABLE);
@@ -423,23 +421,26 @@ void do_input()
// Get the state of the joypad axis/buttons
if (joypad != NULL)
{
- // TODO: one different value of tolerance is needed for each direction
- // This probably means the need for a tuning utility/window
- int tolerance = (int)config.getValue("joytolerance", 100);
+ int lowerTolerance = (int)config.getValue("leftTolerance", -100);
+ int upperTolerance = (int)config.getValue("rightTolerance", 100);
SDL_JoystickUpdate();
- if (SDL_JoystickGetAxis(joypad, 0) > tolerance)
+ int position = SDL_JoystickGetAxis(joypad, 0);
+ if (position >= upperTolerance)
{
joy[JOY_RIGHT] = true;
}
- if (SDL_JoystickGetAxis(joypad, 0) < -tolerance)
+ else if (position <= lowerTolerance)
{
joy[JOY_LEFT] = true;
}
- if (SDL_JoystickGetAxis(joypad, 1) < -tolerance)
+ lowerTolerance = (int)config.getValue("upTolerance", -100);
+ upperTolerance = (int)config.getValue("downTolerance", 100);
+ position = SDL_JoystickGetAxis(joypad, 1);
+ if (position <= lowerTolerance)
{
joy[JOY_UP] = true;
}
- if (SDL_JoystickGetAxis(joypad, 1) > tolerance)
+ else if (position >= upperTolerance)
{
joy[JOY_DOWN] = true;
}