|
15 | 15 | public class Player extends Item implements Avatar {
|
16 | 16 |
|
17 | 17 | private int keyRepeatRate = 5;
|
18 |
| - |
| 18 | + private int shortcut_modifier = Toolkit.getDefaultToolkit ().getMenuShortcutKeyMask(); |
19 | 19 |
|
20 | 20 | protected boolean handleSaveSmallChip() {
|
21 | 21 | return false;
|
@@ -363,16 +363,16 @@ else if (e.getKeyCode() == KeyEvent.VK_T && handleToolbox()) {
|
363 | 363 | else if (e.getKeyCode() == KeyEvent.VK_SLASH && handleHelp()) {
|
364 | 364 | return false;
|
365 | 365 | }
|
366 |
| - else if (e.getKeyCode() == KeyEvent.VK_RIGHT && handleMoveRight(e.isShiftDown(), e.isControlDown())) { |
| 366 | + else if (e.getKeyCode() == KeyEvent.VK_RIGHT && handleMoveRight(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) { |
367 | 367 | return true;
|
368 | 368 | }
|
369 |
| - else if (e.getKeyCode() == KeyEvent.VK_LEFT && handleMoveLeft(e.isShiftDown(), e.isControlDown())) { |
| 369 | + else if (e.getKeyCode() == KeyEvent.VK_LEFT && handleMoveLeft(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) { |
370 | 370 | return true;
|
371 | 371 | }
|
372 |
| - else if (e.getKeyCode() == KeyEvent.VK_UP && handleMoveUp(e.isShiftDown(), e.isControlDown())) { |
| 372 | + else if (e.getKeyCode() == KeyEvent.VK_UP && handleMoveUp(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) { |
373 | 373 | return true;
|
374 | 374 | }
|
375 |
| - else if (e.getKeyCode() == KeyEvent.VK_DOWN && handleMoveDown(e.isShiftDown(), e.isControlDown())) { |
| 375 | + else if (e.getKeyCode() == KeyEvent.VK_DOWN && handleMoveDown(e.isShiftDown(), (e.getModifiers() & shortcut_modifier) > 0)) { |
376 | 376 | return true;
|
377 | 377 | }
|
378 | 378 | else if (e.getKeyCode() == KeyEvent.VK_SPACE && handlePickupDrop()) {
|
@@ -456,22 +456,22 @@ protected boolean handleRepeatSpace() {
|
456 | 456 |
|
457 | 457 | public boolean KeyDown(KeyEvent e) {
|
458 | 458 | if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
|
459 |
| - if (handleRepeatRight(e.isControlDown())) { |
| 459 | + if (handleRepeatRight((e.getModifiers() & shortcut_modifier) > 0)) { |
460 | 460 | return true;
|
461 | 461 | }
|
462 | 462 | }
|
463 | 463 | else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
|
464 |
| - if (handleRepeatLeft(e.isControlDown())) { |
| 464 | + if (handleRepeatLeft((e.getModifiers() & shortcut_modifier) > 0)) { |
465 | 465 | return true;
|
466 | 466 | }
|
467 | 467 | }
|
468 | 468 | else if (e.getKeyCode() == KeyEvent.VK_UP) {
|
469 |
| - if (handleRepeatUp(e.isControlDown())) { |
| 469 | + if (handleRepeatUp((e.getModifiers() & shortcut_modifier) > 0)) { |
470 | 470 | return true;
|
471 | 471 | }
|
472 | 472 | }
|
473 | 473 | else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
|
474 |
| - if (handleRepeatDown(e.isControlDown())) { |
| 474 | + if (handleRepeatDown((e.getModifiers() & shortcut_modifier) > 0)) { |
475 | 475 | return true;
|
476 | 476 | }
|
477 | 477 | }
|
|
0 commit comments