summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-07-15 12:09:30 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-07-15 12:09:30 +0000
commit2723b8680ac1c56aff73e775256b36ca0a88a3e9 (patch)
treecd2bd046675785c47b7649abe7469afe7b650840 /src/game.cpp
parentb8f8c1bd367edd983924e60a61965290dd5c5325 (diff)
downloadmana-2723b8680ac1c56aff73e775256b36ca0a88a3e9.tar.gz
mana-2723b8680ac1c56aff73e775256b36ca0a88a3e9.tar.bz2
mana-2723b8680ac1c56aff73e775256b36ca0a88a3e9.tar.xz
mana-2723b8680ac1c56aff73e775256b36ca0a88a3e9.zip
A small hack to let me sit and pick up objects :P
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp53
1 files changed, 21 insertions, 32 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 3fa3977f..33b153dc 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -588,38 +588,7 @@ void do_input()
popupMenu->showPopup(mx, my);
}
}
- /*
- // Joystick events
- else if (event.type == SDL_JOYBUTTONDOWN)
- {
- // Attacking monsters
- if (player_node->action == STAND)
- {
- if (event.jbutton.which == 0 && event.jbutton.button == 1)
- {
- Being *monster = attack(player_node->x,
- player_node->y,
- player_node->direction);
- }
- }
- logger->log("Joystick button %d", event.jbutton.which);
- }
- else if (event.type == SDL_JOYAXISMOTION)
- {
- if (event.jaxis.axis == 0) {
- if (event.jaxis.value > 100)
- {
- walk(player_node->x + 1, 0, EAST);
- player_node->setDestination(player_node->x + 1, player_node->y);
- }
- else if (event.jaxis.value < -100){
- walk(player_node->x - 1, 0, WEST);
- player_node->setDestination(player_node->x - 1, player_node->y);
- }
- }
- logger->log("Axis %d moved of %d", event.jaxis.axis, event.jaxis.value);
- }*/
-
+
// Quit event
else if (event.type == SDL_QUIT)
{
@@ -747,6 +716,26 @@ void do_input()
}
}
}
+
+ if (joy[JOY_BTN1]) {
+ unsigned short x = player_node->x;
+ unsigned short y = player_node->y;
+ int id = find_floor_item_by_cor(x, y);
+
+ if (id != 0)
+ {
+ WFIFOW(0) = net_w_value(0x009f);
+ WFIFOL(2) = net_l_value(id);
+ WFIFOSET(6);
+ }
+ }
+ else if (joy[JOY_BTN2] && action_time) {
+ if (player_node->action == STAND)
+ action(2, 0);
+ else if (player_node->action == SIT)
+ action(3, 0);
+ action_time = false;
+ }
}
}