ase/patches/090-keyboard-mouse.patch |
1 | 1 | Index: ase-0.8.2/src/jinete/jsystem.cpp |
2 | 2 | =================================================================== |
3 | 3 | --- ase-0.8.2.orig/src/jinete/jsystem.cpp 2011-06-14 22:25:51.681509956 +0200 |
4 | | +++ ase-0.8.2/src/jinete/jsystem.cpp 2011-06-14 23:24:30.101508957 +0200 |
5 | 4 | @@ -29,6 +29,8 @@ |
6 | 5 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
7 | 6 | */ |
... | ... | |
30 | 30 | m_z[0] = mouse_z; |
31 | 31 | |
32 | 32 | update_mouse_position(); |
33 | | @@ -438,8 +443,130 @@ |
| 33 | @@ -438,8 +443,135 @@ |
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | |
... | ... | |
57 | 57 | + return; |
58 | 58 | + } |
59 | 59 | + |
60 | | + if (key[KEY_LEFT]) { |
| 60 | + /* The patched jmessage.cpp filters out all arrow key messages, unless the |
| 61 | + shift key is held, so it's better to disable the keyboard mouse on shift |
| 62 | + key */ |
| 63 | + int shift = key_shifts&KB_SHIFT_FLAG; |
| 64 | + |
| 65 | + if (!shift && key[KEY_LEFT]) { |
61 | 66 | + speed_x -= ak*delta_t; |
62 | 67 | + } |
63 | | + else if (key[KEY_RIGHT]) { |
| 68 | + else if (!shift && key[KEY_RIGHT]) { |
64 | 69 | + speed_x += ak*delta_t; |
65 | 70 | + } |
66 | 71 | + else { |
... | ... | |
76 | 81 | + } |
77 | 82 | + } |
78 | 83 | + |
79 | | + if (key[KEY_UP]) { |
| 84 | + if (!shift && key[KEY_UP]) { |
80 | 85 | + speed_y -= ak*delta_t; |
81 | 86 | + } |
82 | | + else if (key[KEY_DOWN]) { |
| 87 | + else if (!shift && key[KEY_DOWN]) { |
83 | 88 | + speed_y += ak*delta_t; |
84 | 89 | + } |
85 | 90 | + else { |
... | ... | |
184 | 189 | <key command="goto_last_frame" shortcut="End" /> |
185 | 190 | <key command="play_animation" shortcut="Enter" /> |
186 | 191 | <!-- Select --> |
| 192 | Index: ase-0.8.2/src/jinete/jmessage.cpp |
| 193 | =================================================================== |
| 194 | --- ase-0.8.2.orig/src/jinete/jmessage.cpp 2011-06-16 12:43:59.718215107 +0200 |
| 195 | @@ -81,6 +81,18 @@ |
| 196 | msg->key.propagate_to_children = false; |
| 197 | msg->key.propagate_to_parent = true; |
| 198 | |
| 199 | + /* ignore arrow keys without shift, to not interfere with the |
| 200 | + * keyboard-mouse */ |
| 201 | + switch (msg->key.scancode) |
| 202 | + { |
| 203 | + case KEY_UP: |
| 204 | + case KEY_DOWN: |
| 205 | + case KEY_LEFT: |
| 206 | + case KEY_RIGHT: |
| 207 | + if (!(msg->any.shifts&KB_SHIFT_FLAG)) |
| 208 | + msg->any.used = true; |
| 209 | + } |
| 210 | + |
| 211 | #if 0 |
| 212 | printf("%i: %i %i [%c]\n", type, msg->key.scancode, |
| 213 | msg->key.ascii, msg->key.ascii); |